magick-image.c revision 7c0a0a4e6633c6ac3d1106c4c12b4ea1e163bb0b
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,&wand->images->exception);
734  return(status);
735}
736
737/*
738%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
739%                                                                             %
740%                                                                             %
741%                                                                             %
742%   M a g i c k A u t o L e v e l I m a g e                                   %
743%                                                                             %
744%                                                                             %
745%                                                                             %
746%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
747%
748%  MagickAutoLevelImage() adjusts the levels of a particular image channel by
749%  scaling the minimum and maximum values to the full quantum range.
750%
751%  The format of the MagickAutoLevelImage method is:
752%
753%      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
754%
755%  A description of each parameter follows:
756%
757%    o wand: the magick wand.
758%
759*/
760WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
761{
762  MagickBooleanType
763    status;
764
765  assert(wand != (MagickWand *) NULL);
766  assert(wand->signature == WandSignature);
767  if (wand->debug != MagickFalse)
768    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
769  if (wand->images == (Image *) NULL)
770    ThrowWandException(WandError,"ContainsNoImages",wand->name);
771  status=AutoLevelImage(wand->images,&wand->images->exception);
772  return(status);
773}
774
775/*
776%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
777%                                                                             %
778%                                                                             %
779%                                                                             %
780%   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                         %
781%                                                                             %
782%                                                                             %
783%                                                                             %
784%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
785%
786%  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
787%  pixels below the threshold into black while leaving all pixels above the
788%  threshold unchanged.
789%
790%  The format of the MagickBlackThresholdImage method is:
791%
792%      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
793%        const PixelWand *threshold)
794%
795%  A description of each parameter follows:
796%
797%    o wand: the magick wand.
798%
799%    o threshold: the pixel wand.
800%
801*/
802WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
803  const PixelWand *threshold)
804{
805  char
806    thresholds[MaxTextExtent];
807
808  MagickBooleanType
809    status;
810
811  assert(wand != (MagickWand *) NULL);
812  assert(wand->signature == WandSignature);
813  if (wand->debug != MagickFalse)
814    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
815  if (wand->images == (Image *) NULL)
816    ThrowWandException(WandError,"ContainsNoImages",wand->name);
817  (void) FormatLocaleString(thresholds,MaxTextExtent,
818    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
819    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
820    PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
821  status=BlackThresholdImage(wand->images,thresholds,&wand->images->exception);
822  if (status == MagickFalse)
823    InheritException(wand->exception,&wand->images->exception);
824  return(status);
825}
826
827/*
828%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
829%                                                                             %
830%                                                                             %
831%                                                                             %
832%   M a g i c k B l u e S h i f t I m a g e                                   %
833%                                                                             %
834%                                                                             %
835%                                                                             %
836%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
837%
838%  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
839%  nighttime in the moonlight.
840%
841%  The format of the MagickBlueShiftImage method is:
842%
843%      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
844%        const double factor)
845%
846%  A description of each parameter follows:
847%
848%    o wand: the magick wand.
849%
850%    o factor: the blue shift factor (default 1.5)
851%
852*/
853WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
854  const double factor)
855{
856  Image
857    *shift_image;
858
859  assert(wand != (MagickWand *) NULL);
860  assert(wand->signature == WandSignature);
861  if (wand->debug != MagickFalse)
862    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
863  if (wand->images == (Image *) NULL)
864    ThrowWandException(WandError,"ContainsNoImages",wand->name);
865  shift_image=BlueShiftImage(wand->images,factor,wand->exception);
866  if (shift_image == (Image *) NULL)
867    return(MagickFalse);
868  ReplaceImageInList(&wand->images,shift_image);
869  return(MagickTrue);
870}
871
872/*
873%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
874%                                                                             %
875%                                                                             %
876%                                                                             %
877%   M a g i c k B l u r I m a g e                                             %
878%                                                                             %
879%                                                                             %
880%                                                                             %
881%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
882%
883%  MagickBlurImage() blurs an image.  We convolve the image with a
884%  gaussian operator of the given radius and standard deviation (sigma).
885%  For reasonable results, the radius should be larger than sigma.  Use a
886%  radius of 0 and BlurImage() selects a suitable radius for you.
887%
888%  The format of the MagickBlurImage method is:
889%
890%      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
891%        const double sigma)
892%
893%  A description of each parameter follows:
894%
895%    o wand: the magick wand.
896%
897%    o radius: the radius of the , in pixels, not counting the center
898%      pixel.
899%
900%    o sigma: the standard deviation of the , in pixels.
901%
902*/
903WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
904  const double radius,const double sigma)
905{
906  Image
907    *blur_image;
908
909  assert(wand != (MagickWand *) NULL);
910  assert(wand->signature == WandSignature);
911  if (wand->debug != MagickFalse)
912    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
913  if (wand->images == (Image *) NULL)
914    ThrowWandException(WandError,"ContainsNoImages",wand->name);
915  blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
916  if (blur_image == (Image *) NULL)
917    return(MagickFalse);
918  ReplaceImageInList(&wand->images,blur_image);
919  return(MagickTrue);
920}
921
922/*
923%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
924%                                                                             %
925%                                                                             %
926%                                                                             %
927%   M a g i c k B o r d e r I m a g e                                         %
928%                                                                             %
929%                                                                             %
930%                                                                             %
931%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
932%
933%  MagickBorderImage() surrounds the image with a border of the color defined
934%  by the bordercolor pixel wand.
935%
936%  The format of the MagickBorderImage method is:
937%
938%      MagickBooleanType MagickBorderImage(MagickWand *wand,
939%        const PixelWand *bordercolor,const size_t width,
940%        const size_t height)
941%
942%  A description of each parameter follows:
943%
944%    o wand: the magick wand.
945%
946%    o bordercolor: the border color pixel wand.
947%
948%    o width: the border width.
949%
950%    o height: the border height.
951%
952*/
953WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
954  const PixelWand *bordercolor,const size_t width,
955  const size_t height)
956{
957  Image
958    *border_image;
959
960  RectangleInfo
961    border_info;
962
963  assert(wand != (MagickWand *) NULL);
964  assert(wand->signature == WandSignature);
965  if (wand->debug != MagickFalse)
966    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
967  if (wand->images == (Image *) NULL)
968    ThrowWandException(WandError,"ContainsNoImages",wand->name);
969  border_info.width=width;
970  border_info.height=height;
971  border_info.x=0;
972  border_info.y=0;
973  PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
974  border_image=BorderImage(wand->images,&border_info,wand->exception);
975  if (border_image == (Image *) NULL)
976    return(MagickFalse);
977  ReplaceImageInList(&wand->images,border_image);
978  return(MagickTrue);
979}
980
981/*
982%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
983%                                                                             %
984%                                                                             %
985%                                                                             %
986%   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   %
987%                                                                             %
988%                                                                             %
989%                                                                             %
990%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
991%
992%  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
993%  of an image.  It converts the brightness and contrast parameters into slope
994%  and intercept and calls a polynomical function to apply to the image.
995
996%
997%  The format of the MagickBrightnessContrastImage method is:
998%
999%      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1000%        const double brightness,const double contrast)
1001%
1002%  A description of each parameter follows:
1003%
1004%    o wand: the magick wand.
1005%
1006%    o brightness: the brightness percent (-100 .. 100).
1007%
1008%    o contrast: the contrast percent (-100 .. 100).
1009%
1010*/
1011WandExport MagickBooleanType MagickBrightnessContrastImage(
1012  MagickWand *wand,const double brightness,const double contrast)
1013{
1014  MagickBooleanType
1015    status;
1016
1017  assert(wand != (MagickWand *) NULL);
1018  assert(wand->signature == WandSignature);
1019  if (wand->debug != MagickFalse)
1020    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1021  if (wand->images == (Image *) NULL)
1022    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1023  status=BrightnessContrastImage(wand->images,brightness,contrast,
1024    &wand->images->exception);
1025  return(status);
1026}
1027
1028/*
1029%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1030%                                                                             %
1031%                                                                             %
1032%                                                                             %
1033%   M a g i c k C h a r c o a l I m a g e                                     %
1034%                                                                             %
1035%                                                                             %
1036%                                                                             %
1037%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1038%
1039%  MagickCharcoalImage() simulates a charcoal drawing.
1040%
1041%  The format of the MagickCharcoalImage method is:
1042%
1043%      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1044%        const double radius,const double sigma)
1045%
1046%  A description of each parameter follows:
1047%
1048%    o wand: the magick wand.
1049%
1050%    o radius: the radius of the Gaussian, in pixels, not counting the center
1051%      pixel.
1052%
1053%    o sigma: the standard deviation of the Gaussian, in pixels.
1054%
1055*/
1056WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1057  const double radius,const double sigma)
1058{
1059  Image
1060    *charcoal_image;
1061
1062  assert(wand != (MagickWand *) NULL);
1063  assert(wand->signature == WandSignature);
1064  if (wand->debug != MagickFalse)
1065    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1066  if (wand->images == (Image *) NULL)
1067    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1068  charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1069  if (charcoal_image == (Image *) NULL)
1070    return(MagickFalse);
1071  ReplaceImageInList(&wand->images,charcoal_image);
1072  return(MagickTrue);
1073}
1074
1075/*
1076%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1077%                                                                             %
1078%                                                                             %
1079%                                                                             %
1080%   M a g i c k C h o p I m a g e                                             %
1081%                                                                             %
1082%                                                                             %
1083%                                                                             %
1084%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1085%
1086%  MagickChopImage() removes a region of an image and collapses the image to
1087%  occupy the removed portion
1088%
1089%  The format of the MagickChopImage method is:
1090%
1091%      MagickBooleanType MagickChopImage(MagickWand *wand,
1092%        const size_t width,const size_t height,const ssize_t x,
1093%        const ssize_t y)
1094%
1095%  A description of each parameter follows:
1096%
1097%    o wand: the magick wand.
1098%
1099%    o width: the region width.
1100%
1101%    o height: the region height.
1102%
1103%    o x: the region x offset.
1104%
1105%    o y: the region y offset.
1106%
1107%
1108*/
1109WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1110  const size_t width,const size_t height,const ssize_t x,
1111  const ssize_t y)
1112{
1113  Image
1114    *chop_image;
1115
1116  RectangleInfo
1117    chop;
1118
1119  assert(wand != (MagickWand *) NULL);
1120  assert(wand->signature == WandSignature);
1121  if (wand->debug != MagickFalse)
1122    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1123  if (wand->images == (Image *) NULL)
1124    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1125  chop.width=width;
1126  chop.height=height;
1127  chop.x=x;
1128  chop.y=y;
1129  chop_image=ChopImage(wand->images,&chop,wand->exception);
1130  if (chop_image == (Image *) NULL)
1131    return(MagickFalse);
1132  ReplaceImageInList(&wand->images,chop_image);
1133  return(MagickTrue);
1134}
1135
1136/*
1137%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1138%                                                                             %
1139%                                                                             %
1140%                                                                             %
1141%   M a g i c k C l a m p I m a g e                                           %
1142%                                                                             %
1143%                                                                             %
1144%                                                                             %
1145%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1146%
1147%  MagickClampImage() restricts the color range from 0 to the quantum depth.
1148%
1149%  The format of the MagickClampImage method is:
1150%
1151%      MagickBooleanType MagickClampImage(MagickWand *wand)
1152%
1153%  A description of each parameter follows:
1154%
1155%    o wand: the magick wand.
1156%
1157%    o channel: the channel.
1158%
1159*/
1160WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1161{
1162  MagickBooleanType
1163    status;
1164
1165  assert(wand != (MagickWand *) NULL);
1166  assert(wand->signature == WandSignature);
1167  if (wand->debug != MagickFalse)
1168    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1169  if (wand->images == (Image *) NULL)
1170    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1171  status=ClampImage(wand->images);
1172  if (status == MagickFalse)
1173    InheritException(wand->exception,&wand->images->exception);
1174  return(status);
1175}
1176
1177/*
1178%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1179%                                                                             %
1180%                                                                             %
1181%                                                                             %
1182%   M a g i c k C l i p I m a g e                                             %
1183%                                                                             %
1184%                                                                             %
1185%                                                                             %
1186%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1187%
1188%  MagickClipImage() clips along the first path from the 8BIM profile, if
1189%  present.
1190%
1191%  The format of the MagickClipImage method is:
1192%
1193%      MagickBooleanType MagickClipImage(MagickWand *wand)
1194%
1195%  A description of each parameter follows:
1196%
1197%    o wand: the magick wand.
1198%
1199*/
1200WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1201{
1202  MagickBooleanType
1203    status;
1204
1205  assert(wand != (MagickWand *) NULL);
1206  assert(wand->signature == WandSignature);
1207  if (wand->debug != MagickFalse)
1208    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1209  if (wand->images == (Image *) NULL)
1210    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1211  status=ClipImage(wand->images);
1212  if (status == MagickFalse)
1213    InheritException(wand->exception,&wand->images->exception);
1214  return(status);
1215}
1216
1217/*
1218%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1219%                                                                             %
1220%                                                                             %
1221%                                                                             %
1222%   M a g i c k C l i p I m a g e P a t h                                     %
1223%                                                                             %
1224%                                                                             %
1225%                                                                             %
1226%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1227%
1228%  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1229%  present. Later operations take effect inside the path.  Id may be a number
1230%  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1231%  path.
1232%
1233%  The format of the MagickClipImagePath method is:
1234%
1235%      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1236%        const char *pathname,const MagickBooleanType inside)
1237%
1238%  A description of each parameter follows:
1239%
1240%    o wand: the magick wand.
1241%
1242%    o pathname: name of clipping path resource. If name is preceded by #, use
1243%      clipping path numbered by name.
1244%
1245%    o inside: if non-zero, later operations take effect inside clipping path.
1246%      Otherwise later operations take effect outside clipping path.
1247%
1248*/
1249WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1250  const char *pathname,const MagickBooleanType inside)
1251{
1252  MagickBooleanType
1253    status;
1254
1255  assert(wand != (MagickWand *) NULL);
1256  assert(wand->signature == WandSignature);
1257  if (wand->debug != MagickFalse)
1258    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1259  if (wand->images == (Image *) NULL)
1260    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1261  status=ClipImagePath(wand->images,pathname,inside);
1262  if (status == MagickFalse)
1263    InheritException(wand->exception,&wand->images->exception);
1264  return(status);
1265}
1266
1267/*
1268%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1269%                                                                             %
1270%                                                                             %
1271%                                                                             %
1272%   M a g i c k C l u t I m a g e                                             %
1273%                                                                             %
1274%                                                                             %
1275%                                                                             %
1276%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1277%
1278%  MagickClutImage() replaces colors in the image from a color lookup table.
1279%
1280%  The format of the MagickClutImage method is:
1281%
1282%      MagickBooleanType MagickClutImage(MagickWand *wand,
1283%        const MagickWand *clut_wand)
1284%
1285%  A description of each parameter follows:
1286%
1287%    o wand: the magick wand.
1288%
1289%    o clut_image: the clut image.
1290%
1291*/
1292WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1293  const MagickWand *clut_wand)
1294{
1295  MagickBooleanType
1296    status;
1297
1298  assert(wand != (MagickWand *) NULL);
1299  assert(wand->signature == WandSignature);
1300  if (wand->debug != MagickFalse)
1301    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1302  if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1303    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1304  status=ClutImage(wand->images,clut_wand->images,&wand->images->exception);
1305  return(status);
1306}
1307
1308/*
1309%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1310%                                                                             %
1311%                                                                             %
1312%                                                                             %
1313%   M a g i c k C o a l e s c e I m a g e s                                   %
1314%                                                                             %
1315%                                                                             %
1316%                                                                             %
1317%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1318%
1319%  MagickCoalesceImages() composites a set of images while respecting any page
1320%  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1321%  typically start with an image background and each subsequent image
1322%  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1323%  where each image in the sequence is the same size as the first and
1324%  composited with the next image in the sequence.
1325%
1326%  The format of the MagickCoalesceImages method is:
1327%
1328%      MagickWand *MagickCoalesceImages(MagickWand *wand)
1329%
1330%  A description of each parameter follows:
1331%
1332%    o wand: the magick wand.
1333%
1334*/
1335WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1336{
1337  Image
1338    *coalesce_image;
1339
1340  assert(wand != (MagickWand *) NULL);
1341  assert(wand->signature == WandSignature);
1342  if (wand->debug != MagickFalse)
1343    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1344  if (wand->images == (Image *) NULL)
1345    return((MagickWand *) NULL);
1346  coalesce_image=CoalesceImages(wand->images,wand->exception);
1347  if (coalesce_image == (Image *) NULL)
1348    return((MagickWand *) NULL);
1349  return(CloneMagickWandFromImages(wand,coalesce_image));
1350}
1351
1352/*
1353%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1354%                                                                             %
1355%                                                                             %
1356%                                                                             %
1357%   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1358%                                                                             %
1359%                                                                             %
1360%                                                                             %
1361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1362%
1363%  MagickColorDecisionListImage() accepts a lightweight Color Correction
1364%  Collection (CCC) file which solely contains one or more color corrections
1365%  and applies the color correction to the image.  Here is a sample CCC file:
1366%
1367%    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1368%          <ColorCorrection id="cc03345">
1369%                <SOPNode>
1370%                     <Slope> 0.9 1.2 0.5 </Slope>
1371%                     <Offset> 0.4 -0.5 0.6 </Offset>
1372%                     <Power> 1.0 0.8 1.5 </Power>
1373%                </SOPNode>
1374%                <SATNode>
1375%                     <Saturation> 0.85 </Saturation>
1376%                </SATNode>
1377%          </ColorCorrection>
1378%    </ColorCorrectionCollection>
1379%
1380%  which includes the offset, slope, and power for each of the RGB channels
1381%  as well as the saturation.
1382%
1383%  The format of the MagickColorDecisionListImage method is:
1384%
1385%      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1386%        const double gamma)
1387%
1388%  A description of each parameter follows:
1389%
1390%    o wand: the magick wand.
1391%
1392%    o color_correction_collection: the color correction collection in XML.
1393%
1394*/
1395WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1396  const char *color_correction_collection)
1397{
1398  MagickBooleanType
1399    status;
1400
1401  assert(wand != (MagickWand *) NULL);
1402  assert(wand->signature == WandSignature);
1403  if (wand->debug != MagickFalse)
1404    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1405  if (wand->images == (Image *) NULL)
1406    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1407  status=ColorDecisionListImage(wand->images,color_correction_collection,
1408    &wand->images->exception);
1409  return(status);
1410}
1411
1412/*
1413%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1414%                                                                             %
1415%                                                                             %
1416%                                                                             %
1417%   M a g i c k C o l o r i z e I m a g e                                     %
1418%                                                                             %
1419%                                                                             %
1420%                                                                             %
1421%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1422%
1423%  MagickColorizeImage() blends the fill color with each pixel in the image.
1424%
1425%  The format of the MagickColorizeImage method is:
1426%
1427%      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1428%        const PixelWand *colorize,const PixelWand *opacity)
1429%
1430%  A description of each parameter follows:
1431%
1432%    o wand: the magick wand.
1433%
1434%    o colorize: the colorize pixel wand.
1435%
1436%    o opacity: the opacity pixel wand.
1437%
1438*/
1439WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1440  const PixelWand *colorize,const PixelWand *opacity)
1441{
1442  char
1443    percent_opaque[MaxTextExtent];
1444
1445  Image
1446    *colorize_image;
1447
1448  PixelPacket
1449    target;
1450
1451  assert(wand != (MagickWand *) NULL);
1452  assert(wand->signature == WandSignature);
1453  if (wand->debug != MagickFalse)
1454    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1455  if (wand->images == (Image *) NULL)
1456    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1457  (void) FormatLocaleString(percent_opaque,MaxTextExtent,
1458    "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1459    PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
1460    PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
1461    PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
1462    PixelGetOpacityQuantum(opacity)));
1463  PixelGetQuantumPacket(colorize,&target);
1464  colorize_image=ColorizeImage(wand->images,percent_opaque,target,
1465    wand->exception);
1466  if (colorize_image == (Image *) NULL)
1467    return(MagickFalse);
1468  ReplaceImageInList(&wand->images,colorize_image);
1469  return(MagickTrue);
1470}
1471
1472/*
1473%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1474%                                                                             %
1475%                                                                             %
1476%                                                                             %
1477%   M a g i c k C o l o r M a t r i x I m a g e                               %
1478%                                                                             %
1479%                                                                             %
1480%                                                                             %
1481%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1482%
1483%  MagickColorMatrixImage() apply color transformation to an image. The method
1484%  permits saturation changes, hue rotation, luminance to alpha, and various
1485%  other effects.  Although variable-sized transformation matrices can be used,
1486%  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1487%  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1488%  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1489%  and offsets are normalized (divide Flash offset by 255).
1490%
1491%  The format of the MagickColorMatrixImage method is:
1492%
1493%      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1494%        const KernelInfo *color_matrix)
1495%
1496%  A description of each parameter follows:
1497%
1498%    o wand: the magick wand.
1499%
1500%    o color_matrix:  the color matrix.
1501%
1502*/
1503WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1504  const KernelInfo *color_matrix)
1505{
1506  Image
1507    *color_image;
1508
1509  assert(wand != (MagickWand *) NULL);
1510  assert(wand->signature == WandSignature);
1511  if (wand->debug != MagickFalse)
1512    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1513  if (color_matrix == (const KernelInfo *) NULL)
1514    return(MagickFalse);
1515  if (wand->images == (Image *) NULL)
1516    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1517  color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1518  if (color_image == (Image *) NULL)
1519    return(MagickFalse);
1520  ReplaceImageInList(&wand->images,color_image);
1521  return(MagickTrue);
1522}
1523
1524/*
1525%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1526%                                                                             %
1527%                                                                             %
1528%                                                                             %
1529%   M a g i c k C o m b i n e I m a g e s                                     %
1530%                                                                             %
1531%                                                                             %
1532%                                                                             %
1533%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1534%
1535%  MagickCombineImages() combines one or more images into a single image.  The
1536%  grayscale value of the pixels of each image in the sequence is assigned in
1537%  order to the specified  hannels of the combined image.   The typical
1538%  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1539%
1540%  The format of the MagickCombineImages method is:
1541%
1542%      MagickWand *MagickCombineImages(MagickWand *wand)
1543%
1544%  A description of each parameter follows:
1545%
1546%    o wand: the magick wand.
1547%
1548*/
1549WandExport MagickWand *MagickCombineImages(MagickWand *wand)
1550{
1551  Image
1552    *combine_image;
1553
1554  assert(wand != (MagickWand *) NULL);
1555  assert(wand->signature == WandSignature);
1556  if (wand->debug != MagickFalse)
1557    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1558  if (wand->images == (Image *) NULL)
1559    return((MagickWand *) NULL);
1560  combine_image=CombineImages(wand->images,wand->exception);
1561  if (combine_image == (Image *) NULL)
1562    return((MagickWand *) NULL);
1563  return(CloneMagickWandFromImages(wand,combine_image));
1564}
1565
1566/*
1567%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1568%                                                                             %
1569%                                                                             %
1570%                                                                             %
1571%   M a g i c k C o m m e n t I m a g e                                       %
1572%                                                                             %
1573%                                                                             %
1574%                                                                             %
1575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1576%
1577%  MagickCommentImage() adds a comment to your image.
1578%
1579%  The format of the MagickCommentImage method is:
1580%
1581%      MagickBooleanType MagickCommentImage(MagickWand *wand,
1582%        const char *comment)
1583%
1584%  A description of each parameter follows:
1585%
1586%    o wand: the magick wand.
1587%
1588%    o comment: the image comment.
1589%
1590*/
1591WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1592  const char *comment)
1593{
1594  MagickBooleanType
1595    status;
1596
1597  assert(wand != (MagickWand *) NULL);
1598  assert(wand->signature == WandSignature);
1599  if (wand->debug != MagickFalse)
1600    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1601  if (wand->images == (Image *) NULL)
1602    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1603  status=SetImageProperty(wand->images,"comment",comment);
1604  if (status == MagickFalse)
1605    InheritException(wand->exception,&wand->images->exception);
1606  return(status);
1607}
1608
1609/*
1610%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1611%                                                                             %
1612%                                                                             %
1613%                                                                             %
1614%   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1615%                                                                             %
1616%                                                                             %
1617%                                                                             %
1618%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1619%
1620%  MagickCompareImagesLayers() compares each image with the next in a sequence
1621%  and returns the maximum bounding region of any pixel differences it
1622%  discovers.
1623%
1624%  The format of the MagickCompareImagesLayers method is:
1625%
1626%      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1627%        const ImageLayerMethod method)
1628%
1629%  A description of each parameter follows:
1630%
1631%    o wand: the magick wand.
1632%
1633%    o method: the compare method.
1634%
1635*/
1636WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1637  const ImageLayerMethod method)
1638{
1639  Image
1640    *layers_image;
1641
1642  assert(wand != (MagickWand *) NULL);
1643  assert(wand->signature == WandSignature);
1644  if (wand->debug != MagickFalse)
1645    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1646  if (wand->images == (Image *) NULL)
1647    return((MagickWand *) NULL);
1648  layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1649  if (layers_image == (Image *) NULL)
1650    return((MagickWand *) NULL);
1651  return(CloneMagickWandFromImages(wand,layers_image));
1652}
1653
1654/*
1655%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1656%                                                                             %
1657%                                                                             %
1658%                                                                             %
1659%   M a g i c k C o m p a r e I m a g e s                                     %
1660%                                                                             %
1661%                                                                             %
1662%                                                                             %
1663%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1664%
1665%  MagickCompareImages() compares an image to a reconstructed image and returns
1666%  the specified difference image.
1667%
1668%  The format of the MagickCompareImages method is:
1669%
1670%      MagickWand *MagickCompareImages(MagickWand *wand,
1671%        const MagickWand *reference,const MetricType metric,
1672%        double *distortion)
1673%
1674%  A description of each parameter follows:
1675%
1676%    o wand: the magick wand.
1677%
1678%    o reference: the reference wand.
1679%
1680%    o metric: the metric.
1681%
1682%    o distortion: the computed distortion between the images.
1683%
1684*/
1685WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1686  const MagickWand *reference,const MetricType metric,double *distortion)
1687{
1688  Image
1689    *compare_image;
1690
1691
1692  assert(wand != (MagickWand *) NULL);
1693  assert(wand->signature == WandSignature);
1694  if (wand->debug != MagickFalse)
1695    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1696  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1697    {
1698      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1699        "ContainsNoImages","`%s'",wand->name);
1700      return((MagickWand *) NULL);
1701    }
1702  compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1703    &wand->images->exception);
1704  if (compare_image == (Image *) NULL)
1705    return((MagickWand *) NULL);
1706  return(CloneMagickWandFromImages(wand,compare_image));
1707}
1708
1709/*
1710%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1711%                                                                             %
1712%                                                                             %
1713%                                                                             %
1714%   M a g i c k C o m p o s i t e I m a g e                                   %
1715%                                                                             %
1716%                                                                             %
1717%                                                                             %
1718%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1719%
1720%  MagickCompositeImage() composite one image onto another at the specified
1721%  offset.
1722%
1723%  The format of the MagickCompositeImage method is:
1724%
1725%      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1726%        const MagickWand *composite_wand,const CompositeOperator compose,
1727%        const ssize_t x,const ssize_t y)
1728%
1729%  A description of each parameter follows:
1730%
1731%    o wand: the magick wand.
1732%
1733%    o composite_image: the composite image.
1734%
1735%    o compose: This operator affects how the composite is applied to the
1736%      image.  The default is Over.  Choose from these operators:
1737%
1738%        OverCompositeOp       InCompositeOp         OutCompositeOp
1739%        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1740%        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1741%        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1742%        DisplaceCompositeOp
1743%
1744%    o x: the column offset of the composited image.
1745%
1746%    o y: the row offset of the composited image.
1747%
1748*/
1749WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1750  const MagickWand *composite_wand,const CompositeOperator compose,
1751  const ssize_t x,const ssize_t y)
1752{
1753  MagickBooleanType
1754    status;
1755
1756  assert(wand != (MagickWand *) NULL);
1757  assert(wand->signature == WandSignature);
1758  if (wand->debug != MagickFalse)
1759    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1760  if ((wand->images == (Image *) NULL) ||
1761      (composite_wand->images == (Image *) NULL))
1762    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1763  status=CompositeImage(wand->images,compose,composite_wand->images,x,y);
1764  if (status == MagickFalse)
1765    InheritException(wand->exception,&wand->images->exception);
1766  return(status);
1767}
1768
1769/*
1770%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1771%                                                                             %
1772%                                                                             %
1773%                                                                             %
1774%   M a g i c k C o n t r a s t I m a g e                                     %
1775%                                                                             %
1776%                                                                             %
1777%                                                                             %
1778%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1779%
1780%  MagickContrastImage() enhances the intensity differences between the lighter
1781%  and darker elements of the image.  Set sharpen to a value other than 0 to
1782%  increase the image contrast otherwise the contrast is reduced.
1783%
1784%  The format of the MagickContrastImage method is:
1785%
1786%      MagickBooleanType MagickContrastImage(MagickWand *wand,
1787%        const MagickBooleanType sharpen)
1788%
1789%  A description of each parameter follows:
1790%
1791%    o wand: the magick wand.
1792%
1793%    o sharpen: Increase or decrease image contrast.
1794%
1795%
1796*/
1797WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1798  const MagickBooleanType sharpen)
1799{
1800  MagickBooleanType
1801    status;
1802
1803  assert(wand != (MagickWand *) NULL);
1804  assert(wand->signature == WandSignature);
1805  if (wand->debug != MagickFalse)
1806    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1807  if (wand->images == (Image *) NULL)
1808    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1809  status=ContrastImage(wand->images,sharpen,&wand->images->exception);
1810  return(status);
1811}
1812
1813/*
1814%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1815%                                                                             %
1816%                                                                             %
1817%                                                                             %
1818%   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                       %
1819%                                                                             %
1820%                                                                             %
1821%                                                                             %
1822%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1823%
1824%  MagickContrastStretchImage() enhances the contrast of a color image by
1825%  adjusting the pixels color to span the entire range of colors available.
1826%  You can also reduce the influence of a particular channel with a gamma
1827%  value of 0.
1828%
1829%  The format of the MagickContrastStretchImage method is:
1830%
1831%      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1832%        const double black_point,const double white_point)
1833%
1834%  A description of each parameter follows:
1835%
1836%    o wand: the magick wand.
1837%
1838%    o black_point: the black point.
1839%
1840%    o white_point: the white point.
1841%
1842*/
1843WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1844  const double black_point,const double white_point)
1845{
1846  MagickBooleanType
1847    status;
1848
1849  assert(wand != (MagickWand *) NULL);
1850  assert(wand->signature == WandSignature);
1851  if (wand->debug != MagickFalse)
1852    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1853  if (wand->images == (Image *) NULL)
1854    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1855  status=ContrastStretchImage(wand->images,black_point,white_point,
1856    &wand->images->exception);
1857  return(status);
1858}
1859
1860/*
1861%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1862%                                                                             %
1863%                                                                             %
1864%                                                                             %
1865%   M a g i c k C o n v o l v e I m a g e                                     %
1866%                                                                             %
1867%                                                                             %
1868%                                                                             %
1869%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1870%
1871%  MagickConvolveImage() applies a custom convolution kernel to the image.
1872%
1873%  The format of the MagickConvolveImage method is:
1874%
1875%      MagickBooleanType MagickConvolveImage(MagickWand *wand,
1876%        const KernelInfo *kernel)
1877%
1878%  A description of each parameter follows:
1879%
1880%    o wand: the magick wand.
1881%
1882%    o kernel: An array of doubles representing the convolution kernel.
1883%
1884*/
1885WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
1886  const KernelInfo *kernel)
1887{
1888  Image
1889    *filter_image;
1890
1891  assert(wand != (MagickWand *) NULL);
1892  assert(wand->signature == WandSignature);
1893  if (wand->debug != MagickFalse)
1894    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1895  if (kernel == (const KernelInfo *) NULL)
1896    return(MagickFalse);
1897  if (wand->images == (Image *) NULL)
1898    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1899  filter_image=ConvolveImage(wand->images,kernel,wand->exception);
1900  if (filter_image == (Image *) NULL)
1901    return(MagickFalse);
1902  ReplaceImageInList(&wand->images,filter_image);
1903  return(MagickTrue);
1904}
1905
1906/*
1907%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1908%                                                                             %
1909%                                                                             %
1910%                                                                             %
1911%   M a g i c k C r o p I m a g e                                             %
1912%                                                                             %
1913%                                                                             %
1914%                                                                             %
1915%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1916%
1917%  MagickCropImage() extracts a region of the image.
1918%
1919%  The format of the MagickCropImage method is:
1920%
1921%      MagickBooleanType MagickCropImage(MagickWand *wand,
1922%        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1923%
1924%  A description of each parameter follows:
1925%
1926%    o wand: the magick wand.
1927%
1928%    o width: the region width.
1929%
1930%    o height: the region height.
1931%
1932%    o x: the region x-offset.
1933%
1934%    o y: the region y-offset.
1935%
1936*/
1937WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
1938  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1939{
1940  Image
1941    *crop_image;
1942
1943  RectangleInfo
1944    crop;
1945
1946  assert(wand != (MagickWand *) NULL);
1947  assert(wand->signature == WandSignature);
1948  if (wand->debug != MagickFalse)
1949    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1950  if (wand->images == (Image *) NULL)
1951    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1952  crop.width=width;
1953  crop.height=height;
1954  crop.x=x;
1955  crop.y=y;
1956  crop_image=CropImage(wand->images,&crop,wand->exception);
1957  if (crop_image == (Image *) NULL)
1958    return(MagickFalse);
1959  ReplaceImageInList(&wand->images,crop_image);
1960  return(MagickTrue);
1961}
1962
1963/*
1964%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1965%                                                                             %
1966%                                                                             %
1967%                                                                             %
1968%   M a g i c k C y c l e C o l o r m a p I m a g e                           %
1969%                                                                             %
1970%                                                                             %
1971%                                                                             %
1972%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1973%
1974%  MagickCycleColormapImage() displaces an image's colormap by a given number
1975%  of positions.  If you cycle the colormap a number of times you can produce
1976%  a psychodelic effect.
1977%
1978%  The format of the MagickCycleColormapImage method is:
1979%
1980%      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
1981%        const ssize_t displace)
1982%
1983%  A description of each parameter follows:
1984%
1985%    o wand: the magick wand.
1986%
1987%    o pixel_wand: the pixel wand.
1988%
1989*/
1990WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
1991  const ssize_t displace)
1992{
1993  MagickBooleanType
1994    status;
1995
1996  assert(wand != (MagickWand *) NULL);
1997  assert(wand->signature == WandSignature);
1998  if (wand->debug != MagickFalse)
1999    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2000  if (wand->images == (Image *) NULL)
2001    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2002  status=CycleColormapImage(wand->images,displace);
2003  if (status == MagickFalse)
2004    InheritException(wand->exception,&wand->images->exception);
2005  return(status);
2006}
2007
2008/*
2009%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2010%                                                                             %
2011%                                                                             %
2012%                                                                             %
2013%   M a g i c k C o n s t i t u t e I m a g e                                 %
2014%                                                                             %
2015%                                                                             %
2016%                                                                             %
2017%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2018%
2019%  MagickConstituteImage() adds an image to the wand comprised of the pixel
2020%  data you supply.  The pixel data must be in scanline order top-to-bottom.
2021%  The data can be char, short int, int, float, or double.  Float and double
2022%  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2023%  is the maximum value the type can accomodate (e.g. 255 for char).  For
2024%  example, to create a 640x480 image from unsigned red-green-blue character
2025%  data, use
2026%
2027%      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2028%
2029%  The format of the MagickConstituteImage method is:
2030%
2031%      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2032%        const size_t columns,const size_t rows,const char *map,
2033%        const StorageType storage,void *pixels)
2034%
2035%  A description of each parameter follows:
2036%
2037%    o wand: the magick wand.
2038%
2039%    o columns: width in pixels of the image.
2040%
2041%    o rows: height in pixels of the image.
2042%
2043%    o map:  This string reflects the expected ordering of the pixel array.
2044%      It can be any combination or order of R = red, G = green, B = blue,
2045%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2046%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2047%      P = pad.
2048%
2049%    o storage: Define the data type of the pixels.  Float and double types are
2050%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2051%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2052%      LongPixel, QuantumPixel, or ShortPixel.
2053%
2054%    o pixels: This array of values contain the pixel components as defined by
2055%      map and type.  You must preallocate this array where the expected
2056%      length varies depending on the values of width, height, map, and type.
2057%
2058%
2059*/
2060WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2061  const size_t columns,const size_t rows,const char *map,
2062  const StorageType storage,const void *pixels)
2063{
2064  Image
2065    *images;
2066
2067  assert(wand != (MagickWand *) NULL);
2068  assert(wand->signature == WandSignature);
2069  if (wand->debug != MagickFalse)
2070    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2071  images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2072  if (images == (Image *) NULL)
2073    return(MagickFalse);
2074  return(InsertImageInWand(wand,images));
2075}
2076
2077/*
2078%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2079%                                                                             %
2080%                                                                             %
2081%                                                                             %
2082%   M a g i c k D e c i p h e r I m a g e                                     %
2083%                                                                             %
2084%                                                                             %
2085%                                                                             %
2086%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2087%
2088%  MagickDecipherImage() converts cipher pixels to plain pixels.
2089%
2090%  The format of the MagickDecipherImage method is:
2091%
2092%      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2093%        const char *passphrase)
2094%
2095%  A description of each parameter follows:
2096%
2097%    o wand: the magick wand.
2098%
2099%    o passphrase: the passphrase.
2100%
2101*/
2102WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2103  const char *passphrase)
2104{
2105  assert(wand != (MagickWand *) NULL);
2106  assert(wand->signature == WandSignature);
2107  if (wand->debug != MagickFalse)
2108    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2109  if (wand->images == (Image *) NULL)
2110    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2111  return(DecipherImage(wand->images,passphrase,&wand->images->exception));
2112}
2113
2114/*
2115%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2116%                                                                             %
2117%                                                                             %
2118%                                                                             %
2119%   M a g i c k D e c o n s t r u c t I m a g e s                             %
2120%                                                                             %
2121%                                                                             %
2122%                                                                             %
2123%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2124%
2125%  MagickDeconstructImages() compares each image with the next in a sequence
2126%  and returns the maximum bounding region of any pixel differences it
2127%  discovers.
2128%
2129%  The format of the MagickDeconstructImages method is:
2130%
2131%      MagickWand *MagickDeconstructImages(MagickWand *wand)
2132%
2133%  A description of each parameter follows:
2134%
2135%    o wand: the magick wand.
2136%
2137*/
2138WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2139{
2140  Image
2141    *deconstruct_image;
2142
2143  assert(wand != (MagickWand *) NULL);
2144  assert(wand->signature == WandSignature);
2145  if (wand->debug != MagickFalse)
2146    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2147  if (wand->images == (Image *) NULL)
2148    return((MagickWand *) NULL);
2149  deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2150    wand->exception);
2151  if (deconstruct_image == (Image *) NULL)
2152    return((MagickWand *) NULL);
2153  return(CloneMagickWandFromImages(wand,deconstruct_image));
2154}
2155
2156/*
2157%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2158%                                                                             %
2159%                                                                             %
2160%                                                                             %
2161%     M a g i c k D e s k e w I m a g e                                       %
2162%                                                                             %
2163%                                                                             %
2164%                                                                             %
2165%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2166%
2167%  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2168%  occurs in scanned images because of the camera being misaligned,
2169%  imperfections in the scanning or surface, or simply because the paper was
2170%  not placed completely flat when scanned.
2171%
2172%  The format of the MagickDeskewImage method is:
2173%
2174%      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2175%        const double threshold)
2176%
2177%  A description of each parameter follows:
2178%
2179%    o wand: the magick wand.
2180%
2181%    o threshold: separate background from foreground.
2182%
2183*/
2184WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2185  const double threshold)
2186{
2187  Image
2188    *sepia_image;
2189
2190  assert(wand != (MagickWand *) NULL);
2191  assert(wand->signature == WandSignature);
2192  if (wand->debug != MagickFalse)
2193    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2194  if (wand->images == (Image *) NULL)
2195    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2196  sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2197  if (sepia_image == (Image *) NULL)
2198    return(MagickFalse);
2199  ReplaceImageInList(&wand->images,sepia_image);
2200  return(MagickTrue);
2201}
2202
2203/*
2204%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2205%                                                                             %
2206%                                                                             %
2207%                                                                             %
2208%     M a g i c k D e s p e c k l e I m a g e                                 %
2209%                                                                             %
2210%                                                                             %
2211%                                                                             %
2212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2213%
2214%  MagickDespeckleImage() reduces the speckle noise in an image while
2215%  perserving the edges of the original image.
2216%
2217%  The format of the MagickDespeckleImage method is:
2218%
2219%      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2220%
2221%  A description of each parameter follows:
2222%
2223%    o wand: the magick wand.
2224%
2225*/
2226WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2227{
2228  Image
2229    *despeckle_image;
2230
2231  assert(wand != (MagickWand *) NULL);
2232  assert(wand->signature == WandSignature);
2233  if (wand->debug != MagickFalse)
2234    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2235  if (wand->images == (Image *) NULL)
2236    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2237  despeckle_image=DespeckleImage(wand->images,wand->exception);
2238  if (despeckle_image == (Image *) NULL)
2239    return(MagickFalse);
2240  ReplaceImageInList(&wand->images,despeckle_image);
2241  return(MagickTrue);
2242}
2243
2244/*
2245%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2246%                                                                             %
2247%                                                                             %
2248%                                                                             %
2249%   M a g i c k D e s t r o y I m a g e                                       %
2250%                                                                             %
2251%                                                                             %
2252%                                                                             %
2253%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2254%
2255%  MagickDestroyImage() dereferences an image, deallocating memory associated
2256%  with the image if the reference count becomes zero.
2257%
2258%  The format of the MagickDestroyImage method is:
2259%
2260%      Image *MagickDestroyImage(Image *image)
2261%
2262%  A description of each parameter follows:
2263%
2264%    o image: the image.
2265%
2266*/
2267WandExport Image *MagickDestroyImage(Image *image)
2268{
2269  return(DestroyImage(image));
2270}
2271
2272/*
2273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2274%                                                                             %
2275%                                                                             %
2276%                                                                             %
2277%   M a g i c k D i s p l a y I m a g e                                       %
2278%                                                                             %
2279%                                                                             %
2280%                                                                             %
2281%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2282%
2283%  MagickDisplayImage() displays an image.
2284%
2285%  The format of the MagickDisplayImage method is:
2286%
2287%      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2288%        const char *server_name)
2289%
2290%  A description of each parameter follows:
2291%
2292%    o wand: the magick wand.
2293%
2294%    o server_name: the X server name.
2295%
2296*/
2297WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2298  const char *server_name)
2299{
2300  Image
2301    *image;
2302
2303  MagickBooleanType
2304    status;
2305
2306  assert(wand != (MagickWand *) NULL);
2307  assert(wand->signature == WandSignature);
2308  if (wand->debug != MagickFalse)
2309    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2310  if (wand->images == (Image *) NULL)
2311    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2312  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2313  if (image == (Image *) NULL)
2314    return(MagickFalse);
2315  (void) CloneString(&wand->image_info->server_name,server_name);
2316  status=DisplayImages(wand->image_info,image);
2317  if (status == MagickFalse)
2318    InheritException(wand->exception,&image->exception);
2319  image=DestroyImage(image);
2320  return(status);
2321}
2322
2323/*
2324%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2325%                                                                             %
2326%                                                                             %
2327%                                                                             %
2328%   M a g i c k D i s p l a y I m a g e s                                     %
2329%                                                                             %
2330%                                                                             %
2331%                                                                             %
2332%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2333%
2334%  MagickDisplayImages() displays an image or image sequence.
2335%
2336%  The format of the MagickDisplayImages method is:
2337%
2338%      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2339%        const char *server_name)
2340%
2341%  A description of each parameter follows:
2342%
2343%    o wand: the magick wand.
2344%
2345%    o server_name: the X server name.
2346%
2347*/
2348WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2349  const char *server_name)
2350{
2351  MagickBooleanType
2352    status;
2353
2354  assert(wand != (MagickWand *) NULL);
2355  assert(wand->signature == WandSignature);
2356  if (wand->debug != MagickFalse)
2357    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2358  (void) CloneString(&wand->image_info->server_name,server_name);
2359  status=DisplayImages(wand->image_info,wand->images);
2360  if (status == MagickFalse)
2361    InheritException(wand->exception,&wand->images->exception);
2362  return(status);
2363}
2364
2365/*
2366%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2367%                                                                             %
2368%                                                                             %
2369%                                                                             %
2370%   M a g i c k D i s t o r t I m a g e                                       %
2371%                                                                             %
2372%                                                                             %
2373%                                                                             %
2374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2375%
2376%  MagickDistortImage() distorts an image using various distortion methods, by
2377%  mapping color lookups of the source image to a new destination image
2378%  usally of the same size as the source image, unless 'bestfit' is set to
2379%  true.
2380%
2381%  If 'bestfit' is enabled, and distortion allows it, the destination image is
2382%  adjusted to ensure the whole source 'image' will just fit within the final
2383%  destination image, which will be sized and offset accordingly.  Also in
2384%  many cases the virtual offset of the source image will be taken into
2385%  account in the mapping.
2386%
2387%  The format of the MagickDistortImage method is:
2388%
2389%      MagickBooleanType MagickDistortImage(MagickWand *wand,
2390%        const DistortImageMethod method,const size_t number_arguments,
2391%        const double *arguments,const MagickBooleanType bestfit)
2392%
2393%  A description of each parameter follows:
2394%
2395%    o image: the image to be distorted.
2396%
2397%    o method: the method of image distortion.
2398%
2399%        ArcDistortion always ignores the source image offset, and always
2400%        'bestfit' the destination image with the top left corner offset
2401%        relative to the polar mapping center.
2402%
2403%        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2404%        style of image distortion.
2405%
2406%        Affine, Perspective, and Bilinear, do least squares fitting of the
2407%        distortion when more than the minimum number of control point pairs
2408%        are provided.
2409%
2410%        Perspective, and Bilinear, falls back to a Affine distortion when less
2411%        that 4 control point pairs are provided. While Affine distortions let
2412%        you use any number of control point pairs, that is Zero pairs is a
2413%        no-Op (viewport only) distrotion, one pair is a translation and two
2414%        pairs of control points do a scale-rotate-translate, without any
2415%        shearing.
2416%
2417%    o number_arguments: the number of arguments given for this distortion
2418%      method.
2419%
2420%    o arguments: the arguments for this distortion method.
2421%
2422%    o bestfit: Attempt to resize destination to fit distorted source.
2423%
2424*/
2425WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2426  const DistortImageMethod method,const size_t number_arguments,
2427  const double *arguments,const MagickBooleanType bestfit)
2428{
2429  Image
2430    *distort_image;
2431
2432  assert(wand != (MagickWand *) NULL);
2433  assert(wand->signature == WandSignature);
2434  if (wand->debug != MagickFalse)
2435    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2436  if (wand->images == (Image *) NULL)
2437    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2438  distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2439    bestfit,wand->exception);
2440  if (distort_image == (Image *) NULL)
2441    return(MagickFalse);
2442  ReplaceImageInList(&wand->images,distort_image);
2443  return(MagickTrue);
2444}
2445
2446/*
2447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2448%                                                                             %
2449%                                                                             %
2450%                                                                             %
2451%   M a g i c k D r a w I m a g e                                             %
2452%                                                                             %
2453%                                                                             %
2454%                                                                             %
2455%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2456%
2457%  MagickDrawImage() renders the drawing wand on the current image.
2458%
2459%  The format of the MagickDrawImage method is:
2460%
2461%      MagickBooleanType MagickDrawImage(MagickWand *wand,
2462%        const DrawingWand *drawing_wand)
2463%
2464%  A description of each parameter follows:
2465%
2466%    o wand: the magick wand.
2467%
2468%    o drawing_wand: the draw wand.
2469%
2470*/
2471WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2472  const DrawingWand *drawing_wand)
2473{
2474  char
2475    *primitive;
2476
2477  DrawInfo
2478    *draw_info;
2479
2480  MagickBooleanType
2481    status;
2482
2483  assert(wand != (MagickWand *) NULL);
2484  assert(wand->signature == WandSignature);
2485  if (wand->debug != MagickFalse)
2486    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2487  if (wand->images == (Image *) NULL)
2488    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2489  draw_info=PeekDrawingWand(drawing_wand);
2490  if ((draw_info == (DrawInfo *) NULL) ||
2491      (draw_info->primitive == (char *) NULL))
2492    return(MagickFalse);
2493  primitive=AcquireString(draw_info->primitive);
2494  draw_info=DestroyDrawInfo(draw_info);
2495  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2496  draw_info->primitive=primitive;
2497  status=DrawImage(wand->images,draw_info);
2498  if (status == MagickFalse)
2499    InheritException(wand->exception,&wand->images->exception);
2500  draw_info=DestroyDrawInfo(draw_info);
2501  return(status);
2502}
2503
2504/*
2505%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2506%                                                                             %
2507%                                                                             %
2508%                                                                             %
2509%   M a g i c k E d g e I m a g e                                             %
2510%                                                                             %
2511%                                                                             %
2512%                                                                             %
2513%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2514%
2515%  MagickEdgeImage() enhance edges within the image with a convolution filter
2516%  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2517%  radius for you.
2518%
2519%  The format of the MagickEdgeImage method is:
2520%
2521%      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2522%
2523%  A description of each parameter follows:
2524%
2525%    o wand: the magick wand.
2526%
2527%    o radius: the radius of the pixel neighborhood.
2528%
2529*/
2530WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2531  const double radius)
2532{
2533  Image
2534    *edge_image;
2535
2536  assert(wand != (MagickWand *) NULL);
2537  assert(wand->signature == WandSignature);
2538  if (wand->debug != MagickFalse)
2539    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2540  if (wand->images == (Image *) NULL)
2541    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2542  edge_image=EdgeImage(wand->images,radius,wand->exception);
2543  if (edge_image == (Image *) NULL)
2544    return(MagickFalse);
2545  ReplaceImageInList(&wand->images,edge_image);
2546  return(MagickTrue);
2547}
2548
2549/*
2550%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2551%                                                                             %
2552%                                                                             %
2553%                                                                             %
2554%   M a g i c k E m b o s s I m a g e                                         %
2555%                                                                             %
2556%                                                                             %
2557%                                                                             %
2558%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2559%
2560%  MagickEmbossImage() returns a grayscale image with a three-dimensional
2561%  effect.  We convolve the image with a Gaussian operator of the given radius
2562%  and standard deviation (sigma).  For reasonable results, radius should be
2563%  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2564%  radius for you.
2565%
2566%  The format of the MagickEmbossImage method is:
2567%
2568%      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2569%        const double sigma)
2570%
2571%  A description of each parameter follows:
2572%
2573%    o wand: the magick wand.
2574%
2575%    o radius: the radius of the Gaussian, in pixels, not counting the center
2576%      pixel.
2577%
2578%    o sigma: the standard deviation of the Gaussian, in pixels.
2579%
2580*/
2581WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2582  const double radius,const double sigma)
2583{
2584  Image
2585    *emboss_image;
2586
2587  assert(wand != (MagickWand *) NULL);
2588  assert(wand->signature == WandSignature);
2589  if (wand->debug != MagickFalse)
2590    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2591  if (wand->images == (Image *) NULL)
2592    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2593  emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2594  if (emboss_image == (Image *) NULL)
2595    return(MagickFalse);
2596  ReplaceImageInList(&wand->images,emboss_image);
2597  return(MagickTrue);
2598}
2599
2600/*
2601%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2602%                                                                             %
2603%                                                                             %
2604%                                                                             %
2605%   M a g i c k E n c i p h e r I m a g e                                     %
2606%                                                                             %
2607%                                                                             %
2608%                                                                             %
2609%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2610%
2611%  MagickEncipherImage() converts plaint pixels to cipher pixels.
2612%
2613%  The format of the MagickEncipherImage method is:
2614%
2615%      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2616%        const char *passphrase)
2617%
2618%  A description of each parameter follows:
2619%
2620%    o wand: the magick wand.
2621%
2622%    o passphrase: the passphrase.
2623%
2624*/
2625WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2626  const char *passphrase)
2627{
2628  assert(wand != (MagickWand *) NULL);
2629  assert(wand->signature == WandSignature);
2630  if (wand->debug != MagickFalse)
2631    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2632  if (wand->images == (Image *) NULL)
2633    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2634  return(EncipherImage(wand->images,passphrase,&wand->images->exception));
2635}
2636
2637/*
2638%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2639%                                                                             %
2640%                                                                             %
2641%                                                                             %
2642%   M a g i c k E n h a n c e I m a g e                                       %
2643%                                                                             %
2644%                                                                             %
2645%                                                                             %
2646%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2647%
2648%  MagickEnhanceImage() applies a digital filter that improves the quality of a
2649%  noisy image.
2650%
2651%  The format of the MagickEnhanceImage method is:
2652%
2653%      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2654%
2655%  A description of each parameter follows:
2656%
2657%    o wand: the magick wand.
2658%
2659*/
2660WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2661{
2662  Image
2663    *enhance_image;
2664
2665  assert(wand != (MagickWand *) NULL);
2666  assert(wand->signature == WandSignature);
2667  if (wand->debug != MagickFalse)
2668    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2669  if (wand->images == (Image *) NULL)
2670    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2671  enhance_image=EnhanceImage(wand->images,wand->exception);
2672  if (enhance_image == (Image *) NULL)
2673    return(MagickFalse);
2674  ReplaceImageInList(&wand->images,enhance_image);
2675  return(MagickTrue);
2676}
2677
2678/*
2679%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2680%                                                                             %
2681%                                                                             %
2682%                                                                             %
2683%   M a g i c k E q u a l i z e I m a g e                                     %
2684%                                                                             %
2685%                                                                             %
2686%                                                                             %
2687%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2688%
2689%  MagickEqualizeImage() equalizes the image histogram.
2690%
2691%  The format of the MagickEqualizeImage method is:
2692%
2693%      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2694%
2695%  A description of each parameter follows:
2696%
2697%    o wand: the magick wand.
2698%
2699%    o channel: the image channel(s).
2700%
2701*/
2702WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2703{
2704  MagickBooleanType
2705    status;
2706
2707  assert(wand != (MagickWand *) NULL);
2708  assert(wand->signature == WandSignature);
2709  if (wand->debug != MagickFalse)
2710    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2711  if (wand->images == (Image *) NULL)
2712    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2713  status=EqualizeImage(wand->images,&wand->images->exception);
2714  return(status);
2715}
2716
2717/*
2718%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2719%                                                                             %
2720%                                                                             %
2721%                                                                             %
2722%   M a g i c k E v a l u a t e I m a g e                                     %
2723%                                                                             %
2724%                                                                             %
2725%                                                                             %
2726%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2727%
2728%  MagickEvaluateImage() applys an arithmetic, relational, or logical
2729%  expression to an image.  Use these operators to lighten or darken an image,
2730%  to increase or decrease contrast in an image, or to produce the "negative"
2731%  of an image.
2732%
2733%  The format of the MagickEvaluateImage method is:
2734%
2735%      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2736%        const MagickEvaluateOperator operator,const double value)
2737%      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2738%        const MagickEvaluateOperator operator)
2739%
2740%  A description of each parameter follows:
2741%
2742%    o wand: the magick wand.
2743%
2744%    o op: A channel operator.
2745%
2746%    o value: A value value.
2747%
2748*/
2749
2750WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2751  const MagickEvaluateOperator op)
2752{
2753  Image
2754    *evaluate_image;
2755
2756  assert(wand != (MagickWand *) NULL);
2757  assert(wand->signature == WandSignature);
2758  if (wand->debug != MagickFalse)
2759    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2760  if (wand->images == (Image *) NULL)
2761    return((MagickWand *) NULL);
2762  evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2763  if (evaluate_image == (Image *) NULL)
2764    return((MagickWand *) NULL);
2765  return(CloneMagickWandFromImages(wand,evaluate_image));
2766}
2767
2768WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2769  const MagickEvaluateOperator op,const double value)
2770{
2771  MagickBooleanType
2772    status;
2773
2774  assert(wand != (MagickWand *) NULL);
2775  assert(wand->signature == WandSignature);
2776  if (wand->debug != MagickFalse)
2777    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2778  if (wand->images == (Image *) NULL)
2779    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2780  status=EvaluateImage(wand->images,op,value,&wand->images->exception);
2781  return(status);
2782}
2783
2784/*
2785%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2786%                                                                             %
2787%                                                                             %
2788%                                                                             %
2789%   M a g i c k E x p o r t I m a g e P i x e l s                             %
2790%                                                                             %
2791%                                                                             %
2792%                                                                             %
2793%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2794%
2795%  MagickExportImagePixels() extracts pixel data from an image and returns it
2796%  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2797%  an error is encountered.  The data is returned as char, short int, int,
2798%  ssize_t, float, or double in the order specified by map.
2799%
2800%  Suppose you want to extract the first scanline of a 640x480 image as
2801%  character data in red-green-blue order:
2802%
2803%      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
2804%
2805%  The format of the MagickExportImagePixels method is:
2806%
2807%      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2808%        const ssize_t x,const ssize_t y,const size_t columns,
2809%        const size_t rows,const char *map,const StorageType storage,
2810%        void *pixels)
2811%
2812%  A description of each parameter follows:
2813%
2814%    o wand: the magick wand.
2815%
2816%    o x, y, columns, rows:  These values define the perimeter
2817%      of a region of pixels you want to extract.
2818%
2819%    o map:  This string reflects the expected ordering of the pixel array.
2820%      It can be any combination or order of R = red, G = green, B = blue,
2821%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2822%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2823%      P = pad.
2824%
2825%    o storage: Define the data type of the pixels.  Float and double types are
2826%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2827%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2828%      LongPixel, QuantumPixel, or ShortPixel.
2829%
2830%    o pixels: This array of values contain the pixel components as defined by
2831%      map and type.  You must preallocate this array where the expected
2832%      length varies depending on the values of width, height, map, and type.
2833%
2834*/
2835WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2836  const ssize_t x,const ssize_t y,const size_t columns,
2837  const size_t rows,const char *map,const StorageType storage,
2838  void *pixels)
2839{
2840  MagickBooleanType
2841    status;
2842
2843  assert(wand != (MagickWand *) NULL);
2844  assert(wand->signature == WandSignature);
2845  if (wand->debug != MagickFalse)
2846    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2847  if (wand->images == (Image *) NULL)
2848    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2849  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
2850    storage,pixels,wand->exception);
2851  if (status == MagickFalse)
2852    InheritException(wand->exception,&wand->images->exception);
2853  return(status);
2854}
2855
2856/*
2857%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2858%                                                                             %
2859%                                                                             %
2860%                                                                             %
2861%   M a g i c k E x t e n t I m a g e                                         %
2862%                                                                             %
2863%                                                                             %
2864%                                                                             %
2865%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2866%
2867%  MagickExtentImage() extends the image as defined by the geometry, gravity,
2868%  and wand background color.  Set the (x,y) offset of the geometry to move
2869%  the original wand relative to the extended wand.
2870%
2871%  The format of the MagickExtentImage method is:
2872%
2873%      MagickBooleanType MagickExtentImage(MagickWand *wand,
2874%        const size_t width,const size_t height,const ssize_t x,
2875%        const ssize_t y)
2876%
2877%  A description of each parameter follows:
2878%
2879%    o wand: the magick wand.
2880%
2881%    o width: the region width.
2882%
2883%    o height: the region height.
2884%
2885%    o x: the region x offset.
2886%
2887%    o y: the region y offset.
2888%
2889*/
2890WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
2891  const size_t width,const size_t height,const ssize_t x,
2892  const ssize_t y)
2893{
2894  Image
2895    *extent_image;
2896
2897  RectangleInfo
2898    extent;
2899
2900  assert(wand != (MagickWand *) NULL);
2901  assert(wand->signature == WandSignature);
2902  if (wand->debug != MagickFalse)
2903    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2904  if (wand->images == (Image *) NULL)
2905    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2906  extent.width=width;
2907  extent.height=height;
2908  extent.x=x;
2909  extent.y=y;
2910  extent_image=ExtentImage(wand->images,&extent,wand->exception);
2911  if (extent_image == (Image *) NULL)
2912    return(MagickFalse);
2913  ReplaceImageInList(&wand->images,extent_image);
2914  return(MagickTrue);
2915}
2916
2917/*
2918%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2919%                                                                             %
2920%                                                                             %
2921%                                                                             %
2922%   M a g i c k F l i p I m a g e                                             %
2923%                                                                             %
2924%                                                                             %
2925%                                                                             %
2926%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2927%
2928%  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
2929%  around the central x-axis.
2930%
2931%  The format of the MagickFlipImage method is:
2932%
2933%      MagickBooleanType MagickFlipImage(MagickWand *wand)
2934%
2935%  A description of each parameter follows:
2936%
2937%    o wand: the magick wand.
2938%
2939*/
2940WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
2941{
2942  Image
2943    *flip_image;
2944
2945  assert(wand != (MagickWand *) NULL);
2946  assert(wand->signature == WandSignature);
2947  if (wand->debug != MagickFalse)
2948    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2949  if (wand->images == (Image *) NULL)
2950    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2951  flip_image=FlipImage(wand->images,wand->exception);
2952  if (flip_image == (Image *) NULL)
2953    return(MagickFalse);
2954  ReplaceImageInList(&wand->images,flip_image);
2955  return(MagickTrue);
2956}
2957
2958/*
2959%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2960%                                                                             %
2961%                                                                             %
2962%                                                                             %
2963%   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                         %
2964%                                                                             %
2965%                                                                             %
2966%                                                                             %
2967%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2968%
2969%  MagickFloodfillPaintImage() changes the color value of any pixel that matches
2970%  target and is an immediate neighbor.  If the method FillToBorderMethod is
2971%  specified, the color value is changed for any neighbor pixel that does not
2972%  match the bordercolor member of image.
2973%
2974%  The format of the MagickFloodfillPaintImage method is:
2975%
2976%      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
2977%        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
2978%        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
2979%
2980%  A description of each parameter follows:
2981%
2982%    o wand: the magick wand.
2983%
2984%    o fill: the floodfill color pixel wand.
2985%
2986%    o fuzz: By default target must match a particular pixel color
2987%      exactly.  However, in many cases two colors may differ by a small amount.
2988%      The fuzz member of image defines how much tolerance is acceptable to
2989%      consider two colors as the same.  For example, set fuzz to 10 and the
2990%      color red at intensities of 100 and 102 respectively are now interpreted
2991%      as the same color for the purposes of the floodfill.
2992%
2993%    o bordercolor: the border color pixel wand.
2994%
2995%    o x,y: the starting location of the operation.
2996%
2997%    o invert: paint any pixel that does not match the target color.
2998%
2999*/
3000WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3001  const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3002  const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3003{
3004  DrawInfo
3005    *draw_info;
3006
3007  MagickBooleanType
3008    status;
3009
3010  PixelInfo
3011    target;
3012
3013  assert(wand != (MagickWand *) NULL);
3014  assert(wand->signature == WandSignature);
3015  if (wand->debug != MagickFalse)
3016    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3017  if (wand->images == (Image *) NULL)
3018    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3019  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3020  PixelGetQuantumPacket(fill,&draw_info->fill);
3021  (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
3022    y % wand->images->rows,&target,wand->exception);
3023  if (bordercolor != (PixelWand *) NULL)
3024    PixelGetMagickColor(bordercolor,&target);
3025  wand->images->fuzz=fuzz;
3026  status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert);
3027  if (status == MagickFalse)
3028    InheritException(wand->exception,&wand->images->exception);
3029  draw_info=DestroyDrawInfo(draw_info);
3030  return(status);
3031}
3032
3033/*
3034%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3035%                                                                             %
3036%                                                                             %
3037%                                                                             %
3038%   M a g i c k F l o p I m a g e                                             %
3039%                                                                             %
3040%                                                                             %
3041%                                                                             %
3042%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3043%
3044%  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3045%  around the central y-axis.
3046%
3047%  The format of the MagickFlopImage method is:
3048%
3049%      MagickBooleanType MagickFlopImage(MagickWand *wand)
3050%
3051%  A description of each parameter follows:
3052%
3053%    o wand: the magick wand.
3054%
3055*/
3056WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3057{
3058  Image
3059    *flop_image;
3060
3061  assert(wand != (MagickWand *) NULL);
3062  assert(wand->signature == WandSignature);
3063  if (wand->debug != MagickFalse)
3064    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3065  if (wand->images == (Image *) NULL)
3066    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3067  flop_image=FlopImage(wand->images,wand->exception);
3068  if (flop_image == (Image *) NULL)
3069    return(MagickFalse);
3070  ReplaceImageInList(&wand->images,flop_image);
3071  return(MagickTrue);
3072}
3073
3074/*
3075%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3076%                                                                             %
3077%                                                                             %
3078%                                                                             %
3079%   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                     %
3080%                                                                             %
3081%                                                                             %
3082%                                                                             %
3083%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3084%
3085%  MagickForwardFourierTransformImage() implements the discrete Fourier
3086%  transform (DFT) of the image either as a magnitude / phase or real /
3087%  imaginary image pair.
3088%
3089%  The format of the MagickForwardFourierTransformImage method is:
3090%
3091%      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3092%        const MagickBooleanType magnitude)
3093%
3094%  A description of each parameter follows:
3095%
3096%    o wand: the magick wand.
3097%
3098%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3099%      imaginary image pair.
3100%
3101*/
3102WandExport MagickBooleanType MagickForwardFourierTransformImage(
3103  MagickWand *wand,const MagickBooleanType magnitude)
3104{
3105  Image
3106    *forward_image;
3107
3108  assert(wand != (MagickWand *) NULL);
3109  assert(wand->signature == WandSignature);
3110  if (wand->debug != MagickFalse)
3111    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3112  if (wand->images == (Image *) NULL)
3113    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3114  forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3115    wand->exception);
3116  if (forward_image == (Image *) NULL)
3117    return(MagickFalse);
3118  ReplaceImageInList(&wand->images,forward_image);
3119  return(MagickTrue);
3120}
3121
3122/*
3123%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3124%                                                                             %
3125%                                                                             %
3126%                                                                             %
3127%   M a g i c k F r a m e I m a g e                                           %
3128%                                                                             %
3129%                                                                             %
3130%                                                                             %
3131%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3132%
3133%  MagickFrameImage() adds a simulated three-dimensional border around the
3134%  image.  The width and height specify the border width of the vertical and
3135%  horizontal sides of the frame.  The inner and outer bevels indicate the
3136%  width of the inner and outer shadows of the frame.
3137%
3138%  The format of the MagickFrameImage method is:
3139%
3140%      MagickBooleanType MagickFrameImage(MagickWand *wand,
3141%        const PixelWand *matte_color,const size_t width,
3142%        const size_t height,const ssize_t inner_bevel,
3143%        const ssize_t outer_bevel)
3144%
3145%  A description of each parameter follows:
3146%
3147%    o wand: the magick wand.
3148%
3149%    o matte_color: the frame color pixel wand.
3150%
3151%    o width: the border width.
3152%
3153%    o height: the border height.
3154%
3155%    o inner_bevel: the inner bevel width.
3156%
3157%    o outer_bevel: the outer bevel width.
3158%
3159*/
3160WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3161  const PixelWand *matte_color,const size_t width,
3162  const size_t height,const ssize_t inner_bevel,const ssize_t outer_bevel)
3163{
3164  Image
3165    *frame_image;
3166
3167  FrameInfo
3168    frame_info;
3169
3170  assert(wand != (MagickWand *) NULL);
3171  assert(wand->signature == WandSignature);
3172  if (wand->debug != MagickFalse)
3173    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3174  if (wand->images == (Image *) NULL)
3175    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3176  (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3177  frame_info.width=wand->images->columns+2*width;
3178  frame_info.height=wand->images->rows+2*height;
3179  frame_info.x=(ssize_t) width;
3180  frame_info.y=(ssize_t) height;
3181  frame_info.inner_bevel=inner_bevel;
3182  frame_info.outer_bevel=outer_bevel;
3183  PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3184  frame_image=FrameImage(wand->images,&frame_info,wand->exception);
3185  if (frame_image == (Image *) NULL)
3186    return(MagickFalse);
3187  ReplaceImageInList(&wand->images,frame_image);
3188  return(MagickTrue);
3189}
3190
3191/*
3192%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3193%                                                                             %
3194%                                                                             %
3195%                                                                             %
3196%   M a g i c k F u n c t i o n I m a g e                                     %
3197%                                                                             %
3198%                                                                             %
3199%                                                                             %
3200%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3201%
3202%  MagickFunctionImage() applys an arithmetic, relational, or logical
3203%  expression to an image.  Use these operators to lighten or darken an image,
3204%  to increase or decrease contrast in an image, or to produce the "negative"
3205%  of an image.
3206%
3207%  The format of the MagickFunctionImage method is:
3208%
3209%      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3210%        const MagickFunction function,const size_t number_arguments,
3211%        const double *arguments)
3212%
3213%  A description of each parameter follows:
3214%
3215%    o wand: the magick wand.
3216%
3217%    o function: the image function.
3218%
3219%    o number_arguments: the number of function arguments.
3220%
3221%    o arguments: the function arguments.
3222%
3223*/
3224WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3225  const MagickFunction function,const size_t number_arguments,
3226  const double *arguments)
3227{
3228  MagickBooleanType
3229    status;
3230
3231  assert(wand != (MagickWand *) NULL);
3232  assert(wand->signature == WandSignature);
3233  if (wand->debug != MagickFalse)
3234    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3235  if (wand->images == (Image *) NULL)
3236    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3237  status=FunctionImage(wand->images,function,number_arguments,arguments,
3238    &wand->images->exception);
3239  return(status);
3240}
3241
3242/*
3243%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3244%                                                                             %
3245%                                                                             %
3246%                                                                             %
3247%   M a g i c k F x I m a g e                                                 %
3248%                                                                             %
3249%                                                                             %
3250%                                                                             %
3251%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3252%
3253%  MagickFxImage() evaluate expression for each pixel in the image.
3254%
3255%  The format of the MagickFxImage method is:
3256%
3257%      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3258%
3259%  A description of each parameter follows:
3260%
3261%    o wand: the magick wand.
3262%
3263%    o expression: the expression.
3264%
3265*/
3266WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3267{
3268  Image
3269    *fx_image;
3270
3271  assert(wand != (MagickWand *) NULL);
3272  assert(wand->signature == WandSignature);
3273  if (wand->debug != MagickFalse)
3274    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3275  if (wand->images == (Image *) NULL)
3276    return((MagickWand *) NULL);
3277  fx_image=FxImage(wand->images,expression,wand->exception);
3278  if (fx_image == (Image *) NULL)
3279    return((MagickWand *) NULL);
3280  return(CloneMagickWandFromImages(wand,fx_image));
3281}
3282
3283/*
3284%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3285%                                                                             %
3286%                                                                             %
3287%                                                                             %
3288%   M a g i c k G a m m a I m a g e                                           %
3289%                                                                             %
3290%                                                                             %
3291%                                                                             %
3292%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3293%
3294%  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3295%  different devices will have perceptual differences in the way the image's
3296%  intensities are represented on the screen.  Specify individual gamma levels
3297%  for the red, green, and blue channels, or adjust all three with the gamma
3298%  parameter.  Values typically range from 0.8 to 2.3.
3299%
3300%  You can also reduce the influence of a particular channel with a gamma
3301%  value of 0.
3302%
3303%  The format of the MagickGammaImage method is:
3304%
3305%      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3306%
3307%  A description of each parameter follows:
3308%
3309%    o wand: the magick wand.
3310%
3311%    o level: Define the level of gamma correction.
3312%
3313*/
3314WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3315  const double gamma)
3316{
3317  MagickBooleanType
3318    status;
3319
3320  assert(wand != (MagickWand *) NULL);
3321  assert(wand->signature == WandSignature);
3322  if (wand->debug != MagickFalse)
3323    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3324  if (wand->images == (Image *) NULL)
3325    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3326  status=GammaImage(wand->images,gamma,wand->exception);
3327  return(status);
3328}
3329
3330/*
3331%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3332%                                                                             %
3333%                                                                             %
3334%                                                                             %
3335%   M a g i c k G a u s s i a n B l u r I m a g e                             %
3336%                                                                             %
3337%                                                                             %
3338%                                                                             %
3339%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3340%
3341%  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3342%  Gaussian operator of the given radius and standard deviation (sigma).
3343%  For reasonable results, the radius should be larger than sigma.  Use a
3344%  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3345%
3346%  The format of the MagickGaussianBlurImage method is:
3347%
3348%      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3349%        const double radius,const double sigma)
3350%
3351%  A description of each parameter follows:
3352%
3353%    o wand: the magick wand.
3354%
3355%    o radius: the radius of the Gaussian, in pixels, not counting the center
3356%      pixel.
3357%
3358%    o sigma: the standard deviation of the Gaussian, in pixels.
3359%
3360*/
3361WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3362  const double radius,const double sigma)
3363{
3364  Image
3365    *blur_image;
3366
3367  assert(wand != (MagickWand *) NULL);
3368  assert(wand->signature == WandSignature);
3369  if (wand->debug != MagickFalse)
3370    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3371  if (wand->images == (Image *) NULL)
3372    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3373  blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3374  if (blur_image == (Image *) NULL)
3375    return(MagickFalse);
3376  ReplaceImageInList(&wand->images,blur_image);
3377  return(MagickTrue);
3378}
3379
3380/*
3381%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3382%                                                                             %
3383%                                                                             %
3384%                                                                             %
3385%   M a g i c k G e t I m a g e                                               %
3386%                                                                             %
3387%                                                                             %
3388%                                                                             %
3389%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3390%
3391%  MagickGetImage() gets the image at the current image index.
3392%
3393%  The format of the MagickGetImage method is:
3394%
3395%      MagickWand *MagickGetImage(MagickWand *wand)
3396%
3397%  A description of each parameter follows:
3398%
3399%    o wand: the magick wand.
3400%
3401*/
3402WandExport MagickWand *MagickGetImage(MagickWand *wand)
3403{
3404  Image
3405    *image;
3406
3407  assert(wand != (MagickWand *) NULL);
3408  assert(wand->signature == WandSignature);
3409  if (wand->debug != MagickFalse)
3410    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3411  if (wand->images == (Image *) NULL)
3412    {
3413      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3414        "ContainsNoImages","`%s'",wand->name);
3415      return((MagickWand *) NULL);
3416    }
3417  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3418  if (image == (Image *) NULL)
3419    return((MagickWand *) NULL);
3420  return(CloneMagickWandFromImages(wand,image));
3421}
3422
3423/*
3424%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3425%                                                                             %
3426%                                                                             %
3427%                                                                             %
3428%   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                       %
3429%                                                                             %
3430%                                                                             %
3431%                                                                             %
3432%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3433%
3434%  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3435%  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3436%  than CMYKA.
3437%
3438%  The format of the MagickGetImageAlphaChannel method is:
3439%
3440%      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3441%
3442%  A description of each parameter follows:
3443%
3444%    o wand: the magick wand.
3445%
3446*/
3447WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3448{
3449  assert(wand != (MagickWand *) NULL);
3450  assert(wand->signature == WandSignature);
3451  if (wand->debug != MagickFalse)
3452    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3453  if (wand->images == (Image *) NULL)
3454    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3455  return(GetImageAlphaChannel(wand->images));
3456}
3457
3458/*
3459%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3460%                                                                             %
3461%                                                                             %
3462%                                                                             %
3463%   M a g i c k G e t I m a g e C l i p M a s k                               %
3464%                                                                             %
3465%                                                                             %
3466%                                                                             %
3467%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3468%
3469%  MagickGetImageClipMask() gets the image clip mask at the current image index.
3470%
3471%  The format of the MagickGetImageClipMask method is:
3472%
3473%      MagickWand *MagickGetImageClipMask(MagickWand *wand)
3474%
3475%  A description of each parameter follows:
3476%
3477%    o wand: the magick wand.
3478%
3479*/
3480WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
3481{
3482  Image
3483    *image;
3484
3485  assert(wand != (MagickWand *) NULL);
3486  assert(wand->signature == WandSignature);
3487  if (wand->debug != MagickFalse)
3488    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3489  if (wand->images == (Image *) NULL)
3490    {
3491      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3492        "ContainsNoImages","`%s'",wand->name);
3493      return((MagickWand *) NULL);
3494    }
3495  image=GetImageClipMask(wand->images,wand->exception);
3496  if (image == (Image *) NULL)
3497    return((MagickWand *) NULL);
3498  return(CloneMagickWandFromImages(wand,image));
3499}
3500
3501/*
3502%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3503%                                                                             %
3504%                                                                             %
3505%                                                                             %
3506%   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                 %
3507%                                                                             %
3508%                                                                             %
3509%                                                                             %
3510%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3511%
3512%  MagickGetImageBackgroundColor() returns the image background color.
3513%
3514%  The format of the MagickGetImageBackgroundColor method is:
3515%
3516%      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3517%        PixelWand *background_color)
3518%
3519%  A description of each parameter follows:
3520%
3521%    o wand: the magick wand.
3522%
3523%    o background_color: Return the background color.
3524%
3525*/
3526WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3527  PixelWand *background_color)
3528{
3529  assert(wand != (MagickWand *) NULL);
3530  assert(wand->signature == WandSignature);
3531  if (wand->debug != MagickFalse)
3532    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3533  if (wand->images == (Image *) NULL)
3534    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3535  PixelSetQuantumPacket(background_color,&wand->images->background_color);
3536  return(MagickTrue);
3537}
3538
3539/*
3540%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3541%                                                                             %
3542%                                                                             %
3543%                                                                             %
3544%   M a g i c k G e t I m a g e B l o b                                       %
3545%                                                                             %
3546%                                                                             %
3547%                                                                             %
3548%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3549%
3550%  MagickGetImageBlob() implements direct to memory image formats.  It returns
3551%  the image as a blob (a formatted "file" in memory) and its length, starting
3552%  from the current position in the image sequence.  Use MagickSetImageFormat()
3553%  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3554%
3555%  Utilize MagickResetIterator() to ensure the write is from the beginning of
3556%  the image sequence.
3557%
3558%  Use MagickRelinquishMemory() to free the blob when you are done with it.
3559%
3560%  The format of the MagickGetImageBlob method is:
3561%
3562%      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3563%
3564%  A description of each parameter follows:
3565%
3566%    o wand: the magick wand.
3567%
3568%    o length: the length of the blob.
3569%
3570*/
3571WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3572{
3573  assert(wand != (MagickWand *) NULL);
3574  assert(wand->signature == WandSignature);
3575  if (wand->debug != MagickFalse)
3576    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3577  if (wand->images == (Image *) NULL)
3578    {
3579      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3580        "ContainsNoImages","`%s'",wand->name);
3581      return((unsigned char *) NULL);
3582    }
3583  return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3584}
3585
3586/*
3587%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3588%                                                                             %
3589%                                                                             %
3590%                                                                             %
3591%   M a g i c k G e t I m a g e s B l o b                                     %
3592%                                                                             %
3593%                                                                             %
3594%                                                                             %
3595%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3596%
3597%  MagickGetImageBlob() implements direct to memory image formats.  It
3598%  returns the image sequence as a blob and its length.  The format of the image
3599%  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3600%  return a different image format, use MagickSetImageFormat().
3601%
3602%  Note, some image formats do not permit multiple images to the same image
3603%  stream (e.g. JPEG).  in this instance, just the first image of the
3604%  sequence is returned as a blob.
3605%
3606%  The format of the MagickGetImagesBlob method is:
3607%
3608%      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3609%
3610%  A description of each parameter follows:
3611%
3612%    o wand: the magick wand.
3613%
3614%    o length: the length of the blob.
3615%
3616*/
3617WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3618{
3619  unsigned char
3620    *blob;
3621
3622  assert(wand != (MagickWand *) NULL);
3623  assert(wand->signature == WandSignature);
3624  if (wand->debug != MagickFalse)
3625    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3626  if (wand->images == (Image *) NULL)
3627    {
3628      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3629        "ContainsNoImages","`%s'",wand->name);
3630      return((unsigned char *) NULL);
3631    }
3632  blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3633    wand->exception);
3634  return(blob);
3635}
3636
3637/*
3638%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3639%                                                                             %
3640%                                                                             %
3641%                                                                             %
3642%   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                         %
3643%                                                                             %
3644%                                                                             %
3645%                                                                             %
3646%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3647%
3648%  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3649%  image.
3650%
3651%  The format of the MagickGetImageBluePrimary method is:
3652%
3653%      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3654%        double *y)
3655%
3656%  A description of each parameter follows:
3657%
3658%    o wand: the magick wand.
3659%
3660%    o x: the chromaticity blue primary x-point.
3661%
3662%    o y: the chromaticity blue primary y-point.
3663%
3664*/
3665WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3666  double *x,double *y)
3667{
3668  assert(wand != (MagickWand *) NULL);
3669  assert(wand->signature == WandSignature);
3670  if (wand->debug != MagickFalse)
3671    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3672  if (wand->images == (Image *) NULL)
3673    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3674  *x=wand->images->chromaticity.blue_primary.x;
3675  *y=wand->images->chromaticity.blue_primary.y;
3676  return(MagickTrue);
3677}
3678
3679/*
3680%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3681%                                                                             %
3682%                                                                             %
3683%                                                                             %
3684%   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                         %
3685%                                                                             %
3686%                                                                             %
3687%                                                                             %
3688%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3689%
3690%  MagickGetImageBorderColor() returns the image border color.
3691%
3692%  The format of the MagickGetImageBorderColor method is:
3693%
3694%      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3695%        PixelWand *border_color)
3696%
3697%  A description of each parameter follows:
3698%
3699%    o wand: the magick wand.
3700%
3701%    o border_color: Return the border color.
3702%
3703*/
3704WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3705  PixelWand *border_color)
3706{
3707  assert(wand != (MagickWand *) NULL);
3708  assert(wand->signature == WandSignature);
3709  if (wand->debug != MagickFalse)
3710    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3711  if (wand->images == (Image *) NULL)
3712    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3713  PixelSetQuantumPacket(border_color,&wand->images->border_color);
3714  return(MagickTrue);
3715}
3716
3717/*
3718%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3719%                                                                             %
3720%                                                                             %
3721%                                                                             %
3722%   M a g i c k G e t I m a g e F e a t u r e s                               %
3723%                                                                             %
3724%                                                                             %
3725%                                                                             %
3726%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3727%
3728%  MagickGetImageFeatures() returns features for each channel in the
3729%  image in each of four directions (horizontal, vertical, left and right
3730%  diagonals) for the specified distance.  The features include the angular
3731%  second moment, contrast, correlation, sum of squares: variance, inverse
3732%  difference moment, sum average, sum varience, sum entropy, entropy,
3733%  difference variance, difference entropy, information measures of
3734%  correlation 1, information measures of correlation 2, and maximum
3735%  correlation coefficient.  You can access the red channel contrast, for
3736%  example, like this:
3737%
3738%      channel_features=MagickGetImageFeatures(wand,1);
3739%      contrast=channel_features[RedChannel].contrast[0];
3740%
3741%  Use MagickRelinquishMemory() to free the statistics buffer.
3742%
3743%  The format of the MagickGetImageFeatures method is:
3744%
3745%      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3746%        const size_t distance)
3747%
3748%  A description of each parameter follows:
3749%
3750%    o wand: the magick wand.
3751%
3752%    o distance: the distance.
3753%
3754*/
3755WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3756  const size_t distance)
3757{
3758  assert(wand != (MagickWand *) NULL);
3759  assert(wand->signature == WandSignature);
3760  if (wand->debug != MagickFalse)
3761    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3762  if (wand->images == (Image *) NULL)
3763    {
3764      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3765        "ContainsNoImages","`%s'",wand->name);
3766      return((ChannelFeatures *) NULL);
3767    }
3768  return(GetImageFeatures(wand->images,distance,wand->exception));
3769}
3770
3771/*
3772%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3773%                                                                             %
3774%                                                                             %
3775%                                                                             %
3776%   M a g i c k G e t I m a g e K u r t o s i s                               %
3777%                                                                             %
3778%                                                                             %
3779%                                                                             %
3780%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3781%
3782%  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
3783%  more image channels.
3784%
3785%  The format of the MagickGetImageKurtosis method is:
3786%
3787%      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3788%        double *kurtosis,double *skewness)
3789%
3790%  A description of each parameter follows:
3791%
3792%    o wand: the magick wand.
3793%
3794%    o kurtosis:  The kurtosis for the specified channel(s).
3795%
3796%    o skewness:  The skewness for the specified channel(s).
3797%
3798*/
3799WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3800  double *kurtosis,double *skewness)
3801{
3802  MagickBooleanType
3803    status;
3804
3805  assert(wand != (MagickWand *) NULL);
3806  assert(wand->signature == WandSignature);
3807  if (wand->debug != MagickFalse)
3808    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3809  if (wand->images == (Image *) NULL)
3810    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3811  status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
3812  return(status);
3813}
3814
3815/*
3816%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3817%                                                                             %
3818%                                                                             %
3819%                                                                             %
3820%   M a g i c k G e t I m a g e M e a n                                       %
3821%                                                                             %
3822%                                                                             %
3823%                                                                             %
3824%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3825%
3826%  MagickGetImageMean() gets the mean and standard deviation of one or more
3827%  image channels.
3828%
3829%  The format of the MagickGetImageMean method is:
3830%
3831%      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3832%        double *standard_deviation)
3833%
3834%  A description of each parameter follows:
3835%
3836%    o wand: the magick wand.
3837%
3838%    o channel: the image channel(s).
3839%
3840%    o mean:  The mean pixel value for the specified channel(s).
3841%
3842%    o standard_deviation:  The standard deviation for the specified channel(s).
3843%
3844*/
3845WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3846  double *standard_deviation)
3847{
3848  MagickBooleanType
3849    status;
3850
3851  assert(wand != (MagickWand *) NULL);
3852  assert(wand->signature == WandSignature);
3853  if (wand->debug != MagickFalse)
3854    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3855  if (wand->images == (Image *) NULL)
3856    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3857  status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
3858  return(status);
3859}
3860
3861/*
3862%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3863%                                                                             %
3864%                                                                             %
3865%                                                                             %
3866%   M a g i c k G e t I m a g e R a n g e                                     %
3867%                                                                             %
3868%                                                                             %
3869%                                                                             %
3870%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3871%
3872%  MagickGetImageRange() gets the range for one or more image channels.
3873%
3874%  The format of the MagickGetImageRange method is:
3875%
3876%      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
3877%        double *maxima)
3878%
3879%  A description of each parameter follows:
3880%
3881%    o wand: the magick wand.
3882%
3883%    o minima:  The minimum pixel value for the specified channel(s).
3884%
3885%    o maxima:  The maximum pixel value for the specified channel(s).
3886%
3887*/
3888WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
3889  double *minima,double *maxima)
3890{
3891  MagickBooleanType
3892    status;
3893
3894  assert(wand != (MagickWand *) NULL);
3895  assert(wand->signature == WandSignature);
3896  if (wand->debug != MagickFalse)
3897    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3898  if (wand->images == (Image *) NULL)
3899    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3900  status=GetImageRange(wand->images,minima,maxima,wand->exception);
3901  return(status);
3902}
3903
3904/*
3905%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3906%                                                                             %
3907%                                                                             %
3908%                                                                             %
3909%   M a g i c k G e t I m a g e S t a t i s t i c s                           %
3910%                                                                             %
3911%                                                                             %
3912%                                                                             %
3913%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3914%
3915%  MagickGetImageStatistics() returns statistics for each channel in the
3916%  image.  The statistics include the channel depth, its minima and
3917%  maxima, the mean, the standard deviation, the kurtosis and the skewness.
3918%  You can access the red channel mean, for example, like this:
3919%
3920%      channel_statistics=MagickGetImageStatistics(wand);
3921%      red_mean=channel_statistics[RedChannel].mean;
3922%
3923%  Use MagickRelinquishMemory() to free the statistics buffer.
3924%
3925%  The format of the MagickGetImageStatistics method is:
3926%
3927%      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3928%
3929%  A description of each parameter follows:
3930%
3931%    o wand: the magick wand.
3932%
3933*/
3934WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3935{
3936  assert(wand != (MagickWand *) NULL);
3937  assert(wand->signature == WandSignature);
3938  if (wand->debug != MagickFalse)
3939    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3940  if (wand->images == (Image *) NULL)
3941    {
3942      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3943        "ContainsNoImages","`%s'",wand->name);
3944      return((ChannelStatistics *) NULL);
3945    }
3946  return(GetImageStatistics(wand->images,wand->exception));
3947}
3948
3949/*
3950%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3951%                                                                             %
3952%                                                                             %
3953%                                                                             %
3954%   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                     %
3955%                                                                             %
3956%                                                                             %
3957%                                                                             %
3958%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3959%
3960%  MagickGetImageColormapColor() returns the color of the specified colormap
3961%  index.
3962%
3963%  The format of the MagickGetImageColormapColor method is:
3964%
3965%      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
3966%        const size_t index,PixelWand *color)
3967%
3968%  A description of each parameter follows:
3969%
3970%    o wand: the magick wand.
3971%
3972%    o index: the offset into the image colormap.
3973%
3974%    o color: Return the colormap color in this wand.
3975%
3976*/
3977WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
3978  const size_t index,PixelWand *color)
3979{
3980  assert(wand != (MagickWand *) NULL);
3981  assert(wand->signature == WandSignature);
3982  if (wand->debug != MagickFalse)
3983    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3984  if (wand->images == (Image *) NULL)
3985    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3986  if ((wand->images->colormap == (PixelPacket *) NULL) ||
3987      (index >= wand->images->colors))
3988    {
3989      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3990        "InvalidColormapIndex","`%s'",wand->name);
3991      return(MagickFalse);
3992    }
3993  PixelSetQuantumPacket(color,wand->images->colormap+index);
3994  return(MagickTrue);
3995}
3996
3997/*
3998%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3999%                                                                             %
4000%                                                                             %
4001%                                                                             %
4002%   M a g i c k G e t I m a g e C o l o r s                                   %
4003%                                                                             %
4004%                                                                             %
4005%                                                                             %
4006%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4007%
4008%  MagickGetImageColors() gets the number of unique colors in the image.
4009%
4010%  The format of the MagickGetImageColors method is:
4011%
4012%      size_t MagickGetImageColors(MagickWand *wand)
4013%
4014%  A description of each parameter follows:
4015%
4016%    o wand: the magick wand.
4017%
4018*/
4019WandExport size_t MagickGetImageColors(MagickWand *wand)
4020{
4021  assert(wand != (MagickWand *) NULL);
4022  assert(wand->signature == WandSignature);
4023  if (wand->debug != MagickFalse)
4024    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4025  if (wand->images == (Image *) NULL)
4026    {
4027      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4028        "ContainsNoImages","`%s'",wand->name);
4029      return(0);
4030    }
4031  return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4032}
4033
4034/*
4035%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4036%                                                                             %
4037%                                                                             %
4038%                                                                             %
4039%   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4040%                                                                             %
4041%                                                                             %
4042%                                                                             %
4043%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4044%
4045%  MagickGetImageColorspace() gets the image colorspace.
4046%
4047%  The format of the MagickGetImageColorspace method is:
4048%
4049%      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4050%
4051%  A description of each parameter follows:
4052%
4053%    o wand: the magick wand.
4054%
4055*/
4056WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4057{
4058  assert(wand != (MagickWand *) NULL);
4059  assert(wand->signature == WandSignature);
4060  if (wand->debug != MagickFalse)
4061    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4062  if (wand->images == (Image *) NULL)
4063    {
4064      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4065        "ContainsNoImages","`%s'",wand->name);
4066      return(UndefinedColorspace);
4067    }
4068  return(wand->images->colorspace);
4069}
4070
4071/*
4072%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4073%                                                                             %
4074%                                                                             %
4075%                                                                             %
4076%   M a g i c k G e t I m a g e C o m p o s e                                 %
4077%                                                                             %
4078%                                                                             %
4079%                                                                             %
4080%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4081%
4082%  MagickGetImageCompose() returns the composite operator associated with the
4083%  image.
4084%
4085%  The format of the MagickGetImageCompose method is:
4086%
4087%      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4088%
4089%  A description of each parameter follows:
4090%
4091%    o wand: the magick wand.
4092%
4093*/
4094WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4095{
4096  assert(wand != (MagickWand *) NULL);
4097  assert(wand->signature == WandSignature);
4098  if (wand->debug != MagickFalse)
4099    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4100  if (wand->images == (Image *) NULL)
4101    {
4102      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4103        "ContainsNoImages","`%s'",wand->name);
4104      return(UndefinedCompositeOp);
4105    }
4106  return(wand->images->compose);
4107}
4108
4109/*
4110%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4111%                                                                             %
4112%                                                                             %
4113%                                                                             %
4114%   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                         %
4115%                                                                             %
4116%                                                                             %
4117%                                                                             %
4118%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4119%
4120%  MagickGetImageCompression() gets the image compression.
4121%
4122%  The format of the MagickGetImageCompression method is:
4123%
4124%      CompressionType MagickGetImageCompression(MagickWand *wand)
4125%
4126%  A description of each parameter follows:
4127%
4128%    o wand: the magick wand.
4129%
4130*/
4131WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4132{
4133  assert(wand != (MagickWand *) NULL);
4134  assert(wand->signature == WandSignature);
4135  if (wand->debug != MagickFalse)
4136    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4137  if (wand->images == (Image *) NULL)
4138    {
4139      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4140        "ContainsNoImages","`%s'",wand->name);
4141      return(UndefinedCompression);
4142    }
4143  return(wand->images->compression);
4144}
4145
4146/*
4147%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4148%                                                                             %
4149%                                                                             %
4150%                                                                             %
4151%   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           %
4152%                                                                             %
4153%                                                                             %
4154%                                                                             %
4155%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4156%
4157%  MagickGetImageCompression() gets the image compression quality.
4158%
4159%  The format of the MagickGetImageCompression method is:
4160%
4161%      size_t MagickGetImageCompression(MagickWand *wand)
4162%
4163%  A description of each parameter follows:
4164%
4165%    o wand: the magick wand.
4166%
4167*/
4168WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4169{
4170  assert(wand != (MagickWand *) NULL);
4171  assert(wand->signature == WandSignature);
4172  if (wand->debug != MagickFalse)
4173    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4174  if (wand->images == (Image *) NULL)
4175    {
4176      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4177        "ContainsNoImages","`%s'",wand->name);
4178      return(0UL);
4179    }
4180  return(wand->images->quality);
4181}
4182
4183/*
4184%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4185%                                                                             %
4186%                                                                             %
4187%                                                                             %
4188%   M a g i c k G e t I m a g e D e l a y                                     %
4189%                                                                             %
4190%                                                                             %
4191%                                                                             %
4192%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4193%
4194%  MagickGetImageDelay() gets the image delay.
4195%
4196%  The format of the MagickGetImageDelay method is:
4197%
4198%      size_t MagickGetImageDelay(MagickWand *wand)
4199%
4200%  A description of each parameter follows:
4201%
4202%    o wand: the magick wand.
4203%
4204*/
4205WandExport size_t MagickGetImageDelay(MagickWand *wand)
4206{
4207  assert(wand != (MagickWand *) NULL);
4208  assert(wand->signature == WandSignature);
4209  if (wand->debug != MagickFalse)
4210    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4211  if (wand->images == (Image *) NULL)
4212    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4213  return(wand->images->delay);
4214}
4215
4216/*
4217%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4218%                                                                             %
4219%                                                                             %
4220%                                                                             %
4221%   M a g i c k G e t I m a g e D e p t h                                     %
4222%                                                                             %
4223%                                                                             %
4224%                                                                             %
4225%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4226%
4227%  MagickGetImageDepth() gets the image depth.
4228%
4229%  The format of the MagickGetImageDepth method is:
4230%
4231%      size_t MagickGetImageDepth(MagickWand *wand)
4232%
4233%  A description of each parameter follows:
4234%
4235%    o wand: the magick wand.
4236%
4237*/
4238WandExport size_t MagickGetImageDepth(MagickWand *wand)
4239{
4240  assert(wand != (MagickWand *) NULL);
4241  assert(wand->signature == WandSignature);
4242  if (wand->debug != MagickFalse)
4243    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4244  if (wand->images == (Image *) NULL)
4245    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4246  return(GetImageDepth(wand->images,wand->exception));
4247}
4248
4249/*
4250%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4251%                                                                             %
4252%                                                                             %
4253%                                                                             %
4254%   M a g i c k G e t I m a g e D i s p o s e                                 %
4255%                                                                             %
4256%                                                                             %
4257%                                                                             %
4258%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4259%
4260%  MagickGetImageDispose() gets the image disposal method.
4261%
4262%  The format of the MagickGetImageDispose method is:
4263%
4264%      DisposeType MagickGetImageDispose(MagickWand *wand)
4265%
4266%  A description of each parameter follows:
4267%
4268%    o wand: the magick wand.
4269%
4270*/
4271WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4272{
4273  assert(wand != (MagickWand *) NULL);
4274  assert(wand->signature == WandSignature);
4275  if (wand->debug != MagickFalse)
4276    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4277  if (wand->images == (Image *) NULL)
4278    {
4279      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4280        "ContainsNoImages","`%s'",wand->name);
4281      return(UndefinedDispose);
4282    }
4283  return((DisposeType) wand->images->dispose);
4284}
4285
4286/*
4287%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4288%                                                                             %
4289%                                                                             %
4290%                                                                             %
4291%   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4292%                                                                             %
4293%                                                                             %
4294%                                                                             %
4295%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4296%
4297%  MagickGetImageDistortion() compares an image to a reconstructed image and
4298%  returns the specified distortion metric.
4299%
4300%  The format of the MagickGetImageDistortion method is:
4301%
4302%      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4303%        const MagickWand *reference,const MetricType metric,
4304%        double *distortion)
4305%
4306%  A description of each parameter follows:
4307%
4308%    o wand: the magick wand.
4309%
4310%    o reference: the reference wand.
4311%
4312%    o metric: the metric.
4313%
4314%    o distortion: the computed distortion between the images.
4315%
4316*/
4317WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4318  const MagickWand *reference,const MetricType metric,double *distortion)
4319{
4320  MagickBooleanType
4321    status;
4322
4323  assert(wand != (MagickWand *) NULL);
4324  assert(wand->signature == WandSignature);
4325  if (wand->debug != MagickFalse)
4326    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4327  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4328    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4329  status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4330    &wand->images->exception);
4331  return(status);
4332}
4333
4334/*
4335%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4336%                                                                             %
4337%                                                                             %
4338%                                                                             %
4339%   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                         %
4340%                                                                             %
4341%                                                                             %
4342%                                                                             %
4343%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4344%
4345%  MagickGetImageDistortions() compares one or more pixel channels of an
4346%  image to a reconstructed image and returns the specified distortion metrics.
4347%
4348%  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4349%
4350%  The format of the MagickGetImageDistortion method is:
4351%
4352%      double *MagickGetImageDistortion(MagickWand *wand,
4353%        const MagickWand *reference,const MetricType metric)
4354%
4355%  A description of each parameter follows:
4356%
4357%    o wand: the magick wand.
4358%
4359%    o reference: the reference wand.
4360%
4361%    o metric: the metric.
4362%
4363*/
4364WandExport double *MagickGetImageDistortions(MagickWand *wand,
4365  const MagickWand *reference,const MetricType metric)
4366{
4367  double
4368    *channel_distortion;
4369
4370  assert(wand != (MagickWand *) NULL);
4371  assert(wand->signature == WandSignature);
4372  if (wand->debug != MagickFalse)
4373    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4374  assert(reference != (MagickWand *) NULL);
4375  assert(reference->signature == WandSignature);
4376  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4377    {
4378      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4379        "ContainsNoImages","`%s'",wand->name);
4380      return((double *) NULL);
4381    }
4382  channel_distortion=GetImageDistortions(wand->images,reference->images,
4383    metric,&wand->images->exception);
4384  return(channel_distortion);
4385}
4386
4387/*
4388%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4389%                                                                             %
4390%                                                                             %
4391%                                                                             %
4392%   M a g i c k G e t I m a g e F i l e n a m e                               %
4393%                                                                             %
4394%                                                                             %
4395%                                                                             %
4396%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4397%
4398%  MagickGetImageFilename() returns the filename of a particular image in a
4399%  sequence.
4400%
4401%  The format of the MagickGetImageFilename method is:
4402%
4403%      char *MagickGetImageFilename(MagickWand *wand)
4404%
4405%  A description of each parameter follows:
4406%
4407%    o wand: the magick wand.
4408%
4409*/
4410WandExport char *MagickGetImageFilename(MagickWand *wand)
4411{
4412  assert(wand != (MagickWand *) NULL);
4413  assert(wand->signature == WandSignature);
4414  if (wand->debug != MagickFalse)
4415    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4416  if (wand->images == (Image *) NULL)
4417    {
4418      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4419        "ContainsNoImages","`%s'",wand->name);
4420      return((char *) NULL);
4421    }
4422  return(AcquireString(wand->images->filename));
4423}
4424
4425/*
4426%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4427%                                                                             %
4428%                                                                             %
4429%                                                                             %
4430%   M a g i c k G e t I m a g e F o r m a t                                   %
4431%                                                                             %
4432%                                                                             %
4433%                                                                             %
4434%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4435%
4436%  MagickGetImageFormat() returns the format of a particular image in a
4437%  sequence.
4438%
4439%  The format of the MagickGetImageFormat method is:
4440%
4441%      const char *MagickGetImageFormat(MagickWand *wand)
4442%
4443%  A description of each parameter follows:
4444%
4445%    o wand: the magick wand.
4446%
4447*/
4448WandExport char *MagickGetImageFormat(MagickWand *wand)
4449{
4450  assert(wand != (MagickWand *) NULL);
4451  assert(wand->signature == WandSignature);
4452  if (wand->debug != MagickFalse)
4453    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4454  if (wand->images == (Image *) NULL)
4455    {
4456      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4457        "ContainsNoImages","`%s'",wand->name);
4458      return((char *) NULL);
4459    }
4460  return(AcquireString(wand->images->magick));
4461}
4462
4463/*
4464%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4465%                                                                             %
4466%                                                                             %
4467%                                                                             %
4468%   M a g i c k G e t I m a g e F u z z                                       %
4469%                                                                             %
4470%                                                                             %
4471%                                                                             %
4472%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4473%
4474%  MagickGetImageFuzz() gets the image fuzz.
4475%
4476%  The format of the MagickGetImageFuzz method is:
4477%
4478%      double MagickGetImageFuzz(MagickWand *wand)
4479%
4480%  A description of each parameter follows:
4481%
4482%    o wand: the magick wand.
4483%
4484*/
4485WandExport double MagickGetImageFuzz(MagickWand *wand)
4486{
4487  assert(wand != (MagickWand *) NULL);
4488  assert(wand->signature == WandSignature);
4489  if (wand->debug != MagickFalse)
4490    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4491  if (wand->images == (Image *) NULL)
4492    {
4493      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4494        "ContainsNoImages","`%s'",wand->name);
4495      return(0.0);
4496    }
4497  return(wand->images->fuzz);
4498}
4499
4500/*
4501%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4502%                                                                             %
4503%                                                                             %
4504%                                                                             %
4505%   M a g i c k G e t I m a g e G a m m a                                     %
4506%                                                                             %
4507%                                                                             %
4508%                                                                             %
4509%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4510%
4511%  MagickGetImageGamma() gets the image gamma.
4512%
4513%  The format of the MagickGetImageGamma method is:
4514%
4515%      double MagickGetImageGamma(MagickWand *wand)
4516%
4517%  A description of each parameter follows:
4518%
4519%    o wand: the magick wand.
4520%
4521*/
4522WandExport double MagickGetImageGamma(MagickWand *wand)
4523{
4524  assert(wand != (MagickWand *) NULL);
4525  assert(wand->signature == WandSignature);
4526  if (wand->debug != MagickFalse)
4527    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4528  if (wand->images == (Image *) NULL)
4529    {
4530      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4531        "ContainsNoImages","`%s'",wand->name);
4532      return(0.0);
4533    }
4534  return(wand->images->gamma);
4535}
4536
4537/*
4538%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4539%                                                                             %
4540%                                                                             %
4541%                                                                             %
4542%   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                 %
4543%                                                                             %
4544%                                                                             %
4545%                                                                             %
4546%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4547%
4548%  MagickGetImageGravity() gets the image gravity.
4549%
4550%  The format of the MagickGetImageGravity method is:
4551%
4552%      GravityType MagickGetImageGravity(MagickWand *wand)
4553%
4554%  A description of each parameter follows:
4555%
4556%    o wand: the magick wand.
4557%
4558*/
4559WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4560{
4561  assert(wand != (MagickWand *) NULL);
4562  assert(wand->signature == WandSignature);
4563  if (wand->debug != MagickFalse)
4564    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4565  if (wand->images == (Image *) NULL)
4566    {
4567      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4568        "ContainsNoImages","`%s'",wand->name);
4569      return(UndefinedGravity);
4570    }
4571  return(wand->images->gravity);
4572}
4573
4574/*
4575%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4576%                                                                             %
4577%                                                                             %
4578%                                                                             %
4579%   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                       %
4580%                                                                             %
4581%                                                                             %
4582%                                                                             %
4583%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4584%
4585%  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4586%
4587%  The format of the MagickGetImageGreenPrimary method is:
4588%
4589%      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4590%        double *y)
4591%
4592%  A description of each parameter follows:
4593%
4594%    o wand: the magick wand.
4595%
4596%    o x: the chromaticity green primary x-point.
4597%
4598%    o y: the chromaticity green primary y-point.
4599%
4600*/
4601WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4602  double *x,double *y)
4603{
4604  assert(wand != (MagickWand *) NULL);
4605  assert(wand->signature == WandSignature);
4606  if (wand->debug != MagickFalse)
4607    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4608  if (wand->images == (Image *) NULL)
4609    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4610  *x=wand->images->chromaticity.green_primary.x;
4611  *y=wand->images->chromaticity.green_primary.y;
4612  return(MagickTrue);
4613}
4614
4615/*
4616%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4617%                                                                             %
4618%                                                                             %
4619%                                                                             %
4620%   M a g i c k G e t I m a g e H e i g h t                                   %
4621%                                                                             %
4622%                                                                             %
4623%                                                                             %
4624%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4625%
4626%  MagickGetImageHeight() returns the image height.
4627%
4628%  The format of the MagickGetImageHeight method is:
4629%
4630%      size_t MagickGetImageHeight(MagickWand *wand)
4631%
4632%  A description of each parameter follows:
4633%
4634%    o wand: the magick wand.
4635%
4636*/
4637WandExport size_t MagickGetImageHeight(MagickWand *wand)
4638{
4639  assert(wand != (MagickWand *) NULL);
4640  assert(wand->signature == WandSignature);
4641  if (wand->debug != MagickFalse)
4642    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4643  if (wand->images == (Image *) NULL)
4644    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4645  return(wand->images->rows);
4646}
4647
4648/*
4649%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4650%                                                                             %
4651%                                                                             %
4652%                                                                             %
4653%   M a g i c k G e t I m a g e H i s t o g r a m                             %
4654%                                                                             %
4655%                                                                             %
4656%                                                                             %
4657%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4658%
4659%  MagickGetImageHistogram() returns the image histogram as an array of
4660%  PixelWand wands.
4661%
4662%  The format of the MagickGetImageHistogram method is:
4663%
4664%      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4665%        size_t *number_colors)
4666%
4667%  A description of each parameter follows:
4668%
4669%    o wand: the magick wand.
4670%
4671%    o number_colors: the number of unique colors in the image and the number
4672%      of pixel wands returned.
4673%
4674*/
4675WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4676  size_t *number_colors)
4677{
4678  PixelPacket
4679    *histogram;
4680
4681  PixelWand
4682    **pixel_wands;
4683
4684  register ssize_t
4685    i;
4686
4687  assert(wand != (MagickWand *) NULL);
4688  assert(wand->signature == WandSignature);
4689  if (wand->debug != MagickFalse)
4690    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4691  if (wand->images == (Image *) NULL)
4692    {
4693      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4694        "ContainsNoImages","`%s'",wand->name);
4695      return((PixelWand **) NULL);
4696    }
4697  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4698  if (histogram == (PixelPacket *) NULL)
4699    return((PixelWand **) NULL);
4700  pixel_wands=NewPixelWands(*number_colors);
4701  for (i=0; i < (ssize_t) *number_colors; i++)
4702  {
4703    PixelSetQuantumPacket(pixel_wands[i],&histogram[i]);
4704    PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4705  }
4706  histogram=(PixelPacket *) RelinquishMagickMemory(histogram);
4707  return(pixel_wands);
4708}
4709
4710/*
4711%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4712%                                                                             %
4713%                                                                             %
4714%                                                                             %
4715%   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                 %
4716%                                                                             %
4717%                                                                             %
4718%                                                                             %
4719%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4720%
4721%  MagickGetImageInterlaceScheme() gets the image interlace scheme.
4722%
4723%  The format of the MagickGetImageInterlaceScheme method is:
4724%
4725%      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4726%
4727%  A description of each parameter follows:
4728%
4729%    o wand: the magick wand.
4730%
4731*/
4732WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4733{
4734  assert(wand != (MagickWand *) NULL);
4735  assert(wand->signature == WandSignature);
4736  if (wand->debug != MagickFalse)
4737    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4738  if (wand->images == (Image *) NULL)
4739    {
4740      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4741        "ContainsNoImages","`%s'",wand->name);
4742      return(UndefinedInterlace);
4743    }
4744  return(wand->images->interlace);
4745}
4746
4747/*
4748%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4749%                                                                             %
4750%                                                                             %
4751%                                                                             %
4752%   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             %
4753%                                                                             %
4754%                                                                             %
4755%                                                                             %
4756%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4757%
4758%  MagickGetImageInterpolateMethod() returns the interpolation method for the
4759%  sepcified image.
4760%
4761%  The format of the MagickGetImageInterpolateMethod method is:
4762%
4763%      InterpolatePixelMethod MagickGetImageInterpolateMethod(MagickWand *wand)
4764%
4765%  A description of each parameter follows:
4766%
4767%    o wand: the magick wand.
4768%
4769*/
4770WandExport InterpolatePixelMethod MagickGetImageInterpolateMethod(
4771  MagickWand *wand)
4772{
4773  assert(wand != (MagickWand *) NULL);
4774  assert(wand->signature == WandSignature);
4775  if (wand->debug != MagickFalse)
4776    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4777  if (wand->images == (Image *) NULL)
4778    {
4779      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4780        "ContainsNoImages","`%s'",wand->name);
4781      return(UndefinedInterpolatePixel);
4782    }
4783  return(wand->images->interpolate);
4784}
4785
4786/*
4787%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4788%                                                                             %
4789%                                                                             %
4790%                                                                             %
4791%   M a g i c k G e t I m a g e I t e r a t i o n s                           %
4792%                                                                             %
4793%                                                                             %
4794%                                                                             %
4795%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4796%
4797%  MagickGetImageIterations() gets the image iterations.
4798%
4799%  The format of the MagickGetImageIterations method is:
4800%
4801%      size_t MagickGetImageIterations(MagickWand *wand)
4802%
4803%  A description of each parameter follows:
4804%
4805%    o wand: the magick wand.
4806%
4807*/
4808WandExport size_t MagickGetImageIterations(MagickWand *wand)
4809{
4810  assert(wand != (MagickWand *) NULL);
4811  assert(wand->signature == WandSignature);
4812  if (wand->debug != MagickFalse)
4813    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4814  if (wand->images == (Image *) NULL)
4815    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4816  return(wand->images->iterations);
4817}
4818
4819/*
4820%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4821%                                                                             %
4822%                                                                             %
4823%                                                                             %
4824%   M a g i c k G e t I m a g e L e n g t h                                   %
4825%                                                                             %
4826%                                                                             %
4827%                                                                             %
4828%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4829%
4830%  MagickGetImageLength() returns the image length in bytes.
4831%
4832%  The format of the MagickGetImageLength method is:
4833%
4834%      MagickBooleanType MagickGetImageLength(MagickWand *wand,
4835%        MagickSizeType *length)
4836%
4837%  A description of each parameter follows:
4838%
4839%    o wand: the magick wand.
4840%
4841%    o length: the image length in bytes.
4842%
4843*/
4844WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
4845  MagickSizeType *length)
4846{
4847  assert(wand != (MagickWand *) NULL);
4848  assert(wand->signature == WandSignature);
4849  if (wand->debug != MagickFalse)
4850    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4851  if (wand->images == (Image *) NULL)
4852    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4853  *length=GetBlobSize(wand->images);
4854  return(MagickTrue);
4855}
4856
4857/*
4858%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4859%                                                                             %
4860%                                                                             %
4861%                                                                             %
4862%   M a g i c k G e t I m a g e M a t t e C o l o r                           %
4863%                                                                             %
4864%                                                                             %
4865%                                                                             %
4866%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4867%
4868%  MagickGetImageMatteColor() returns the image matte color.
4869%
4870%  The format of the MagickGetImageMatteColor method is:
4871%
4872%      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
4873%        PixelWand *matte_color)
4874%
4875%  A description of each parameter follows:
4876%
4877%    o wand: the magick wand.
4878%
4879%    o matte_color: Return the matte color.
4880%
4881*/
4882WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
4883  PixelWand *matte_color)
4884{
4885  assert(wand != (MagickWand *) NULL);
4886  assert(wand->signature == WandSignature);
4887  if (wand->debug != MagickFalse)
4888    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4889  if (wand->images == (Image *) NULL)
4890    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4891  PixelSetQuantumPacket(matte_color,&wand->images->matte_color);
4892  return(MagickTrue);
4893}
4894
4895/*
4896%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4897%                                                                             %
4898%                                                                             %
4899%                                                                             %
4900%   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                         %
4901%                                                                             %
4902%                                                                             %
4903%                                                                             %
4904%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4905%
4906%  MagickGetImageOrientation() returns the image orientation.
4907%
4908%  The format of the MagickGetImageOrientation method is:
4909%
4910%      OrientationType MagickGetImageOrientation(MagickWand *wand)
4911%
4912%  A description of each parameter follows:
4913%
4914%    o wand: the magick wand.
4915%
4916*/
4917WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
4918{
4919  assert(wand != (MagickWand *) NULL);
4920  assert(wand->signature == WandSignature);
4921  if (wand->debug != MagickFalse)
4922    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4923  if (wand->images == (Image *) NULL)
4924    {
4925      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4926        "ContainsNoImages","`%s'",wand->name);
4927      return(UndefinedOrientation);
4928    }
4929  return(wand->images->orientation);
4930}
4931
4932/*
4933%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4934%                                                                             %
4935%                                                                             %
4936%                                                                             %
4937%   M a g i c k G e t I m a g e P a g e                                       %
4938%                                                                             %
4939%                                                                             %
4940%                                                                             %
4941%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4942%
4943%  MagickGetImagePage() returns the page geometry associated with the image.
4944%
4945%  The format of the MagickGetImagePage method is:
4946%
4947%      MagickBooleanType MagickGetImagePage(MagickWand *wand,
4948%        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4949%
4950%  A description of each parameter follows:
4951%
4952%    o wand: the magick wand.
4953%
4954%    o width: the page width.
4955%
4956%    o height: the page height.
4957%
4958%    o x: the page x-offset.
4959%
4960%    o y: the page y-offset.
4961%
4962*/
4963WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
4964  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4965{
4966  assert(wand != (const MagickWand *) NULL);
4967  assert(wand->signature == WandSignature);
4968  if (wand->debug != MagickFalse)
4969    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4970  if (wand->images == (Image *) NULL)
4971    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4972  *width=wand->images->page.width;
4973  *height=wand->images->page.height;
4974  *x=wand->images->page.x;
4975  *y=wand->images->page.y;
4976  return(MagickTrue);
4977}
4978
4979/*
4980%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4981%                                                                             %
4982%                                                                             %
4983%                                                                             %
4984%   M a g i c k G e t I m a g e P i x e l C o l o r                           %
4985%                                                                             %
4986%                                                                             %
4987%                                                                             %
4988%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4989%
4990%  MagickGetImagePixelColor() returns the color of the specified pixel.
4991%
4992%  The format of the MagickGetImagePixelColor method is:
4993%
4994%      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
4995%        const ssize_t x,const ssize_t y,PixelWand *color)
4996%
4997%  A description of each parameter follows:
4998%
4999%    o wand: the magick wand.
5000%
5001%    o x,y: the pixel offset into the image.
5002%
5003%    o color: Return the colormap color in this wand.
5004%
5005*/
5006WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5007  const ssize_t x,const ssize_t y,PixelWand *color)
5008{
5009  register const Quantum
5010    *p;
5011
5012  CacheView
5013    *image_view;
5014
5015  assert(wand != (MagickWand *) NULL);
5016  assert(wand->signature == WandSignature);
5017  if (wand->debug != MagickFalse)
5018    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5019  if (wand->images == (Image *) NULL)
5020    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5021  image_view=AcquireCacheView(wand->images);
5022  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5023  if (p == (const Quantum *) NULL)
5024    {
5025      image_view=DestroyCacheView(image_view);
5026      return(MagickFalse);
5027    }
5028  PixelSetQuantumPixel(wand->images,p,color);
5029  image_view=DestroyCacheView(image_view);
5030  return(MagickTrue);
5031}
5032
5033/*
5034%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5035%                                                                             %
5036%                                                                             %
5037%                                                                             %
5038%   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5039%                                                                             %
5040%                                                                             %
5041%                                                                             %
5042%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5043%
5044%  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5045%
5046%  The format of the MagickGetImageRedPrimary method is:
5047%
5048%      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5049%        double *y)
5050%
5051%  A description of each parameter follows:
5052%
5053%    o wand: the magick wand.
5054%
5055%    o x: the chromaticity red primary x-point.
5056%
5057%    o y: the chromaticity red primary y-point.
5058%
5059*/
5060WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5061  double *x,double *y)
5062{
5063  assert(wand != (MagickWand *) NULL);
5064  assert(wand->signature == WandSignature);
5065  if (wand->debug != MagickFalse)
5066    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5067  if (wand->images == (Image *) NULL)
5068    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5069  *x=wand->images->chromaticity.red_primary.x;
5070  *y=wand->images->chromaticity.red_primary.y;
5071  return(MagickTrue);
5072}
5073
5074/*
5075%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5076%                                                                             %
5077%                                                                             %
5078%                                                                             %
5079%   M a g i c k G e t I m a g e R e g i o n                                   %
5080%                                                                             %
5081%                                                                             %
5082%                                                                             %
5083%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5084%
5085%  MagickGetImageRegion() extracts a region of the image and returns it as a
5086%  a new wand.
5087%
5088%  The format of the MagickGetImageRegion method is:
5089%
5090%      MagickWand *MagickGetImageRegion(MagickWand *wand,
5091%        const size_t width,const size_t height,const ssize_t x,
5092%        const ssize_t y)
5093%
5094%  A description of each parameter follows:
5095%
5096%    o wand: the magick wand.
5097%
5098%    o width: the region width.
5099%
5100%    o height: the region height.
5101%
5102%    o x: the region x offset.
5103%
5104%    o y: the region y offset.
5105%
5106*/
5107WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5108  const size_t width,const size_t height,const ssize_t x,
5109  const ssize_t y)
5110{
5111  Image
5112    *region_image;
5113
5114  RectangleInfo
5115    region;
5116
5117  assert(wand != (MagickWand *) NULL);
5118  assert(wand->signature == WandSignature);
5119  if (wand->debug != MagickFalse)
5120    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5121  if (wand->images == (Image *) NULL)
5122    return((MagickWand *) NULL);
5123  region.width=width;
5124  region.height=height;
5125  region.x=x;
5126  region.y=y;
5127  region_image=CropImage(wand->images,&region,wand->exception);
5128  if (region_image == (Image *) NULL)
5129    return((MagickWand *) NULL);
5130  return(CloneMagickWandFromImages(wand,region_image));
5131}
5132
5133/*
5134%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5135%                                                                             %
5136%                                                                             %
5137%                                                                             %
5138%   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                 %
5139%                                                                             %
5140%                                                                             %
5141%                                                                             %
5142%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5143%
5144%  MagickGetImageRenderingIntent() gets the image rendering intent.
5145%
5146%  The format of the MagickGetImageRenderingIntent method is:
5147%
5148%      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5149%
5150%  A description of each parameter follows:
5151%
5152%    o wand: the magick wand.
5153%
5154*/
5155WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5156{
5157  assert(wand != (MagickWand *) NULL);
5158  assert(wand->signature == WandSignature);
5159  if (wand->debug != MagickFalse)
5160    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5161  if (wand->images == (Image *) NULL)
5162    {
5163      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5164        "ContainsNoImages","`%s'",wand->name);
5165      return(UndefinedIntent);
5166    }
5167  return((RenderingIntent) wand->images->rendering_intent);
5168}
5169
5170/*
5171%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5172%                                                                             %
5173%                                                                             %
5174%                                                                             %
5175%   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5176%                                                                             %
5177%                                                                             %
5178%                                                                             %
5179%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5180%
5181%  MagickGetImageResolution() gets the image X and Y resolution.
5182%
5183%  The format of the MagickGetImageResolution method is:
5184%
5185%      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5186%        double *y)
5187%
5188%  A description of each parameter follows:
5189%
5190%    o wand: the magick wand.
5191%
5192%    o x: the image x-resolution.
5193%
5194%    o y: the image y-resolution.
5195%
5196*/
5197WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5198  double *x,double *y)
5199{
5200  assert(wand != (MagickWand *) NULL);
5201  assert(wand->signature == WandSignature);
5202  if (wand->debug != MagickFalse)
5203    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5204  if (wand->images == (Image *) NULL)
5205    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5206  *x=wand->images->x_resolution;
5207  *y=wand->images->y_resolution;
5208  return(MagickTrue);
5209}
5210
5211/*
5212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5213%                                                                             %
5214%                                                                             %
5215%                                                                             %
5216%   M a g i c k G e t I m a g e S c e n e                                     %
5217%                                                                             %
5218%                                                                             %
5219%                                                                             %
5220%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5221%
5222%  MagickGetImageScene() gets the image scene.
5223%
5224%  The format of the MagickGetImageScene method is:
5225%
5226%      size_t MagickGetImageScene(MagickWand *wand)
5227%
5228%  A description of each parameter follows:
5229%
5230%    o wand: the magick wand.
5231%
5232*/
5233WandExport size_t MagickGetImageScene(MagickWand *wand)
5234{
5235  assert(wand != (MagickWand *) NULL);
5236  assert(wand->signature == WandSignature);
5237  if (wand->debug != MagickFalse)
5238    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5239  if (wand->images == (Image *) NULL)
5240    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5241  return(wand->images->scene);
5242}
5243
5244/*
5245%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5246%                                                                             %
5247%                                                                             %
5248%                                                                             %
5249%   M a g i c k G e t I m a g e S i g n a t u r e                             %
5250%                                                                             %
5251%                                                                             %
5252%                                                                             %
5253%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5254%
5255%  MagickGetImageSignature() generates an SHA-256 message digest for the image
5256%  pixel stream.
5257%
5258%  The format of the MagickGetImageSignature method is:
5259%
5260%      const char MagickGetImageSignature(MagickWand *wand)
5261%
5262%  A description of each parameter follows:
5263%
5264%    o wand: the magick wand.
5265%
5266*/
5267WandExport char *MagickGetImageSignature(MagickWand *wand)
5268{
5269  const char
5270    *value;
5271
5272  MagickBooleanType
5273    status;
5274
5275  assert(wand != (MagickWand *) NULL);
5276  assert(wand->signature == WandSignature);
5277  if (wand->debug != MagickFalse)
5278    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5279  if (wand->images == (Image *) NULL)
5280    {
5281      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5282        "ContainsNoImages","`%s'",wand->name);
5283      return((char *) NULL);
5284    }
5285  status=SignatureImage(wand->images);
5286  if (status == MagickFalse)
5287    InheritException(wand->exception,&wand->images->exception);
5288  value=GetImageProperty(wand->images,"signature");
5289  if (value != (const char *) NULL)
5290    return(AcquireString(value));
5291  InheritException(wand->exception,&wand->images->exception);
5292  return((char *) NULL);
5293}
5294
5295/*
5296%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5297%                                                                             %
5298%                                                                             %
5299%                                                                             %
5300%   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                   %
5301%                                                                             %
5302%                                                                             %
5303%                                                                             %
5304%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5305%
5306%  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5307%
5308%  The format of the MagickGetImageTicksPerSecond method is:
5309%
5310%      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5311%
5312%  A description of each parameter follows:
5313%
5314%    o wand: the magick wand.
5315%
5316*/
5317WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5318{
5319  assert(wand != (MagickWand *) NULL);
5320  assert(wand->signature == WandSignature);
5321  if (wand->debug != MagickFalse)
5322    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5323  if (wand->images == (Image *) NULL)
5324    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5325  return((size_t) wand->images->ticks_per_second);
5326}
5327
5328/*
5329%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5330%                                                                             %
5331%                                                                             %
5332%                                                                             %
5333%   M a g i c k G e t I m a g e T y p e                                       %
5334%                                                                             %
5335%                                                                             %
5336%                                                                             %
5337%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5338%
5339%  MagickGetImageType() gets the potential image type:
5340%
5341%        Bilevel        Grayscale       GrayscaleMatte
5342%        Palette        PaletteMatte    TrueColor
5343%        TrueColorMatte ColorSeparation ColorSeparationMatte
5344%
5345%  To ensure the image type matches its potential, use MagickSetImageType():
5346%
5347%    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5348%
5349%  The format of the MagickGetImageType method is:
5350%
5351%      ImageType MagickGetImageType(MagickWand *wand)
5352%
5353%  A description of each parameter follows:
5354%
5355%    o wand: the magick wand.
5356%
5357*/
5358WandExport ImageType MagickGetImageType(MagickWand *wand)
5359{
5360  assert(wand != (MagickWand *) NULL);
5361  assert(wand->signature == WandSignature);
5362  if (wand->debug != MagickFalse)
5363    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5364  if (wand->images == (Image *) NULL)
5365    {
5366      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5367        "ContainsNoImages","`%s'",wand->name);
5368      return(UndefinedType);
5369    }
5370  return(GetImageType(wand->images,wand->exception));
5371}
5372
5373/*
5374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5375%                                                                             %
5376%                                                                             %
5377%                                                                             %
5378%   M a g i c k G e t I m a g e U n i t s                                     %
5379%                                                                             %
5380%                                                                             %
5381%                                                                             %
5382%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5383%
5384%  MagickGetImageUnits() gets the image units of resolution.
5385%
5386%  The format of the MagickGetImageUnits method is:
5387%
5388%      ResolutionType MagickGetImageUnits(MagickWand *wand)
5389%
5390%  A description of each parameter follows:
5391%
5392%    o wand: the magick wand.
5393%
5394*/
5395WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5396{
5397  assert(wand != (MagickWand *) NULL);
5398  assert(wand->signature == WandSignature);
5399  if (wand->debug != MagickFalse)
5400    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5401  if (wand->images == (Image *) NULL)
5402    {
5403      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5404        "ContainsNoImages","`%s'",wand->name);
5405      return(UndefinedResolution);
5406    }
5407  return(wand->images->units);
5408}
5409
5410/*
5411%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5412%                                                                             %
5413%                                                                             %
5414%                                                                             %
5415%   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           %
5416%                                                                             %
5417%                                                                             %
5418%                                                                             %
5419%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5420%
5421%  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5422%  sepcified image.
5423%
5424%  The format of the MagickGetImageVirtualPixelMethod method is:
5425%
5426%      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5427%
5428%  A description of each parameter follows:
5429%
5430%    o wand: the magick wand.
5431%
5432*/
5433WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5434{
5435  assert(wand != (MagickWand *) NULL);
5436  assert(wand->signature == WandSignature);
5437  if (wand->debug != MagickFalse)
5438    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5439  if (wand->images == (Image *) NULL)
5440    {
5441      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5442        "ContainsNoImages","`%s'",wand->name);
5443      return(UndefinedVirtualPixelMethod);
5444    }
5445  return(GetImageVirtualPixelMethod(wand->images));
5446}
5447
5448/*
5449%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5450%                                                                             %
5451%                                                                             %
5452%                                                                             %
5453%   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5454%                                                                             %
5455%                                                                             %
5456%                                                                             %
5457%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5458%
5459%  MagickGetImageWhitePoint() returns the chromaticy white point.
5460%
5461%  The format of the MagickGetImageWhitePoint method is:
5462%
5463%      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5464%        double *y)
5465%
5466%  A description of each parameter follows:
5467%
5468%    o wand: the magick wand.
5469%
5470%    o x: the chromaticity white x-point.
5471%
5472%    o y: the chromaticity white y-point.
5473%
5474*/
5475WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5476  double *x,double *y)
5477{
5478  assert(wand != (MagickWand *) NULL);
5479  assert(wand->signature == WandSignature);
5480  if (wand->debug != MagickFalse)
5481    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5482  if (wand->images == (Image *) NULL)
5483    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5484  *x=wand->images->chromaticity.white_point.x;
5485  *y=wand->images->chromaticity.white_point.y;
5486  return(MagickTrue);
5487}
5488
5489/*
5490%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5491%                                                                             %
5492%                                                                             %
5493%                                                                             %
5494%   M a g i c k G e t I m a g e W i d t h                                     %
5495%                                                                             %
5496%                                                                             %
5497%                                                                             %
5498%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5499%
5500%  MagickGetImageWidth() returns the image width.
5501%
5502%  The format of the MagickGetImageWidth method is:
5503%
5504%      size_t MagickGetImageWidth(MagickWand *wand)
5505%
5506%  A description of each parameter follows:
5507%
5508%    o wand: the magick wand.
5509%
5510*/
5511WandExport size_t MagickGetImageWidth(MagickWand *wand)
5512{
5513  assert(wand != (MagickWand *) NULL);
5514  assert(wand->signature == WandSignature);
5515  if (wand->debug != MagickFalse)
5516    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5517  if (wand->images == (Image *) NULL)
5518    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5519  return(wand->images->columns);
5520}
5521
5522/*
5523%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5524%                                                                             %
5525%                                                                             %
5526%                                                                             %
5527%   M a g i c k G e t N u m b e r I m a g e s                                 %
5528%                                                                             %
5529%                                                                             %
5530%                                                                             %
5531%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5532%
5533%  MagickGetNumberImages() returns the number of images associated with a
5534%  magick wand.
5535%
5536%  The format of the MagickGetNumberImages method is:
5537%
5538%      size_t MagickGetNumberImages(MagickWand *wand)
5539%
5540%  A description of each parameter follows:
5541%
5542%    o wand: the magick wand.
5543%
5544*/
5545WandExport size_t MagickGetNumberImages(MagickWand *wand)
5546{
5547  assert(wand != (MagickWand *) NULL);
5548  assert(wand->signature == WandSignature);
5549  if (wand->debug != MagickFalse)
5550    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5551  return(GetImageListLength(wand->images));
5552}
5553
5554/*
5555%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5556%                                                                             %
5557%                                                                             %
5558%                                                                             %
5559%   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                 %
5560%                                                                             %
5561%                                                                             %
5562%                                                                             %
5563%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5564%
5565%  MagickGetImageTotalInkDensity() gets the image total ink density.
5566%
5567%  The format of the MagickGetImageTotalInkDensity method is:
5568%
5569%      double MagickGetImageTotalInkDensity(MagickWand *wand)
5570%
5571%  A description of each parameter follows:
5572%
5573%    o wand: the magick wand.
5574%
5575*/
5576WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5577{
5578  assert(wand != (MagickWand *) NULL);
5579  assert(wand->signature == WandSignature);
5580  if (wand->debug != MagickFalse)
5581    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5582  if (wand->images == (Image *) NULL)
5583    {
5584      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5585        "ContainsNoImages","`%s'",wand->name);
5586      return(0.0);
5587    }
5588  return(GetImageTotalInkDensity(wand->images));
5589}
5590
5591/*
5592%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5593%                                                                             %
5594%                                                                             %
5595%                                                                             %
5596%   M a g i c k H a l d C l u t I m a g e                                     %
5597%                                                                             %
5598%                                                                             %
5599%                                                                             %
5600%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5601%
5602%  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5603%  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5604%  dimensions.  Create it with the HALD coder.  You can apply any color
5605%  transformation to the Hald image and then use this method to apply the
5606%  transform to the image.
5607%
5608%  The format of the MagickHaldClutImage method is:
5609%
5610%      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5611%        const MagickWand *hald_wand)
5612%
5613%  A description of each parameter follows:
5614%
5615%    o wand: the magick wand.
5616%
5617%    o hald_image: the hald CLUT image.
5618%
5619*/
5620WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5621  const MagickWand *hald_wand)
5622{
5623  MagickBooleanType
5624    status;
5625
5626  assert(wand != (MagickWand *) NULL);
5627  assert(wand->signature == WandSignature);
5628  if (wand->debug != MagickFalse)
5629    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5630  if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5631    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5632  status=HaldClutImage(wand->images,hald_wand->images,&wand->images->exception);
5633  return(status);
5634}
5635
5636/*
5637%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5638%                                                                             %
5639%                                                                             %
5640%                                                                             %
5641%   M a g i c k H a s N e x t I m a g e                                       %
5642%                                                                             %
5643%                                                                             %
5644%                                                                             %
5645%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5646%
5647%  MagickHasNextImage() returns MagickTrue if the wand has more images when
5648%  traversing the list in the forward direction
5649%
5650%  The format of the MagickHasNextImage method is:
5651%
5652%      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5653%
5654%  A description of each parameter follows:
5655%
5656%    o wand: the magick wand.
5657%
5658*/
5659WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5660{
5661  assert(wand != (MagickWand *) NULL);
5662  assert(wand->signature == WandSignature);
5663  if (wand->debug != MagickFalse)
5664    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5665  if (wand->images == (Image *) NULL)
5666    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5667  if (GetNextImageInList(wand->images) == (Image *) NULL)
5668    return(MagickFalse);
5669  return(MagickTrue);
5670}
5671
5672/*
5673%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5674%                                                                             %
5675%                                                                             %
5676%                                                                             %
5677%   M a g i c k H a s P r e v i o u s I m a g e                               %
5678%                                                                             %
5679%                                                                             %
5680%                                                                             %
5681%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5682%
5683%  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5684%  traversing the list in the reverse direction
5685%
5686%  The format of the MagickHasPreviousImage method is:
5687%
5688%      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5689%
5690%  A description of each parameter follows:
5691%
5692%    o wand: the magick wand.
5693%
5694*/
5695WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5696{
5697  assert(wand != (MagickWand *) NULL);
5698  assert(wand->signature == WandSignature);
5699  if (wand->debug != MagickFalse)
5700    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5701  if (wand->images == (Image *) NULL)
5702    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5703  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5704    return(MagickFalse);
5705  return(MagickTrue);
5706}
5707
5708/*
5709%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5710%                                                                             %
5711%                                                                             %
5712%                                                                             %
5713%   M a g i c k I d e n t i f y I m a g e                                     %
5714%                                                                             %
5715%                                                                             %
5716%                                                                             %
5717%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5718%
5719%  MagickIdentifyImage() identifies an image by printing its attributes to the
5720%  file.  Attributes include the image width, height, size, and others.
5721%
5722%  The format of the MagickIdentifyImage method is:
5723%
5724%      const char *MagickIdentifyImage(MagickWand *wand)
5725%
5726%  A description of each parameter follows:
5727%
5728%    o wand: the magick wand.
5729%
5730*/
5731WandExport char *MagickIdentifyImage(MagickWand *wand)
5732{
5733  char
5734    *description,
5735    filename[MaxTextExtent];
5736
5737  FILE
5738    *file;
5739
5740  int
5741    unique_file;
5742
5743  assert(wand != (MagickWand *) NULL);
5744  assert(wand->signature == WandSignature);
5745  if (wand->debug != MagickFalse)
5746    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5747  if (wand->images == (Image *) NULL)
5748    {
5749      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5750        "ContainsNoImages","`%s'",wand->name);
5751      return((char *) NULL);
5752    }
5753  description=(char *) NULL;
5754  unique_file=AcquireUniqueFileResource(filename);
5755  file=(FILE *) NULL;
5756  if (unique_file != -1)
5757    file=fdopen(unique_file,"wb");
5758  if ((unique_file == -1) || (file == (FILE *) NULL))
5759    {
5760      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5761        "UnableToCreateTemporaryFile","`%s'",wand->name);
5762      return((char *) NULL);
5763    }
5764  (void) IdentifyImage(wand->images,file,MagickTrue);
5765  (void) fclose(file);
5766  description=FileToString(filename,~0,wand->exception);
5767  (void) RelinquishUniqueFileResource(filename);
5768  return(description);
5769}
5770
5771/*
5772%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5773%                                                                             %
5774%                                                                             %
5775%                                                                             %
5776%   M a g i c k I m p l o d e I m a g e                                       %
5777%                                                                             %
5778%                                                                             %
5779%                                                                             %
5780%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5781%
5782%  MagickImplodeImage() creates a new image that is a copy of an existing
5783%  one with the image pixels "implode" by the specified percentage.  It
5784%  allocates the memory necessary for the new Image structure and returns a
5785%  pointer to the new image.
5786%
5787%  The format of the MagickImplodeImage method is:
5788%
5789%      MagickBooleanType MagickImplodeImage(MagickWand *wand,
5790%        const double radius)
5791%
5792%  A description of each parameter follows:
5793%
5794%    o wand: the magick wand.
5795%
5796%    o amount: Define the extent of the implosion.
5797%
5798*/
5799WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
5800  const double amount)
5801{
5802  Image
5803    *implode_image;
5804
5805  assert(wand != (MagickWand *) NULL);
5806  assert(wand->signature == WandSignature);
5807  if (wand->debug != MagickFalse)
5808    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5809  if (wand->images == (Image *) NULL)
5810    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5811  implode_image=ImplodeImage(wand->images,amount,wand->exception);
5812  if (implode_image == (Image *) NULL)
5813    return(MagickFalse);
5814  ReplaceImageInList(&wand->images,implode_image);
5815  return(MagickTrue);
5816}
5817
5818/*
5819%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5820%                                                                             %
5821%                                                                             %
5822%                                                                             %
5823%   M a g i c k I m p o r t I m a g e P i x e l s                             %
5824%                                                                             %
5825%                                                                             %
5826%                                                                             %
5827%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5828%
5829%  MagickImportImagePixels() accepts pixel datand stores it in the image at the
5830%  location you specify.  The method returns MagickFalse on success otherwise
5831%  MagickTrue if an error is encountered.  The pixel data can be either char,
5832%  short int, int, ssize_t, float, or double in the order specified by map.
5833%
5834%  Suppose your want to upload the first scanline of a 640x480 image from
5835%  character data in red-green-blue order:
5836%
5837%      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
5838%
5839%  The format of the MagickImportImagePixels method is:
5840%
5841%      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5842%        const ssize_t x,const ssize_t y,const size_t columns,
5843%        const size_t rows,const char *map,const StorageType storage,
5844%        const void *pixels)
5845%
5846%  A description of each parameter follows:
5847%
5848%    o wand: the magick wand.
5849%
5850%    o x, y, columns, rows:  These values define the perimeter of a region
5851%      of pixels you want to define.
5852%
5853%    o map:  This string reflects the expected ordering of the pixel array.
5854%      It can be any combination or order of R = red, G = green, B = blue,
5855%      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
5856%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
5857%      P = pad.
5858%
5859%    o storage: Define the data type of the pixels.  Float and double types are
5860%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
5861%      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
5862%      or DoublePixel.
5863%
5864%    o pixels: This array of values contain the pixel components as defined by
5865%      map and type.  You must preallocate this array where the expected
5866%      length varies depending on the values of width, height, map, and type.
5867%
5868*/
5869WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5870  const ssize_t x,const ssize_t y,const size_t columns,
5871  const size_t rows,const char *map,const StorageType storage,
5872  const void *pixels)
5873{
5874  MagickBooleanType
5875    status;
5876
5877  assert(wand != (MagickWand *) NULL);
5878  assert(wand->signature == WandSignature);
5879  if (wand->debug != MagickFalse)
5880    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5881  if (wand->images == (Image *) NULL)
5882    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5883  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels);
5884  if (status == MagickFalse)
5885    InheritException(wand->exception,&wand->images->exception);
5886  return(status);
5887}
5888
5889/*
5890%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5891%                                                                             %
5892%                                                                             %
5893%                                                                             %
5894%   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       %
5895%                                                                             %
5896%                                                                             %
5897%                                                                             %
5898%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5899%
5900%  MagickInverseFourierTransformImage() implements the inverse discrete
5901%  Fourier transform (DFT) of the image either as a magnitude / phase or real /
5902%  imaginary image pair.
5903%
5904%  The format of the MagickInverseFourierTransformImage method is:
5905%
5906%      MagickBooleanType MagickInverseFourierTransformImage(
5907%        MagickWand *magnitude_wand,MagickWand *phase_wand,
5908%        const MagickBooleanType magnitude)
5909%
5910%  A description of each parameter follows:
5911%
5912%    o magnitude_wand: the magnitude or real wand.
5913%
5914%    o phase_wand: the phase or imaginary wand.
5915%
5916%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
5917%      imaginary image pair.
5918%
5919*/
5920WandExport MagickBooleanType MagickInverseFourierTransformImage(
5921  MagickWand *magnitude_wand,MagickWand *phase_wand,
5922  const MagickBooleanType magnitude)
5923{
5924  Image
5925    *inverse_image;
5926
5927  MagickWand
5928    *wand;
5929
5930  assert(magnitude_wand != (MagickWand *) NULL);
5931  assert(magnitude_wand->signature == WandSignature);
5932  if (magnitude_wand->debug != MagickFalse)
5933    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
5934      magnitude_wand->name);
5935  wand=magnitude_wand;
5936  if (magnitude_wand->images == (Image *) NULL)
5937    ThrowWandException(WandError,"ContainsNoImages",
5938      magnitude_wand->name);
5939  assert(phase_wand != (MagickWand *) NULL);
5940  assert(phase_wand->signature == WandSignature);
5941  inverse_image=InverseFourierTransformImage(magnitude_wand->images,
5942    phase_wand->images,magnitude,wand->exception);
5943  if (inverse_image == (Image *) NULL)
5944    return(MagickFalse);
5945  ReplaceImageInList(&wand->images,inverse_image);
5946  return(MagickTrue);
5947}
5948
5949/*
5950%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5951%                                                                             %
5952%                                                                             %
5953%                                                                             %
5954%   M a g i c k L a b e l I m a g e                                           %
5955%                                                                             %
5956%                                                                             %
5957%                                                                             %
5958%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5959%
5960%  MagickLabelImage() adds a label to your image.
5961%
5962%  The format of the MagickLabelImage method is:
5963%
5964%      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
5965%
5966%  A description of each parameter follows:
5967%
5968%    o wand: the magick wand.
5969%
5970%    o label: the image label.
5971%
5972*/
5973WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
5974  const char *label)
5975{
5976  MagickBooleanType
5977    status;
5978
5979  assert(wand != (MagickWand *) NULL);
5980  assert(wand->signature == WandSignature);
5981  if (wand->debug != MagickFalse)
5982    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5983  if (wand->images == (Image *) NULL)
5984    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5985  status=SetImageProperty(wand->images,"label",label);
5986  if (status == MagickFalse)
5987    InheritException(wand->exception,&wand->images->exception);
5988  return(status);
5989}
5990
5991/*
5992%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5993%                                                                             %
5994%                                                                             %
5995%                                                                             %
5996%   M a g i c k L e v e l I m a g e                                           %
5997%                                                                             %
5998%                                                                             %
5999%                                                                             %
6000%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6001%
6002%  MagickLevelImage() adjusts the levels of an image by scaling the colors
6003%  falling between specified white and black points to the full available
6004%  quantum range. The parameters provided represent the black, mid, and white
6005%  points. The black point specifies the darkest color in the image. Colors
6006%  darker than the black point are set to zero. Mid point specifies a gamma
6007%  correction to apply to the image.  White point specifies the lightest color
6008%  in the image. Colors brighter than the white point are set to the maximum
6009%  quantum value.
6010%
6011%  The format of the MagickLevelImage method is:
6012%
6013%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6014%        const double black_point,const double gamma,const double white_point)
6015%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6016%        const ChannelType channel,const double black_point,const double gamma,
6017%        const double white_point)
6018%
6019%  A description of each parameter follows:
6020%
6021%    o wand: the magick wand.
6022%
6023%    o channel: Identify which channel to level: RedChannel, GreenChannel,
6024%
6025%    o black_point: the black point.
6026%
6027%    o gamma: the gamma.
6028%
6029%    o white_point: the white point.
6030%
6031*/
6032WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6033  const double black_point,const double gamma,const double white_point)
6034{
6035  MagickBooleanType
6036    status;
6037
6038  assert(wand != (MagickWand *) NULL);
6039  assert(wand->signature == WandSignature);
6040  if (wand->debug != MagickFalse)
6041    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6042  if (wand->images == (Image *) NULL)
6043    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6044  status=LevelImage(wand->images,black_point,white_point,gamma,
6045    &wand->images->exception);
6046  return(status);
6047}
6048
6049/*
6050%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6051%                                                                             %
6052%                                                                             %
6053%                                                                             %
6054%   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6055%                                                                             %
6056%                                                                             %
6057%                                                                             %
6058%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6059%
6060%  MagickLinearStretchImage() stretches with saturation the image intensity.
6061%
6062%  You can also reduce the influence of a particular channel with a gamma
6063%  value of 0.
6064%
6065%  The format of the MagickLinearStretchImage method is:
6066%
6067%      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6068%        const double black_point,const double white_point)
6069%
6070%  A description of each parameter follows:
6071%
6072%    o wand: the magick wand.
6073%
6074%    o black_point: the black point.
6075%
6076%    o white_point: the white point.
6077%
6078*/
6079WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6080  const double black_point,const double white_point)
6081{
6082  MagickBooleanType
6083    status;
6084
6085  assert(wand != (MagickWand *) NULL);
6086  assert(wand->signature == WandSignature);
6087  if (wand->debug != MagickFalse)
6088    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6089  if (wand->images == (Image *) NULL)
6090    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6091  status=LinearStretchImage(wand->images,black_point,white_point);
6092  if (status == MagickFalse)
6093    InheritException(wand->exception,&wand->images->exception);
6094  return(status);
6095}
6096
6097/*
6098%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6099%                                                                             %
6100%                                                                             %
6101%                                                                             %
6102%   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6103%                                                                             %
6104%                                                                             %
6105%                                                                             %
6106%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6107%
6108%  MagickLiquidRescaleImage() rescales image with seam carving.
6109%
6110%      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6111%        const size_t columns,const size_t rows,
6112%        const double delta_x,const double rigidity)
6113%
6114%  A description of each parameter follows:
6115%
6116%    o wand: the magick wand.
6117%
6118%    o columns: the number of columns in the scaled image.
6119%
6120%    o rows: the number of rows in the scaled image.
6121%
6122%    o delta_x: maximum seam transversal step (0 means straight seams).
6123%
6124%    o rigidity: introduce a bias for non-straight seams (typically 0).
6125%
6126*/
6127WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6128  const size_t columns,const size_t rows,const double delta_x,
6129  const double rigidity)
6130{
6131  Image
6132    *rescale_image;
6133
6134  assert(wand != (MagickWand *) NULL);
6135  assert(wand->signature == WandSignature);
6136  if (wand->debug != MagickFalse)
6137    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6138  if (wand->images == (Image *) NULL)
6139    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6140  rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6141    rigidity,wand->exception);
6142  if (rescale_image == (Image *) NULL)
6143    return(MagickFalse);
6144  ReplaceImageInList(&wand->images,rescale_image);
6145  return(MagickTrue);
6146}
6147
6148/*
6149%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6150%                                                                             %
6151%                                                                             %
6152%                                                                             %
6153%   M a g i c k M a g n i f y I m a g e                                       %
6154%                                                                             %
6155%                                                                             %
6156%                                                                             %
6157%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6158%
6159%  MagickMagnifyImage() is a convenience method that scales an image
6160%  proportionally to twice its original size.
6161%
6162%  The format of the MagickMagnifyImage method is:
6163%
6164%      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6165%
6166%  A description of each parameter follows:
6167%
6168%    o wand: the magick wand.
6169%
6170*/
6171WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6172{
6173  Image
6174    *magnify_image;
6175
6176  assert(wand != (MagickWand *) NULL);
6177  assert(wand->signature == WandSignature);
6178  if (wand->debug != MagickFalse)
6179    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6180  if (wand->images == (Image *) NULL)
6181    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6182  magnify_image=MagnifyImage(wand->images,wand->exception);
6183  if (magnify_image == (Image *) NULL)
6184    return(MagickFalse);
6185  ReplaceImageInList(&wand->images,magnify_image);
6186  return(MagickTrue);
6187}
6188
6189/*
6190%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6191%                                                                             %
6192%                                                                             %
6193%                                                                             %
6194%   M a g i c k M e r g e I m a g e L a y e r s                               %
6195%                                                                             %
6196%                                                                             %
6197%                                                                             %
6198%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6199%
6200%  MagickMergeImageLayers() composes all the image layers from the current
6201%  given image onward to produce a single image of the merged layers.
6202%
6203%  The inital canvas's size depends on the given ImageLayerMethod, and is
6204%  initialized using the first images background color.  The images
6205%  are then compositied onto that image in sequence using the given
6206%  composition that has been assigned to each individual image.
6207%
6208%  The format of the MagickMergeImageLayers method is:
6209%
6210%      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6211%        const ImageLayerMethod method)
6212%
6213%  A description of each parameter follows:
6214%
6215%    o wand: the magick wand.
6216%
6217%    o method: the method of selecting the size of the initial canvas.
6218%
6219%        MergeLayer: Merge all layers onto a canvas just large enough
6220%           to hold all the actual images. The virtual canvas of the
6221%           first image is preserved but otherwise ignored.
6222%
6223%        FlattenLayer: Use the virtual canvas size of first image.
6224%           Images which fall outside this canvas is clipped.
6225%           This can be used to 'fill out' a given virtual canvas.
6226%
6227%        MosaicLayer: Start with the virtual canvas of the first image,
6228%           enlarging left and right edges to contain all images.
6229%           Images with negative offsets will be clipped.
6230%
6231*/
6232WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6233  const ImageLayerMethod method)
6234{
6235  Image
6236    *mosaic_image;
6237
6238  assert(wand != (MagickWand *) NULL);
6239  assert(wand->signature == WandSignature);
6240  if (wand->debug != MagickFalse)
6241    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6242  if (wand->images == (Image *) NULL)
6243    return((MagickWand *) NULL);
6244  mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6245  if (mosaic_image == (Image *) NULL)
6246    return((MagickWand *) NULL);
6247  return(CloneMagickWandFromImages(wand,mosaic_image));
6248}
6249
6250/*
6251%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6252%                                                                             %
6253%                                                                             %
6254%                                                                             %
6255%   M a g i c k M i n i f y I m a g e                                         %
6256%                                                                             %
6257%                                                                             %
6258%                                                                             %
6259%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6260%
6261%  MagickMinifyImage() is a convenience method that scales an image
6262%  proportionally to one-half its original size
6263%
6264%  The format of the MagickMinifyImage method is:
6265%
6266%      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6267%
6268%  A description of each parameter follows:
6269%
6270%    o wand: the magick wand.
6271%
6272*/
6273WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6274{
6275  Image
6276    *minify_image;
6277
6278  assert(wand != (MagickWand *) NULL);
6279  assert(wand->signature == WandSignature);
6280  if (wand->debug != MagickFalse)
6281    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6282  if (wand->images == (Image *) NULL)
6283    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6284  minify_image=MinifyImage(wand->images,wand->exception);
6285  if (minify_image == (Image *) NULL)
6286    return(MagickFalse);
6287  ReplaceImageInList(&wand->images,minify_image);
6288  return(MagickTrue);
6289}
6290
6291/*
6292%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6293%                                                                             %
6294%                                                                             %
6295%                                                                             %
6296%   M a g i c k M o d u l a t e I m a g e                                     %
6297%                                                                             %
6298%                                                                             %
6299%                                                                             %
6300%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6301%
6302%  MagickModulateImage() lets you control the brightness, saturation, and hue
6303%  of an image.  Hue is the percentage of absolute rotation from the current
6304%  position.  For example 50 results in a counter-clockwise rotation of 90
6305%  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6306%  both resulting in a rotation of 180 degrees.
6307%
6308%  To increase the color brightness by 20% and decrease the color saturation by
6309%  10% and leave the hue unchanged, use: 120,90,100.
6310%
6311%  The format of the MagickModulateImage method is:
6312%
6313%      MagickBooleanType MagickModulateImage(MagickWand *wand,
6314%        const double brightness,const double saturation,const double hue)
6315%
6316%  A description of each parameter follows:
6317%
6318%    o wand: the magick wand.
6319%
6320%    o brightness: the percent change in brighness.
6321%
6322%    o saturation: the percent change in saturation.
6323%
6324%    o hue: the percent change in hue.
6325%
6326*/
6327WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6328  const double brightness,const double saturation,const double hue)
6329{
6330  char
6331    modulate[MaxTextExtent];
6332
6333  MagickBooleanType
6334    status;
6335
6336  assert(wand != (MagickWand *) NULL);
6337  assert(wand->signature == WandSignature);
6338  if (wand->debug != MagickFalse)
6339    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6340  if (wand->images == (Image *) NULL)
6341    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6342  (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6343    brightness,saturation,hue);
6344  status=ModulateImage(wand->images,modulate);
6345  if (status == MagickFalse)
6346    InheritException(wand->exception,&wand->images->exception);
6347  return(status);
6348}
6349
6350/*
6351%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6352%                                                                             %
6353%                                                                             %
6354%                                                                             %
6355%   M a g i c k M o n t a g e I m a g e                                       %
6356%                                                                             %
6357%                                                                             %
6358%                                                                             %
6359%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6360%
6361%  MagickMontageImage() creates a composite image by combining several
6362%  separate images. The images are tiled on the composite image with the name
6363%  of the image optionally appearing just below the individual tile.
6364%
6365%  The format of the MagickMontageImage method is:
6366%
6367%      MagickWand *MagickMontageImage(MagickWand *wand,
6368%        const DrawingWand drawing_wand,const char *tile_geometry,
6369%        const char *thumbnail_geometry,const MontageMode mode,
6370%        const char *frame)
6371%
6372%  A description of each parameter follows:
6373%
6374%    o wand: the magick wand.
6375%
6376%    o drawing_wand: the drawing wand.  The font name, size, and color are
6377%      obtained from this wand.
6378%
6379%    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6380%
6381%    o thumbnail_geometry: Preferred image size and border size of each
6382%      thumbnail (e.g. 120x120+4+3>).
6383%
6384%    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6385%
6386%    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6387%      The frame color is that of the thumbnail's matte color.
6388%
6389*/
6390WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6391  const DrawingWand *drawing_wand,const char *tile_geometry,
6392  const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6393{
6394  char
6395    *font;
6396
6397  Image
6398    *montage_image;
6399
6400  MontageInfo
6401    *montage_info;
6402
6403  PixelWand
6404    *pixel_wand;
6405
6406  assert(wand != (MagickWand *) NULL);
6407  assert(wand->signature == WandSignature);
6408  if (wand->debug != MagickFalse)
6409    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6410  if (wand->images == (Image *) NULL)
6411    return((MagickWand *) NULL);
6412  montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6413  switch (mode)
6414  {
6415    case FrameMode:
6416    {
6417      (void) CloneString(&montage_info->frame,"15x15+3+3");
6418      montage_info->shadow=MagickTrue;
6419      break;
6420    }
6421    case UnframeMode:
6422    {
6423      montage_info->frame=(char *) NULL;
6424      montage_info->shadow=MagickFalse;
6425      montage_info->border_width=0;
6426      break;
6427    }
6428    case ConcatenateMode:
6429    {
6430      montage_info->frame=(char *) NULL;
6431      montage_info->shadow=MagickFalse;
6432      (void) CloneString(&montage_info->geometry,"+0+0");
6433      montage_info->border_width=0;
6434      break;
6435    }
6436    default:
6437      break;
6438  }
6439  font=DrawGetFont(drawing_wand);
6440  if (font != (char *) NULL)
6441    (void) CloneString(&montage_info->font,font);
6442  if (frame != (char *) NULL)
6443    (void) CloneString(&montage_info->frame,frame);
6444  montage_info->pointsize=DrawGetFontSize(drawing_wand);
6445  pixel_wand=NewPixelWand();
6446  DrawGetFillColor(drawing_wand,pixel_wand);
6447  PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6448  DrawGetStrokeColor(drawing_wand,pixel_wand);
6449  PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6450  pixel_wand=DestroyPixelWand(pixel_wand);
6451  if (thumbnail_geometry != (char *) NULL)
6452    (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6453  if (tile_geometry != (char *) NULL)
6454    (void) CloneString(&montage_info->tile,tile_geometry);
6455  montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6456    wand->exception);
6457  montage_info=DestroyMontageInfo(montage_info);
6458  if (montage_image == (Image *) NULL)
6459    return((MagickWand *) NULL);
6460  return(CloneMagickWandFromImages(wand,montage_image));
6461}
6462
6463/*
6464%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6465%                                                                             %
6466%                                                                             %
6467%                                                                             %
6468%   M a g i c k M o r p h I m a g e s                                         %
6469%                                                                             %
6470%                                                                             %
6471%                                                                             %
6472%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6473%
6474%  MagickMorphImages() method morphs a set of images.  Both the image pixels
6475%  and size are linearly interpolated to give the appearance of a
6476%  meta-morphosis from one image to the next.
6477%
6478%  The format of the MagickMorphImages method is:
6479%
6480%      MagickWand *MagickMorphImages(MagickWand *wand,
6481%        const size_t number_frames)
6482%
6483%  A description of each parameter follows:
6484%
6485%    o wand: the magick wand.
6486%
6487%    o number_frames: the number of in-between images to generate.
6488%
6489*/
6490WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6491  const size_t number_frames)
6492{
6493  Image
6494    *morph_image;
6495
6496  assert(wand != (MagickWand *) NULL);
6497  assert(wand->signature == WandSignature);
6498  if (wand->debug != MagickFalse)
6499    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6500  if (wand->images == (Image *) NULL)
6501    return((MagickWand *) NULL);
6502  morph_image=MorphImages(wand->images,number_frames,wand->exception);
6503  if (morph_image == (Image *) NULL)
6504    return((MagickWand *) NULL);
6505  return(CloneMagickWandFromImages(wand,morph_image));
6506}
6507
6508/*
6509%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6510%                                                                             %
6511%                                                                             %
6512%                                                                             %
6513%   M a g i c k M o r p h o l o g y I m a g e                                 %
6514%                                                                             %
6515%                                                                             %
6516%                                                                             %
6517%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6518%
6519%  MagickMorphologyImage() applies a user supplied kernel to the image
6520%  according to the given mophology method.
6521%
6522%  The format of the MagickMorphologyImage method is:
6523%
6524%      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6525%        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6526%
6527%  A description of each parameter follows:
6528%
6529%    o wand: the magick wand.
6530%
6531%    o method: the morphology method to be applied.
6532%
6533%    o iterations: apply the operation this many times (or no change).
6534%      A value of -1 means loop until no change found.  How this is applied
6535%      may depend on the morphology method.  Typically this is a value of 1.
6536%
6537%    o kernel: An array of doubles representing the morphology kernel.
6538%
6539*/
6540WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6541  MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6542{
6543  Image
6544    *morphology_image;
6545
6546  assert(wand != (MagickWand *) NULL);
6547  assert(wand->signature == WandSignature);
6548  if (wand->debug != MagickFalse)
6549    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6550  if (kernel == (const KernelInfo *) NULL)
6551    return(MagickFalse);
6552  if (wand->images == (Image *) NULL)
6553    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6554  morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6555    wand->exception);
6556  if (morphology_image == (Image *) NULL)
6557    return(MagickFalse);
6558  ReplaceImageInList(&wand->images,morphology_image);
6559  return(MagickTrue);
6560}
6561
6562/*
6563%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6564%                                                                             %
6565%                                                                             %
6566%                                                                             %
6567%   M a g i c k M o t i o n B l u r I m a g e                                 %
6568%                                                                             %
6569%                                                                             %
6570%                                                                             %
6571%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6572%
6573%  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6574%  Gaussian operator of the given radius and standard deviation (sigma).
6575%  For reasonable results, radius should be larger than sigma.  Use a
6576%  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6577%  Angle gives the angle of the blurring motion.
6578%
6579%  The format of the MagickMotionBlurImage method is:
6580%
6581%      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6582%        const double radius,const double sigma,const double angle)
6583%
6584%  A description of each parameter follows:
6585%
6586%    o wand: the magick wand.
6587%
6588%    o radius: the radius of the Gaussian, in pixels, not counting
6589%      the center pixel.
6590%
6591%    o sigma: the standard deviation of the Gaussian, in pixels.
6592%
6593%    o angle: Apply the effect along this angle.
6594%
6595*/
6596WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6597  const double radius,const double sigma,const double angle)
6598{
6599  Image
6600    *blur_image;
6601
6602  assert(wand != (MagickWand *) NULL);
6603  assert(wand->signature == WandSignature);
6604  if (wand->debug != MagickFalse)
6605    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6606  if (wand->images == (Image *) NULL)
6607    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6608  blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
6609  if (blur_image == (Image *) NULL)
6610    return(MagickFalse);
6611  ReplaceImageInList(&wand->images,blur_image);
6612  return(MagickTrue);
6613}
6614
6615/*
6616%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6617%                                                                             %
6618%                                                                             %
6619%                                                                             %
6620%   M a g i c k N e g a t e I m a g e                                         %
6621%                                                                             %
6622%                                                                             %
6623%                                                                             %
6624%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6625%
6626%  MagickNegateImage() negates the colors in the reference image.  The
6627%  Grayscale option means that only grayscale values within the image are
6628%  negated.
6629%
6630%  You can also reduce the influence of a particular channel with a gamma
6631%  value of 0.
6632%
6633%  The format of the MagickNegateImage method is:
6634%
6635%      MagickBooleanType MagickNegateImage(MagickWand *wand,
6636%        const MagickBooleanType gray)
6637%
6638%  A description of each parameter follows:
6639%
6640%    o wand: the magick wand.
6641%
6642%    o gray: If MagickTrue, only negate grayscale pixels within the image.
6643%
6644*/
6645WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6646  const MagickBooleanType gray)
6647{
6648  MagickBooleanType
6649    status;
6650
6651  assert(wand != (MagickWand *) NULL);
6652  assert(wand->signature == WandSignature);
6653  if (wand->debug != MagickFalse)
6654    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6655  if (wand->images == (Image *) NULL)
6656    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6657  status=NegateImage(wand->images,gray,wand->exception);
6658  return(status);
6659}
6660
6661/*
6662%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6663%                                                                             %
6664%                                                                             %
6665%                                                                             %
6666%   M a g i c k N e w I m a g e                                               %
6667%                                                                             %
6668%                                                                             %
6669%                                                                             %
6670%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6671%
6672%  MagickNewImage() adds a blank image canvas of the specified size and
6673%  background color to the wand.
6674%
6675%  The format of the MagickNewImage method is:
6676%
6677%      MagickBooleanType MagickNewImage(MagickWand *wand,
6678%        const size_t columns,const size_t rows,
6679%        const PixelWand *background)
6680%
6681%  A description of each parameter follows:
6682%
6683%    o wand: the magick wand.
6684%
6685%    o width: the image width.
6686%
6687%    o height: the image height.
6688%
6689%    o background: the image color.
6690%
6691*/
6692WandExport MagickBooleanType MagickNewImage(MagickWand *wand,
6693  const size_t width,const size_t height,
6694  const PixelWand *background)
6695{
6696  Image
6697    *images;
6698
6699  PixelInfo
6700    pixel;
6701
6702  assert(wand != (MagickWand *) NULL);
6703  assert(wand->signature == WandSignature);
6704  if (wand->debug != MagickFalse)
6705    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6706  PixelGetMagickColor(background,&pixel);
6707  images=NewMagickImage(wand->image_info,width,height,&pixel);
6708  if (images == (Image *) NULL)
6709    return(MagickFalse);
6710  if (images->exception.severity != UndefinedException)
6711    InheritException(wand->exception,&images->exception);
6712  return(InsertImageInWand(wand,images));
6713}
6714
6715/*
6716%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6717%                                                                             %
6718%                                                                             %
6719%                                                                             %
6720%   M a g i c k N e x t I m a g e                                             %
6721%                                                                             %
6722%                                                                             %
6723%                                                                             %
6724%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6725%
6726%  MagickNextImage() associates the next image in the image list with a magick
6727%  wand.
6728%
6729%  The format of the MagickNextImage method is:
6730%
6731%      MagickBooleanType MagickNextImage(MagickWand *wand)
6732%
6733%  A description of each parameter follows:
6734%
6735%    o wand: the magick wand.
6736%
6737*/
6738WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
6739{
6740  assert(wand != (MagickWand *) NULL);
6741  assert(wand->signature == WandSignature);
6742  if (wand->debug != MagickFalse)
6743    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6744  if (wand->images == (Image *) NULL)
6745    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6746  if (wand->pend != MagickFalse)
6747    {
6748      wand->pend=MagickFalse;
6749      return(MagickTrue);
6750    }
6751  if (GetNextImageInList(wand->images) == (Image *) NULL)
6752    {
6753      wand->pend=MagickTrue;
6754      return(MagickFalse);
6755    }
6756  wand->images=GetNextImageInList(wand->images);
6757  return(MagickTrue);
6758}
6759
6760/*
6761%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6762%                                                                             %
6763%                                                                             %
6764%                                                                             %
6765%   M a g i c k N o r m a l i z e I m a g e                                   %
6766%                                                                             %
6767%                                                                             %
6768%                                                                             %
6769%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6770%
6771%  MagickNormalizeImage() enhances the contrast of a color image by adjusting
6772%  the pixels color to span the entire range of colors available
6773%
6774%  You can also reduce the influence of a particular channel with a gamma
6775%  value of 0.
6776%
6777%  The format of the MagickNormalizeImage method is:
6778%
6779%      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6780%
6781%  A description of each parameter follows:
6782%
6783%    o wand: the magick wand.
6784%
6785*/
6786WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6787{
6788  MagickBooleanType
6789    status;
6790
6791  assert(wand != (MagickWand *) NULL);
6792  assert(wand->signature == WandSignature);
6793  if (wand->debug != MagickFalse)
6794    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6795  if (wand->images == (Image *) NULL)
6796    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6797  status=NormalizeImage(wand->images,&wand->images->exception);
6798  return(status);
6799}
6800
6801/*
6802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6803%                                                                             %
6804%                                                                             %
6805%                                                                             %
6806%   M a g i c k O i l P a i n t I m a g e                                     %
6807%                                                                             %
6808%                                                                             %
6809%                                                                             %
6810%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6811%
6812%  MagickOilPaintImage() applies a special effect filter that simulates an oil
6813%  painting.  Each pixel is replaced by the most frequent color occurring
6814%  in a circular region defined by radius.
6815%
6816%  The format of the MagickOilPaintImage method is:
6817%
6818%      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6819%        const double radius)
6820%
6821%  A description of each parameter follows:
6822%
6823%    o wand: the magick wand.
6824%
6825%    o radius: the radius of the circular neighborhood.
6826%
6827*/
6828WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6829  const double radius)
6830{
6831  Image
6832    *paint_image;
6833
6834  assert(wand != (MagickWand *) NULL);
6835  assert(wand->signature == WandSignature);
6836  if (wand->debug != MagickFalse)
6837    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6838  if (wand->images == (Image *) NULL)
6839    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6840  paint_image=OilPaintImage(wand->images,radius,wand->exception);
6841  if (paint_image == (Image *) NULL)
6842    return(MagickFalse);
6843  ReplaceImageInList(&wand->images,paint_image);
6844  return(MagickTrue);
6845}
6846
6847/*
6848%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6849%                                                                             %
6850%                                                                             %
6851%                                                                             %
6852%   M a g i c k O p a q u e P a i n t I m a g e                               %
6853%                                                                             %
6854%                                                                             %
6855%                                                                             %
6856%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6857%
6858%  MagickOpaquePaintImage() changes any pixel that matches color with the color
6859%  defined by fill.
6860%
6861%  The format of the MagickOpaquePaintImage method is:
6862%
6863%      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6864%        const PixelWand *target,const PixelWand *fill,const double fuzz,
6865%        const MagickBooleanType invert)
6866%
6867%  A description of each parameter follows:
6868%
6869%    o wand: the magick wand.
6870%
6871%    o target: Change this target color to the fill color within the image.
6872%
6873%    o fill: the fill pixel wand.
6874%
6875%    o fuzz: By default target must match a particular pixel color
6876%      exactly.  However, in many cases two colors may differ by a small amount.
6877%      The fuzz member of image defines how much tolerance is acceptable to
6878%      consider two colors as the same.  For example, set fuzz to 10 and the
6879%      color red at intensities of 100 and 102 respectively are now interpreted
6880%      as the same color for the purposes of the floodfill.
6881%
6882%    o invert: paint any pixel that does not match the target color.
6883%
6884*/
6885WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6886  const PixelWand *target,const PixelWand *fill,const double fuzz,
6887  const MagickBooleanType invert)
6888{
6889  MagickBooleanType
6890    status;
6891
6892  PixelInfo
6893    fill_pixel,
6894    target_pixel;
6895
6896  assert(wand != (MagickWand *) NULL);
6897  assert(wand->signature == WandSignature);
6898  if (wand->debug != MagickFalse)
6899    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6900  if (wand->images == (Image *) NULL)
6901    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6902  PixelGetMagickColor(target,&target_pixel);
6903  PixelGetMagickColor(fill,&fill_pixel);
6904  wand->images->fuzz=fuzz;
6905  status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert);
6906  if (status == MagickFalse)
6907    InheritException(wand->exception,&wand->images->exception);
6908  return(status);
6909}
6910
6911/*
6912%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6913%                                                                             %
6914%                                                                             %
6915%                                                                             %
6916%   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                         %
6917%                                                                             %
6918%                                                                             %
6919%                                                                             %
6920%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6921%
6922%  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
6923%  previous image in the sequence.  From this it attempts to select the
6924%  smallest cropped image to replace each frame, while preserving the results
6925%  of the animation.
6926%
6927%  The format of the MagickOptimizeImageLayers method is:
6928%
6929%      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6930%
6931%  A description of each parameter follows:
6932%
6933%    o wand: the magick wand.
6934%
6935*/
6936WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6937{
6938  Image
6939    *optimize_image;
6940
6941  assert(wand != (MagickWand *) NULL);
6942  assert(wand->signature == WandSignature);
6943  if (wand->debug != MagickFalse)
6944    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6945  if (wand->images == (Image *) NULL)
6946    return((MagickWand *) NULL);
6947  optimize_image=OptimizeImageLayers(wand->images,wand->exception);
6948  if (optimize_image == (Image *) NULL)
6949    return((MagickWand *) NULL);
6950  return(CloneMagickWandFromImages(wand,optimize_image));
6951}
6952
6953/*
6954%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6955%                                                                             %
6956%                                                                             %
6957%                                                                             %
6958%     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                   %
6959%                                                                             %
6960%                                                                             %
6961%                                                                             %
6962%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6963%
6964%  MagickOrderedPosterizeImage() performs an ordered dither based on a number
6965%  of pre-defined dithering threshold maps, but over multiple intensity levels,
6966%  which can be different for different channels, according to the input
6967%  arguments.
6968%
6969%  The format of the MagickOrderedPosterizeImage method is:
6970%
6971%      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
6972%        const char *threshold_map)
6973%
6974%  A description of each parameter follows:
6975%
6976%    o image: the image.
6977%
6978%    o threshold_map: A string containing the name of the threshold dither
6979%      map to use, followed by zero or more numbers representing the number of
6980%      color levels tho dither between.
6981%
6982%      Any level number less than 2 is equivalent to 2, and means only binary
6983%      dithering will be applied to each color channel.
6984%
6985%      No numbers also means a 2 level (bitmap) dither will be applied to all
6986%      channels, while a single number is the number of levels applied to each
6987%      channel in sequence.  More numbers will be applied in turn to each of
6988%      the color channels.
6989%
6990%      For example: "o3x3,6" generates a 6 level posterization of the image
6991%      with a ordered 3x3 diffused pixel dither being applied between each
6992%      level. While checker,8,8,4 will produce a 332 colormaped image with
6993%      only a single checkerboard hash pattern (50% grey) between each color
6994%      level, to basically double the number of color levels with a bare
6995%      minimim of dithering.
6996%
6997*/
6998WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
6999  const char *threshold_map)
7000{
7001  MagickBooleanType
7002    status;
7003
7004  assert(wand != (MagickWand *) NULL);
7005  assert(wand->signature == WandSignature);
7006  if (wand->debug != MagickFalse)
7007    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7008  if (wand->images == (Image *) NULL)
7009    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7010  status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7011  return(status);
7012}
7013
7014/*
7015%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7016%                                                                             %
7017%                                                                             %
7018%                                                                             %
7019%   M a g i c k P i n g I m a g e                                             %
7020%                                                                             %
7021%                                                                             %
7022%                                                                             %
7023%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7024%
7025%  MagickPingImage() is like MagickReadImage() except the only valid
7026%  information returned is the image width, height, size, and format.  It
7027%  is designed to efficiently obtain this information from a file without
7028%  reading the entire image sequence into memory.
7029%
7030%  The format of the MagickPingImage method is:
7031%
7032%      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7033%
7034%  A description of each parameter follows:
7035%
7036%    o wand: the magick wand.
7037%
7038%    o filename: the image filename.
7039%
7040*/
7041WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7042  const char *filename)
7043{
7044  Image
7045    *images;
7046
7047  ImageInfo
7048    *ping_info;
7049
7050  assert(wand != (MagickWand *) NULL);
7051  assert(wand->signature == WandSignature);
7052  if (wand->debug != MagickFalse)
7053    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7054  ping_info=CloneImageInfo(wand->image_info);
7055  if (filename != (const char *) NULL)
7056    (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7057  images=PingImage(ping_info,wand->exception);
7058  ping_info=DestroyImageInfo(ping_info);
7059  if (images == (Image *) NULL)
7060    return(MagickFalse);
7061  return(InsertImageInWand(wand,images));
7062}
7063
7064/*
7065%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7066%                                                                             %
7067%                                                                             %
7068%                                                                             %
7069%   M a g i c k P i n g I m a g e B l o b                                     %
7070%                                                                             %
7071%                                                                             %
7072%                                                                             %
7073%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7074%
7075%  MagickPingImageBlob() pings an image or image sequence from a blob.
7076%
7077%  The format of the MagickPingImageBlob method is:
7078%
7079%      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7080%        const void *blob,const size_t length)
7081%
7082%  A description of each parameter follows:
7083%
7084%    o wand: the magick wand.
7085%
7086%    o blob: the blob.
7087%
7088%    o length: the blob length.
7089%
7090*/
7091WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7092  const void *blob,const size_t length)
7093{
7094  Image
7095    *images;
7096
7097  ImageInfo
7098    *read_info;
7099
7100  assert(wand != (MagickWand *) NULL);
7101  assert(wand->signature == WandSignature);
7102  if (wand->debug != MagickFalse)
7103    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7104  read_info=CloneImageInfo(wand->image_info);
7105  SetImageInfoBlob(read_info,blob,length);
7106  images=PingImage(read_info,wand->exception);
7107  read_info=DestroyImageInfo(read_info);
7108  if (images == (Image *) NULL)
7109    return(MagickFalse);
7110  return(InsertImageInWand(wand,images));
7111}
7112
7113/*
7114%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7115%                                                                             %
7116%                                                                             %
7117%                                                                             %
7118%   M a g i c k P i n g I m a g e F i l e                                     %
7119%                                                                             %
7120%                                                                             %
7121%                                                                             %
7122%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7123%
7124%  MagickPingImageFile() pings an image or image sequence from an open file
7125%  descriptor.
7126%
7127%  The format of the MagickPingImageFile method is:
7128%
7129%      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7130%
7131%  A description of each parameter follows:
7132%
7133%    o wand: the magick wand.
7134%
7135%    o file: the file descriptor.
7136%
7137*/
7138WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7139{
7140  Image
7141    *images;
7142
7143  ImageInfo
7144    *read_info;
7145
7146  assert(wand != (MagickWand *) NULL);
7147  assert(wand->signature == WandSignature);
7148  assert(file != (FILE *) NULL);
7149  if (wand->debug != MagickFalse)
7150    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7151  read_info=CloneImageInfo(wand->image_info);
7152  SetImageInfoFile(read_info,file);
7153  images=PingImage(read_info,wand->exception);
7154  read_info=DestroyImageInfo(read_info);
7155  if (images == (Image *) NULL)
7156    return(MagickFalse);
7157  return(InsertImageInWand(wand,images));
7158}
7159
7160/*
7161%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7162%                                                                             %
7163%                                                                             %
7164%                                                                             %
7165%   M a g i c k P o l a r o i d I m a g e                                     %
7166%                                                                             %
7167%                                                                             %
7168%                                                                             %
7169%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7170%
7171%  MagickPolaroidImage() simulates a Polaroid picture.
7172%
7173%  The format of the MagickPolaroidImage method is:
7174%
7175%      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7176%        const DrawingWand *drawing_wand,const double angle)
7177%
7178%  A description of each parameter follows:
7179%
7180%    o wand: the magick wand.
7181%
7182%    o drawing_wand: the draw wand.
7183%
7184%    o angle: Apply the effect along this angle.
7185%
7186*/
7187WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7188  const DrawingWand *drawing_wand,const double angle)
7189{
7190  DrawInfo
7191    *draw_info;
7192
7193  Image
7194    *polaroid_image;
7195
7196  assert(wand != (MagickWand *) NULL);
7197  assert(wand->signature == WandSignature);
7198  if (wand->debug != MagickFalse)
7199    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7200  if (wand->images == (Image *) NULL)
7201    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7202  draw_info=PeekDrawingWand(drawing_wand);
7203  if (draw_info == (DrawInfo *) NULL)
7204    return(MagickFalse);
7205  polaroid_image=PolaroidImage(wand->images,draw_info,angle,wand->exception);
7206  if (polaroid_image == (Image *) NULL)
7207    return(MagickFalse);
7208  ReplaceImageInList(&wand->images,polaroid_image);
7209  return(MagickTrue);
7210}
7211
7212/*
7213%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7214%                                                                             %
7215%                                                                             %
7216%                                                                             %
7217%   M a g i c k P o s t e r i z e I m a g e                                   %
7218%                                                                             %
7219%                                                                             %
7220%                                                                             %
7221%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7222%
7223%  MagickPosterizeImage() reduces the image to a limited number of color level.
7224%
7225%  The format of the MagickPosterizeImage method is:
7226%
7227%      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7228%        const unsigned levels,const MagickBooleanType dither)
7229%
7230%  A description of each parameter follows:
7231%
7232%    o wand: the magick wand.
7233%
7234%    o levels: Number of color levels allowed in each channel.  Very low values
7235%      (2, 3, or 4) have the most visible effect.
7236%
7237%    o dither: Set this integer value to something other than zero to dither
7238%      the mapped image.
7239%
7240*/
7241WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7242  const size_t levels,const MagickBooleanType dither)
7243{
7244  MagickBooleanType
7245    status;
7246
7247  assert(wand != (MagickWand *) NULL);
7248  assert(wand->signature == WandSignature);
7249  if (wand->debug != MagickFalse)
7250    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7251  if (wand->images == (Image *) NULL)
7252    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7253  status=PosterizeImage(wand->images,levels,dither);
7254  if (status == MagickFalse)
7255    InheritException(wand->exception,&wand->images->exception);
7256  return(status);
7257}
7258
7259/*
7260%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7261%                                                                             %
7262%                                                                             %
7263%                                                                             %
7264%   M a g i c k P r e v i e w I m a g e s                                     %
7265%                                                                             %
7266%                                                                             %
7267%                                                                             %
7268%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7269%
7270%  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7271%  image processing operation applied at varying strengths.  This helpful
7272%  to quickly pin-point an appropriate parameter for an image processing
7273%  operation.
7274%
7275%  The format of the MagickPreviewImages method is:
7276%
7277%      MagickWand *MagickPreviewImages(MagickWand *wand,
7278%        const PreviewType preview)
7279%
7280%  A description of each parameter follows:
7281%
7282%    o wand: the magick wand.
7283%
7284%    o preview: the preview type.
7285%
7286*/
7287WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7288  const PreviewType preview)
7289{
7290  Image
7291    *preview_image;
7292
7293  assert(wand != (MagickWand *) NULL);
7294  assert(wand->signature == WandSignature);
7295  if (wand->debug != MagickFalse)
7296    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7297  if (wand->images == (Image *) NULL)
7298    return((MagickWand *) NULL);
7299  preview_image=PreviewImage(wand->images,preview,wand->exception);
7300  if (preview_image == (Image *) NULL)
7301    return((MagickWand *) NULL);
7302  return(CloneMagickWandFromImages(wand,preview_image));
7303}
7304
7305/*
7306%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7307%                                                                             %
7308%                                                                             %
7309%                                                                             %
7310%   M a g i c k P r e v i o u s I m a g e                                     %
7311%                                                                             %
7312%                                                                             %
7313%                                                                             %
7314%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7315%
7316%  MagickPreviousImage() assocates the previous image in an image list with
7317%  the magick wand.
7318%
7319%  The format of the MagickPreviousImage method is:
7320%
7321%      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7322%
7323%  A description of each parameter follows:
7324%
7325%    o wand: the magick wand.
7326%
7327*/
7328WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7329{
7330  assert(wand != (MagickWand *) NULL);
7331  assert(wand->signature == WandSignature);
7332  if (wand->debug != MagickFalse)
7333    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7334  if (wand->images == (Image *) NULL)
7335    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7336  if (wand->pend != MagickFalse)
7337    {
7338      wand->pend=MagickFalse;
7339      return(MagickTrue);
7340    }
7341  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7342    {
7343      wand->pend=MagickTrue;
7344      return(MagickFalse);
7345    }
7346  wand->images=GetPreviousImageInList(wand->images);
7347  return(MagickTrue);
7348}
7349
7350/*
7351%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7352%                                                                             %
7353%                                                                             %
7354%                                                                             %
7355%   M a g i c k Q u a n t i z e I m a g e                                     %
7356%                                                                             %
7357%                                                                             %
7358%                                                                             %
7359%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7360%
7361%  MagickQuantizeImage() analyzes the colors within a reference image and
7362%  chooses a fixed number of colors to represent the image.  The goal of the
7363%  algorithm is to minimize the color difference between the input and output
7364%  image while minimizing the processing time.
7365%
7366%  The format of the MagickQuantizeImage method is:
7367%
7368%      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7369%        const size_t number_colors,const ColorspaceType colorspace,
7370%        const size_t treedepth,const MagickBooleanType dither,
7371%        const MagickBooleanType measure_error)
7372%
7373%  A description of each parameter follows:
7374%
7375%    o wand: the magick wand.
7376%
7377%    o number_colors: the number of colors.
7378%
7379%    o colorspace: Perform color reduction in this colorspace, typically
7380%      RGBColorspace.
7381%
7382%    o treedepth: Normally, this integer value is zero or one.  A zero or
7383%      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
7384%      reference image with the least amount of memory and the fastest
7385%      computational speed.  In some cases, such as an image with low color
7386%      dispersion (a few number of colors), a value other than
7387%      Log4(number_colors) is required.  To expand the color tree completely,
7388%      use a value of 8.
7389%
7390%    o dither: A value other than zero distributes the difference between an
7391%      original image and the corresponding color reduced image to
7392%      neighboring pixels along a Hilbert curve.
7393%
7394%    o measure_error: A value other than zero measures the difference between
7395%      the original and quantized images.  This difference is the total
7396%      quantization error.  The error is computed by summing over all pixels
7397%      in an image the distance squared in RGB space between each reference
7398%      pixel value and its quantized value.
7399%
7400*/
7401WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7402  const size_t number_colors,const ColorspaceType colorspace,
7403  const size_t treedepth,const MagickBooleanType dither,
7404  const MagickBooleanType measure_error)
7405{
7406  MagickBooleanType
7407    status;
7408
7409  QuantizeInfo
7410    *quantize_info;
7411
7412  assert(wand != (MagickWand *) NULL);
7413  assert(wand->signature == WandSignature);
7414  if (wand->debug != MagickFalse)
7415    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7416  if (wand->images == (Image *) NULL)
7417    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7418  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7419  quantize_info->number_colors=number_colors;
7420  quantize_info->dither=dither;
7421  quantize_info->tree_depth=treedepth;
7422  quantize_info->colorspace=colorspace;
7423  quantize_info->measure_error=measure_error;
7424  status=QuantizeImage(quantize_info,wand->images);
7425  if (status == MagickFalse)
7426    InheritException(wand->exception,&wand->images->exception);
7427  quantize_info=DestroyQuantizeInfo(quantize_info);
7428  return(status);
7429}
7430
7431/*
7432%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7433%                                                                             %
7434%                                                                             %
7435%                                                                             %
7436%   M a g i c k Q u a n t i z e I m a g e s                                   %
7437%                                                                             %
7438%                                                                             %
7439%                                                                             %
7440%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7441%
7442%  MagickQuantizeImages() analyzes the colors within a sequence of images and
7443%  chooses a fixed number of colors to represent the image.  The goal of the
7444%  algorithm is to minimize the color difference between the input and output
7445%  image while minimizing the processing time.
7446%
7447%  The format of the MagickQuantizeImages method is:
7448%
7449%      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7450%        const size_t number_colors,const ColorspaceType colorspace,
7451%        const size_t treedepth,const MagickBooleanType dither,
7452%        const MagickBooleanType measure_error)
7453%
7454%  A description of each parameter follows:
7455%
7456%    o wand: the magick wand.
7457%
7458%    o number_colors: the number of colors.
7459%
7460%    o colorspace: Perform color reduction in this colorspace, typically
7461%      RGBColorspace.
7462%
7463%    o treedepth: Normally, this integer value is zero or one.  A zero or
7464%      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
7465%      reference image with the least amount of memory and the fastest
7466%      computational speed.  In some cases, such as an image with low color
7467%      dispersion (a few number of colors), a value other than
7468%      Log4(number_colors) is required.  To expand the color tree completely,
7469%      use a value of 8.
7470%
7471%    o dither: A value other than zero distributes the difference between an
7472%      original image and the corresponding color reduced algorithm to
7473%      neighboring pixels along a Hilbert curve.
7474%
7475%    o measure_error: A value other than zero measures the difference between
7476%      the original and quantized images.  This difference is the total
7477%      quantization error.  The error is computed by summing over all pixels
7478%      in an image the distance squared in RGB space between each reference
7479%      pixel value and its quantized value.
7480%
7481*/
7482WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7483  const size_t number_colors,const ColorspaceType colorspace,
7484  const size_t treedepth,const MagickBooleanType dither,
7485  const MagickBooleanType measure_error)
7486{
7487  MagickBooleanType
7488    status;
7489
7490  QuantizeInfo
7491    *quantize_info;
7492
7493  assert(wand != (MagickWand *) NULL);
7494  assert(wand->signature == WandSignature);
7495  if (wand->debug != MagickFalse)
7496    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7497  if (wand->images == (Image *) NULL)
7498    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7499  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7500  quantize_info->number_colors=number_colors;
7501  quantize_info->dither=dither;
7502  quantize_info->tree_depth=treedepth;
7503  quantize_info->colorspace=colorspace;
7504  quantize_info->measure_error=measure_error;
7505  status=QuantizeImages(quantize_info,wand->images);
7506  if (status == MagickFalse)
7507    InheritException(wand->exception,&wand->images->exception);
7508  quantize_info=DestroyQuantizeInfo(quantize_info);
7509  return(status);
7510}
7511
7512/*
7513%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7514%                                                                             %
7515%                                                                             %
7516%                                                                             %
7517%   M a g i c k R a d i a l B l u r I m a g e                                 %
7518%                                                                             %
7519%                                                                             %
7520%                                                                             %
7521%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7522%
7523%  MagickRadialBlurImage() radial blurs an image.
7524%
7525%  The format of the MagickRadialBlurImage method is:
7526%
7527%      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7528%        const double angle)
7529%
7530%  A description of each parameter follows:
7531%
7532%    o wand: the magick wand.
7533%
7534%    o angle: the angle of the blur in degrees.
7535%
7536*/
7537WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7538  const double angle)
7539{
7540  Image
7541    *blur_image;
7542
7543  assert(wand != (MagickWand *) NULL);
7544  assert(wand->signature == WandSignature);
7545  if (wand->debug != MagickFalse)
7546    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7547  if (wand->images == (Image *) NULL)
7548    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7549  blur_image=RadialBlurImage(wand->images,angle,wand->exception);
7550  if (blur_image == (Image *) NULL)
7551    return(MagickFalse);
7552  ReplaceImageInList(&wand->images,blur_image);
7553  return(MagickTrue);
7554}
7555
7556/*
7557%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7558%                                                                             %
7559%                                                                             %
7560%                                                                             %
7561%   M a g i c k R a i s e I m a g e                                           %
7562%                                                                             %
7563%                                                                             %
7564%                                                                             %
7565%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7566%
7567%  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7568%  by lightening and darkening the edges of the image.  Members width and
7569%  height of raise_info define the width of the vertical and horizontal
7570%  edge of the effect.
7571%
7572%  The format of the MagickRaiseImage method is:
7573%
7574%      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7575%        const size_t width,const size_t height,const ssize_t x,
7576%        const ssize_t y,const MagickBooleanType raise)
7577%
7578%  A description of each parameter follows:
7579%
7580%    o wand: the magick wand.
7581%
7582%    o width,height,x,y:  Define the dimensions of the area to raise.
7583%
7584%    o raise: A value other than zero creates a 3-D raise effect,
7585%      otherwise it has a lowered effect.
7586%
7587*/
7588WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7589  const size_t width,const size_t height,const ssize_t x,
7590  const ssize_t y,const MagickBooleanType raise)
7591{
7592  MagickBooleanType
7593    status;
7594
7595  RectangleInfo
7596    raise_info;
7597
7598  assert(wand != (MagickWand *) NULL);
7599  assert(wand->signature == WandSignature);
7600  if (wand->debug != MagickFalse)
7601    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7602  if (wand->images == (Image *) NULL)
7603    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7604  raise_info.width=width;
7605  raise_info.height=height;
7606  raise_info.x=x;
7607  raise_info.y=y;
7608  status=RaiseImage(wand->images,&raise_info,raise);
7609  if (status == MagickFalse)
7610    InheritException(wand->exception,&wand->images->exception);
7611  return(status);
7612}
7613
7614/*
7615%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7616%                                                                             %
7617%                                                                             %
7618%                                                                             %
7619%   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                       %
7620%                                                                             %
7621%                                                                             %
7622%                                                                             %
7623%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7624%
7625%  MagickRandomThresholdImage() changes the value of individual pixels based on
7626%  the intensity of each pixel compared to threshold.  The result is a
7627%  high-contrast, two color image.
7628%
7629%  The format of the MagickRandomThresholdImage method is:
7630%
7631%      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7632%        const double low,const double high)
7633%
7634%  A description of each parameter follows:
7635%
7636%    o wand: the magick wand.
7637%
7638%    o low,high: Specify the high and low thresholds.  These values range from
7639%      0 to QuantumRange.
7640%
7641*/
7642WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7643  const double low,const double high)
7644{
7645  char
7646    threshold[MaxTextExtent];
7647
7648  MagickBooleanType
7649    status;
7650
7651  assert(wand != (MagickWand *) NULL);
7652  assert(wand->signature == WandSignature);
7653  if (wand->debug != MagickFalse)
7654    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7655  if (wand->images == (Image *) NULL)
7656    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7657  (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
7658  status=RandomThresholdImage(wand->images,threshold,wand->exception);
7659  if (status == MagickFalse)
7660    InheritException(wand->exception,&wand->images->exception);
7661  return(status);
7662}
7663
7664/*
7665%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7666%                                                                             %
7667%                                                                             %
7668%                                                                             %
7669%   M a g i c k R e a d I m a g e                                             %
7670%                                                                             %
7671%                                                                             %
7672%                                                                             %
7673%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7674%
7675%  MagickReadImage() reads an image or image sequence.  The images are inserted
7676%  at the current image pointer position.   Use MagickSetFirstIterator(),
7677%  MagickSetLastIterator, or MagickSetImageIndex() to specify the current
7678%  image pointer position at the beginning of the image list, the end, or
7679%  anywhere in-between respectively.
7680%
7681%  The format of the MagickReadImage method is:
7682%
7683%      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
7684%
7685%  A description of each parameter follows:
7686%
7687%    o wand: the magick wand.
7688%
7689%    o filename: the image filename.
7690%
7691*/
7692WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
7693  const char *filename)
7694{
7695  Image
7696    *images;
7697
7698  ImageInfo
7699    *read_info;
7700
7701  assert(wand != (MagickWand *) NULL);
7702  assert(wand->signature == WandSignature);
7703  if (wand->debug != MagickFalse)
7704    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7705  read_info=CloneImageInfo(wand->image_info);
7706  if (filename != (const char *) NULL)
7707    (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
7708  images=ReadImage(read_info,wand->exception);
7709  read_info=DestroyImageInfo(read_info);
7710  if (images == (Image *) NULL)
7711    return(MagickFalse);
7712  return(InsertImageInWand(wand,images));
7713}
7714
7715/*
7716%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7717%                                                                             %
7718%                                                                             %
7719%                                                                             %
7720%   M a g i c k R e a d I m a g e B l o b                                     %
7721%                                                                             %
7722%                                                                             %
7723%                                                                             %
7724%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7725%
7726%  MagickReadImageBlob() reads an image or image sequence from a blob.
7727%
7728%  The format of the MagickReadImageBlob method is:
7729%
7730%      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7731%        const void *blob,const size_t length)
7732%
7733%  A description of each parameter follows:
7734%
7735%    o wand: the magick wand.
7736%
7737%    o blob: the blob.
7738%
7739%    o length: the blob length.
7740%
7741*/
7742WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7743  const void *blob,const size_t length)
7744{
7745  Image
7746    *images;
7747
7748  assert(wand != (MagickWand *) NULL);
7749  assert(wand->signature == WandSignature);
7750  if (wand->debug != MagickFalse)
7751    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7752  images=BlobToImage(wand->image_info,blob,length,wand->exception);
7753  if (images == (Image *) NULL)
7754    return(MagickFalse);
7755  return(InsertImageInWand(wand,images));
7756}
7757
7758/*
7759%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7760%                                                                             %
7761%                                                                             %
7762%                                                                             %
7763%   M a g i c k R e a d I m a g e F i l e                                     %
7764%                                                                             %
7765%                                                                             %
7766%                                                                             %
7767%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7768%
7769%  MagickReadImageFile() reads an image or image sequence from an open file
7770%  descriptor.
7771%
7772%  The format of the MagickReadImageFile method is:
7773%
7774%      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7775%
7776%  A description of each parameter follows:
7777%
7778%    o wand: the magick wand.
7779%
7780%    o file: the file descriptor.
7781%
7782*/
7783WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7784{
7785  Image
7786    *images;
7787
7788  ImageInfo
7789    *read_info;
7790
7791  assert(wand != (MagickWand *) NULL);
7792  assert(wand->signature == WandSignature);
7793  assert(file != (FILE *) NULL);
7794  if (wand->debug != MagickFalse)
7795    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7796  read_info=CloneImageInfo(wand->image_info);
7797  SetImageInfoFile(read_info,file);
7798  images=ReadImage(read_info,wand->exception);
7799  read_info=DestroyImageInfo(read_info);
7800  if (images == (Image *) NULL)
7801    return(MagickFalse);
7802  return(InsertImageInWand(wand,images));
7803}
7804
7805/*
7806%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7807%                                                                             %
7808%                                                                             %
7809%                                                                             %
7810%   M a g i c k R e m a p I m a g e                                           %
7811%                                                                             %
7812%                                                                             %
7813%                                                                             %
7814%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7815%
7816%  MagickRemapImage() replaces the colors of an image with the closest color
7817%  from a reference image.
7818%
7819%  The format of the MagickRemapImage method is:
7820%
7821%      MagickBooleanType MagickRemapImage(MagickWand *wand,
7822%        const MagickWand *remap_wand,const DitherMethod method)
7823%
7824%  A description of each parameter follows:
7825%
7826%    o wand: the magick wand.
7827%
7828%    o affinity: the affinity wand.
7829%
7830%    o method: choose from these dither methods: NoDitherMethod,
7831%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7832%
7833*/
7834WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
7835  const MagickWand *remap_wand,const DitherMethod method)
7836{
7837  MagickBooleanType
7838    status;
7839
7840  QuantizeInfo
7841    *quantize_info;
7842
7843  assert(wand != (MagickWand *) NULL);
7844  assert(wand->signature == WandSignature);
7845  if (wand->debug != MagickFalse)
7846    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7847  if ((wand->images == (Image *) NULL) ||
7848      (remap_wand->images == (Image *) NULL))
7849    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7850  quantize_info=AcquireQuantizeInfo(wand->image_info);
7851  quantize_info->dither_method=method;
7852  if (method == NoDitherMethod)
7853    quantize_info->dither=MagickFalse;
7854  status=RemapImage(quantize_info,wand->images,remap_wand->images);
7855  quantize_info=DestroyQuantizeInfo(quantize_info);
7856  if (status == MagickFalse)
7857    InheritException(wand->exception,&wand->images->exception);
7858  return(status);
7859}
7860
7861/*
7862%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7863%                                                                             %
7864%                                                                             %
7865%                                                                             %
7866%   M a g i c k R e m o v e I m a g e                                         %
7867%                                                                             %
7868%                                                                             %
7869%                                                                             %
7870%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7871%
7872%  MagickRemoveImage() removes an image from the image list.
7873%
7874%  The format of the MagickRemoveImage method is:
7875%
7876%      MagickBooleanType MagickRemoveImage(MagickWand *wand)
7877%
7878%  A description of each parameter follows:
7879%
7880%    o wand: the magick wand.
7881%
7882%    o insert: the splice wand.
7883%
7884*/
7885WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
7886{
7887  assert(wand != (MagickWand *) NULL);
7888  assert(wand->signature == WandSignature);
7889  if (wand->debug != MagickFalse)
7890    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7891  if (wand->images == (Image *) NULL)
7892    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7893  DeleteImageFromList(&wand->images);
7894  return(MagickTrue);
7895}
7896
7897/*
7898%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7899%                                                                             %
7900%                                                                             %
7901%                                                                             %
7902%   M a g i c k R e s a m p l e I m a g e                                     %
7903%                                                                             %
7904%                                                                             %
7905%                                                                             %
7906%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7907%
7908%  MagickResampleImage() resample image to desired resolution.
7909%
7910%    Bessel   Blackman   Box
7911%    Catrom   Cubic      Gaussian
7912%    Hanning  Hermite    Lanczos
7913%    Mitchell Point      Quandratic
7914%    Sinc     Triangle
7915%
7916%  Most of the filters are FIR (finite impulse response), however, Bessel,
7917%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
7918%  are windowed (brought down to zero) with the Blackman filter.
7919%
7920%  The format of the MagickResampleImage method is:
7921%
7922%      MagickBooleanType MagickResampleImage(MagickWand *wand,
7923%        const double x_resolution,const double y_resolution,
7924%        const FilterTypes filter,const double blur)
7925%
7926%  A description of each parameter follows:
7927%
7928%    o wand: the magick wand.
7929%
7930%    o x_resolution: the new image x resolution.
7931%
7932%    o y_resolution: the new image y resolution.
7933%
7934%    o filter: Image filter to use.
7935%
7936%    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
7937%
7938*/
7939WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
7940  const double x_resolution,const double y_resolution,const FilterTypes filter,
7941  const double blur)
7942{
7943  Image
7944    *resample_image;
7945
7946  assert(wand != (MagickWand *) NULL);
7947  assert(wand->signature == WandSignature);
7948  if (wand->debug != MagickFalse)
7949    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7950  if (wand->images == (Image *) NULL)
7951    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7952  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
7953    blur,wand->exception);
7954  if (resample_image == (Image *) NULL)
7955    return(MagickFalse);
7956  ReplaceImageInList(&wand->images,resample_image);
7957  return(MagickTrue);
7958}
7959
7960/*
7961%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7962%                                                                             %
7963%                                                                             %
7964%                                                                             %
7965%   M a g i c k R e s e t I m a g e P a g e                                   %
7966%                                                                             %
7967%                                                                             %
7968%                                                                             %
7969%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7970%
7971%  MagickResetImagePage() resets the Wand page canvas and position.
7972%
7973%  The format of the MagickResetImagePage method is:
7974%
7975%      MagickBooleanType MagickResetImagePage(MagickWand *wand,
7976%        const char *page)
7977%
7978%  A description of each parameter follows:
7979%
7980%    o wand: the magick wand.
7981%
7982%    o page: the relative page specification.
7983%
7984*/
7985WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
7986  const char *page)
7987{
7988  assert(wand != (MagickWand *) NULL);
7989  assert(wand->signature == WandSignature);
7990  if (wand->debug != MagickFalse)
7991    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7992  if (wand->images == (Image *) NULL)
7993    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7994  if ((page == (char *) NULL) || (*page == '\0'))
7995    {
7996      (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
7997      return(MagickTrue);
7998    }
7999  return(ResetImagePage(wand->images,page));
8000}
8001
8002/*
8003%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8004%                                                                             %
8005%                                                                             %
8006%                                                                             %
8007%   M a g i c k R e s i z e I m a g e                                         %
8008%                                                                             %
8009%                                                                             %
8010%                                                                             %
8011%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8012%
8013%  MagickResizeImage() scales an image to the desired dimensions with one of
8014%  these filters:
8015%
8016%    Bessel   Blackman   Box
8017%    Catrom   Cubic      Gaussian
8018%    Hanning  Hermite    Lanczos
8019%    Mitchell Point      Quandratic
8020%    Sinc     Triangle
8021%
8022%  Most of the filters are FIR (finite impulse response), however, Bessel,
8023%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8024%  are windowed (brought down to zero) with the Blackman filter.
8025%
8026%  The format of the MagickResizeImage method is:
8027%
8028%      MagickBooleanType MagickResizeImage(MagickWand *wand,
8029%        const size_t columns,const size_t rows,
8030%        const FilterTypes filter,const double blur)
8031%
8032%  A description of each parameter follows:
8033%
8034%    o wand: the magick wand.
8035%
8036%    o columns: the number of columns in the scaled image.
8037%
8038%    o rows: the number of rows in the scaled image.
8039%
8040%    o filter: Image filter to use.
8041%
8042%    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8043%
8044*/
8045WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8046  const size_t columns,const size_t rows,const FilterTypes filter,
8047  const double blur)
8048{
8049  Image
8050    *resize_image;
8051
8052  assert(wand != (MagickWand *) NULL);
8053  assert(wand->signature == WandSignature);
8054  if (wand->debug != MagickFalse)
8055    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8056  if (wand->images == (Image *) NULL)
8057    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8058  resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8059    wand->exception);
8060  if (resize_image == (Image *) NULL)
8061    return(MagickFalse);
8062  ReplaceImageInList(&wand->images,resize_image);
8063  return(MagickTrue);
8064}
8065
8066/*
8067%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8068%                                                                             %
8069%                                                                             %
8070%                                                                             %
8071%   M a g i c k R o l l I m a g e                                             %
8072%                                                                             %
8073%                                                                             %
8074%                                                                             %
8075%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8076%
8077%  MagickRollImage() offsets an image as defined by x and y.
8078%
8079%  The format of the MagickRollImage method is:
8080%
8081%      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8082%        const size_t y)
8083%
8084%  A description of each parameter follows:
8085%
8086%    o wand: the magick wand.
8087%
8088%    o x: the x offset.
8089%
8090%    o y: the y offset.
8091%
8092%
8093*/
8094WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8095  const ssize_t x,const ssize_t y)
8096{
8097  Image
8098    *roll_image;
8099
8100  assert(wand != (MagickWand *) NULL);
8101  assert(wand->signature == WandSignature);
8102  if (wand->debug != MagickFalse)
8103    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8104  if (wand->images == (Image *) NULL)
8105    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8106  roll_image=RollImage(wand->images,x,y,wand->exception);
8107  if (roll_image == (Image *) NULL)
8108    return(MagickFalse);
8109  ReplaceImageInList(&wand->images,roll_image);
8110  return(MagickTrue);
8111}
8112
8113/*
8114%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8115%                                                                             %
8116%                                                                             %
8117%                                                                             %
8118%   M a g i c k R o t a t e I m a g e                                         %
8119%                                                                             %
8120%                                                                             %
8121%                                                                             %
8122%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8123%
8124%  MagickRotateImage() rotates an image the specified number of degrees. Empty
8125%  triangles left over from rotating the image are filled with the
8126%  background color.
8127%
8128%  The format of the MagickRotateImage method is:
8129%
8130%      MagickBooleanType MagickRotateImage(MagickWand *wand,
8131%        const PixelWand *background,const double degrees)
8132%
8133%  A description of each parameter follows:
8134%
8135%    o wand: the magick wand.
8136%
8137%    o background: the background pixel wand.
8138%
8139%    o degrees: the number of degrees to rotate the image.
8140%
8141%
8142*/
8143WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8144  const PixelWand *background,const double degrees)
8145{
8146  Image
8147    *rotate_image;
8148
8149  assert(wand != (MagickWand *) NULL);
8150  assert(wand->signature == WandSignature);
8151  if (wand->debug != MagickFalse)
8152    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8153  if (wand->images == (Image *) NULL)
8154    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8155  PixelGetQuantumPacket(background,&wand->images->background_color);
8156  rotate_image=RotateImage(wand->images,degrees,wand->exception);
8157  if (rotate_image == (Image *) NULL)
8158    return(MagickFalse);
8159  ReplaceImageInList(&wand->images,rotate_image);
8160  return(MagickTrue);
8161}
8162
8163/*
8164%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8165%                                                                             %
8166%                                                                             %
8167%                                                                             %
8168%   M a g i c k S a m p l e I m a g e                                         %
8169%                                                                             %
8170%                                                                             %
8171%                                                                             %
8172%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8173%
8174%  MagickSampleImage() scales an image to the desired dimensions with pixel
8175%  sampling.  Unlike other scaling methods, this method does not introduce
8176%  any additional color into the scaled image.
8177%
8178%  The format of the MagickSampleImage method is:
8179%
8180%      MagickBooleanType MagickSampleImage(MagickWand *wand,
8181%        const size_t columns,const size_t rows)
8182%
8183%  A description of each parameter follows:
8184%
8185%    o wand: the magick wand.
8186%
8187%    o columns: the number of columns in the scaled image.
8188%
8189%    o rows: the number of rows in the scaled image.
8190%
8191%
8192*/
8193WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8194  const size_t columns,const size_t rows)
8195{
8196  Image
8197    *sample_image;
8198
8199  assert(wand != (MagickWand *) NULL);
8200  assert(wand->signature == WandSignature);
8201  if (wand->debug != MagickFalse)
8202    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8203  if (wand->images == (Image *) NULL)
8204    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8205  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8206  if (sample_image == (Image *) NULL)
8207    return(MagickFalse);
8208  ReplaceImageInList(&wand->images,sample_image);
8209  return(MagickTrue);
8210}
8211
8212/*
8213%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8214%                                                                             %
8215%                                                                             %
8216%                                                                             %
8217%   M a g i c k S c a l e I m a g e                                           %
8218%                                                                             %
8219%                                                                             %
8220%                                                                             %
8221%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8222%
8223%  MagickScaleImage() scales the size of an image to the given dimensions.
8224%
8225%  The format of the MagickScaleImage method is:
8226%
8227%      MagickBooleanType MagickScaleImage(MagickWand *wand,
8228%        const size_t columns,const size_t rows)
8229%
8230%  A description of each parameter follows:
8231%
8232%    o wand: the magick wand.
8233%
8234%    o columns: the number of columns in the scaled image.
8235%
8236%    o rows: the number of rows in the scaled image.
8237%
8238%
8239*/
8240WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8241  const size_t columns,const size_t rows)
8242{
8243  Image
8244    *scale_image;
8245
8246  assert(wand != (MagickWand *) NULL);
8247  assert(wand->signature == WandSignature);
8248  if (wand->debug != MagickFalse)
8249    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8250  if (wand->images == (Image *) NULL)
8251    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8252  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8253  if (scale_image == (Image *) NULL)
8254    return(MagickFalse);
8255  ReplaceImageInList(&wand->images,scale_image);
8256  return(MagickTrue);
8257}
8258
8259/*
8260%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8261%                                                                             %
8262%                                                                             %
8263%                                                                             %
8264%   M a g i c k S e g m e n t I m a g e                                       %
8265%                                                                             %
8266%                                                                             %
8267%                                                                             %
8268%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8269%
8270%  MagickSegmentImage() segments an image by analyzing the histograms of the
8271%  color components and identifying units that are homogeneous with the fuzzy
8272%  C-means technique.
8273%
8274%  The format of the SegmentImage method is:
8275%
8276%      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8277%        const ColorspaceType colorspace,const MagickBooleanType verbose,
8278%        const double cluster_threshold,const double smooth_threshold)
8279%
8280%  A description of each parameter follows.
8281%
8282%    o wand: the wand.
8283%
8284%    o colorspace: the image colorspace.
8285%
8286%    o verbose:  Set to MagickTrue to print detailed information about the
8287%      identified classes.
8288%
8289%    o cluster_threshold:  This represents the minimum number of pixels
8290%      contained in a hexahedra before it can be considered valid (expressed as
8291%      a percentage).
8292%
8293%    o smooth_threshold: the smoothing threshold eliminates noise in the second
8294%      derivative of the histogram.  As the value is increased, you can expect a
8295%      smoother second derivative.
8296%
8297*/
8298MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8299  const ColorspaceType colorspace,const MagickBooleanType verbose,
8300  const double cluster_threshold,const double smooth_threshold)
8301{
8302  MagickBooleanType
8303    status;
8304
8305  assert(wand != (MagickWand *) NULL);
8306  assert(wand->signature == WandSignature);
8307  if (wand->debug != MagickFalse)
8308    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8309  if (wand->images == (Image *) NULL)
8310    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8311  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8312    smooth_threshold);
8313  if (status == MagickFalse)
8314    InheritException(wand->exception,&wand->images->exception);
8315  return(status);
8316}
8317
8318/*
8319%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8320%                                                                             %
8321%                                                                             %
8322%                                                                             %
8323%   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8324%                                                                             %
8325%                                                                             %
8326%                                                                             %
8327%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8328%
8329%  MagickSelectiveBlurImage() selectively blur an image within a contrast
8330%  threshold. It is similar to the unsharpen mask that sharpens everything with
8331%  contrast above a certain threshold.
8332%
8333%  The format of the MagickSelectiveBlurImage method is:
8334%
8335%      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8336%        const double radius,const double sigma,const double threshold)
8337%
8338%  A description of each parameter follows:
8339%
8340%    o wand: the magick wand.
8341%
8342%    o radius: the radius of the gaussian, in pixels, not counting the center
8343%      pixel.
8344%
8345%    o sigma: the standard deviation of the gaussian, in pixels.
8346%
8347%    o threshold: only pixels within this contrast threshold are included
8348%      in the blur operation.
8349%
8350*/
8351WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8352  const double radius,const double sigma,const double threshold)
8353{
8354  Image
8355    *blur_image;
8356
8357  assert(wand != (MagickWand *) NULL);
8358  assert(wand->signature == WandSignature);
8359  if (wand->debug != MagickFalse)
8360    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8361  if (wand->images == (Image *) NULL)
8362    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8363  blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
8364    wand->exception);
8365  if (blur_image == (Image *) NULL)
8366    return(MagickFalse);
8367  ReplaceImageInList(&wand->images,blur_image);
8368  return(MagickTrue);
8369}
8370
8371/*
8372%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8373%                                                                             %
8374%                                                                             %
8375%                                                                             %
8376%   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                       %
8377%                                                                             %
8378%                                                                             %
8379%                                                                             %
8380%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8381%
8382%  MagickSeparateImage() separates a channel from the image and returns a
8383%  grayscale image.  A channel is a particular color component of each pixel
8384%  in the image.
8385%
8386%  The format of the MagickSeparateImage method is:
8387%
8388%      MagickBooleanType MagickSeparateImage(MagickWand *wand)
8389%
8390%  A description of each parameter follows:
8391%
8392%    o wand: the magick wand.
8393%
8394*/
8395WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand)
8396{
8397  MagickBooleanType
8398    status;
8399
8400  assert(wand != (MagickWand *) NULL);
8401  assert(wand->signature == WandSignature);
8402  if (wand->debug != MagickFalse)
8403    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8404  if (wand->images == (Image *) NULL)
8405    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8406  status=SeparateImage(wand->images);
8407  if (status == MagickFalse)
8408    InheritException(wand->exception,&wand->images->exception);
8409  return(status);
8410}
8411
8412/*
8413%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8414%                                                                             %
8415%                                                                             %
8416%                                                                             %
8417%     M a g i c k S e p i a T o n e I m a g e                                 %
8418%                                                                             %
8419%                                                                             %
8420%                                                                             %
8421%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8422%
8423%  MagickSepiaToneImage() applies a special effect to the image, similar to the
8424%  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8425%  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8426%  threshold of 80% is a good starting point for a reasonable tone.
8427%
8428%  The format of the MagickSepiaToneImage method is:
8429%
8430%      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8431%        const double threshold)
8432%
8433%  A description of each parameter follows:
8434%
8435%    o wand: the magick wand.
8436%
8437%    o threshold:  Define the extent of the sepia toning.
8438%
8439*/
8440WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8441  const double threshold)
8442{
8443  Image
8444    *sepia_image;
8445
8446  assert(wand != (MagickWand *) NULL);
8447  assert(wand->signature == WandSignature);
8448  if (wand->debug != MagickFalse)
8449    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8450  if (wand->images == (Image *) NULL)
8451    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8452  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8453  if (sepia_image == (Image *) NULL)
8454    return(MagickFalse);
8455  ReplaceImageInList(&wand->images,sepia_image);
8456  return(MagickTrue);
8457}
8458
8459/*
8460%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8461%                                                                             %
8462%                                                                             %
8463%                                                                             %
8464%   M a g i c k S e t I m a g e                                               %
8465%                                                                             %
8466%                                                                             %
8467%                                                                             %
8468%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8469%
8470%  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8471%  MagickNextImage(), MagickPreviousImage() with the images from the specified
8472%  wand.
8473%
8474%  The format of the MagickSetImage method is:
8475%
8476%      MagickBooleanType MagickSetImage(MagickWand *wand,
8477%        const MagickWand *set_wand)
8478%
8479%  A description of each parameter follows:
8480%
8481%    o wand: the magick wand.
8482%
8483%    o set_wand: the set_wand wand.
8484%
8485*/
8486WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8487  const MagickWand *set_wand)
8488{
8489  Image
8490    *images;
8491
8492  assert(wand != (MagickWand *) NULL);
8493  assert(wand->signature == WandSignature);
8494  if (wand->debug != MagickFalse)
8495    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8496  assert(set_wand != (MagickWand *) NULL);
8497  assert(set_wand->signature == WandSignature);
8498  if (wand->debug != MagickFalse)
8499    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8500  if (set_wand->images == (Image *) NULL)
8501    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8502  images=CloneImageList(set_wand->images,wand->exception);
8503  if (images == (Image *) NULL)
8504    return(MagickFalse);
8505  ReplaceImageInList(&wand->images,images);
8506  return(MagickTrue);
8507}
8508
8509/*
8510%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8511%                                                                             %
8512%                                                                             %
8513%                                                                             %
8514%   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                       %
8515%                                                                             %
8516%                                                                             %
8517%                                                                             %
8518%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8519%
8520%  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8521%  alpha channel.
8522%
8523%  The format of the MagickSetImageAlphaChannel method is:
8524%
8525%      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8526%        const AlphaChannelType alpha_type)
8527%
8528%  A description of each parameter follows:
8529%
8530%    o wand: the magick wand.
8531%
8532%    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8533%      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8534%
8535*/
8536WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8537  const AlphaChannelType alpha_type)
8538{
8539  assert(wand != (MagickWand *) NULL);
8540  assert(wand->signature == WandSignature);
8541  if (wand->debug != MagickFalse)
8542    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8543  if (wand->images == (Image *) NULL)
8544    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8545  return(SetImageAlphaChannel(wand->images,alpha_type,&wand->images->exception));
8546}
8547
8548/*
8549%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8550%                                                                             %
8551%                                                                             %
8552%                                                                             %
8553%   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                 %
8554%                                                                             %
8555%                                                                             %
8556%                                                                             %
8557%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8558%
8559%  MagickSetImageBackgroundColor() sets the image background color.
8560%
8561%  The format of the MagickSetImageBackgroundColor method is:
8562%
8563%      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8564%        const PixelWand *background)
8565%
8566%  A description of each parameter follows:
8567%
8568%    o wand: the magick wand.
8569%
8570%    o background: the background pixel wand.
8571%
8572*/
8573WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8574  const PixelWand *background)
8575{
8576  assert(wand != (MagickWand *) NULL);
8577  assert(wand->signature == WandSignature);
8578  if (wand->debug != MagickFalse)
8579    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8580  if (wand->images == (Image *) NULL)
8581    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8582  PixelGetQuantumPacket(background,&wand->images->background_color);
8583  return(MagickTrue);
8584}
8585
8586/*
8587%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8588%                                                                             %
8589%                                                                             %
8590%                                                                             %
8591%   M a g i c k S e t I m a g e B i a s                                       %
8592%                                                                             %
8593%                                                                             %
8594%                                                                             %
8595%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8596%
8597%  MagickSetImageBias() sets the image bias for any method that convolves an
8598%  image (e.g. MagickConvolveImage()).
8599%
8600%  The format of the MagickSetImageBias method is:
8601%
8602%      MagickBooleanType MagickSetImageBias(MagickWand *wand,
8603%        const double bias)
8604%
8605%  A description of each parameter follows:
8606%
8607%    o wand: the magick wand.
8608%
8609%    o bias: the image bias.
8610%
8611*/
8612WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
8613  const double bias)
8614{
8615  assert(wand != (MagickWand *) NULL);
8616  assert(wand->signature == WandSignature);
8617  if (wand->debug != MagickFalse)
8618    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8619  if (wand->images == (Image *) NULL)
8620    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8621  wand->images->bias=bias;
8622  return(MagickTrue);
8623}
8624
8625/*
8626%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8627%                                                                             %
8628%                                                                             %
8629%                                                                             %
8630%   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                         %
8631%                                                                             %
8632%                                                                             %
8633%                                                                             %
8634%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8635%
8636%  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8637%
8638%  The format of the MagickSetImageBluePrimary method is:
8639%
8640%      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8641%        const double x,const double y)
8642%
8643%  A description of each parameter follows:
8644%
8645%    o wand: the magick wand.
8646%
8647%    o x: the blue primary x-point.
8648%
8649%    o y: the blue primary y-point.
8650%
8651*/
8652WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8653  const double x,const double y)
8654{
8655  assert(wand != (MagickWand *) NULL);
8656  assert(wand->signature == WandSignature);
8657  if (wand->debug != MagickFalse)
8658    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8659  if (wand->images == (Image *) NULL)
8660    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8661  wand->images->chromaticity.blue_primary.x=x;
8662  wand->images->chromaticity.blue_primary.y=y;
8663  return(MagickTrue);
8664}
8665
8666/*
8667%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8668%                                                                             %
8669%                                                                             %
8670%                                                                             %
8671%   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                         %
8672%                                                                             %
8673%                                                                             %
8674%                                                                             %
8675%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8676%
8677%  MagickSetImageBorderColor() sets the image border color.
8678%
8679%  The format of the MagickSetImageBorderColor method is:
8680%
8681%      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8682%        const PixelWand *border)
8683%
8684%  A description of each parameter follows:
8685%
8686%    o wand: the magick wand.
8687%
8688%    o border: the border pixel wand.
8689%
8690*/
8691WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8692  const PixelWand *border)
8693{
8694  assert(wand != (MagickWand *) NULL);
8695  assert(wand->signature == WandSignature);
8696  if (wand->debug != MagickFalse)
8697    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8698  if (wand->images == (Image *) NULL)
8699    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8700  PixelGetQuantumPacket(border,&wand->images->border_color);
8701  return(MagickTrue);
8702}
8703
8704/*
8705%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8706%                                                                             %
8707%                                                                             %
8708%                                                                             %
8709%   M a g i c k S e t I m a g e C l i p M a s k                               %
8710%                                                                             %
8711%                                                                             %
8712%                                                                             %
8713%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8714%
8715%  MagickSetImageClipMask() sets image clip mask.
8716%
8717%  The format of the MagickSetImageClipMask method is:
8718%
8719%      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8720%        const MagickWand *clip_mask)
8721%
8722%  A description of each parameter follows:
8723%
8724%    o wand: the magick wand.
8725%
8726%    o clip_mask: the clip_mask wand.
8727%
8728*/
8729WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8730  const MagickWand *clip_mask)
8731{
8732  assert(wand != (MagickWand *) NULL);
8733  assert(wand->signature == WandSignature);
8734  if (wand->debug != MagickFalse)
8735    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8736  assert(clip_mask != (MagickWand *) NULL);
8737  assert(clip_mask->signature == WandSignature);
8738  if (wand->debug != MagickFalse)
8739    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
8740  if (clip_mask->images == (Image *) NULL)
8741    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8742  return(SetImageClipMask(wand->images,clip_mask->images));
8743}
8744
8745/*
8746%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8747%                                                                             %
8748%                                                                             %
8749%                                                                             %
8750%   M a g i c k S e t I m a g e C o l o r                                     %
8751%                                                                             %
8752%                                                                             %
8753%                                                                             %
8754%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8755%
8756%  MagickSetImageColor() set the entire wand canvas to the specified color.
8757%
8758%  The format of the MagickSetImageColor method is:
8759%
8760%      MagickBooleanType MagickSetImageColor(MagickWand *wand,
8761%        const PixelWand *color)
8762%
8763%  A description of each parameter follows:
8764%
8765%    o wand: the magick wand.
8766%
8767%    o background: the image color.
8768%
8769*/
8770WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
8771  const PixelWand *color)
8772{
8773  MagickBooleanType
8774    status;
8775
8776  PixelInfo
8777    pixel;
8778
8779  assert(wand != (MagickWand *) NULL);
8780  assert(wand->signature == WandSignature);
8781  if (wand->debug != MagickFalse)
8782    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8783  PixelGetMagickColor(color,&pixel);
8784  status=SetImageColor(wand->images,&pixel);
8785  if (status == MagickFalse)
8786    InheritException(wand->exception,&wand->images->exception);
8787  return(status);
8788}
8789
8790/*
8791%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8792%                                                                             %
8793%                                                                             %
8794%                                                                             %
8795%   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                     %
8796%                                                                             %
8797%                                                                             %
8798%                                                                             %
8799%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8800%
8801%  MagickSetImageColormapColor() sets the color of the specified colormap
8802%  index.
8803%
8804%  The format of the MagickSetImageColormapColor method is:
8805%
8806%      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8807%        const size_t index,const PixelWand *color)
8808%
8809%  A description of each parameter follows:
8810%
8811%    o wand: the magick wand.
8812%
8813%    o index: the offset into the image colormap.
8814%
8815%    o color: Return the colormap color in this wand.
8816%
8817*/
8818WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8819  const size_t index,const PixelWand *color)
8820{
8821  assert(wand != (MagickWand *) NULL);
8822  assert(wand->signature == WandSignature);
8823  if (wand->debug != MagickFalse)
8824    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8825  if (wand->images == (Image *) NULL)
8826    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8827  if ((wand->images->colormap == (PixelPacket *) NULL) ||
8828      (index >= wand->images->colors))
8829    ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
8830  PixelGetQuantumPacket(color,wand->images->colormap+index);
8831  return(SyncImage(wand->images));
8832}
8833
8834/*
8835%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8836%                                                                             %
8837%                                                                             %
8838%                                                                             %
8839%   M a g i c k S e t I m a g e C o l o r s p a c e                           %
8840%                                                                             %
8841%                                                                             %
8842%                                                                             %
8843%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8844%
8845%  MagickSetImageColorspace() sets the image colorspace.
8846%
8847%  The format of the MagickSetImageColorspace method is:
8848%
8849%      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8850%        const ColorspaceType colorspace)
8851%
8852%  A description of each parameter follows:
8853%
8854%    o wand: the magick wand.
8855%
8856%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
8857%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
8858%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
8859%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
8860%      HSLColorspace, or HWBColorspace.
8861%
8862*/
8863WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8864  const ColorspaceType colorspace)
8865{
8866  assert(wand != (MagickWand *) NULL);
8867  assert(wand->signature == WandSignature);
8868  if (wand->debug != MagickFalse)
8869    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8870  if (wand->images == (Image *) NULL)
8871    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8872  return(SetImageColorspace(wand->images,colorspace,&wand->images->exception));
8873}
8874
8875/*
8876%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8877%                                                                             %
8878%                                                                             %
8879%                                                                             %
8880%   M a g i c k S e t I m a g e C o m p o s e                                 %
8881%                                                                             %
8882%                                                                             %
8883%                                                                             %
8884%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8885%
8886%  MagickSetImageCompose() sets the image composite operator, useful for
8887%  specifying how to composite the image thumbnail when using the
8888%  MagickMontageImage() method.
8889%
8890%  The format of the MagickSetImageCompose method is:
8891%
8892%      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8893%        const CompositeOperator compose)
8894%
8895%  A description of each parameter follows:
8896%
8897%    o wand: the magick wand.
8898%
8899%    o compose: the image composite operator.
8900%
8901*/
8902WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8903  const CompositeOperator compose)
8904{
8905  assert(wand != (MagickWand *) NULL);
8906  assert(wand->signature == WandSignature);
8907  if (wand->debug != MagickFalse)
8908    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8909  if (wand->images == (Image *) NULL)
8910    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8911  wand->images->compose=compose;
8912  return(MagickTrue);
8913}
8914
8915/*
8916%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8917%                                                                             %
8918%                                                                             %
8919%                                                                             %
8920%   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                         %
8921%                                                                             %
8922%                                                                             %
8923%                                                                             %
8924%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8925%
8926%  MagickSetImageCompression() sets the image compression.
8927%
8928%  The format of the MagickSetImageCompression method is:
8929%
8930%      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8931%        const CompressionType compression)
8932%
8933%  A description of each parameter follows:
8934%
8935%    o wand: the magick wand.
8936%
8937%    o compression: the image compression type.
8938%
8939*/
8940WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8941  const CompressionType compression)
8942{
8943  assert(wand != (MagickWand *) NULL);
8944  assert(wand->signature == WandSignature);
8945  if (wand->debug != MagickFalse)
8946    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8947  if (wand->images == (Image *) NULL)
8948    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8949  wand->images->compression=compression;
8950  return(MagickTrue);
8951}
8952
8953/*
8954%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8955%                                                                             %
8956%                                                                             %
8957%                                                                             %
8958%   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           %
8959%                                                                             %
8960%                                                                             %
8961%                                                                             %
8962%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8963%
8964%  MagickSetImageCompressionQuality() sets the image compression quality.
8965%
8966%  The format of the MagickSetImageCompressionQuality method is:
8967%
8968%      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
8969%        const size_t quality)
8970%
8971%  A description of each parameter follows:
8972%
8973%    o wand: the magick wand.
8974%
8975%    o quality: the image compression tlityype.
8976%
8977*/
8978WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
8979  const size_t quality)
8980{
8981  assert(wand != (MagickWand *) NULL);
8982  assert(wand->signature == WandSignature);
8983  if (wand->debug != MagickFalse)
8984    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8985  if (wand->images == (Image *) NULL)
8986    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8987  wand->images->quality=quality;
8988  return(MagickTrue);
8989}
8990
8991/*
8992%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8993%                                                                             %
8994%                                                                             %
8995%                                                                             %
8996%   M a g i c k S e t I m a g e D e l a y                                     %
8997%                                                                             %
8998%                                                                             %
8999%                                                                             %
9000%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9001%
9002%  MagickSetImageDelay() sets the image delay.
9003%
9004%  The format of the MagickSetImageDelay method is:
9005%
9006%      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9007%        const size_t delay)
9008%
9009%  A description of each parameter follows:
9010%
9011%    o wand: the magick wand.
9012%
9013%    o delay: the image delay in ticks-per-second units.
9014%
9015*/
9016WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9017  const size_t delay)
9018{
9019  assert(wand != (MagickWand *) NULL);
9020  assert(wand->signature == WandSignature);
9021  if (wand->debug != MagickFalse)
9022    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9023  if (wand->images == (Image *) NULL)
9024    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9025  wand->images->delay=delay;
9026  return(MagickTrue);
9027}
9028
9029/*
9030%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9031%                                                                             %
9032%                                                                             %
9033%                                                                             %
9034%   M a g i c k S e t I m a g e D e p t h                                     %
9035%                                                                             %
9036%                                                                             %
9037%                                                                             %
9038%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9039%
9040%  MagickSetImageDepth() sets the image depth.
9041%
9042%  The format of the MagickSetImageDepth method is:
9043%
9044%      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9045%        const size_t depth)
9046%
9047%  A description of each parameter follows:
9048%
9049%    o wand: the magick wand.
9050%
9051%    o depth: the image depth in bits: 8, 16, or 32.
9052%
9053*/
9054WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9055  const size_t depth)
9056{
9057  assert(wand != (MagickWand *) NULL);
9058  assert(wand->signature == WandSignature);
9059  if (wand->debug != MagickFalse)
9060    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9061  if (wand->images == (Image *) NULL)
9062    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9063  return(SetImageDepth(wand->images,depth));
9064}
9065
9066/*
9067%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9068%                                                                             %
9069%                                                                             %
9070%                                                                             %
9071%   M a g i c k S e t I m a g e D i s p o s e                                 %
9072%                                                                             %
9073%                                                                             %
9074%                                                                             %
9075%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9076%
9077%  MagickSetImageDispose() sets the image disposal method.
9078%
9079%  The format of the MagickSetImageDispose method is:
9080%
9081%      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9082%        const DisposeType dispose)
9083%
9084%  A description of each parameter follows:
9085%
9086%    o wand: the magick wand.
9087%
9088%    o dispose: the image disposeal type.
9089%
9090*/
9091WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9092  const DisposeType dispose)
9093{
9094  assert(wand != (MagickWand *) NULL);
9095  assert(wand->signature == WandSignature);
9096  if (wand->debug != MagickFalse)
9097    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9098  if (wand->images == (Image *) NULL)
9099    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9100  wand->images->dispose=dispose;
9101  return(MagickTrue);
9102}
9103
9104/*
9105%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9106%                                                                             %
9107%                                                                             %
9108%                                                                             %
9109%   M a g i c k S e t I m a g e E x t e n t                                   %
9110%                                                                             %
9111%                                                                             %
9112%                                                                             %
9113%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9114%
9115%  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9116%
9117%  The format of the MagickSetImageExtent method is:
9118%
9119%      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9120%        const size_t columns,const unsigned rows)
9121%
9122%  A description of each parameter follows:
9123%
9124%    o wand: the magick wand.
9125%
9126%    o columns:  The image width in pixels.
9127%
9128%    o rows:  The image height in pixels.
9129%
9130*/
9131WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9132  const size_t columns,const size_t rows)
9133{
9134  assert(wand != (MagickWand *) NULL);
9135  assert(wand->signature == WandSignature);
9136  if (wand->debug != MagickFalse)
9137    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9138  if (wand->images == (Image *) NULL)
9139    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9140  return(SetImageExtent(wand->images,columns,rows,&wand->images->exception));
9141}
9142
9143/*
9144%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9145%                                                                             %
9146%                                                                             %
9147%                                                                             %
9148%   M a g i c k S e t I m a g e F i l e n a m e                               %
9149%                                                                             %
9150%                                                                             %
9151%                                                                             %
9152%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9153%
9154%  MagickSetImageFilename() sets the filename of a particular image in a
9155%  sequence.
9156%
9157%  The format of the MagickSetImageFilename method is:
9158%
9159%      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9160%        const char *filename)
9161%
9162%  A description of each parameter follows:
9163%
9164%    o wand: the magick wand.
9165%
9166%    o filename: the image filename.
9167%
9168*/
9169WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9170  const char *filename)
9171{
9172  assert(wand != (MagickWand *) NULL);
9173  assert(wand->signature == WandSignature);
9174  if (wand->debug != MagickFalse)
9175    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9176  if (wand->images == (Image *) NULL)
9177    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9178  if (filename != (const char *) NULL)
9179    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9180  return(MagickTrue);
9181}
9182
9183/*
9184%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9185%                                                                             %
9186%                                                                             %
9187%                                                                             %
9188%   M a g i c k S e t I m a g e F o r m a t                                   %
9189%                                                                             %
9190%                                                                             %
9191%                                                                             %
9192%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9193%
9194%  MagickSetImageFormat() sets the format of a particular image in a
9195%  sequence.
9196%
9197%  The format of the MagickSetImageFormat method is:
9198%
9199%      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9200%        const char *format)
9201%
9202%  A description of each parameter follows:
9203%
9204%    o wand: the magick wand.
9205%
9206%    o format: the image format.
9207%
9208*/
9209WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9210  const char *format)
9211{
9212  const MagickInfo
9213    *magick_info;
9214
9215  assert(wand != (MagickWand *) NULL);
9216  assert(wand->signature == WandSignature);
9217  if (wand->debug != MagickFalse)
9218    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9219  if (wand->images == (Image *) NULL)
9220    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9221  if ((format == (char *) NULL) || (*format == '\0'))
9222    {
9223      *wand->images->magick='\0';
9224      return(MagickTrue);
9225    }
9226  magick_info=GetMagickInfo(format,wand->exception);
9227  if (magick_info == (const MagickInfo *) NULL)
9228    return(MagickFalse);
9229  ClearMagickException(wand->exception);
9230  (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9231  return(MagickTrue);
9232}
9233
9234/*
9235%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9236%                                                                             %
9237%                                                                             %
9238%                                                                             %
9239%   M a g i c k S e t I m a g e F u z z                                       %
9240%                                                                             %
9241%                                                                             %
9242%                                                                             %
9243%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9244%
9245%  MagickSetImageFuzz() sets the image fuzz.
9246%
9247%  The format of the MagickSetImageFuzz method is:
9248%
9249%      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9250%        const double fuzz)
9251%
9252%  A description of each parameter follows:
9253%
9254%    o wand: the magick wand.
9255%
9256%    o fuzz: the image fuzz.
9257%
9258*/
9259WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9260  const double fuzz)
9261{
9262  assert(wand != (MagickWand *) NULL);
9263  assert(wand->signature == WandSignature);
9264  if (wand->debug != MagickFalse)
9265    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9266  if (wand->images == (Image *) NULL)
9267    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9268  wand->images->fuzz=fuzz;
9269  return(MagickTrue);
9270}
9271
9272/*
9273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9274%                                                                             %
9275%                                                                             %
9276%                                                                             %
9277%   M a g i c k S e t I m a g e G a m m a                                     %
9278%                                                                             %
9279%                                                                             %
9280%                                                                             %
9281%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9282%
9283%  MagickSetImageGamma() sets the image gamma.
9284%
9285%  The format of the MagickSetImageGamma method is:
9286%
9287%      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9288%        const double gamma)
9289%
9290%  A description of each parameter follows:
9291%
9292%    o wand: the magick wand.
9293%
9294%    o gamma: the image gamma.
9295%
9296*/
9297WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9298  const double gamma)
9299{
9300  assert(wand != (MagickWand *) NULL);
9301  assert(wand->signature == WandSignature);
9302  if (wand->debug != MagickFalse)
9303    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9304  if (wand->images == (Image *) NULL)
9305    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9306  wand->images->gamma=gamma;
9307  return(MagickTrue);
9308}
9309
9310/*
9311%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9312%                                                                             %
9313%                                                                             %
9314%                                                                             %
9315%   M a g i c k S e t I m a g e G r a v i t y                                 %
9316%                                                                             %
9317%                                                                             %
9318%                                                                             %
9319%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9320%
9321%  MagickSetImageGravity() sets the image gravity type.
9322%
9323%  The format of the MagickSetImageGravity method is:
9324%
9325%      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9326%        const GravityType gravity)
9327%
9328%  A description of each parameter follows:
9329%
9330%    o wand: the magick wand.
9331%
9332%    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9333%      PlaneInterlace, PartitionInterlace.
9334%
9335*/
9336WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9337  const GravityType gravity)
9338{
9339  assert(wand != (MagickWand *) NULL);
9340  assert(wand->signature == WandSignature);
9341  if (wand->debug != MagickFalse)
9342    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9343  if (wand->images == (Image *) NULL)
9344    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9345  wand->images->gravity=gravity;
9346  return(MagickTrue);
9347}
9348
9349/*
9350%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9351%                                                                             %
9352%                                                                             %
9353%                                                                             %
9354%   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                       %
9355%                                                                             %
9356%                                                                             %
9357%                                                                             %
9358%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9359%
9360%  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9361%  point.
9362%
9363%  The format of the MagickSetImageGreenPrimary method is:
9364%
9365%      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9366%        const double x,const double y)
9367%
9368%  A description of each parameter follows:
9369%
9370%    o wand: the magick wand.
9371%
9372%    o x: the green primary x-point.
9373%
9374%    o y: the green primary y-point.
9375%
9376%
9377*/
9378WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9379  const double x,const double y)
9380{
9381  assert(wand != (MagickWand *) NULL);
9382  assert(wand->signature == WandSignature);
9383  if (wand->debug != MagickFalse)
9384    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9385  if (wand->images == (Image *) NULL)
9386    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9387  wand->images->chromaticity.green_primary.x=x;
9388  wand->images->chromaticity.green_primary.y=y;
9389  return(MagickTrue);
9390}
9391
9392/*
9393%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9394%                                                                             %
9395%                                                                             %
9396%                                                                             %
9397%   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                 %
9398%                                                                             %
9399%                                                                             %
9400%                                                                             %
9401%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9402%
9403%  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9404%
9405%  The format of the MagickSetImageInterlaceScheme method is:
9406%
9407%      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9408%        const InterlaceType interlace)
9409%
9410%  A description of each parameter follows:
9411%
9412%    o wand: the magick wand.
9413%
9414%    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9415%      PlaneInterlace, PartitionInterlace.
9416%
9417*/
9418WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9419  const InterlaceType interlace)
9420{
9421  assert(wand != (MagickWand *) NULL);
9422  assert(wand->signature == WandSignature);
9423  if (wand->debug != MagickFalse)
9424    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9425  if (wand->images == (Image *) NULL)
9426    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9427  wand->images->interlace=interlace;
9428  return(MagickTrue);
9429}
9430
9431/*
9432%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9433%                                                                             %
9434%                                                                             %
9435%                                                                             %
9436%   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             %
9437%                                                                             %
9438%                                                                             %
9439%                                                                             %
9440%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9441%
9442%  MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
9443%
9444%  The format of the MagickSetImageInterpolateMethod method is:
9445%
9446%      MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
9447%        const InterpolatePixelMethod method)
9448%
9449%  A description of each parameter follows:
9450%
9451%    o wand: the magick wand.
9452%
9453%    o method: the image interpole pixel methods: choose from Undefined,
9454%      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9455%
9456*/
9457WandExport MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
9458  const InterpolatePixelMethod method)
9459{
9460  assert(wand != (MagickWand *) NULL);
9461  assert(wand->signature == WandSignature);
9462  if (wand->debug != MagickFalse)
9463    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9464  if (wand->images == (Image *) NULL)
9465    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9466  wand->images->interpolate=method;
9467  return(MagickTrue);
9468}
9469
9470/*
9471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9472%                                                                             %
9473%                                                                             %
9474%                                                                             %
9475%   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9476%                                                                             %
9477%                                                                             %
9478%                                                                             %
9479%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9480%
9481%  MagickSetImageIterations() sets the image iterations.
9482%
9483%  The format of the MagickSetImageIterations method is:
9484%
9485%      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9486%        const size_t iterations)
9487%
9488%  A description of each parameter follows:
9489%
9490%    o wand: the magick wand.
9491%
9492%    o delay: the image delay in 1/100th of a second.
9493%
9494*/
9495WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9496  const size_t iterations)
9497{
9498  assert(wand != (MagickWand *) NULL);
9499  assert(wand->signature == WandSignature);
9500  if (wand->debug != MagickFalse)
9501    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9502  if (wand->images == (Image *) NULL)
9503    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9504  wand->images->iterations=iterations;
9505  return(MagickTrue);
9506}
9507
9508/*
9509%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9510%                                                                             %
9511%                                                                             %
9512%                                                                             %
9513%   M a g i c k S e t I m a g e M a t t e                                     %
9514%                                                                             %
9515%                                                                             %
9516%                                                                             %
9517%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9518%
9519%  MagickSetImageMatte() sets the image matte channel.
9520%
9521%  The format of the MagickSetImageMatteColor method is:
9522%
9523%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9524%        const MagickBooleanType *matte)
9525%
9526%  A description of each parameter follows:
9527%
9528%    o wand: the magick wand.
9529%
9530%    o matte: Set to MagickTrue to enable the image matte channel otherwise
9531%      MagickFalse.
9532%
9533*/
9534WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9535  const MagickBooleanType matte)
9536{
9537  assert(wand != (MagickWand *) NULL);
9538  assert(wand->signature == WandSignature);
9539  if (wand->debug != MagickFalse)
9540    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9541  if (wand->images == (Image *) NULL)
9542    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9543  if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
9544    (void) SetImageOpacity(wand->images,OpaqueAlpha);
9545  wand->images->matte=matte;
9546  return(MagickTrue);
9547}
9548
9549/*
9550%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9551%                                                                             %
9552%                                                                             %
9553%                                                                             %
9554%   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9555%                                                                             %
9556%                                                                             %
9557%                                                                             %
9558%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9559%
9560%  MagickSetImageMatteColor() sets the image matte color.
9561%
9562%  The format of the MagickSetImageMatteColor method is:
9563%
9564%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9565%        const PixelWand *matte)
9566%
9567%  A description of each parameter follows:
9568%
9569%    o wand: the magick wand.
9570%
9571%    o matte: the matte pixel wand.
9572%
9573*/
9574WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9575  const PixelWand *matte)
9576{
9577  assert(wand != (MagickWand *) NULL);
9578  assert(wand->signature == WandSignature);
9579  if (wand->debug != MagickFalse)
9580    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9581  if (wand->images == (Image *) NULL)
9582    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9583  PixelGetQuantumPacket(matte,&wand->images->matte_color);
9584  return(MagickTrue);
9585}
9586
9587/*
9588%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9589%                                                                             %
9590%                                                                             %
9591%                                                                             %
9592%   M a g i c k S e t I m a g e O p a c i t y                                 %
9593%                                                                             %
9594%                                                                             %
9595%                                                                             %
9596%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9597%
9598%  MagickSetImageOpacity() sets the image to the specified opacity level.
9599%
9600%  The format of the MagickSetImageOpacity method is:
9601%
9602%      MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
9603%        const double alpha)
9604%
9605%  A description of each parameter follows:
9606%
9607%    o wand: the magick wand.
9608%
9609%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9610%      transparent.
9611%
9612*/
9613WandExport MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
9614  const double alpha)
9615{
9616  MagickBooleanType
9617    status;
9618
9619  assert(wand != (MagickWand *) NULL);
9620  assert(wand->signature == WandSignature);
9621  if (wand->debug != MagickFalse)
9622    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9623  if (wand->images == (Image *) NULL)
9624    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9625  status=SetImageOpacity(wand->images,ClampToQuantum(QuantumRange*alpha));
9626  if (status == MagickFalse)
9627    InheritException(wand->exception,&wand->images->exception);
9628  return(status);
9629}
9630
9631/*
9632%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9633%                                                                             %
9634%                                                                             %
9635%                                                                             %
9636%   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                         %
9637%                                                                             %
9638%                                                                             %
9639%                                                                             %
9640%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9641%
9642%  MagickSetImageOrientation() sets the image orientation.
9643%
9644%  The format of the MagickSetImageOrientation method is:
9645%
9646%      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9647%        const OrientationType orientation)
9648%
9649%  A description of each parameter follows:
9650%
9651%    o wand: the magick wand.
9652%
9653%    o orientation: the image orientation type.
9654%
9655*/
9656WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9657  const OrientationType orientation)
9658{
9659  assert(wand != (MagickWand *) NULL);
9660  assert(wand->signature == WandSignature);
9661  if (wand->debug != MagickFalse)
9662    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9663  if (wand->images == (Image *) NULL)
9664    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9665  wand->images->orientation=orientation;
9666  return(MagickTrue);
9667}
9668
9669/*
9670%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9671%                                                                             %
9672%                                                                             %
9673%                                                                             %
9674%   M a g i c k S e t I m a g e P a g e                                       %
9675%                                                                             %
9676%                                                                             %
9677%                                                                             %
9678%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9679%
9680%  MagickSetImagePage() sets the page geometry of the image.
9681%
9682%  The format of the MagickSetImagePage method is:
9683%
9684%      MagickBooleanType MagickSetImagePage(MagickWand *wand,
9685%        const size_t width,const size_t height,const ssize_t x,
9686%        const ssize_t y)
9687%
9688%  A description of each parameter follows:
9689%
9690%    o wand: the magick wand.
9691%
9692%    o width: the page width.
9693%
9694%    o height: the page height.
9695%
9696%    o x: the page x-offset.
9697%
9698%    o y: the page y-offset.
9699%
9700*/
9701WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
9702  const size_t width,const size_t height,const ssize_t x,
9703  const ssize_t y)
9704{
9705  assert(wand != (MagickWand *) NULL);
9706  assert(wand->signature == WandSignature);
9707  if (wand->debug != MagickFalse)
9708    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9709  if (wand->images == (Image *) NULL)
9710    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9711  wand->images->page.width=width;
9712  wand->images->page.height=height;
9713  wand->images->page.x=x;
9714  wand->images->page.y=y;
9715  return(MagickTrue);
9716}
9717
9718/*
9719%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9720%                                                                             %
9721%                                                                             %
9722%                                                                             %
9723%   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                 %
9724%                                                                             %
9725%                                                                             %
9726%                                                                             %
9727%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9728%
9729%  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
9730%  specified method and returns the previous progress monitor if any.  The
9731%  progress monitor method looks like this:
9732%
9733%    MagickBooleanType MagickProgressMonitor(const char *text,
9734%      const MagickOffsetType offset,const MagickSizeType span,
9735%      void *client_data)
9736%
9737%  If the progress monitor returns MagickFalse, the current operation is
9738%  interrupted.
9739%
9740%  The format of the MagickSetImageProgressMonitor method is:
9741%
9742%      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
9743%        const MagickProgressMonitor progress_monitor,void *client_data)
9744%
9745%  A description of each parameter follows:
9746%
9747%    o wand: the magick wand.
9748%
9749%    o progress_monitor: Specifies a pointer to a method to monitor progress
9750%      of an image operation.
9751%
9752%    o client_data: Specifies a pointer to any client data.
9753%
9754*/
9755WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
9756  const MagickProgressMonitor progress_monitor,void *client_data)
9757{
9758  MagickProgressMonitor
9759    previous_monitor;
9760
9761  assert(wand != (MagickWand *) NULL);
9762  assert(wand->signature == WandSignature);
9763  if (wand->debug != MagickFalse)
9764    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9765  if (wand->images == (Image *) NULL)
9766    {
9767      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
9768        "ContainsNoImages","`%s'",wand->name);
9769      return((MagickProgressMonitor) NULL);
9770    }
9771  previous_monitor=SetImageProgressMonitor(wand->images,
9772    progress_monitor,client_data);
9773  return(previous_monitor);
9774}
9775
9776/*
9777%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9778%                                                                             %
9779%                                                                             %
9780%                                                                             %
9781%   M a g i c k S e t I m a g e R e d P r i m a r y                           %
9782%                                                                             %
9783%                                                                             %
9784%                                                                             %
9785%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9786%
9787%  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
9788%
9789%  The format of the MagickSetImageRedPrimary method is:
9790%
9791%      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9792%        const double x,const double y)
9793%
9794%  A description of each parameter follows:
9795%
9796%    o wand: the magick wand.
9797%
9798%    o x: the red primary x-point.
9799%
9800%    o y: the red primary y-point.
9801%
9802*/
9803WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9804  const double x,const double y)
9805{
9806  assert(wand != (MagickWand *) NULL);
9807  assert(wand->signature == WandSignature);
9808  if (wand->debug != MagickFalse)
9809    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9810  if (wand->images == (Image *) NULL)
9811    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9812  wand->images->chromaticity.red_primary.x=x;
9813  wand->images->chromaticity.red_primary.y=y;
9814  return(MagickTrue);
9815}
9816
9817/*
9818%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9819%                                                                             %
9820%                                                                             %
9821%                                                                             %
9822%   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                 %
9823%                                                                             %
9824%                                                                             %
9825%                                                                             %
9826%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9827%
9828%  MagickSetImageRenderingIntent() sets the image rendering intent.
9829%
9830%  The format of the MagickSetImageRenderingIntent method is:
9831%
9832%      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9833%        const RenderingIntent rendering_intent)
9834%
9835%  A description of each parameter follows:
9836%
9837%    o wand: the magick wand.
9838%
9839%    o rendering_intent: the image rendering intent: UndefinedIntent,
9840%      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
9841%
9842*/
9843WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9844  const RenderingIntent rendering_intent)
9845{
9846  assert(wand != (MagickWand *) NULL);
9847  assert(wand->signature == WandSignature);
9848  if (wand->debug != MagickFalse)
9849    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9850  if (wand->images == (Image *) NULL)
9851    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9852  wand->images->rendering_intent=rendering_intent;
9853  return(MagickTrue);
9854}
9855
9856/*
9857%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9858%                                                                             %
9859%                                                                             %
9860%                                                                             %
9861%   M a g i c k S e t I m a g e R e s o l u t i o n                           %
9862%                                                                             %
9863%                                                                             %
9864%                                                                             %
9865%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9866%
9867%  MagickSetImageResolution() sets the image resolution.
9868%
9869%  The format of the MagickSetImageResolution method is:
9870%
9871%      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9872%        const double x_resolution,const doubtl y_resolution)
9873%
9874%  A description of each parameter follows:
9875%
9876%    o wand: the magick wand.
9877%
9878%    o x_resolution: the image x resolution.
9879%
9880%    o y_resolution: the image y resolution.
9881%
9882*/
9883WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9884  const double x_resolution,const double y_resolution)
9885{
9886  assert(wand != (MagickWand *) NULL);
9887  assert(wand->signature == WandSignature);
9888  if (wand->debug != MagickFalse)
9889    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9890  if (wand->images == (Image *) NULL)
9891    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9892  wand->images->x_resolution=x_resolution;
9893  wand->images->y_resolution=y_resolution;
9894  return(MagickTrue);
9895}
9896
9897/*
9898%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9899%                                                                             %
9900%                                                                             %
9901%                                                                             %
9902%   M a g i c k S e t I m a g e S c e n e                                     %
9903%                                                                             %
9904%                                                                             %
9905%                                                                             %
9906%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9907%
9908%  MagickSetImageScene() sets the image scene.
9909%
9910%  The format of the MagickSetImageScene method is:
9911%
9912%      MagickBooleanType MagickSetImageScene(MagickWand *wand,
9913%        const size_t scene)
9914%
9915%  A description of each parameter follows:
9916%
9917%    o wand: the magick wand.
9918%
9919%    o delay: the image scene number.
9920%
9921*/
9922WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
9923  const size_t scene)
9924{
9925  assert(wand != (MagickWand *) NULL);
9926  assert(wand->signature == WandSignature);
9927  if (wand->debug != MagickFalse)
9928    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9929  if (wand->images == (Image *) NULL)
9930    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9931  wand->images->scene=scene;
9932  return(MagickTrue);
9933}
9934
9935/*
9936%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9937%                                                                             %
9938%                                                                             %
9939%                                                                             %
9940%   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                   %
9941%                                                                             %
9942%                                                                             %
9943%                                                                             %
9944%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9945%
9946%  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
9947%
9948%  The format of the MagickSetImageTicksPerSecond method is:
9949%
9950%      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9951%        const ssize_t ticks_per-second)
9952%
9953%  A description of each parameter follows:
9954%
9955%    o wand: the magick wand.
9956%
9957%    o ticks_per_second: the units to use for the image delay.
9958%
9959*/
9960WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9961  const ssize_t ticks_per_second)
9962{
9963  assert(wand != (MagickWand *) NULL);
9964  assert(wand->signature == WandSignature);
9965  if (wand->debug != MagickFalse)
9966    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9967  if (wand->images == (Image *) NULL)
9968    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9969  wand->images->ticks_per_second=ticks_per_second;
9970  return(MagickTrue);
9971}
9972
9973/*
9974%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9975%                                                                             %
9976%                                                                             %
9977%                                                                             %
9978%   M a g i c k S e t I m a g e T y p e                                       %
9979%                                                                             %
9980%                                                                             %
9981%                                                                             %
9982%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9983%
9984%  MagickSetImageType() sets the image type.
9985%
9986%  The format of the MagickSetImageType method is:
9987%
9988%      MagickBooleanType MagickSetImageType(MagickWand *wand,
9989%        const ImageType image_type)
9990%
9991%  A description of each parameter follows:
9992%
9993%    o wand: the magick wand.
9994%
9995%    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
9996%      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
9997%      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
9998%      or OptimizeType.
9999%
10000*/
10001WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10002  const ImageType image_type)
10003{
10004  assert(wand != (MagickWand *) NULL);
10005  assert(wand->signature == WandSignature);
10006  if (wand->debug != MagickFalse)
10007    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10008  if (wand->images == (Image *) NULL)
10009    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10010  return(SetImageType(wand->images,image_type));
10011}
10012
10013/*
10014%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10015%                                                                             %
10016%                                                                             %
10017%                                                                             %
10018%   M a g i c k S e t I m a g e U n i t s                                     %
10019%                                                                             %
10020%                                                                             %
10021%                                                                             %
10022%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10023%
10024%  MagickSetImageUnits() sets the image units of resolution.
10025%
10026%  The format of the MagickSetImageUnits method is:
10027%
10028%      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10029%        const ResolutionType units)
10030%
10031%  A description of each parameter follows:
10032%
10033%    o wand: the magick wand.
10034%
10035%    o units: the image units of resolution : UndefinedResolution,
10036%      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10037%
10038*/
10039WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10040  const ResolutionType units)
10041{
10042  assert(wand != (MagickWand *) NULL);
10043  assert(wand->signature == WandSignature);
10044  if (wand->debug != MagickFalse)
10045    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10046  if (wand->images == (Image *) NULL)
10047    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10048  wand->images->units=units;
10049  return(MagickTrue);
10050}
10051
10052/*
10053%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10054%                                                                             %
10055%                                                                             %
10056%                                                                             %
10057%   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           %
10058%                                                                             %
10059%                                                                             %
10060%                                                                             %
10061%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10062%
10063%  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10064%
10065%  The format of the MagickSetImageVirtualPixelMethod method is:
10066%
10067%      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10068%        const VirtualPixelMethod method)
10069%
10070%  A description of each parameter follows:
10071%
10072%    o wand: the magick wand.
10073%
10074%    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10075%      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10076%      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10077%
10078*/
10079WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10080  const VirtualPixelMethod method)
10081{
10082  assert(wand != (MagickWand *) NULL);
10083  assert(wand->signature == WandSignature);
10084  if (wand->debug != MagickFalse)
10085    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10086  if (wand->images == (Image *) NULL)
10087    return(UndefinedVirtualPixelMethod);
10088  return(SetImageVirtualPixelMethod(wand->images,method));
10089}
10090
10091/*
10092%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10093%                                                                             %
10094%                                                                             %
10095%                                                                             %
10096%   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10097%                                                                             %
10098%                                                                             %
10099%                                                                             %
10100%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10101%
10102%  MagickSetImageWhitePoint() sets the image chromaticity white point.
10103%
10104%  The format of the MagickSetImageWhitePoint method is:
10105%
10106%      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10107%        const double x,const double y)
10108%
10109%  A description of each parameter follows:
10110%
10111%    o wand: the magick wand.
10112%
10113%    o x: the white x-point.
10114%
10115%    o y: the white y-point.
10116%
10117*/
10118WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10119  const double x,const double y)
10120{
10121  assert(wand != (MagickWand *) NULL);
10122  assert(wand->signature == WandSignature);
10123  if (wand->debug != MagickFalse)
10124    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10125  if (wand->images == (Image *) NULL)
10126    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10127  wand->images->chromaticity.white_point.x=x;
10128  wand->images->chromaticity.white_point.y=y;
10129  return(MagickTrue);
10130}
10131
10132/*
10133%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10134%                                                                             %
10135%                                                                             %
10136%                                                                             %
10137%   M a g i c k S h a d e I m a g e C h a n n e l                             %
10138%                                                                             %
10139%                                                                             %
10140%                                                                             %
10141%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10142%
10143%  MagickShadeImage() shines a distant light on an image to create a
10144%  three-dimensional effect. You control the positioning of the light with
10145%  azimuth and elevation; azimuth is measured in degrees off the x axis
10146%  and elevation is measured in pixels above the Z axis.
10147%
10148%  The format of the MagickShadeImage method is:
10149%
10150%      MagickBooleanType MagickShadeImage(MagickWand *wand,
10151%        const MagickBooleanType gray,const double azimuth,
10152%        const double elevation)
10153%
10154%  A description of each parameter follows:
10155%
10156%    o wand: the magick wand.
10157%
10158%    o gray: A value other than zero shades the intensity of each pixel.
10159%
10160%    o azimuth, elevation:  Define the light source direction.
10161%
10162*/
10163WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10164  const MagickBooleanType gray,const double asimuth,const double elevation)
10165{
10166  Image
10167    *shade_image;
10168
10169  assert(wand != (MagickWand *) NULL);
10170  assert(wand->signature == WandSignature);
10171  if (wand->debug != MagickFalse)
10172    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10173  if (wand->images == (Image *) NULL)
10174    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10175  shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10176  if (shade_image == (Image *) NULL)
10177    return(MagickFalse);
10178  ReplaceImageInList(&wand->images,shade_image);
10179  return(MagickTrue);
10180}
10181
10182/*
10183%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10184%                                                                             %
10185%                                                                             %
10186%                                                                             %
10187%   M a g i c k S h a d o w I m a g e                                         %
10188%                                                                             %
10189%                                                                             %
10190%                                                                             %
10191%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10192%
10193%  MagickShadowImage() simulates an image shadow.
10194%
10195%  The format of the MagickShadowImage method is:
10196%
10197%      MagickBooleanType MagickShadowImage(MagickWand *wand,
10198%        const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10199%
10200%  A description of each parameter follows:
10201%
10202%    o wand: the magick wand.
10203%
10204%    o opacity: percentage transparency.
10205%
10206%    o sigma: the standard deviation of the Gaussian, in pixels.
10207%
10208%    o x: the shadow x-offset.
10209%
10210%    o y: the shadow y-offset.
10211%
10212*/
10213WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10214  const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10215{
10216  Image
10217    *shadow_image;
10218
10219  assert(wand != (MagickWand *) NULL);
10220  assert(wand->signature == WandSignature);
10221  if (wand->debug != MagickFalse)
10222    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10223  if (wand->images == (Image *) NULL)
10224    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10225  shadow_image=ShadowImage(wand->images,opacity,sigma,x,y,wand->exception);
10226  if (shadow_image == (Image *) NULL)
10227    return(MagickFalse);
10228  ReplaceImageInList(&wand->images,shadow_image);
10229  return(MagickTrue);
10230}
10231
10232/*
10233%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10234%                                                                             %
10235%                                                                             %
10236%                                                                             %
10237%   M a g i c k S h a r p e n I m a g e                                       %
10238%                                                                             %
10239%                                                                             %
10240%                                                                             %
10241%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10242%
10243%  MagickSharpenImage() sharpens an image.  We convolve the image with a
10244%  Gaussian operator of the given radius and standard deviation (sigma).
10245%  For reasonable results, the radius should be larger than sigma.  Use a
10246%  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10247%
10248%  The format of the MagickSharpenImage method is:
10249%
10250%      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10251%        const double radius,const double sigma)
10252%
10253%  A description of each parameter follows:
10254%
10255%    o wand: the magick wand.
10256%
10257%    o radius: the radius of the Gaussian, in pixels, not counting the center
10258%      pixel.
10259%
10260%    o sigma: the standard deviation of the Gaussian, in pixels.
10261%
10262*/
10263WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10264  const double radius,const double sigma)
10265{
10266  Image
10267    *sharp_image;
10268
10269  assert(wand != (MagickWand *) NULL);
10270  assert(wand->signature == WandSignature);
10271  if (wand->debug != MagickFalse)
10272    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10273  if (wand->images == (Image *) NULL)
10274    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10275  sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
10276  if (sharp_image == (Image *) NULL)
10277    return(MagickFalse);
10278  ReplaceImageInList(&wand->images,sharp_image);
10279  return(MagickTrue);
10280}
10281
10282/*
10283%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10284%                                                                             %
10285%                                                                             %
10286%                                                                             %
10287%   M a g i c k S h a v e I m a g e                                           %
10288%                                                                             %
10289%                                                                             %
10290%                                                                             %
10291%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10292%
10293%  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10294%  memory necessary for the new Image structure and returns a pointer to the
10295%  new image.
10296%
10297%  The format of the MagickShaveImage method is:
10298%
10299%      MagickBooleanType MagickShaveImage(MagickWand *wand,
10300%        const size_t columns,const size_t rows)
10301%
10302%  A description of each parameter follows:
10303%
10304%    o wand: the magick wand.
10305%
10306%    o columns: the number of columns in the scaled image.
10307%
10308%    o rows: the number of rows in the scaled image.
10309%
10310%
10311*/
10312WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10313  const size_t columns,const size_t rows)
10314{
10315  Image
10316    *shave_image;
10317
10318  RectangleInfo
10319    shave_info;
10320
10321  assert(wand != (MagickWand *) NULL);
10322  assert(wand->signature == WandSignature);
10323  if (wand->debug != MagickFalse)
10324    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10325  if (wand->images == (Image *) NULL)
10326    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10327  shave_info.width=columns;
10328  shave_info.height=rows;
10329  shave_info.x=0;
10330  shave_info.y=0;
10331  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10332  if (shave_image == (Image *) NULL)
10333    return(MagickFalse);
10334  ReplaceImageInList(&wand->images,shave_image);
10335  return(MagickTrue);
10336}
10337
10338/*
10339%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10340%                                                                             %
10341%                                                                             %
10342%                                                                             %
10343%   M a g i c k S h e a r I m a g e                                           %
10344%                                                                             %
10345%                                                                             %
10346%                                                                             %
10347%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10348%
10349%  MagickShearImage() slides one edge of an image along the X or Y axis,
10350%  creating a parallelogram.  An X direction shear slides an edge along the X
10351%  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10352%  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10353%  is measured relative to the Y axis, and similarly, for Y direction shears
10354%  y_shear is measured relative to the X axis.  Empty triangles left over from
10355%  shearing the image are filled with the background color.
10356%
10357%  The format of the MagickShearImage method is:
10358%
10359%      MagickBooleanType MagickShearImage(MagickWand *wand,
10360%        const PixelWand *background,const double x_shear,onst double y_shear)
10361%
10362%  A description of each parameter follows:
10363%
10364%    o wand: the magick wand.
10365%
10366%    o background: the background pixel wand.
10367%
10368%    o x_shear: the number of degrees to shear the image.
10369%
10370%    o y_shear: the number of degrees to shear the image.
10371%
10372*/
10373WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10374  const PixelWand *background,const double x_shear,const double y_shear)
10375{
10376  Image
10377    *shear_image;
10378
10379  assert(wand != (MagickWand *) NULL);
10380  assert(wand->signature == WandSignature);
10381  if (wand->debug != MagickFalse)
10382    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10383  if (wand->images == (Image *) NULL)
10384    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10385  PixelGetQuantumPacket(background,&wand->images->background_color);
10386  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10387  if (shear_image == (Image *) NULL)
10388    return(MagickFalse);
10389  ReplaceImageInList(&wand->images,shear_image);
10390  return(MagickTrue);
10391}
10392
10393/*
10394%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10395%                                                                             %
10396%                                                                             %
10397%                                                                             %
10398%   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                   %
10399%                                                                             %
10400%                                                                             %
10401%                                                                             %
10402%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10403%
10404%  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10405%  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10406%  image using a sigmoidal transfer function without saturating highlights or
10407%  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10408%  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10409%  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10410%  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10411%  is reduced.
10412%
10413%  The format of the MagickSigmoidalContrastImage method is:
10414%
10415%      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10416%        const MagickBooleanType sharpen,const double alpha,const double beta)
10417%
10418%  A description of each parameter follows:
10419%
10420%    o wand: the magick wand.
10421%
10422%    o sharpen: Increase or decrease image contrast.
10423%
10424%    o alpha: strength of the contrast, the larger the number the more
10425%      'threshold-like' it becomes.
10426%
10427%    o beta: midpoint of the function as a color value 0 to QuantumRange.
10428%
10429*/
10430WandExport MagickBooleanType MagickSigmoidalContrastImage(
10431  MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10432  const double beta)
10433{
10434  MagickBooleanType
10435    status;
10436
10437  assert(wand != (MagickWand *) NULL);
10438  assert(wand->signature == WandSignature);
10439  if (wand->debug != MagickFalse)
10440    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10441  if (wand->images == (Image *) NULL)
10442    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10443  status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta);
10444  if (status == MagickFalse)
10445    InheritException(wand->exception,&wand->images->exception);
10446  return(status);
10447}
10448
10449/*
10450%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10451%                                                                             %
10452%                                                                             %
10453%                                                                             %
10454%   M a g i c k S i m i l a r i t y I m a g e                                 %
10455%                                                                             %
10456%                                                                             %
10457%                                                                             %
10458%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10459%
10460%  MagickSimilarityImage() compares the reference image of the image and
10461%  returns the best match offset.  In addition, it returns a similarity image
10462%  such that an exact match location is completely white and if none of the
10463%  pixels match, black, otherwise some gray level in-between.
10464%
10465%  The format of the MagickSimilarityImage method is:
10466%
10467%      MagickWand *MagickSimilarityImage(MagickWand *wand,
10468%        const MagickWand *reference,RectangeInfo *offset,double *similarity)
10469%
10470%  A description of each parameter follows:
10471%
10472%    o wand: the magick wand.
10473%
10474%    o reference: the reference wand.
10475%
10476%    o offset: the best match offset of the reference image within the image.
10477%
10478%    o similarity: the computed similarity between the images.
10479%
10480*/
10481WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10482  const MagickWand *reference,RectangleInfo *offset,double *similarity)
10483{
10484  Image
10485    *similarity_image;
10486
10487  assert(wand != (MagickWand *) NULL);
10488  assert(wand->signature == WandSignature);
10489  if (wand->debug != MagickFalse)
10490    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10491  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10492    {
10493      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10494        "ContainsNoImages","`%s'",wand->name);
10495      return((MagickWand *) NULL);
10496    }
10497  similarity_image=SimilarityImage(wand->images,reference->images,offset,
10498    similarity,&wand->images->exception);
10499  if (similarity_image == (Image *) NULL)
10500    return((MagickWand *) NULL);
10501  return(CloneMagickWandFromImages(wand,similarity_image));
10502}
10503
10504/*
10505%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10506%                                                                             %
10507%                                                                             %
10508%                                                                             %
10509%   M a g i c k S k e t c h I m a g e                                         %
10510%                                                                             %
10511%                                                                             %
10512%                                                                             %
10513%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10514%
10515%  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10516%  a Gaussian operator of the given radius and standard deviation (sigma).
10517%  For reasonable results, radius should be larger than sigma.  Use a
10518%  radius of 0 and SketchImage() selects a suitable radius for you.
10519%  Angle gives the angle of the blurring motion.
10520%
10521%  The format of the MagickSketchImage method is:
10522%
10523%      MagickBooleanType MagickSketchImage(MagickWand *wand,
10524%        const double radius,const double sigma,const double angle)
10525%
10526%  A description of each parameter follows:
10527%
10528%    o wand: the magick wand.
10529%
10530%    o radius: the radius of the Gaussian, in pixels, not counting
10531%      the center pixel.
10532%
10533%    o sigma: the standard deviation of the Gaussian, in pixels.
10534%
10535%    o angle: Apply the effect along this angle.
10536%
10537*/
10538WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10539  const double radius,const double sigma,const double angle)
10540{
10541  Image
10542    *sketch_image;
10543
10544  assert(wand != (MagickWand *) NULL);
10545  assert(wand->signature == WandSignature);
10546  if (wand->debug != MagickFalse)
10547    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10548  if (wand->images == (Image *) NULL)
10549    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10550  sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
10551  if (sketch_image == (Image *) NULL)
10552    return(MagickFalse);
10553  ReplaceImageInList(&wand->images,sketch_image);
10554  return(MagickTrue);
10555}
10556
10557/*
10558%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10559%                                                                             %
10560%                                                                             %
10561%                                                                             %
10562%   M a g i c k S m u s h I m a g e s                                         %
10563%                                                                             %
10564%                                                                             %
10565%                                                                             %
10566%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10567%
10568%  MagickSmushImages() takes all images from the current image pointer to the
10569%  end of the image list and smushs them to each other top-to-bottom if the
10570%  stack parameter is true, otherwise left-to-right.
10571%
10572%  The format of the MagickSmushImages method is:
10573%
10574%      MagickWand *MagickSmushImages(MagickWand *wand,
10575%        const MagickBooleanType stack,const ssize_t offset)
10576%
10577%  A description of each parameter follows:
10578%
10579%    o wand: the magick wand.
10580%
10581%    o stack: By default, images are stacked left-to-right. Set stack to
10582%      MagickTrue to stack them top-to-bottom.
10583%
10584%    o offset: minimum distance in pixels between images.
10585%
10586*/
10587WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10588  const MagickBooleanType stack,const ssize_t offset)
10589{
10590  Image
10591    *smush_image;
10592
10593  assert(wand != (MagickWand *) NULL);
10594  assert(wand->signature == WandSignature);
10595  if (wand->debug != MagickFalse)
10596    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10597  if (wand->images == (Image *) NULL)
10598    return((MagickWand *) NULL);
10599  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10600  if (smush_image == (Image *) NULL)
10601    return((MagickWand *) NULL);
10602  return(CloneMagickWandFromImages(wand,smush_image));
10603}
10604
10605/*
10606%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10607%                                                                             %
10608%                                                                             %
10609%                                                                             %
10610%     M a g i c k S o l a r i z e I m a g e                                   %
10611%                                                                             %
10612%                                                                             %
10613%                                                                             %
10614%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10615%
10616%  MagickSolarizeImage() applies a special effect to the image, similar to the
10617%  effect achieved in a photo darkroom by selectively exposing areas of photo
10618%  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
10619%  measure of the extent of the solarization.
10620%
10621%  The format of the MagickSolarizeImage method is:
10622%
10623%      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10624%        const double threshold)
10625%
10626%  A description of each parameter follows:
10627%
10628%    o wand: the magick wand.
10629%
10630%    o threshold:  Define the extent of the solarization.
10631%
10632*/
10633WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10634  const double threshold)
10635{
10636  MagickBooleanType
10637    status;
10638
10639  assert(wand != (MagickWand *) NULL);
10640  assert(wand->signature == WandSignature);
10641  if (wand->debug != MagickFalse)
10642    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10643  if (wand->images == (Image *) NULL)
10644    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10645  status=SolarizeImage(wand->images,threshold);
10646  if (status == MagickFalse)
10647    InheritException(wand->exception,&wand->images->exception);
10648  return(status);
10649}
10650
10651/*
10652%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10653%                                                                             %
10654%                                                                             %
10655%                                                                             %
10656%   M a g i c k S p a r s e C o l o r I m a g e                               %
10657%                                                                             %
10658%                                                                             %
10659%                                                                             %
10660%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10661%
10662%  MagickSparseColorImage(), given a set of coordinates, interpolates the
10663%  colors found at those coordinates, across the whole image, using various
10664%  methods.
10665%
10666%  The format of the MagickSparseColorImage method is:
10667%
10668%      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10669%        const SparseColorMethod method,const size_t number_arguments,
10670%        const double *arguments)
10671%
10672%  A description of each parameter follows:
10673%
10674%    o image: the image to be sparseed.
10675%
10676%    o method: the method of image sparseion.
10677%
10678%        ArcSparseColorion will always ignore source image offset, and always
10679%        'bestfit' the destination image with the top left corner offset
10680%        relative to the polar mapping center.
10681%
10682%        Bilinear has no simple inverse mapping so will not allow 'bestfit'
10683%        style of image sparseion.
10684%
10685%        Affine, Perspective, and Bilinear, will do least squares fitting of
10686%        the distrotion when more than the minimum number of control point
10687%        pairs are provided.
10688%
10689%        Perspective, and Bilinear, will fall back to a Affine sparseion when
10690%        less than 4 control point pairs are provided. While Affine sparseions
10691%        will let you use any number of control point pairs, that is Zero pairs
10692%        is a No-Op (viewport only) distrotion, one pair is a translation and
10693%        two pairs of control points will do a scale-rotate-translate, without
10694%        any shearing.
10695%
10696%    o number_arguments: the number of arguments given for this sparseion
10697%      method.
10698%
10699%    o arguments: the arguments for this sparseion method.
10700%
10701*/
10702WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10703  const SparseColorMethod method,const size_t number_arguments,
10704  const double *arguments)
10705{
10706  Image
10707    *sparse_image;
10708
10709  assert(wand != (MagickWand *) NULL);
10710  assert(wand->signature == WandSignature);
10711  if (wand->debug != MagickFalse)
10712    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10713  if (wand->images == (Image *) NULL)
10714    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10715  sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
10716    wand->exception);
10717  if (sparse_image == (Image *) NULL)
10718    return(MagickFalse);
10719  ReplaceImageInList(&wand->images,sparse_image);
10720  return(MagickTrue);
10721}
10722
10723/*
10724%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10725%                                                                             %
10726%                                                                             %
10727%                                                                             %
10728%   M a g i c k S p l i c e I m a g e                                         %
10729%                                                                             %
10730%                                                                             %
10731%                                                                             %
10732%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10733%
10734%  MagickSpliceImage() splices a solid color into the image.
10735%
10736%  The format of the MagickSpliceImage method is:
10737%
10738%      MagickBooleanType MagickSpliceImage(MagickWand *wand,
10739%        const size_t width,const size_t height,const ssize_t x,
10740%        const ssize_t y)
10741%
10742%  A description of each parameter follows:
10743%
10744%    o wand: the magick wand.
10745%
10746%    o width: the region width.
10747%
10748%    o height: the region height.
10749%
10750%    o x: the region x offset.
10751%
10752%    o y: the region y offset.
10753%
10754*/
10755WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
10756  const size_t width,const size_t height,const ssize_t x,
10757  const ssize_t y)
10758{
10759  Image
10760    *splice_image;
10761
10762  RectangleInfo
10763    splice;
10764
10765  assert(wand != (MagickWand *) NULL);
10766  assert(wand->signature == WandSignature);
10767  if (wand->debug != MagickFalse)
10768    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10769  if (wand->images == (Image *) NULL)
10770    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10771  splice.width=width;
10772  splice.height=height;
10773  splice.x=x;
10774  splice.y=y;
10775  splice_image=SpliceImage(wand->images,&splice,wand->exception);
10776  if (splice_image == (Image *) NULL)
10777    return(MagickFalse);
10778  ReplaceImageInList(&wand->images,splice_image);
10779  return(MagickTrue);
10780}
10781
10782/*
10783%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10784%                                                                             %
10785%                                                                             %
10786%                                                                             %
10787%   M a g i c k S p r e a d I m a g e                                         %
10788%                                                                             %
10789%                                                                             %
10790%                                                                             %
10791%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10792%
10793%  MagickSpreadImage() is a special effects method that randomly displaces each
10794%  pixel in a block defined by the radius parameter.
10795%
10796%  The format of the MagickSpreadImage method is:
10797%
10798%      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius)
10799%
10800%  A description of each parameter follows:
10801%
10802%    o wand: the magick wand.
10803%
10804%    o radius:  Choose a random pixel in a neighborhood of this extent.
10805%
10806*/
10807WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
10808  const double radius)
10809{
10810  Image
10811    *spread_image;
10812
10813  assert(wand != (MagickWand *) NULL);
10814  assert(wand->signature == WandSignature);
10815  if (wand->debug != MagickFalse)
10816    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10817  if (wand->images == (Image *) NULL)
10818    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10819  spread_image=SpreadImage(wand->images,radius,wand->exception);
10820  if (spread_image == (Image *) NULL)
10821    return(MagickFalse);
10822  ReplaceImageInList(&wand->images,spread_image);
10823  return(MagickTrue);
10824}
10825
10826/*
10827%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10828%                                                                             %
10829%                                                                             %
10830%                                                                             %
10831%   M a g i c k S t a t i s t i c I m a g e                                   %
10832%                                                                             %
10833%                                                                             %
10834%                                                                             %
10835%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10836%
10837%  MagickStatisticImage() replace each pixel with corresponding statistic from
10838%  the neighborhood of the specified width and height.
10839%
10840%  The format of the MagickStatisticImage method is:
10841%
10842%      MagickBooleanType MagickStatisticImage(MagickWand *wand,
10843%        const StatisticType type,const double width,const size_t height)
10844%
10845%  A description of each parameter follows:
10846%
10847%    o wand: the magick wand.
10848%
10849%    o type: the statistic type (e.g. median, mode, etc.).
10850%
10851%    o width: the width of the pixel neighborhood.
10852%
10853%    o height: the height of the pixel neighborhood.
10854%
10855*/
10856WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
10857  const StatisticType type,const size_t width,const size_t height)
10858{
10859  Image
10860    *statistic_image;
10861
10862  assert(wand != (MagickWand *) NULL);
10863  assert(wand->signature == WandSignature);
10864  if (wand->debug != MagickFalse)
10865    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10866  if (wand->images == (Image *) NULL)
10867    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10868  statistic_image=StatisticImage(wand->images,type,width,height,
10869    wand->exception);
10870  if (statistic_image == (Image *) NULL)
10871    return(MagickFalse);
10872  ReplaceImageInList(&wand->images,statistic_image);
10873  return(MagickTrue);
10874}
10875
10876/*
10877%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10878%                                                                             %
10879%                                                                             %
10880%                                                                             %
10881%   M a g i c k S t e g a n o I m a g e                                       %
10882%                                                                             %
10883%                                                                             %
10884%                                                                             %
10885%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10886%
10887%  MagickSteganoImage() hides a digital watermark within the image.
10888%  Recover the hidden watermark later to prove that the authenticity of
10889%  an image.  Offset defines the start position within the image to hide
10890%  the watermark.
10891%
10892%  The format of the MagickSteganoImage method is:
10893%
10894%      MagickWand *MagickSteganoImage(MagickWand *wand,
10895%        const MagickWand *watermark_wand,const ssize_t offset)
10896%
10897%  A description of each parameter follows:
10898%
10899%    o wand: the magick wand.
10900%
10901%    o watermark_wand: the watermark wand.
10902%
10903%    o offset: Start hiding at this offset into the image.
10904%
10905*/
10906WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
10907  const MagickWand *watermark_wand,const ssize_t offset)
10908{
10909  Image
10910    *stegano_image;
10911
10912  assert(wand != (MagickWand *) NULL);
10913  assert(wand->signature == WandSignature);
10914  if (wand->debug != MagickFalse)
10915    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10916  if ((wand->images == (Image *) NULL) ||
10917      (watermark_wand->images == (Image *) NULL))
10918    {
10919      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10920        "ContainsNoImages","`%s'",wand->name);
10921      return((MagickWand *) NULL);
10922    }
10923  wand->images->offset=offset;
10924  stegano_image=SteganoImage(wand->images,watermark_wand->images,
10925    wand->exception);
10926  if (stegano_image == (Image *) NULL)
10927    return((MagickWand *) NULL);
10928  return(CloneMagickWandFromImages(wand,stegano_image));
10929}
10930
10931/*
10932%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10933%                                                                             %
10934%                                                                             %
10935%                                                                             %
10936%   M a g i c k S t e r e o I m a g e                                         %
10937%                                                                             %
10938%                                                                             %
10939%                                                                             %
10940%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10941%
10942%  MagickStereoImage() composites two images and produces a single image that
10943%  is the composite of a left and right image of a stereo pair
10944%
10945%  The format of the MagickStereoImage method is:
10946%
10947%      MagickWand *MagickStereoImage(MagickWand *wand,
10948%        const MagickWand *offset_wand)
10949%
10950%  A description of each parameter follows:
10951%
10952%    o wand: the magick wand.
10953%
10954%    o offset_wand: Another image wand.
10955%
10956*/
10957WandExport MagickWand *MagickStereoImage(MagickWand *wand,
10958  const MagickWand *offset_wand)
10959{
10960  Image
10961    *stereo_image;
10962
10963  assert(wand != (MagickWand *) NULL);
10964  assert(wand->signature == WandSignature);
10965  if (wand->debug != MagickFalse)
10966    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10967  if ((wand->images == (Image *) NULL) ||
10968      (offset_wand->images == (Image *) NULL))
10969    {
10970      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10971        "ContainsNoImages","`%s'",wand->name);
10972      return((MagickWand *) NULL);
10973    }
10974  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
10975  if (stereo_image == (Image *) NULL)
10976    return((MagickWand *) NULL);
10977  return(CloneMagickWandFromImages(wand,stereo_image));
10978}
10979
10980/*
10981%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10982%                                                                             %
10983%                                                                             %
10984%                                                                             %
10985%   M a g i c k S t r i p I m a g e                                           %
10986%                                                                             %
10987%                                                                             %
10988%                                                                             %
10989%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10990%
10991%  MagickStripImage() strips an image of all profiles and comments.
10992%
10993%  The format of the MagickStripImage method is:
10994%
10995%      MagickBooleanType MagickStripImage(MagickWand *wand)
10996%
10997%  A description of each parameter follows:
10998%
10999%    o wand: the magick wand.
11000%
11001*/
11002WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11003{
11004  MagickBooleanType
11005    status;
11006
11007  assert(wand != (MagickWand *) NULL);
11008  assert(wand->signature == WandSignature);
11009  if (wand->debug != MagickFalse)
11010    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11011  if (wand->images == (Image *) NULL)
11012    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11013  status=StripImage(wand->images);
11014  if (status == MagickFalse)
11015    InheritException(wand->exception,&wand->images->exception);
11016  return(status);
11017}
11018
11019/*
11020%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11021%                                                                             %
11022%                                                                             %
11023%                                                                             %
11024%   M a g i c k S w i r l I m a g e                                           %
11025%                                                                             %
11026%                                                                             %
11027%                                                                             %
11028%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11029%
11030%  MagickSwirlImage() swirls the pixels about the center of the image, where
11031%  degrees indicates the sweep of the arc through which each pixel is moved.
11032%  You get a more dramatic effect as the degrees move from 1 to 360.
11033%
11034%  The format of the MagickSwirlImage method is:
11035%
11036%      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees)
11037%
11038%  A description of each parameter follows:
11039%
11040%    o wand: the magick wand.
11041%
11042%    o degrees: Define the tightness of the swirling effect.
11043%
11044*/
11045WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11046  const double degrees)
11047{
11048  Image
11049    *swirl_image;
11050
11051  assert(wand != (MagickWand *) NULL);
11052  assert(wand->signature == WandSignature);
11053  if (wand->debug != MagickFalse)
11054    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11055  if (wand->images == (Image *) NULL)
11056    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11057  swirl_image=SwirlImage(wand->images,degrees,wand->exception);
11058  if (swirl_image == (Image *) NULL)
11059    return(MagickFalse);
11060  ReplaceImageInList(&wand->images,swirl_image);
11061  return(MagickTrue);
11062}
11063
11064/*
11065%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11066%                                                                             %
11067%                                                                             %
11068%                                                                             %
11069%   M a g i c k T e x t u r e I m a g e                                       %
11070%                                                                             %
11071%                                                                             %
11072%                                                                             %
11073%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11074%
11075%  MagickTextureImage() repeatedly tiles the texture image across and down the
11076%  image canvas.
11077%
11078%  The format of the MagickTextureImage method is:
11079%
11080%      MagickWand *MagickTextureImage(MagickWand *wand,
11081%        const MagickWand *texture_wand)
11082%
11083%  A description of each parameter follows:
11084%
11085%    o wand: the magick wand.
11086%
11087%    o texture_wand: the texture wand
11088%
11089*/
11090WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11091  const MagickWand *texture_wand)
11092{
11093  Image
11094    *texture_image;
11095
11096  MagickBooleanType
11097    status;
11098
11099  assert(wand != (MagickWand *) NULL);
11100  assert(wand->signature == WandSignature);
11101  if (wand->debug != MagickFalse)
11102    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11103  if ((wand->images == (Image *) NULL) ||
11104      (texture_wand->images == (Image *) NULL))
11105    {
11106      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11107        "ContainsNoImages","`%s'",wand->name);
11108      return((MagickWand *) NULL);
11109    }
11110  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11111  if (texture_image == (Image *) NULL)
11112    return((MagickWand *) NULL);
11113  status=TextureImage(texture_image,texture_wand->images);
11114  if (status == MagickFalse)
11115    {
11116      InheritException(wand->exception,&texture_image->exception);
11117      texture_image=DestroyImage(texture_image);
11118      return((MagickWand *) NULL);
11119    }
11120  return(CloneMagickWandFromImages(wand,texture_image));
11121}
11122
11123/*
11124%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11125%                                                                             %
11126%                                                                             %
11127%                                                                             %
11128%   M a g i c k T h r e s h o l d I m a g e                                   %
11129%                                                                             %
11130%                                                                             %
11131%                                                                             %
11132%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11133%
11134%  MagickThresholdImage() changes the value of individual pixels based on
11135%  the intensity of each pixel compared to threshold.  The result is a
11136%  high-contrast, two color image.
11137%
11138%  The format of the MagickThresholdImage method is:
11139%
11140%      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11141%        const double threshold)
11142%      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11143%        const ChannelType channel,const double threshold)
11144%
11145%  A description of each parameter follows:
11146%
11147%    o wand: the magick wand.
11148%
11149%    o channel: the image channel(s).
11150%
11151%    o threshold: Define the threshold value.
11152%
11153*/
11154WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11155  const double threshold)
11156{
11157  MagickBooleanType
11158    status;
11159
11160  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11161  return(status);
11162}
11163
11164WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11165  const ChannelType channel,const double threshold)
11166{
11167  MagickBooleanType
11168    status;
11169
11170  assert(wand != (MagickWand *) NULL);
11171  assert(wand->signature == WandSignature);
11172  if (wand->debug != MagickFalse)
11173    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11174  if (wand->images == (Image *) NULL)
11175    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11176  status=BilevelImage(wand->images,threshold);
11177  if (status == MagickFalse)
11178    InheritException(wand->exception,&wand->images->exception);
11179  return(status);
11180}
11181
11182/*
11183%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11184%                                                                             %
11185%                                                                             %
11186%                                                                             %
11187%   M a g i c k T h u m b n a i l I m a g e                                   %
11188%                                                                             %
11189%                                                                             %
11190%                                                                             %
11191%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11192%
11193%  MagickThumbnailImage()  changes the size of an image to the given dimensions
11194%  and removes any associated profiles.  The goal is to produce small low cost
11195%  thumbnail images suited for display on the Web.
11196%
11197%  The format of the MagickThumbnailImage method is:
11198%
11199%      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11200%        const size_t columns,const size_t rows)
11201%
11202%  A description of each parameter follows:
11203%
11204%    o wand: the magick wand.
11205%
11206%    o columns: the number of columns in the scaled image.
11207%
11208%    o rows: the number of rows in the scaled image.
11209%
11210*/
11211WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11212  const size_t columns,const size_t rows)
11213{
11214  Image
11215    *thumbnail_image;
11216
11217  assert(wand != (MagickWand *) NULL);
11218  assert(wand->signature == WandSignature);
11219  if (wand->debug != MagickFalse)
11220    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11221  if (wand->images == (Image *) NULL)
11222    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11223  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11224  if (thumbnail_image == (Image *) NULL)
11225    return(MagickFalse);
11226  ReplaceImageInList(&wand->images,thumbnail_image);
11227  return(MagickTrue);
11228}
11229
11230/*
11231%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11232%                                                                             %
11233%                                                                             %
11234%                                                                             %
11235%   M a g i c k T i n t I m a g e                                             %
11236%                                                                             %
11237%                                                                             %
11238%                                                                             %
11239%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11240%
11241%  MagickTintImage() applies a color vector to each pixel in the image.  The
11242%  length of the vector is 0 for black and white and at its maximum for the
11243%  midtones.  The vector weighting function is
11244%  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11245%
11246%  The format of the MagickTintImage method is:
11247%
11248%      MagickBooleanType MagickTintImage(MagickWand *wand,
11249%        const PixelWand *tint,const PixelWand *opacity)
11250%
11251%  A description of each parameter follows:
11252%
11253%    o wand: the magick wand.
11254%
11255%    o tint: the tint pixel wand.
11256%
11257%    o opacity: the opacity pixel wand.
11258%
11259*/
11260WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11261  const PixelWand *tint,const PixelWand *opacity)
11262{
11263  char
11264    percent_opaque[MaxTextExtent];
11265
11266  Image
11267    *tint_image;
11268
11269  PixelPacket
11270    target;
11271
11272  assert(wand != (MagickWand *) NULL);
11273  assert(wand->signature == WandSignature);
11274  if (wand->debug != MagickFalse)
11275    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11276  if (wand->images == (Image *) NULL)
11277    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11278  (void) FormatLocaleString(percent_opaque,MaxTextExtent,
11279    "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11280    PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
11281    PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
11282    PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
11283    PixelGetOpacityQuantum(opacity)));
11284  PixelGetQuantumPacket(tint,&target);
11285  tint_image=TintImage(wand->images,percent_opaque,target,wand->exception);
11286  if (tint_image == (Image *) NULL)
11287    return(MagickFalse);
11288  ReplaceImageInList(&wand->images,tint_image);
11289  return(MagickTrue);
11290}
11291
11292/*
11293%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11294%                                                                             %
11295%                                                                             %
11296%                                                                             %
11297%   M a g i c k T r a n s f o r m I m a g e                                   %
11298%                                                                             %
11299%                                                                             %
11300%                                                                             %
11301%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11302%
11303%  MagickTransformImage() is a convenience method that behaves like
11304%  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11305%  information as a region geometry specification.  If the operation fails,
11306%  a NULL image handle is returned.
11307%
11308%  The format of the MagickTransformImage method is:
11309%
11310%      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11311%        const char *geometry)
11312%
11313%  A description of each parameter follows:
11314%
11315%    o wand: the magick wand.
11316%
11317%    o crop: A crop geometry string.  This geometry defines a subregion of the
11318%      image to crop.
11319%
11320%    o geometry: An image geometry string.  This geometry defines the final
11321%      size of the image.
11322%
11323*/
11324WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11325  const char *crop,const char *geometry)
11326{
11327  Image
11328    *transform_image;
11329
11330  MagickBooleanType
11331    status;
11332
11333  assert(wand != (MagickWand *) NULL);
11334  assert(wand->signature == WandSignature);
11335  if (wand->debug != MagickFalse)
11336    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11337  if (wand->images == (Image *) NULL)
11338    return((MagickWand *) NULL);
11339  transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11340  if (transform_image == (Image *) NULL)
11341    return((MagickWand *) NULL);
11342  status=TransformImage(&transform_image,crop,geometry);
11343  if (status == MagickFalse)
11344    {
11345      InheritException(wand->exception,&transform_image->exception);
11346      transform_image=DestroyImage(transform_image);
11347      return((MagickWand *) NULL);
11348    }
11349  return(CloneMagickWandFromImages(wand,transform_image));
11350}
11351
11352/*
11353%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11354%                                                                             %
11355%                                                                             %
11356%                                                                             %
11357%   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               %
11358%                                                                             %
11359%                                                                             %
11360%                                                                             %
11361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11362%
11363%  MagickTransformImageColorspace() transform the image colorspace.
11364%
11365%  The format of the MagickTransformImageColorspace method is:
11366%
11367%      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11368%        const ColorspaceType colorspace)
11369%
11370%  A description of each parameter follows:
11371%
11372%    o wand: the magick wand.
11373%
11374%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
11375%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
11376%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
11377%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
11378%      HSLColorspace, or HWBColorspace.
11379%
11380*/
11381WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11382  const ColorspaceType colorspace)
11383{
11384  assert(wand != (MagickWand *) NULL);
11385  assert(wand->signature == WandSignature);
11386  if (wand->debug != MagickFalse)
11387    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11388  if (wand->images == (Image *) NULL)
11389    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11390  return(TransformImageColorspace(wand->images,colorspace));
11391}
11392
11393/*
11394%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11395%                                                                             %
11396%                                                                             %
11397%                                                                             %
11398%   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                     %
11399%                                                                             %
11400%                                                                             %
11401%                                                                             %
11402%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11403%
11404%  MagickTransparentPaintImage() changes any pixel that matches color with the
11405%  color defined by fill.
11406%
11407%  The format of the MagickTransparentPaintImage method is:
11408%
11409%      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11410%        const PixelWand *target,const double alpha,const double fuzz,
11411%        const MagickBooleanType invert)
11412%
11413%  A description of each parameter follows:
11414%
11415%    o wand: the magick wand.
11416%
11417%    o target: Change this target color to specified opacity value within
11418%      the image.
11419%
11420%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11421%      transparent.
11422%
11423%    o fuzz: By default target must match a particular pixel color
11424%      exactly.  However, in many cases two colors may differ by a small amount.
11425%      The fuzz member of image defines how much tolerance is acceptable to
11426%      consider two colors as the same.  For example, set fuzz to 10 and the
11427%      color red at intensities of 100 and 102 respectively are now interpreted
11428%      as the same color for the purposes of the floodfill.
11429%
11430%    o invert: paint any pixel that does not match the target color.
11431%
11432*/
11433WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11434  const PixelWand *target,const double alpha,const double fuzz,
11435  const MagickBooleanType invert)
11436{
11437  MagickBooleanType
11438    status;
11439
11440  PixelInfo
11441    target_pixel;
11442
11443  assert(wand != (MagickWand *) NULL);
11444  assert(wand->signature == WandSignature);
11445  if (wand->debug != MagickFalse)
11446    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11447  if (wand->images == (Image *) NULL)
11448    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11449  PixelGetMagickColor(target,&target_pixel);
11450  wand->images->fuzz=fuzz;
11451  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11452    QuantumRange*alpha),invert);
11453  if (status == MagickFalse)
11454    InheritException(wand->exception,&wand->images->exception);
11455  return(status);
11456}
11457
11458/*
11459%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11460%                                                                             %
11461%                                                                             %
11462%                                                                             %
11463%   M a g i c k T r a n s p o s e I m a g e                                   %
11464%                                                                             %
11465%                                                                             %
11466%                                                                             %
11467%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11468%
11469%  MagickTransposeImage() creates a vertical mirror image by reflecting the
11470%  pixels around the central x-axis while rotating them 90-degrees.
11471%
11472%  The format of the MagickTransposeImage method is:
11473%
11474%      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11475%
11476%  A description of each parameter follows:
11477%
11478%    o wand: the magick wand.
11479%
11480*/
11481WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11482{
11483  Image
11484    *transpose_image;
11485
11486  assert(wand != (MagickWand *) NULL);
11487  assert(wand->signature == WandSignature);
11488  if (wand->debug != MagickFalse)
11489    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11490  if (wand->images == (Image *) NULL)
11491    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11492  transpose_image=TransposeImage(wand->images,wand->exception);
11493  if (transpose_image == (Image *) NULL)
11494    return(MagickFalse);
11495  ReplaceImageInList(&wand->images,transpose_image);
11496  return(MagickTrue);
11497}
11498
11499/*
11500%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11501%                                                                             %
11502%                                                                             %
11503%                                                                             %
11504%   M a g i c k T r a n s v e r s e I m a g e                                 %
11505%                                                                             %
11506%                                                                             %
11507%                                                                             %
11508%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11509%
11510%  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11511%  pixels around the central y-axis while rotating them 270-degrees.
11512%
11513%  The format of the MagickTransverseImage method is:
11514%
11515%      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11516%
11517%  A description of each parameter follows:
11518%
11519%    o wand: the magick wand.
11520%
11521*/
11522WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11523{
11524  Image
11525    *transverse_image;
11526
11527  assert(wand != (MagickWand *) NULL);
11528  assert(wand->signature == WandSignature);
11529  if (wand->debug != MagickFalse)
11530    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11531  if (wand->images == (Image *) NULL)
11532    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11533  transverse_image=TransverseImage(wand->images,wand->exception);
11534  if (transverse_image == (Image *) NULL)
11535    return(MagickFalse);
11536  ReplaceImageInList(&wand->images,transverse_image);
11537  return(MagickTrue);
11538}
11539
11540/*
11541%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11542%                                                                             %
11543%                                                                             %
11544%                                                                             %
11545%   M a g i c k T r i m I m a g e                                             %
11546%                                                                             %
11547%                                                                             %
11548%                                                                             %
11549%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11550%
11551%  MagickTrimImage() remove edges that are the background color from the image.
11552%
11553%  The format of the MagickTrimImage method is:
11554%
11555%      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11556%
11557%  A description of each parameter follows:
11558%
11559%    o wand: the magick wand.
11560%
11561%    o fuzz: By default target must match a particular pixel color
11562%      exactly.  However, in many cases two colors may differ by a small amount.
11563%      The fuzz member of image defines how much tolerance is acceptable to
11564%      consider two colors as the same.  For example, set fuzz to 10 and the
11565%      color red at intensities of 100 and 102 respectively are now interpreted
11566%      as the same color for the purposes of the floodfill.
11567%
11568*/
11569WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11570{
11571  Image
11572    *trim_image;
11573
11574  assert(wand != (MagickWand *) NULL);
11575  assert(wand->signature == WandSignature);
11576  if (wand->debug != MagickFalse)
11577    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11578  if (wand->images == (Image *) NULL)
11579    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11580  wand->images->fuzz=fuzz;
11581  trim_image=TrimImage(wand->images,wand->exception);
11582  if (trim_image == (Image *) NULL)
11583    return(MagickFalse);
11584  ReplaceImageInList(&wand->images,trim_image);
11585  return(MagickTrue);
11586}
11587
11588/*
11589%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11590%                                                                             %
11591%                                                                             %
11592%                                                                             %
11593%   M a g i c k U n i q u e I m a g e C o l o r s                             %
11594%                                                                             %
11595%                                                                             %
11596%                                                                             %
11597%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11598%
11599%  MagickUniqueImageColors() discards all but one of any pixel color.
11600%
11601%  The format of the MagickUniqueImageColors method is:
11602%
11603%      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11604%
11605%  A description of each parameter follows:
11606%
11607%    o wand: the magick wand.
11608%
11609*/
11610WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11611{
11612  Image
11613    *unique_image;
11614
11615  assert(wand != (MagickWand *) NULL);
11616  assert(wand->signature == WandSignature);
11617  if (wand->debug != MagickFalse)
11618    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11619  if (wand->images == (Image *) NULL)
11620    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11621  unique_image=UniqueImageColors(wand->images,wand->exception);
11622  if (unique_image == (Image *) NULL)
11623    return(MagickFalse);
11624  ReplaceImageInList(&wand->images,unique_image);
11625  return(MagickTrue);
11626}
11627
11628/*
11629%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11630%                                                                             %
11631%                                                                             %
11632%                                                                             %
11633%   M a g i c k U n s h a r p M a s k I m a g e                               %
11634%                                                                             %
11635%                                                                             %
11636%                                                                             %
11637%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11638%
11639%  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
11640%  Gaussian operator of the given radius and standard deviation (sigma).
11641%  For reasonable results, radius should be larger than sigma.  Use a radius
11642%  of 0 and UnsharpMaskImage() selects a suitable radius for you.
11643%
11644%  The format of the MagickUnsharpMaskImage method is:
11645%
11646%      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11647%        const double radius,const double sigma,const double amount,
11648%        const double threshold)
11649%
11650%  A description of each parameter follows:
11651%
11652%    o wand: the magick wand.
11653%
11654%    o radius: the radius of the Gaussian, in pixels, not counting the center
11655%      pixel.
11656%
11657%    o sigma: the standard deviation of the Gaussian, in pixels.
11658%
11659%    o amount: the percentage of the difference between the original and the
11660%      blur image that is added back into the original.
11661%
11662%    o threshold: the threshold in pixels needed to apply the diffence amount.
11663%
11664*/
11665WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11666  const double radius,const double sigma,const double amount,
11667  const double threshold)
11668{
11669  Image
11670    *unsharp_image;
11671
11672  assert(wand != (MagickWand *) NULL);
11673  assert(wand->signature == WandSignature);
11674  if (wand->debug != MagickFalse)
11675    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11676  if (wand->images == (Image *) NULL)
11677    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11678  unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
11679    wand->exception);
11680  if (unsharp_image == (Image *) NULL)
11681    return(MagickFalse);
11682  ReplaceImageInList(&wand->images,unsharp_image);
11683  return(MagickTrue);
11684}
11685
11686/*
11687%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11688%                                                                             %
11689%                                                                             %
11690%                                                                             %
11691%   M a g i c k V i g n e t t e I m a g e                                     %
11692%                                                                             %
11693%                                                                             %
11694%                                                                             %
11695%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11696%
11697%  MagickVignetteImage() softens the edges of the image in vignette style.
11698%
11699%  The format of the MagickVignetteImage method is:
11700%
11701%      MagickBooleanType MagickVignetteImage(MagickWand *wand,
11702%        const double black_point,const double white_point,const ssize_t x,
11703%        const ssize_t y)
11704%
11705%  A description of each parameter follows:
11706%
11707%    o wand: the magick wand.
11708%
11709%    o black_point: the black point.
11710%
11711%    o white_point: the white point.
11712%
11713%    o x, y:  Define the x and y ellipse offset.
11714%
11715*/
11716WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
11717  const double black_point,const double white_point,const ssize_t x,const ssize_t y)
11718{
11719  Image
11720    *vignette_image;
11721
11722  assert(wand != (MagickWand *) NULL);
11723  assert(wand->signature == WandSignature);
11724  if (wand->debug != MagickFalse)
11725    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11726  if (wand->images == (Image *) NULL)
11727    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11728  vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
11729    wand->exception);
11730  if (vignette_image == (Image *) NULL)
11731    return(MagickFalse);
11732  ReplaceImageInList(&wand->images,vignette_image);
11733  return(MagickTrue);
11734}
11735
11736/*
11737%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11738%                                                                             %
11739%                                                                             %
11740%                                                                             %
11741%   M a g i c k W a v e I m a g e                                             %
11742%                                                                             %
11743%                                                                             %
11744%                                                                             %
11745%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11746%
11747%  MagickWaveImage()  creates a "ripple" effect in the image by shifting
11748%  the pixels vertically along a sine wave whose amplitude and wavelength
11749%  is specified by the given parameters.
11750%
11751%  The format of the MagickWaveImage method is:
11752%
11753%      MagickBooleanType MagickWaveImage(MagickWand *wand,const double amplitude,
11754%        const double wave_length)
11755%
11756%  A description of each parameter follows:
11757%
11758%    o wand: the magick wand.
11759%
11760%    o amplitude, wave_length:  Define the amplitude and wave length of the
11761%      sine wave.
11762%
11763*/
11764WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
11765  const double amplitude,const double wave_length)
11766{
11767  Image
11768    *wave_image;
11769
11770  assert(wand != (MagickWand *) NULL);
11771  assert(wand->signature == WandSignature);
11772  if (wand->debug != MagickFalse)
11773    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11774  if (wand->images == (Image *) NULL)
11775    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11776  wave_image=WaveImage(wand->images,amplitude,wave_length,wand->exception);
11777  if (wave_image == (Image *) NULL)
11778    return(MagickFalse);
11779  ReplaceImageInList(&wand->images,wave_image);
11780  return(MagickTrue);
11781}
11782
11783/*
11784%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11785%                                                                             %
11786%                                                                             %
11787%                                                                             %
11788%   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                         %
11789%                                                                             %
11790%                                                                             %
11791%                                                                             %
11792%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11793%
11794%  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
11795%  above the threshold into white while leaving all pixels below the threshold
11796%  unchanged.
11797%
11798%  The format of the MagickWhiteThresholdImage method is:
11799%
11800%      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11801%        const PixelWand *threshold)
11802%
11803%  A description of each parameter follows:
11804%
11805%    o wand: the magick wand.
11806%
11807%    o threshold: the pixel wand.
11808%
11809*/
11810WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11811  const PixelWand *threshold)
11812{
11813  char
11814    thresholds[MaxTextExtent];
11815
11816  MagickBooleanType
11817    status;
11818
11819  assert(wand != (MagickWand *) NULL);
11820  assert(wand->signature == WandSignature);
11821  if (wand->debug != MagickFalse)
11822    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11823  if (wand->images == (Image *) NULL)
11824    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11825  (void) FormatLocaleString(thresholds,MaxTextExtent,
11826    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
11827    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
11828    PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
11829  status=WhiteThresholdImage(wand->images,thresholds,&wand->images->exception);
11830  if (status == MagickFalse)
11831    InheritException(wand->exception,&wand->images->exception);
11832  return(status);
11833}
11834
11835/*
11836%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11837%                                                                             %
11838%                                                                             %
11839%                                                                             %
11840%   M a g i c k W r i t e I m a g e                                           %
11841%                                                                             %
11842%                                                                             %
11843%                                                                             %
11844%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11845%
11846%  MagickWriteImage() writes an image to the specified filename.  If the
11847%  filename parameter is NULL, the image is written to the filename set
11848%  by MagickReadImage() or MagickSetImageFilename().
11849%
11850%  The format of the MagickWriteImage method is:
11851%
11852%      MagickBooleanType MagickWriteImage(MagickWand *wand,
11853%        const char *filename)
11854%
11855%  A description of each parameter follows:
11856%
11857%    o wand: the magick wand.
11858%
11859%    o filename: the image filename.
11860%
11861%
11862*/
11863WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
11864  const char *filename)
11865{
11866  Image
11867    *image;
11868
11869  ImageInfo
11870    *write_info;
11871
11872  MagickBooleanType
11873    status;
11874
11875  assert(wand != (MagickWand *) NULL);
11876  assert(wand->signature == WandSignature);
11877  if (wand->debug != MagickFalse)
11878    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11879  if (wand->images == (Image *) NULL)
11880    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11881  if (filename != (const char *) NULL)
11882    (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
11883  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11884  if (image == (Image *) NULL)
11885    return(MagickFalse);
11886  write_info=CloneImageInfo(wand->image_info);
11887  write_info->adjoin=MagickTrue;
11888  status=WriteImage(write_info,image);
11889  if (status == MagickFalse)
11890    InheritException(wand->exception,&image->exception);
11891  image=DestroyImage(image);
11892  write_info=DestroyImageInfo(write_info);
11893  return(status);
11894}
11895
11896/*
11897%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11898%                                                                             %
11899%                                                                             %
11900%                                                                             %
11901%   M a g i c k W r i t e I m a g e F i l e                                   %
11902%                                                                             %
11903%                                                                             %
11904%                                                                             %
11905%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11906%
11907%  MagickWriteImageFile() writes an image to an open file descriptor.
11908%
11909%  The format of the MagickWriteImageFile method is:
11910%
11911%      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11912%
11913%  A description of each parameter follows:
11914%
11915%    o wand: the magick wand.
11916%
11917%    o file: the file descriptor.
11918%
11919*/
11920WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11921{
11922  Image
11923    *image;
11924
11925  ImageInfo
11926    *write_info;
11927
11928  MagickBooleanType
11929    status;
11930
11931  assert(wand != (MagickWand *) NULL);
11932  assert(wand->signature == WandSignature);
11933  assert(file != (FILE *) NULL);
11934  if (wand->debug != MagickFalse)
11935    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11936  if (wand->images == (Image *) NULL)
11937    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11938  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11939  if (image == (Image *) NULL)
11940    return(MagickFalse);
11941  write_info=CloneImageInfo(wand->image_info);
11942  SetImageInfoFile(write_info,file);
11943  write_info->adjoin=MagickTrue;
11944  status=WriteImage(write_info,image);
11945  write_info=DestroyImageInfo(write_info);
11946  if (status == MagickFalse)
11947    InheritException(wand->exception,&image->exception);
11948  image=DestroyImage(image);
11949  return(status);
11950}
11951
11952/*
11953%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11954%                                                                             %
11955%                                                                             %
11956%                                                                             %
11957%   M a g i c k W r i t e I m a g e s                                         %
11958%                                                                             %
11959%                                                                             %
11960%                                                                             %
11961%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11962%
11963%  MagickWriteImages() writes an image or image sequence.
11964%
11965%  The format of the MagickWriteImages method is:
11966%
11967%      MagickBooleanType MagickWriteImages(MagickWand *wand,
11968%        const char *filename,const MagickBooleanType adjoin)
11969%
11970%  A description of each parameter follows:
11971%
11972%    o wand: the magick wand.
11973%
11974%    o filename: the image filename.
11975%
11976%    o adjoin: join images into a single multi-image file.
11977%
11978*/
11979WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
11980  const char *filename,const MagickBooleanType adjoin)
11981{
11982  ImageInfo
11983    *write_info;
11984
11985  MagickBooleanType
11986    status;
11987
11988  assert(wand != (MagickWand *) NULL);
11989  assert(wand->signature == WandSignature);
11990  if (wand->debug != MagickFalse)
11991    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11992  if (wand->images == (Image *) NULL)
11993    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11994  write_info=CloneImageInfo(wand->image_info);
11995  write_info->adjoin=adjoin;
11996  status=WriteImages(write_info,wand->images,filename,wand->exception);
11997  if (status == MagickFalse)
11998    InheritException(wand->exception,&wand->images->exception);
11999  write_info=DestroyImageInfo(write_info);
12000  return(status);
12001}
12002
12003/*
12004%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12005%                                                                             %
12006%                                                                             %
12007%                                                                             %
12008%   M a g i c k W r i t e I m a g e s F i l e                                 %
12009%                                                                             %
12010%                                                                             %
12011%                                                                             %
12012%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12013%
12014%  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12015%
12016%  The format of the MagickWriteImagesFile method is:
12017%
12018%      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12019%
12020%  A description of each parameter follows:
12021%
12022%    o wand: the magick wand.
12023%
12024%    o file: the file descriptor.
12025%
12026*/
12027WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12028{
12029  ImageInfo
12030    *write_info;
12031
12032  MagickBooleanType
12033    status;
12034
12035  assert(wand != (MagickWand *) NULL);
12036  assert(wand->signature == WandSignature);
12037  if (wand->debug != MagickFalse)
12038    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12039  if (wand->images == (Image *) NULL)
12040    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12041  write_info=CloneImageInfo(wand->image_info);
12042  SetImageInfoFile(write_info,file);
12043  write_info->adjoin=MagickTrue;
12044  status=WriteImages(write_info,wand->images,(const char *) NULL,
12045    wand->exception);
12046  write_info=DestroyImageInfo(write_info);
12047  if (status == MagickFalse)
12048    InheritException(wand->exception,&wand->images->exception);
12049  return(status);
12050}
12051