magick-image.c revision a99d9febe0d1682ac40a5a72ca2641db88d944d0
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%                                    Cristy                                   %
23%                                 August 2003                                 %
24%                                                                             %
25%                                                                             %
26%  Copyright 1999-2015 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#include "MagickCore/image-private.h"
55
56/*
57  Define declarations.
58*/
59#define MagickWandId  "MagickWand"
60
61/*
62%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63%                                                                             %
64%                                                                             %
65%                                                                             %
66+   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                         %
67%                                                                             %
68%                                                                             %
69%                                                                             %
70%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71%
72%  CloneMagickWandFromImages() clones the magick wand and inserts a new image
73%  list.
74%
75%  The format of the CloneMagickWandFromImages method is:
76%
77%      MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
78%        Image *images)
79%
80%  A description of each parameter follows:
81%
82%    o wand: the magick wand.
83%
84%    o images: replace the image list with these image(s).
85%
86*/
87static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
88  Image *images)
89{
90  MagickWand
91    *clone_wand;
92
93  assert(wand != (MagickWand *) NULL);
94  assert(wand->signature == WandSignature);
95  if (IfMagickTrue(wand->debug))
96    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
97  clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
98  if (clone_wand == (MagickWand *) NULL)
99    ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
100      images->filename);
101  (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
102  clone_wand->id=AcquireWandId();
103  (void) FormatLocaleString(clone_wand->name,MagickPathExtent,"%s-%.20g",
104    MagickWandId,(double) clone_wand->id);
105  clone_wand->exception=AcquireExceptionInfo();
106  InheritException(clone_wand->exception,wand->exception);
107  clone_wand->image_info=CloneImageInfo(wand->image_info);
108  clone_wand->images=images;
109  clone_wand->debug=IsEventLogging();
110  clone_wand->signature=WandSignature;
111  if (IfMagickTrue(clone_wand->debug))
112    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
113  return(clone_wand);
114}
115
116/*
117%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
118%                                                                             %
119%                                                                             %
120%                                                                             %
121%   G e t I m a g e F r o m M a g i c k W a n d                               %
122%                                                                             %
123%                                                                             %
124%                                                                             %
125%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
126%
127%  GetImageFromMagickWand() returns the current image from the magick wand.
128%
129%  The format of the GetImageFromMagickWand method is:
130%
131%      Image *GetImageFromMagickWand(const MagickWand *wand)
132%
133%  A description of each parameter follows:
134%
135%    o wand: the magick wand.
136%
137*/
138WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
139{
140  assert(wand != (MagickWand *) NULL);
141  assert(wand->signature == WandSignature);
142  if (IfMagickTrue(wand->debug))
143    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
144  if (wand->images == (Image *) NULL)
145    {
146      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
147        "ContainsNoImages","`%s'",wand->name);
148      return((Image *) NULL);
149    }
150  return(wand->images);
151}
152
153/*
154%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
155%                                                                             %
156%                                                                             %
157%                                                                             %
158%   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                       %
159%                                                                             %
160%                                                                             %
161%                                                                             %
162%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
163%
164%  MagickAdaptiveBlurImage() adaptively blurs the image by blurring
165%  less intensely near image edges and more intensely far from edges. We
166%  blur the image with a Gaussian operator of the given radius and standard
167%  deviation (sigma).  For reasonable results, radius should be larger than
168%  sigma.  Use a radius of 0 and MagickAdaptiveBlurImage() selects a
169%  suitable radius for you.
170%
171%  The format of the MagickAdaptiveBlurImage method is:
172%
173%      MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
174%        const double radius,const double sigma)
175%
176%  A description of each parameter follows:
177%
178%    o wand: the magick wand.
179%
180%    o radius: the radius of the Gaussian, in pixels, not counting the center
181%      pixel.
182%
183%    o sigma: the standard deviation of the Gaussian, in pixels.
184%
185*/
186WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
187  const double radius,const double sigma)
188{
189  Image
190    *sharp_image;
191
192  assert(wand != (MagickWand *) NULL);
193  assert(wand->signature == WandSignature);
194  if (IfMagickTrue(wand->debug))
195    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
196  if (wand->images == (Image *) NULL)
197    ThrowWandException(WandError,"ContainsNoImages",wand->name);
198  sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,wand->exception);
199  if (sharp_image == (Image *) NULL)
200    return(MagickFalse);
201  ReplaceImageInList(&wand->images,sharp_image);
202  return(MagickTrue);
203}
204
205/*
206%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
207%                                                                             %
208%                                                                             %
209%                                                                             %
210%   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                         %
211%                                                                             %
212%                                                                             %
213%                                                                             %
214%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
215%
216%  MagickAdaptiveResizeImage() adaptively resize image with data dependent
217%  triangulation.
218%
219%      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
220%        const size_t columns,const size_t rows)
221%
222%  A description of each parameter follows:
223%
224%    o wand: the magick wand.
225%
226%    o columns: the number of columns in the scaled image.
227%
228%    o rows: the number of rows in the scaled image.
229%
230*/
231WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
232  const size_t columns,const size_t rows)
233{
234  Image
235    *resize_image;
236
237  assert(wand != (MagickWand *) NULL);
238  assert(wand->signature == WandSignature);
239  if (IfMagickTrue(wand->debug))
240    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
241  if (wand->images == (Image *) NULL)
242    ThrowWandException(WandError,"ContainsNoImages",wand->name);
243  resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
244  if (resize_image == (Image *) NULL)
245    return(MagickFalse);
246  ReplaceImageInList(&wand->images,resize_image);
247  return(MagickTrue);
248}
249
250/*
251%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
252%                                                                             %
253%                                                                             %
254%                                                                             %
255%   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                       %
256%                                                                             %
257%                                                                             %
258%                                                                             %
259%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
260%
261%  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
262%  more intensely near image edges and less intensely far from edges. We
263%  sharpen the image with a Gaussian operator of the given radius and standard
264%  deviation (sigma).  For reasonable results, radius should be larger than
265%  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
266%  suitable radius for you.
267%
268%  The format of the MagickAdaptiveSharpenImage method is:
269%
270%      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
271%        const double radius,const double sigma)
272%
273%  A description of each parameter follows:
274%
275%    o wand: the magick wand.
276%
277%    o radius: the radius of the Gaussian, in pixels, not counting the center
278%      pixel.
279%
280%    o sigma: the standard deviation of the Gaussian, in pixels.
281%
282*/
283WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
284  const double radius,const double sigma)
285{
286  Image
287    *sharp_image;
288
289  assert(wand != (MagickWand *) NULL);
290  assert(wand->signature == WandSignature);
291  if (IfMagickTrue(wand->debug))
292    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
293  if (wand->images == (Image *) NULL)
294    ThrowWandException(WandError,"ContainsNoImages",wand->name);
295  sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,wand->exception);
296  if (sharp_image == (Image *) NULL)
297    return(MagickFalse);
298  ReplaceImageInList(&wand->images,sharp_image);
299  return(MagickTrue);
300}
301
302/*
303%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
304%                                                                             %
305%                                                                             %
306%                                                                             %
307%   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                   %
308%                                                                             %
309%                                                                             %
310%                                                                             %
311%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
312%
313%  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
314%  based on the range of intensity values in its local neighborhood.  This
315%  allows for thresholding of an image whose global intensity histogram
316%  doesn't contain distinctive peaks.
317%
318%  The format of the AdaptiveThresholdImage method is:
319%
320%      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
321%        const size_t width,const size_t height,const double bias)
322%
323%  A description of each parameter follows:
324%
325%    o wand: the magick wand.
326%
327%    o width: the width of the local neighborhood.
328%
329%    o height: the height of the local neighborhood.
330%
331%    o offset: the mean bias.
332%
333*/
334WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
335  const size_t width,const size_t height,const double bias)
336{
337  Image
338    *threshold_image;
339
340  assert(wand != (MagickWand *) NULL);
341  assert(wand->signature == WandSignature);
342  if (IfMagickTrue(wand->debug))
343    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
344  if (wand->images == (Image *) NULL)
345    ThrowWandException(WandError,"ContainsNoImages",wand->name);
346  threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
347    wand->exception);
348  if (threshold_image == (Image *) NULL)
349    return(MagickFalse);
350  ReplaceImageInList(&wand->images,threshold_image);
351  return(MagickTrue);
352}
353
354/*
355%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
356%                                                                             %
357%                                                                             %
358%                                                                             %
359%   M a g i c k A d d I m a g e                                               %
360%                                                                             %
361%                                                                             %
362%                                                                             %
363%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
364%
365%  MagickAddImage() adds a clone of the images from the second wand and
366%  inserts them into the first wand.
367%
368%  Use MagickSetLastIterator(), to append new images into an existing wand,
369%  current image will be set to last image so later adds with also be
370%  appened to end of wand.
371%
372%  Use MagickSetFirstIterator() to prepend new images into wand, any more
373%  images added will also be prepended before other images in the wand.
374%  However the order of a list of new images will not change.
375%
376%  Otherwise the new images will be inserted just after the current image,
377%  and any later image will also be added after this current image but
378%  before the previously added images.  Caution is advised when multiple
379%  image adds are inserted into the middle of the wand image list.
380%
381%  The format of the MagickAddImage method is:
382%
383%      MagickBooleanType MagickAddImage(MagickWand *wand,
384%        const MagickWand *add_wand)
385%
386%  A description of each parameter follows:
387%
388%    o wand: the magick wand.
389%
390%    o add_wand: A wand that contains the image list to be added
391%
392*/
393static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
394  Image *images)
395{
396  if (wand->images == (Image *) NULL)
397    {
398      /*
399        No images in wand, just add them, set current as appropriate.
400      */
401      if (IfMagickTrue(wand->insert_before))
402        wand->images=GetFirstImageInList(images);
403      else
404        wand->images=GetLastImageInList(images);
405      return(MagickTrue);
406    }
407  /* user jumped to first image, so prepend new images - remain active */
408  if (IfMagickTrue((wand->insert_before)) &&
409       (wand->images->previous == (Image *) NULL))
410    {
411      PrependImageToList(&wand->images,images);
412      wand->images=GetFirstImageInList(images);
413      return(MagickTrue);
414    }
415  /*
416    Note you should never have 'insert_before' true when current image is not
417    the first image in the wand!  That is no insert before current image, only
418    after current image
419  */
420  if (wand->images->next == (Image *) NULL)
421    {
422      /*
423        At last image, append new images.
424      */
425      InsertImageInList(&wand->images,images);
426      wand->images=GetLastImageInList(images);
427      return(MagickTrue);
428    }
429  /*
430    Insert new images, just after the current image.
431  */
432  InsertImageInList(&wand->images,images);
433  return(MagickTrue);
434}
435
436WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
437  const MagickWand *add_wand)
438{
439  Image
440    *images;
441
442  assert(wand != (MagickWand *) NULL);
443  assert(wand->signature == WandSignature);
444  if (IfMagickTrue(wand->debug))
445    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
446  assert(add_wand != (MagickWand *) NULL);
447  assert(add_wand->signature == WandSignature);
448  if (add_wand->images == (Image *) NULL)
449    ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
450  /*
451    Clone images in second wand, and insert into first.
452  */
453  images=CloneImageList(add_wand->images,wand->exception);
454  if (images == (Image *) NULL)
455    return(MagickFalse);
456  return(InsertImageInWand(wand,images));
457}
458
459/*
460%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
461%                                                                             %
462%                                                                             %
463%                                                                             %
464%     M a g i c k A d d N o i s e I m a g e                                   %
465%                                                                             %
466%                                                                             %
467%                                                                             %
468%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
469%
470%  MagickAddNoiseImage() adds random noise to the image.
471%
472%  The format of the MagickAddNoiseImage method is:
473%
474%      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
475%        const NoiseType noise_type,const double attenuate)
476%
477%  A description of each parameter follows:
478%
479%    o wand: the magick wand.
480%
481%    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
482%      Impulse, Laplacian, or Poisson.
483%
484%    o attenuate:  attenuate the random distribution.
485%
486*/
487WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
488  const NoiseType noise_type,const double attenuate)
489{
490  Image
491    *noise_image;
492
493  assert(wand != (MagickWand *) NULL);
494  assert(wand->signature == WandSignature);
495  if (IfMagickTrue(wand->debug))
496    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
497  if (wand->images == (Image *) NULL)
498    ThrowWandException(WandError,"ContainsNoImages",wand->name);
499  noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
500  if (noise_image == (Image *) NULL)
501    return(MagickFalse);
502  ReplaceImageInList(&wand->images,noise_image);
503  return(MagickTrue);
504}
505
506/*
507%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
508%                                                                             %
509%                                                                             %
510%                                                                             %
511%   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                       %
512%                                                                             %
513%                                                                             %
514%                                                                             %
515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
516%
517%  MagickAffineTransformImage() transforms an image as dictated by the affine
518%  matrix of the drawing wand.
519%
520%  The format of the MagickAffineTransformImage method is:
521%
522%      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
523%        const DrawingWand *drawing_wand)
524%
525%  A description of each parameter follows:
526%
527%    o wand: the magick wand.
528%
529%    o drawing_wand: the draw wand.
530%
531*/
532WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
533  const DrawingWand *drawing_wand)
534{
535  DrawInfo
536    *draw_info;
537
538  Image
539    *affine_image;
540
541  assert(wand != (MagickWand *) NULL);
542  assert(wand->signature == WandSignature);
543  if (IfMagickTrue(wand->debug))
544    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
545  if (wand->images == (Image *) NULL)
546    ThrowWandException(WandError,"ContainsNoImages",wand->name);
547  draw_info=PeekDrawingWand(drawing_wand);
548  if (draw_info == (DrawInfo *) NULL)
549    return(MagickFalse);
550  affine_image=AffineTransformImage(wand->images,&draw_info->affine,
551    wand->exception);
552  draw_info=DestroyDrawInfo(draw_info);
553  if (affine_image == (Image *) NULL)
554    return(MagickFalse);
555  ReplaceImageInList(&wand->images,affine_image);
556  return(MagickTrue);
557}
558
559/*
560%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
561%                                                                             %
562%                                                                             %
563%                                                                             %
564%   M a g i c k A n n o t a t e I m a g e                                     %
565%                                                                             %
566%                                                                             %
567%                                                                             %
568%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
569%
570%  MagickAnnotateImage() annotates an image with text.
571%
572%  The format of the MagickAnnotateImage method is:
573%
574%      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
575%        const DrawingWand *drawing_wand,const double x,const double y,
576%        const double angle,const char *text)
577%
578%  A description of each parameter follows:
579%
580%    o wand: the magick wand.
581%
582%    o drawing_wand: the draw wand.
583%
584%    o x: x ordinate to left of text
585%
586%    o y: y ordinate to text baseline
587%
588%    o angle: rotate text relative to this angle.
589%
590%    o text: text to draw
591%
592*/
593WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
594  const DrawingWand *drawing_wand,const double x,const double y,
595  const double angle,const char *text)
596{
597  char
598    geometry[MagickPathExtent];
599
600  DrawInfo
601    *draw_info;
602
603  MagickBooleanType
604    status;
605
606  assert(wand != (MagickWand *) NULL);
607  assert(wand->signature == WandSignature);
608  if (IfMagickTrue(wand->debug))
609    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
610  if (wand->images == (Image *) NULL)
611    ThrowWandException(WandError,"ContainsNoImages",wand->name);
612  draw_info=PeekDrawingWand(drawing_wand);
613  if (draw_info == (DrawInfo *) NULL)
614    return(MagickFalse);
615  (void) CloneString(&draw_info->text,text);
616  (void) FormatLocaleString(geometry,MagickPathExtent,"%+g%+g",x,y);
617  draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0)));
618  draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0)));
619  draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0))));
620  draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0)));
621  (void) CloneString(&draw_info->geometry,geometry);
622  status=AnnotateImage(wand->images,draw_info,wand->exception);
623  draw_info=DestroyDrawInfo(draw_info);
624  return(status);
625}
626
627/*
628%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
629%                                                                             %
630%                                                                             %
631%                                                                             %
632%   M a g i c k A n i m a t e I m a g e s                                     %
633%                                                                             %
634%                                                                             %
635%                                                                             %
636%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
637%
638%  MagickAnimateImages() animates an image or image sequence.
639%
640%  The format of the MagickAnimateImages method is:
641%
642%      MagickBooleanType MagickAnimateImages(MagickWand *wand,
643%        const char *server_name)
644%
645%  A description of each parameter follows:
646%
647%    o wand: the magick wand.
648%
649%    o server_name: the X server name.
650%
651*/
652WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
653  const char *server_name)
654{
655  MagickBooleanType
656    status;
657
658  assert(wand != (MagickWand *) NULL);
659  assert(wand->signature == WandSignature);
660  if (IfMagickTrue(wand->debug))
661    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
662  (void) CloneString(&wand->image_info->server_name,server_name);
663  status=AnimateImages(wand->image_info,wand->images,wand->exception);
664  return(status);
665}
666
667/*
668%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
669%                                                                             %
670%                                                                             %
671%                                                                             %
672%   M a g i c k A p p e n d I m a g e s                                       %
673%                                                                             %
674%                                                                             %
675%                                                                             %
676%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
677%
678%  MagickAppendImages() append the images in a wand from the current image
679%  onwards, creating a new wand with the single image result.  This is
680%  affected by the gravity and background settings of the first image.
681%
682%  Typically you would call either MagickResetIterator() or
683%  MagickSetFirstImage() before calling this function to ensure that all
684%  the images in the wand's image list will be appended together.
685%
686%  The format of the MagickAppendImages method is:
687%
688%      MagickWand *MagickAppendImages(MagickWand *wand,
689%        const MagickBooleanType stack)
690%
691%  A description of each parameter follows:
692%
693%    o wand: the magick wand.
694%
695%    o stack: By default, images are stacked left-to-right. Set stack to
696%      MagickTrue to stack them top-to-bottom.
697%
698*/
699WandExport MagickWand *MagickAppendImages(MagickWand *wand,
700  const MagickBooleanType stack)
701{
702  Image
703    *append_image;
704
705  assert(wand != (MagickWand *) NULL);
706  assert(wand->signature == WandSignature);
707  if (IfMagickTrue(wand->debug))
708    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
709  if (wand->images == (Image *) NULL)
710    return((MagickWand *) NULL);
711  append_image=AppendImages(wand->images,stack,wand->exception);
712  if (append_image == (Image *) NULL)
713    return((MagickWand *) NULL);
714  return(CloneMagickWandFromImages(wand,append_image));
715}
716
717/*
718%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
719%                                                                             %
720%                                                                             %
721%                                                                             %
722%   M a g i c k A u t o G a m m a I m a g e                                   %
723%                                                                             %
724%                                                                             %
725%                                                                             %
726%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
727%
728%  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
729%  image to try make set its gamma appropriatally.
730%
731%  The format of the MagickAutoGammaImage method is:
732%
733%      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
734%
735%  A description of each parameter follows:
736%
737%    o wand: the magick wand.
738%
739*/
740WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
741{
742  MagickBooleanType
743    status;
744
745  assert(wand != (MagickWand *) NULL);
746  assert(wand->signature == WandSignature);
747  if (IfMagickTrue(wand->debug))
748    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
749  if (wand->images == (Image *) NULL)
750    ThrowWandException(WandError,"ContainsNoImages",wand->name);
751  status=AutoGammaImage(wand->images,wand->exception);
752  return(status);
753}
754
755/*
756%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
757%                                                                             %
758%                                                                             %
759%                                                                             %
760%   M a g i c k A u t o L e v e l I m a g e                                   %
761%                                                                             %
762%                                                                             %
763%                                                                             %
764%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
765%
766%  MagickAutoLevelImage() adjusts the levels of a particular image channel by
767%  scaling the minimum and maximum values to the full quantum range.
768%
769%  The format of the MagickAutoLevelImage method is:
770%
771%      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
772%
773%  A description of each parameter follows:
774%
775%    o wand: the magick wand.
776%
777*/
778WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
779{
780  MagickBooleanType
781    status;
782
783  assert(wand != (MagickWand *) NULL);
784  assert(wand->signature == WandSignature);
785  if (IfMagickTrue(wand->debug))
786    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
787  if (wand->images == (Image *) NULL)
788    ThrowWandException(WandError,"ContainsNoImages",wand->name);
789  status=AutoLevelImage(wand->images,wand->exception);
790  return(status);
791}
792
793/*
794%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
795%                                                                             %
796%                                                                             %
797%                                                                             %
798%   M a g i c k A u t o O r i e n t I m a g e                                 %
799%                                                                             %
800%                                                                             %
801%                                                                             %
802%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
803%
804%  MagickAutoOrientImage() adjusts an image so that its orientation is suitable
805$  for viewing (i.e. top-left orientation).
806%
807%  The format of the MagickAutoOrientImage method is:
808%
809%      MagickBooleanType MagickAutoOrientImage(MagickWand *image)
810%
811%  A description of each parameter follows:
812%
813%    o wand: the magick wand.
814%
815*/
816WandExport MagickBooleanType MagickAutoOrientImage(MagickWand *wand)
817{
818
819  Image
820    *orient_image;
821
822  assert(wand != (MagickWand *) NULL);
823  assert(wand->signature == WandSignature);
824  if (wand->debug != MagickFalse)
825    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
826  if (wand->images == (Image *) NULL)
827    ThrowWandException(WandError,"ContainsNoImages",wand->name);
828  orient_image=AutoOrientImage(wand->images,wand->images->orientation,
829    wand->exception);
830  if (orient_image == (Image *) NULL)
831    return(MagickFalse);
832  ReplaceImageInList(&wand->images,orient_image);
833  return(MagickTrue);
834}
835
836/*
837%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838%                                                                             %
839%                                                                             %
840%                                                                             %
841%   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                         %
842%                                                                             %
843%                                                                             %
844%                                                                             %
845%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
846%
847%  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
848%  pixels below the threshold into black while leaving all pixels above the
849%  threshold unchanged.
850%
851%  The format of the MagickBlackThresholdImage method is:
852%
853%      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
854%        const PixelWand *threshold)
855%
856%  A description of each parameter follows:
857%
858%    o wand: the magick wand.
859%
860%    o threshold: the pixel wand.
861%
862*/
863WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
864  const PixelWand *threshold)
865{
866  char
867    thresholds[MagickPathExtent];
868
869  MagickBooleanType
870    status;
871
872  assert(wand != (MagickWand *) NULL);
873  assert(wand->signature == WandSignature);
874  if (IfMagickTrue(wand->debug))
875    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
876  if (wand->images == (Image *) NULL)
877    ThrowWandException(WandError,"ContainsNoImages",wand->name);
878  (void) FormatLocaleString(thresholds,MagickPathExtent,
879    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
880    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
881    PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
882  status=BlackThresholdImage(wand->images,thresholds,wand->exception);
883  return(status);
884}
885
886/*
887%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
888%                                                                             %
889%                                                                             %
890%                                                                             %
891%   M a g i c k B l u e S h i f t I m a g e                                   %
892%                                                                             %
893%                                                                             %
894%                                                                             %
895%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
896%
897%  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
898%  nighttime in the moonlight.
899%
900%  The format of the MagickBlueShiftImage method is:
901%
902%      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
903%        const double factor)
904%
905%  A description of each parameter follows:
906%
907%    o wand: the magick wand.
908%
909%    o factor: the blue shift factor (default 1.5)
910%
911*/
912WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
913  const double factor)
914{
915  Image
916    *shift_image;
917
918  assert(wand != (MagickWand *) NULL);
919  assert(wand->signature == WandSignature);
920  if (IfMagickTrue(wand->debug))
921    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
922  if (wand->images == (Image *) NULL)
923    ThrowWandException(WandError,"ContainsNoImages",wand->name);
924  shift_image=BlueShiftImage(wand->images,factor,wand->exception);
925  if (shift_image == (Image *) NULL)
926    return(MagickFalse);
927  ReplaceImageInList(&wand->images,shift_image);
928  return(MagickTrue);
929}
930
931/*
932%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
933%                                                                             %
934%                                                                             %
935%                                                                             %
936%   M a g i c k B l u r I m a g e                                             %
937%                                                                             %
938%                                                                             %
939%                                                                             %
940%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
941%
942%  MagickBlurImage() blurs an image.  We convolve the image with a
943%  gaussian operator of the given radius and standard deviation (sigma).
944%  For reasonable results, the radius should be larger than sigma.  Use a
945%  radius of 0 and BlurImage() selects a suitable radius for you.
946%
947%  The format of the MagickBlurImage method is:
948%
949%      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
950%        const double sigma)
951%
952%  A description of each parameter follows:
953%
954%    o wand: the magick wand.
955%
956%    o radius: the radius of the , in pixels, not counting the center
957%      pixel.
958%
959%    o sigma: the standard deviation of the , in pixels.
960%
961*/
962WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
963  const double radius,const double sigma)
964{
965  Image
966    *blur_image;
967
968  assert(wand != (MagickWand *) NULL);
969  assert(wand->signature == WandSignature);
970  if (IfMagickTrue(wand->debug))
971    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
972  if (wand->images == (Image *) NULL)
973    ThrowWandException(WandError,"ContainsNoImages",wand->name);
974  blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
975  if (blur_image == (Image *) NULL)
976    return(MagickFalse);
977  ReplaceImageInList(&wand->images,blur_image);
978  return(MagickTrue);
979}
980
981/*
982%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
983%                                                                             %
984%                                                                             %
985%                                                                             %
986%   M a g i c k B o r d e r I m a g e                                         %
987%                                                                             %
988%                                                                             %
989%                                                                             %
990%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
991%
992%  MagickBorderImage() surrounds the image with a border of the color defined
993%  by the bordercolor pixel wand.
994%
995%  The format of the MagickBorderImage method is:
996%
997%      MagickBooleanType MagickBorderImage(MagickWand *wand,
998%        const PixelWand *bordercolor,const size_t width,
999%        const size_t height,const CompositeOperator compose)
1000%
1001%  A description of each parameter follows:
1002%
1003%    o wand: the magick wand.
1004%
1005%    o bordercolor: the border color pixel wand.
1006%
1007%    o width: the border width.
1008%
1009%    o height: the border height.
1010%
1011%    o compose: the composite operator.
1012%
1013*/
1014WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
1015  const PixelWand *bordercolor,const size_t width,const size_t height,
1016  const CompositeOperator compose)
1017{
1018  Image
1019    *border_image;
1020
1021  RectangleInfo
1022    border_info;
1023
1024  assert(wand != (MagickWand *) NULL);
1025  assert(wand->signature == WandSignature);
1026  if (IfMagickTrue(wand->debug))
1027    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1028  if (wand->images == (Image *) NULL)
1029    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1030  border_info.width=width;
1031  border_info.height=height;
1032  border_info.x=0;
1033  border_info.y=0;
1034  PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
1035  border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
1036  if (border_image == (Image *) NULL)
1037    return(MagickFalse);
1038  ReplaceImageInList(&wand->images,border_image);
1039  return(MagickTrue);
1040}
1041
1042/*
1043%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1044%                                                                             %
1045%                                                                             %
1046%                                                                             %
1047%   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   %
1048%                                                                             %
1049%                                                                             %
1050%                                                                             %
1051%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1052%
1053%  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1054%  of an image.  It converts the brightness and contrast parameters into slope
1055%  and intercept and calls a polynomical function to apply to the image.
1056
1057%
1058%  The format of the MagickBrightnessContrastImage method is:
1059%
1060%      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1061%        const double brightness,const double contrast)
1062%
1063%  A description of each parameter follows:
1064%
1065%    o wand: the magick wand.
1066%
1067%    o brightness: the brightness percent (-100 .. 100).
1068%
1069%    o contrast: the contrast percent (-100 .. 100).
1070%
1071*/
1072WandExport MagickBooleanType MagickBrightnessContrastImage(
1073  MagickWand *wand,const double brightness,const double contrast)
1074{
1075  MagickBooleanType
1076    status;
1077
1078  assert(wand != (MagickWand *) NULL);
1079  assert(wand->signature == WandSignature);
1080  if (IfMagickTrue(wand->debug))
1081    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1082  if (wand->images == (Image *) NULL)
1083    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1084  status=BrightnessContrastImage(wand->images,brightness,contrast,
1085    wand->exception);
1086  return(status);
1087}
1088
1089/*
1090%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1091%                                                                             %
1092%                                                                             %
1093%                                                                             %
1094%   M a g i c k C h a n n e l F x I m a g e                                   %
1095%                                                                             %
1096%                                                                             %
1097%                                                                             %
1098%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1099%
1100%  MagickChannelFxImage() applies a channel expression to the specified image.
1101%  The expression consists of one or more channels, either mnemonic or numeric
1102%  (e.g. red, 1), separated by actions as follows:
1103%
1104%    <=>     exchange two channels (e.g. red<=>blue)
1105%    =>      transfer a channel to another (e.g. red=>green)
1106%    ,       separate channel operations (e.g. red, green)
1107%    |       read channels from next input image (e.g. red | green)
1108%    ;       write channels to next output image (e.g. red; green; blue)
1109%
1110%  A channel without a operation symbol implies extract. For example, to create
1111%  3 grayscale images from the red, green, and blue channels of an image, use:
1112%
1113%    -channel-fx "red; green; blue"
1114%
1115%  The format of the MagickChannelFxImage method is:
1116%
1117%      MagickWand *MagickChannelFxImage(MagickWand *wand,const char *expression)
1118%
1119%  A description of each parameter follows:
1120%
1121%    o wand: the magick wand.
1122%
1123%    o expression: the expression.
1124%
1125*/
1126WandExport MagickWand *MagickChannelFxImage(MagickWand *wand,
1127  const char *expression)
1128{
1129  Image
1130    *fx_image;
1131
1132  assert(wand != (MagickWand *) NULL);
1133  assert(wand->signature == WandSignature);
1134  if (IfMagickTrue(wand->debug))
1135    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1136  if (wand->images == (Image *) NULL)
1137    return((MagickWand *) NULL);
1138  fx_image=ChannelFxImage(wand->images,expression,wand->exception);
1139  if (fx_image == (Image *) NULL)
1140    return((MagickWand *) NULL);
1141  return(CloneMagickWandFromImages(wand,fx_image));
1142}
1143
1144/*
1145%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1146%                                                                             %
1147%                                                                             %
1148%                                                                             %
1149%   M a g i c k C h a r c o a l I m a g e                                     %
1150%                                                                             %
1151%                                                                             %
1152%                                                                             %
1153%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1154%
1155%  MagickCharcoalImage() simulates a charcoal drawing.
1156%
1157%  The format of the MagickCharcoalImage method is:
1158%
1159%      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1160%        const double radius,const double sigma)
1161%
1162%  A description of each parameter follows:
1163%
1164%    o wand: the magick wand.
1165%
1166%    o radius: the radius of the Gaussian, in pixels, not counting the center
1167%      pixel.
1168%
1169%    o sigma: the standard deviation of the Gaussian, in pixels.
1170%
1171*/
1172WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1173  const double radius,const double sigma)
1174{
1175  Image
1176    *charcoal_image;
1177
1178  assert(wand != (MagickWand *) NULL);
1179  assert(wand->signature == WandSignature);
1180  if (IfMagickTrue(wand->debug))
1181    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1182  if (wand->images == (Image *) NULL)
1183    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1184  charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1185  if (charcoal_image == (Image *) NULL)
1186    return(MagickFalse);
1187  ReplaceImageInList(&wand->images,charcoal_image);
1188  return(MagickTrue);
1189}
1190
1191/*
1192%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1193%                                                                             %
1194%                                                                             %
1195%                                                                             %
1196%   M a g i c k C h o p I m a g e                                             %
1197%                                                                             %
1198%                                                                             %
1199%                                                                             %
1200%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1201%
1202%  MagickChopImage() removes a region of an image and collapses the image to
1203%  occupy the removed portion
1204%
1205%  The format of the MagickChopImage method is:
1206%
1207%      MagickBooleanType MagickChopImage(MagickWand *wand,
1208%        const size_t width,const size_t height,const ssize_t x,
1209%        const ssize_t y)
1210%
1211%  A description of each parameter follows:
1212%
1213%    o wand: the magick wand.
1214%
1215%    o width: the region width.
1216%
1217%    o height: the region height.
1218%
1219%    o x: the region x offset.
1220%
1221%    o y: the region y offset.
1222%
1223%
1224*/
1225WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1226  const size_t width,const size_t height,const ssize_t x,
1227  const ssize_t y)
1228{
1229  Image
1230    *chop_image;
1231
1232  RectangleInfo
1233    chop;
1234
1235  assert(wand != (MagickWand *) NULL);
1236  assert(wand->signature == WandSignature);
1237  if (IfMagickTrue(wand->debug))
1238    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1239  if (wand->images == (Image *) NULL)
1240    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1241  chop.width=width;
1242  chop.height=height;
1243  chop.x=x;
1244  chop.y=y;
1245  chop_image=ChopImage(wand->images,&chop,wand->exception);
1246  if (chop_image == (Image *) NULL)
1247    return(MagickFalse);
1248  ReplaceImageInList(&wand->images,chop_image);
1249  return(MagickTrue);
1250}
1251
1252/*
1253%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1254%                                                                             %
1255%                                                                             %
1256%                                                                             %
1257%   M a g i c k C l a m p I m a g e                                           %
1258%                                                                             %
1259%                                                                             %
1260%                                                                             %
1261%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1262%
1263%  MagickClampImage() restricts the color range from 0 to the quantum depth.
1264%
1265%  The format of the MagickClampImage method is:
1266%
1267%      MagickBooleanType MagickClampImage(MagickWand *wand)
1268%
1269%  A description of each parameter follows:
1270%
1271%    o wand: the magick wand.
1272%
1273%    o channel: the channel.
1274%
1275*/
1276WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1277{
1278  assert(wand != (MagickWand *) NULL);
1279  assert(wand->signature == WandSignature);
1280  if (IfMagickTrue(wand->debug))
1281    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1282  if (wand->images == (Image *) NULL)
1283    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1284  return(ClampImage(wand->images,wand->exception));
1285}
1286
1287/*
1288%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1289%                                                                             %
1290%                                                                             %
1291%                                                                             %
1292%   M a g i c k C l i p I m a g e                                             %
1293%                                                                             %
1294%                                                                             %
1295%                                                                             %
1296%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1297%
1298%  MagickClipImage() clips along the first path from the 8BIM profile, if
1299%  present.
1300%
1301%  The format of the MagickClipImage method is:
1302%
1303%      MagickBooleanType MagickClipImage(MagickWand *wand)
1304%
1305%  A description of each parameter follows:
1306%
1307%    o wand: the magick wand.
1308%
1309*/
1310WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1311{
1312  MagickBooleanType
1313    status;
1314
1315  assert(wand != (MagickWand *) NULL);
1316  assert(wand->signature == WandSignature);
1317  if (IfMagickTrue(wand->debug))
1318    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1319  if (wand->images == (Image *) NULL)
1320    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1321  status=ClipImage(wand->images,wand->exception);
1322  return(status);
1323}
1324
1325/*
1326%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1327%                                                                             %
1328%                                                                             %
1329%                                                                             %
1330%   M a g i c k C l i p I m a g e P a t h                                     %
1331%                                                                             %
1332%                                                                             %
1333%                                                                             %
1334%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1335%
1336%  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1337%  present. Later operations take effect inside the path.  Id may be a number
1338%  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1339%  path.
1340%
1341%  The format of the MagickClipImagePath method is:
1342%
1343%      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1344%        const char *pathname,const MagickBooleanType inside)
1345%
1346%  A description of each parameter follows:
1347%
1348%    o wand: the magick wand.
1349%
1350%    o pathname: name of clipping path resource. If name is preceded by #, use
1351%      clipping path numbered by name.
1352%
1353%    o inside: if non-zero, later operations take effect inside clipping path.
1354%      Otherwise later operations take effect outside clipping path.
1355%
1356*/
1357WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1358  const char *pathname,const MagickBooleanType inside)
1359{
1360  MagickBooleanType
1361    status;
1362
1363  assert(wand != (MagickWand *) NULL);
1364  assert(wand->signature == WandSignature);
1365  if (IfMagickTrue(wand->debug))
1366    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1367  if (wand->images == (Image *) NULL)
1368    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1369  status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1370  return(status);
1371}
1372
1373/*
1374%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1375%                                                                             %
1376%                                                                             %
1377%                                                                             %
1378%   M a g i c k C l u t I m a g e                                             %
1379%                                                                             %
1380%                                                                             %
1381%                                                                             %
1382%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1383%
1384%  MagickClutImage() replaces colors in the image from a color lookup table.
1385%
1386%  The format of the MagickClutImage method is:
1387%
1388%      MagickBooleanType MagickClutImage(MagickWand *wand,
1389%        const MagickWand *clut_wand,const PixelInterpolateMethod method)
1390%
1391%  A description of each parameter follows:
1392%
1393%    o wand: the magick wand.
1394%
1395%    o clut_image: the clut image.
1396%
1397%    o method: the pixel interpolation method.
1398%
1399*/
1400WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1401  const MagickWand *clut_wand,const PixelInterpolateMethod method)
1402{
1403  MagickBooleanType
1404    status;
1405
1406  assert(wand != (MagickWand *) NULL);
1407  assert(wand->signature == WandSignature);
1408  if (IfMagickTrue(wand->debug))
1409    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1410  if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1411    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1412  status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1413  return(status);
1414}
1415
1416/*
1417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1418%                                                                             %
1419%                                                                             %
1420%                                                                             %
1421%   M a g i c k C o a l e s c e I m a g e s                                   %
1422%                                                                             %
1423%                                                                             %
1424%                                                                             %
1425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1426%
1427%  MagickCoalesceImages() composites a set of images while respecting any page
1428%  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1429%  typically start with an image background and each subsequent image
1430%  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1431%  where each image in the sequence is the same size as the first and
1432%  composited with the next image in the sequence.
1433%
1434%  The format of the MagickCoalesceImages method is:
1435%
1436%      MagickWand *MagickCoalesceImages(MagickWand *wand)
1437%
1438%  A description of each parameter follows:
1439%
1440%    o wand: the magick wand.
1441%
1442*/
1443WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1444{
1445  Image
1446    *coalesce_image;
1447
1448  assert(wand != (MagickWand *) NULL);
1449  assert(wand->signature == WandSignature);
1450  if (IfMagickTrue(wand->debug))
1451    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1452  if (wand->images == (Image *) NULL)
1453    return((MagickWand *) NULL);
1454  coalesce_image=CoalesceImages(wand->images,wand->exception);
1455  if (coalesce_image == (Image *) NULL)
1456    return((MagickWand *) NULL);
1457  return(CloneMagickWandFromImages(wand,coalesce_image));
1458}
1459
1460/*
1461%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1462%                                                                             %
1463%                                                                             %
1464%                                                                             %
1465%   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1466%                                                                             %
1467%                                                                             %
1468%                                                                             %
1469%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1470%
1471%  MagickColorDecisionListImage() accepts a lightweight Color Correction
1472%  Collection (CCC) file which solely contains one or more color corrections
1473%  and applies the color correction to the image.  Here is a sample CCC file:
1474%
1475%    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1476%          <ColorCorrection id="cc03345">
1477%                <SOPNode>
1478%                     <Slope> 0.9 1.2 0.5 </Slope>
1479%                     <Offset> 0.4 -0.5 0.6 </Offset>
1480%                     <Power> 1.0 0.8 1.5 </Power>
1481%                </SOPNode>
1482%                <SATNode>
1483%                     <Saturation> 0.85 </Saturation>
1484%                </SATNode>
1485%          </ColorCorrection>
1486%    </ColorCorrectionCollection>
1487%
1488%  which includes the offset, slope, and power for each of the RGB channels
1489%  as well as the saturation.
1490%
1491%  The format of the MagickColorDecisionListImage method is:
1492%
1493%      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1494%        const char *color_correction_collection)
1495%
1496%  A description of each parameter follows:
1497%
1498%    o wand: the magick wand.
1499%
1500%    o color_correction_collection: the color correction collection in XML.
1501%
1502*/
1503WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1504  const char *color_correction_collection)
1505{
1506  MagickBooleanType
1507    status;
1508
1509  assert(wand != (MagickWand *) NULL);
1510  assert(wand->signature == WandSignature);
1511  if (IfMagickTrue(wand->debug))
1512    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1513  if (wand->images == (Image *) NULL)
1514    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1515  status=ColorDecisionListImage(wand->images,color_correction_collection,
1516    wand->exception);
1517  return(status);
1518}
1519
1520/*
1521%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1522%                                                                             %
1523%                                                                             %
1524%                                                                             %
1525%   M a g i c k C o l o r i z e I m a g e                                     %
1526%                                                                             %
1527%                                                                             %
1528%                                                                             %
1529%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1530%
1531%  MagickColorizeImage() blends the fill color with each pixel in the image.
1532%
1533%  The format of the MagickColorizeImage method is:
1534%
1535%      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1536%        const PixelWand *colorize,const PixelWand *blend)
1537%
1538%  A description of each parameter follows:
1539%
1540%    o wand: the magick wand.
1541%
1542%    o colorize: the colorize pixel wand.
1543%
1544%    o alpha: the alpha pixel wand.
1545%
1546*/
1547WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1548  const PixelWand *colorize,const PixelWand *blend)
1549{
1550  char
1551    percent_blend[MagickPathExtent];
1552
1553  Image
1554    *colorize_image;
1555
1556  PixelInfo
1557    target;
1558
1559  assert(wand != (MagickWand *) NULL);
1560  assert(wand->signature == WandSignature);
1561  if (IfMagickTrue(wand->debug))
1562    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1563  if (wand->images == (Image *) NULL)
1564    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1565  GetPixelInfo(wand->images,&target);
1566  if (target.colorspace != CMYKColorspace)
1567    (void) FormatLocaleString(percent_blend,MagickPathExtent,
1568      "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1569      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1570      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1571      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1572      PixelGetAlphaQuantum(blend)));
1573  else
1574    (void) FormatLocaleString(percent_blend,MagickPathExtent,
1575      "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1576      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1577      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1578      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1579      PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1580      PixelGetAlphaQuantum(blend)));
1581  target=PixelGetPixel(colorize);
1582  colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1583    wand->exception);
1584  if (colorize_image == (Image *) NULL)
1585    return(MagickFalse);
1586  ReplaceImageInList(&wand->images,colorize_image);
1587  return(MagickTrue);
1588}
1589
1590/*
1591%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1592%                                                                             %
1593%                                                                             %
1594%                                                                             %
1595%   M a g i c k C o l o r M a t r i x I m a g e                               %
1596%                                                                             %
1597%                                                                             %
1598%                                                                             %
1599%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1600%
1601%  MagickColorMatrixImage() apply color transformation to an image. The method
1602%  permits saturation changes, hue rotation, luminance to alpha, and various
1603%  other effects.  Although variable-sized transformation matrices can be used,
1604%  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1605%  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1606%  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1607%  and offsets are normalized (divide Flash offset by 255).
1608%
1609%  The format of the MagickColorMatrixImage method is:
1610%
1611%      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1612%        const KernelInfo *color_matrix)
1613%
1614%  A description of each parameter follows:
1615%
1616%    o wand: the magick wand.
1617%
1618%    o color_matrix:  the color matrix.
1619%
1620*/
1621WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1622  const KernelInfo *color_matrix)
1623{
1624  Image
1625    *color_image;
1626
1627  assert(wand != (MagickWand *) NULL);
1628  assert(wand->signature == WandSignature);
1629  if (IfMagickTrue(wand->debug))
1630    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1631  if (color_matrix == (const KernelInfo *) NULL)
1632    return(MagickFalse);
1633  if (wand->images == (Image *) NULL)
1634    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1635  color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1636  if (color_image == (Image *) NULL)
1637    return(MagickFalse);
1638  ReplaceImageInList(&wand->images,color_image);
1639  return(MagickTrue);
1640}
1641
1642/*
1643%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1644%                                                                             %
1645%                                                                             %
1646%                                                                             %
1647%   M a g i c k C o m b i n e I m a g e s                                     %
1648%                                                                             %
1649%                                                                             %
1650%                                                                             %
1651%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1652%
1653%  MagickCombineImages() combines one or more images into a single image.  The
1654%  grayscale value of the pixels of each image in the sequence is assigned in
1655%  order to the specified  hannels of the combined image.   The typical
1656%  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1657%
1658%  The format of the MagickCombineImages method is:
1659%
1660%      MagickWand *MagickCombineImages(MagickWand *wand,
1661%        const ColorspaceType colorspace)
1662%
1663%  A description of each parameter follows:
1664%
1665%    o wand: the magick wand.
1666%
1667%    o colorspace: the colorspace.
1668%
1669*/
1670WandExport MagickWand *MagickCombineImages(MagickWand *wand,
1671  const ColorspaceType colorspace)
1672{
1673  Image
1674    *combine_image;
1675
1676  assert(wand != (MagickWand *) NULL);
1677  assert(wand->signature == WandSignature);
1678  if (IfMagickTrue(wand->debug))
1679    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1680  if (wand->images == (Image *) NULL)
1681    return((MagickWand *) NULL);
1682  combine_image=CombineImages(wand->images,colorspace,wand->exception);
1683  if (combine_image == (Image *) NULL)
1684    return((MagickWand *) NULL);
1685  return(CloneMagickWandFromImages(wand,combine_image));
1686}
1687
1688/*
1689%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1690%                                                                             %
1691%                                                                             %
1692%                                                                             %
1693%   M a g i c k C o m m e n t I m a g e                                       %
1694%                                                                             %
1695%                                                                             %
1696%                                                                             %
1697%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1698%
1699%  MagickCommentImage() adds a comment to your image.
1700%
1701%  The format of the MagickCommentImage method is:
1702%
1703%      MagickBooleanType MagickCommentImage(MagickWand *wand,
1704%        const char *comment)
1705%
1706%  A description of each parameter follows:
1707%
1708%    o wand: the magick wand.
1709%
1710%    o comment: the image comment.
1711%
1712*/
1713WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1714  const char *comment)
1715{
1716  MagickBooleanType
1717    status;
1718
1719  assert(wand != (MagickWand *) NULL);
1720  assert(wand->signature == WandSignature);
1721  if (IfMagickTrue(wand->debug))
1722    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1723  if (wand->images == (Image *) NULL)
1724    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1725  status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1726  return(status);
1727}
1728
1729/*
1730%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1731%                                                                             %
1732%                                                                             %
1733%                                                                             %
1734%   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1735%                                                                             %
1736%                                                                             %
1737%                                                                             %
1738%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1739%
1740%  MagickCompareImagesLayers() compares each image with the next in a sequence
1741%  and returns the maximum bounding region of any pixel differences it
1742%  discovers.
1743%
1744%  The format of the MagickCompareImagesLayers method is:
1745%
1746%      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1747%        const LayerMethod method)
1748%
1749%  A description of each parameter follows:
1750%
1751%    o wand: the magick wand.
1752%
1753%    o method: the compare method.
1754%
1755*/
1756WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1757  const LayerMethod method)
1758{
1759  Image
1760    *layers_image;
1761
1762  assert(wand != (MagickWand *) NULL);
1763  assert(wand->signature == WandSignature);
1764  if (IfMagickTrue(wand->debug))
1765    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1766  if (wand->images == (Image *) NULL)
1767    return((MagickWand *) NULL);
1768  layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1769  if (layers_image == (Image *) NULL)
1770    return((MagickWand *) NULL);
1771  return(CloneMagickWandFromImages(wand,layers_image));
1772}
1773
1774/*
1775%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1776%                                                                             %
1777%                                                                             %
1778%                                                                             %
1779%   M a g i c k C o m p a r e I m a g e s                                     %
1780%                                                                             %
1781%                                                                             %
1782%                                                                             %
1783%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1784%
1785%  MagickCompareImages() compares an image to a reconstructed image and returns
1786%  the specified difference image.
1787%
1788%  The format of the MagickCompareImages method is:
1789%
1790%      MagickWand *MagickCompareImages(MagickWand *wand,
1791%        const MagickWand *reference,const MetricType metric,
1792%        double *distortion)
1793%
1794%  A description of each parameter follows:
1795%
1796%    o wand: the magick wand.
1797%
1798%    o reference: the reference wand.
1799%
1800%    o metric: the metric.
1801%
1802%    o distortion: the computed distortion between the images.
1803%
1804*/
1805WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1806  const MagickWand *reference,const MetricType metric,double *distortion)
1807{
1808  Image
1809    *compare_image;
1810
1811
1812  assert(wand != (MagickWand *) NULL);
1813  assert(wand->signature == WandSignature);
1814  if (IfMagickTrue(wand->debug))
1815    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1816  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1817    {
1818      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1819        "ContainsNoImages","`%s'",wand->name);
1820      return((MagickWand *) NULL);
1821    }
1822  compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1823    wand->exception);
1824  if (compare_image == (Image *) NULL)
1825    return((MagickWand *) NULL);
1826  return(CloneMagickWandFromImages(wand,compare_image));
1827}
1828
1829/*
1830%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1831%                                                                             %
1832%                                                                             %
1833%                                                                             %
1834%   M a g i c k C o m p o s i t e I m a g e                                   %
1835%                                                                             %
1836%                                                                             %
1837%                                                                             %
1838%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1839%
1840%  MagickCompositeImage() composite one image onto another at the specified
1841%  offset.
1842%
1843%  The format of the MagickCompositeImage method is:
1844%
1845%      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1846%        const MagickWand *source_wand,const CompositeOperator compose,
1847%        const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1848%
1849%  A description of each parameter follows:
1850%
1851%    o wand: the magick wand holding the destination images
1852%
1853%    o source_image: the magick wand holding source image.
1854%
1855%    o compose: This operator affects how the composite is applied to the
1856%      image.  The default is Over.  These are some of the compose methods
1857%      availble.
1858%
1859%        OverCompositeOp       InCompositeOp         OutCompositeOp
1860%        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1861%        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1862%        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1863%        DisplaceCompositeOp
1864%
1865%    o clip_to_self: set to MagickTrue to limit composition to area composed.
1866%
1867%    o x: the column offset of the composited image.
1868%
1869%    o y: the row offset of the composited image.
1870%
1871*/
1872WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1873  const MagickWand *source_wand,const CompositeOperator compose,
1874  const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1875{
1876  MagickBooleanType
1877    status;
1878
1879  assert(wand != (MagickWand *) NULL);
1880  assert(wand->signature == WandSignature);
1881  if (IfMagickTrue(wand->debug))
1882    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1883  if ((wand->images == (Image *) NULL) ||
1884      (source_wand->images == (Image *) NULL))
1885    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1886  status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self,
1887    x,y,wand->exception);
1888  return(status);
1889}
1890
1891/*
1892%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1893%                                                                             %
1894%                                                                             %
1895%                                                                             %
1896%   M a g i c k C o m p o s i t e L a y e r s                                 %
1897%                                                                             %
1898%                                                                             %
1899%                                                                             %
1900%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1901%
1902%  MagickCompositeLayers() composite the images in the source wand over the
1903%  images in the destination wand in sequence, starting with the current
1904%  image in both lists.
1905%
1906%  Each layer from the two image lists are composted together until the end of
1907%  one of the image lists is reached.  The offset of each composition is also
1908%  adjusted to match the virtual canvas offsets of each layer. As such the
1909%  given offset is relative to the virtual canvas, and not the actual image.
1910%
1911%  Composition uses given x and y offsets, as the 'origin' location of the
1912%  source images virtual canvas (not the real image) allowing you to compose a
1913%  list of 'layer images' into the destiantioni images.  This makes it well
1914%  sutiable for directly composing 'Clears Frame Animations' or 'Coaleased
1915%  Animations' onto a static or other 'Coaleased Animation' destination image
1916%  list.  GIF disposal handling is not looked at.
1917%
1918%  Special case:- If one of the image sequences is the last image (just a
1919%  single image remaining), that image is repeatally composed with all the
1920%  images in the other image list.  Either the source or destination lists may
1921%  be the single image, for this situation.
1922%
1923%  In the case of a single destination image (or last image given), that image
1924%  will ve cloned to match the number of images remaining in the source image
1925%  list.
1926%
1927%  This is equivelent to the "-layer Composite" Shell API operator.
1928%
1929%  The format of the MagickCompositeLayers method is:
1930%
1931%      MagickBooleanType MagickCompositeLayers(MagickWand *wand,
1932%        const MagickWand *source_wand, const CompositeOperator compose,
1933%        const ssize_t x,const ssize_t y)
1934%
1935%  A description of each parameter follows:
1936%
1937%    o wand: the magick wand holding destaintion images
1938%
1939%    o source_wand: the wand holding the source images
1940%
1941%    o compose, x, y:  composition arguments
1942%
1943*/
1944WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand,
1945  const MagickWand *source_wand,const CompositeOperator compose,
1946  const ssize_t x,const ssize_t y)
1947{
1948  MagickBooleanType
1949    status;
1950
1951  assert(wand != (MagickWand *) NULL);
1952  assert(wand->signature == WandSignature);
1953  if (IfMagickTrue(wand->debug))
1954    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1955  if ((wand->images == (Image *) NULL) ||
1956      (source_wand->images == (Image *) NULL))
1957    ThrowWandException(WandError,"ContainsNoImages",wand->name);
1958  CompositeLayers(wand->images,compose,source_wand->images,x,y,wand->exception);
1959  status=MagickTrue;  /* FUTURE: determine status from exceptions */
1960  return(status);
1961}
1962
1963/*
1964%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1965%                                                                             %
1966%                                                                             %
1967%                                                                             %
1968%   M a g i c k C o n t r a s t I m a g e                                     %
1969%                                                                             %
1970%                                                                             %
1971%                                                                             %
1972%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1973%
1974%  MagickContrastImage() enhances the intensity differences between the lighter
1975%  and darker elements of the image.  Set sharpen to a value other than 0 to
1976%  increase the image contrast otherwise the contrast is reduced.
1977%
1978%  The format of the MagickContrastImage method is:
1979%
1980%      MagickBooleanType MagickContrastImage(MagickWand *wand,
1981%        const MagickBooleanType sharpen)
1982%
1983%  A description of each parameter follows:
1984%
1985%    o wand: the magick wand.
1986%
1987%    o sharpen: Increase or decrease image contrast.
1988%
1989%
1990*/
1991WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1992  const MagickBooleanType sharpen)
1993{
1994  MagickBooleanType
1995    status;
1996
1997  assert(wand != (MagickWand *) NULL);
1998  assert(wand->signature == WandSignature);
1999  if (IfMagickTrue(wand->debug))
2000    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2001  if (wand->images == (Image *) NULL)
2002    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2003  status=ContrastImage(wand->images,sharpen,wand->exception);
2004  return(status);
2005}
2006
2007/*
2008%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2009%                                                                             %
2010%                                                                             %
2011%                                                                             %
2012%   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                       %
2013%                                                                             %
2014%                                                                             %
2015%                                                                             %
2016%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2017%
2018%  MagickContrastStretchImage() enhances the contrast of a color image by
2019%  adjusting the pixels color to span the entire range of colors available.
2020%  You can also reduce the influence of a particular channel with a gamma
2021%  value of 0.
2022%
2023%  The format of the MagickContrastStretchImage method is:
2024%
2025%      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2026%        const double black_point,const double white_point)
2027%
2028%  A description of each parameter follows:
2029%
2030%    o wand: the magick wand.
2031%
2032%    o black_point: the black point.
2033%
2034%    o white_point: the white point.
2035%
2036*/
2037WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2038  const double black_point,const double white_point)
2039{
2040  MagickBooleanType
2041    status;
2042
2043  assert(wand != (MagickWand *) NULL);
2044  assert(wand->signature == WandSignature);
2045  if (IfMagickTrue(wand->debug))
2046    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2047  if (wand->images == (Image *) NULL)
2048    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2049  status=ContrastStretchImage(wand->images,black_point,white_point,
2050    wand->exception);
2051  return(status);
2052}
2053
2054/*
2055%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2056%                                                                             %
2057%                                                                             %
2058%                                                                             %
2059%   M a g i c k C o n v o l v e I m a g e                                     %
2060%                                                                             %
2061%                                                                             %
2062%                                                                             %
2063%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2064%
2065%  MagickConvolveImage() applies a custom convolution kernel to the image.
2066%
2067%  The format of the MagickConvolveImage method is:
2068%
2069%      MagickBooleanType MagickConvolveImage(MagickWand *wand,
2070%        const KernelInfo *kernel)
2071%
2072%  A description of each parameter follows:
2073%
2074%    o wand: the magick wand.
2075%
2076%    o kernel: An array of doubles representing the convolution kernel.
2077%
2078*/
2079WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2080  const KernelInfo *kernel)
2081{
2082  Image
2083    *filter_image;
2084
2085  assert(wand != (MagickWand *) NULL);
2086  assert(wand->signature == WandSignature);
2087  if (IfMagickTrue(wand->debug))
2088    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2089  if (kernel == (const KernelInfo *) NULL)
2090    return(MagickFalse);
2091  if (wand->images == (Image *) NULL)
2092    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2093  filter_image=ConvolveImage(wand->images,kernel,wand->exception);
2094  if (filter_image == (Image *) NULL)
2095    return(MagickFalse);
2096  ReplaceImageInList(&wand->images,filter_image);
2097  return(MagickTrue);
2098}
2099
2100/*
2101%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2102%                                                                             %
2103%                                                                             %
2104%                                                                             %
2105%   M a g i c k C r o p I m a g e                                             %
2106%                                                                             %
2107%                                                                             %
2108%                                                                             %
2109%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2110%
2111%  MagickCropImage() extracts a region of the image.
2112%
2113%  The format of the MagickCropImage method is:
2114%
2115%      MagickBooleanType MagickCropImage(MagickWand *wand,
2116%        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2117%
2118%  A description of each parameter follows:
2119%
2120%    o wand: the magick wand.
2121%
2122%    o width: the region width.
2123%
2124%    o height: the region height.
2125%
2126%    o x: the region x-offset.
2127%
2128%    o y: the region y-offset.
2129%
2130*/
2131WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2132  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2133{
2134  Image
2135    *crop_image;
2136
2137  RectangleInfo
2138    crop;
2139
2140  assert(wand != (MagickWand *) NULL);
2141  assert(wand->signature == WandSignature);
2142  if (IfMagickTrue(wand->debug))
2143    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2144  if (wand->images == (Image *) NULL)
2145    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2146  crop.width=width;
2147  crop.height=height;
2148  crop.x=x;
2149  crop.y=y;
2150  crop_image=CropImage(wand->images,&crop,wand->exception);
2151  if (crop_image == (Image *) NULL)
2152    return(MagickFalse);
2153  ReplaceImageInList(&wand->images,crop_image);
2154  return(MagickTrue);
2155}
2156
2157/*
2158%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2159%                                                                             %
2160%                                                                             %
2161%                                                                             %
2162%   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2163%                                                                             %
2164%                                                                             %
2165%                                                                             %
2166%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2167%
2168%  MagickCycleColormapImage() displaces an image's colormap by a given number
2169%  of positions.  If you cycle the colormap a number of times you can produce
2170%  a psychodelic effect.
2171%
2172%  The format of the MagickCycleColormapImage method is:
2173%
2174%      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2175%        const ssize_t displace)
2176%
2177%  A description of each parameter follows:
2178%
2179%    o wand: the magick wand.
2180%
2181%    o pixel_wand: the pixel wand.
2182%
2183*/
2184WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2185  const ssize_t displace)
2186{
2187  MagickBooleanType
2188    status;
2189
2190  assert(wand != (MagickWand *) NULL);
2191  assert(wand->signature == WandSignature);
2192  if (IfMagickTrue(wand->debug))
2193    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2194  if (wand->images == (Image *) NULL)
2195    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2196  status=CycleColormapImage(wand->images,displace,wand->exception);
2197  return(status);
2198}
2199
2200/*
2201%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2202%                                                                             %
2203%                                                                             %
2204%                                                                             %
2205%   M a g i c k C o n s t i t u t e I m a g e                                 %
2206%                                                                             %
2207%                                                                             %
2208%                                                                             %
2209%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2210%
2211%  MagickConstituteImage() adds an image to the wand comprised of the pixel
2212%  data you supply.  The pixel data must be in scanline order top-to-bottom.
2213%  The data can be char, short int, int, float, or double.  Float and double
2214%  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2215%  is the maximum value the type can accomodate (e.g. 255 for char).  For
2216%  example, to create a 640x480 image from unsigned red-green-blue character
2217%  data, use
2218%
2219%      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2220%
2221%  The format of the MagickConstituteImage method is:
2222%
2223%      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2224%        const size_t columns,const size_t rows,const char *map,
2225%        const StorageType storage,void *pixels)
2226%
2227%  A description of each parameter follows:
2228%
2229%    o wand: the magick wand.
2230%
2231%    o columns: width in pixels of the image.
2232%
2233%    o rows: height in pixels of the image.
2234%
2235%    o map:  This string reflects the expected ordering of the pixel array.
2236%      It can be any combination or order of R = red, G = green, B = blue,
2237%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2238%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2239%      P = pad.
2240%
2241%    o storage: Define the data type of the pixels.  Float and double types are
2242%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2243%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2244%      LongPixel, QuantumPixel, or ShortPixel.
2245%
2246%    o pixels: This array of values contain the pixel components as defined by
2247%      map and type.  You must preallocate this array where the expected
2248%      length varies depending on the values of width, height, map, and type.
2249%
2250%
2251*/
2252WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2253  const size_t columns,const size_t rows,const char *map,
2254  const StorageType storage,const void *pixels)
2255{
2256  Image
2257    *images;
2258
2259  assert(wand != (MagickWand *) NULL);
2260  assert(wand->signature == WandSignature);
2261  if (IfMagickTrue(wand->debug))
2262    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2263  images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2264  if (images == (Image *) NULL)
2265    return(MagickFalse);
2266  return(InsertImageInWand(wand,images));
2267}
2268
2269/*
2270%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2271%                                                                             %
2272%                                                                             %
2273%                                                                             %
2274%   M a g i c k D e c i p h e r I m a g e                                     %
2275%                                                                             %
2276%                                                                             %
2277%                                                                             %
2278%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2279%
2280%  MagickDecipherImage() converts cipher pixels to plain pixels.
2281%
2282%  The format of the MagickDecipherImage method is:
2283%
2284%      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2285%        const char *passphrase)
2286%
2287%  A description of each parameter follows:
2288%
2289%    o wand: the magick wand.
2290%
2291%    o passphrase: the passphrase.
2292%
2293*/
2294WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2295  const char *passphrase)
2296{
2297  assert(wand != (MagickWand *) NULL);
2298  assert(wand->signature == WandSignature);
2299  if (IfMagickTrue(wand->debug))
2300    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2301  if (wand->images == (Image *) NULL)
2302    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2303  return(DecipherImage(wand->images,passphrase,wand->exception));
2304}
2305
2306/*
2307%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2308%                                                                             %
2309%                                                                             %
2310%                                                                             %
2311%   M a g i c k D e c o n s t r u c t I m a g e s                             %
2312%                                                                             %
2313%                                                                             %
2314%                                                                             %
2315%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2316%
2317%  MagickDeconstructImages() compares each image with the next in a sequence
2318%  and returns the maximum bounding region of any pixel differences it
2319%  discovers.
2320%
2321%  The format of the MagickDeconstructImages method is:
2322%
2323%      MagickWand *MagickDeconstructImages(MagickWand *wand)
2324%
2325%  A description of each parameter follows:
2326%
2327%    o wand: the magick wand.
2328%
2329*/
2330WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2331{
2332  Image
2333    *deconstruct_image;
2334
2335  assert(wand != (MagickWand *) NULL);
2336  assert(wand->signature == WandSignature);
2337  if (IfMagickTrue(wand->debug))
2338    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2339  if (wand->images == (Image *) NULL)
2340    return((MagickWand *) NULL);
2341  deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2342    wand->exception);
2343  if (deconstruct_image == (Image *) NULL)
2344    return((MagickWand *) NULL);
2345  return(CloneMagickWandFromImages(wand,deconstruct_image));
2346}
2347
2348/*
2349%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2350%                                                                             %
2351%                                                                             %
2352%                                                                             %
2353%     M a g i c k D e s k e w I m a g e                                       %
2354%                                                                             %
2355%                                                                             %
2356%                                                                             %
2357%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2358%
2359%  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2360%  occurs in scanned images because of the camera being misaligned,
2361%  imperfections in the scanning or surface, or simply because the paper was
2362%  not placed completely flat when scanned.
2363%
2364%  The format of the MagickDeskewImage method is:
2365%
2366%      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2367%        const double threshold)
2368%
2369%  A description of each parameter follows:
2370%
2371%    o wand: the magick wand.
2372%
2373%    o threshold: separate background from foreground.
2374%
2375*/
2376WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2377  const double threshold)
2378{
2379  Image
2380    *sepia_image;
2381
2382  assert(wand != (MagickWand *) NULL);
2383  assert(wand->signature == WandSignature);
2384  if (IfMagickTrue(wand->debug))
2385    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2386  if (wand->images == (Image *) NULL)
2387    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2388  sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2389  if (sepia_image == (Image *) NULL)
2390    return(MagickFalse);
2391  ReplaceImageInList(&wand->images,sepia_image);
2392  return(MagickTrue);
2393}
2394
2395/*
2396%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2397%                                                                             %
2398%                                                                             %
2399%                                                                             %
2400%     M a g i c k D e s p e c k l e I m a g e                                 %
2401%                                                                             %
2402%                                                                             %
2403%                                                                             %
2404%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2405%
2406%  MagickDespeckleImage() reduces the speckle noise in an image while
2407%  perserving the edges of the original image.
2408%
2409%  The format of the MagickDespeckleImage method is:
2410%
2411%      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2412%
2413%  A description of each parameter follows:
2414%
2415%    o wand: the magick wand.
2416%
2417*/
2418WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2419{
2420  Image
2421    *despeckle_image;
2422
2423  assert(wand != (MagickWand *) NULL);
2424  assert(wand->signature == WandSignature);
2425  if (IfMagickTrue(wand->debug))
2426    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2427  if (wand->images == (Image *) NULL)
2428    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2429  despeckle_image=DespeckleImage(wand->images,wand->exception);
2430  if (despeckle_image == (Image *) NULL)
2431    return(MagickFalse);
2432  ReplaceImageInList(&wand->images,despeckle_image);
2433  return(MagickTrue);
2434}
2435
2436/*
2437%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2438%                                                                             %
2439%                                                                             %
2440%                                                                             %
2441%   M a g i c k D e s t r o y I m a g e                                       %
2442%                                                                             %
2443%                                                                             %
2444%                                                                             %
2445%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2446%
2447%  MagickDestroyImage() dereferences an image, deallocating memory associated
2448%  with the image if the reference count becomes zero.
2449%
2450%  The format of the MagickDestroyImage method is:
2451%
2452%      Image *MagickDestroyImage(Image *image)
2453%
2454%  A description of each parameter follows:
2455%
2456%    o image: the image.
2457%
2458*/
2459WandExport Image *MagickDestroyImage(Image *image)
2460{
2461  return(DestroyImage(image));
2462}
2463
2464/*
2465%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2466%                                                                             %
2467%                                                                             %
2468%                                                                             %
2469%   M a g i c k D i s p l a y I m a g e                                       %
2470%                                                                             %
2471%                                                                             %
2472%                                                                             %
2473%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2474%
2475%  MagickDisplayImage() displays an image.
2476%
2477%  The format of the MagickDisplayImage method is:
2478%
2479%      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2480%        const char *server_name)
2481%
2482%  A description of each parameter follows:
2483%
2484%    o wand: the magick wand.
2485%
2486%    o server_name: the X server name.
2487%
2488*/
2489WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2490  const char *server_name)
2491{
2492  Image
2493    *image;
2494
2495  MagickBooleanType
2496    status;
2497
2498  assert(wand != (MagickWand *) NULL);
2499  assert(wand->signature == WandSignature);
2500  if (IfMagickTrue(wand->debug))
2501    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2502  if (wand->images == (Image *) NULL)
2503    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2504  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2505  if (image == (Image *) NULL)
2506    return(MagickFalse);
2507  (void) CloneString(&wand->image_info->server_name,server_name);
2508  status=DisplayImages(wand->image_info,image,wand->exception);
2509  image=DestroyImage(image);
2510  return(status);
2511}
2512
2513/*
2514%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2515%                                                                             %
2516%                                                                             %
2517%                                                                             %
2518%   M a g i c k D i s p l a y I m a g e s                                     %
2519%                                                                             %
2520%                                                                             %
2521%                                                                             %
2522%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2523%
2524%  MagickDisplayImages() displays an image or image sequence.
2525%
2526%  The format of the MagickDisplayImages method is:
2527%
2528%      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2529%        const char *server_name)
2530%
2531%  A description of each parameter follows:
2532%
2533%    o wand: the magick wand.
2534%
2535%    o server_name: the X server name.
2536%
2537*/
2538WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2539  const char *server_name)
2540{
2541  MagickBooleanType
2542    status;
2543
2544  assert(wand != (MagickWand *) NULL);
2545  assert(wand->signature == WandSignature);
2546  if (IfMagickTrue(wand->debug))
2547    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2548  (void) CloneString(&wand->image_info->server_name,server_name);
2549  status=DisplayImages(wand->image_info,wand->images,wand->exception);
2550  return(status);
2551}
2552
2553/*
2554%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2555%                                                                             %
2556%                                                                             %
2557%                                                                             %
2558%   M a g i c k D i s t o r t I m a g e                                       %
2559%                                                                             %
2560%                                                                             %
2561%                                                                             %
2562%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2563%
2564%  MagickDistortImage() distorts an image using various distortion methods, by
2565%  mapping color lookups of the source image to a new destination image
2566%  usally of the same size as the source image, unless 'bestfit' is set to
2567%  true.
2568%
2569%  If 'bestfit' is enabled, and distortion allows it, the destination image is
2570%  adjusted to ensure the whole source 'image' will just fit within the final
2571%  destination image, which will be sized and offset accordingly.  Also in
2572%  many cases the virtual offset of the source image will be taken into
2573%  account in the mapping.
2574%
2575%  The format of the MagickDistortImage method is:
2576%
2577%      MagickBooleanType MagickDistortImage(MagickWand *wand,
2578%        const DistortImageMethod method,const size_t number_arguments,
2579%        const double *arguments,const MagickBooleanType bestfit)
2580%
2581%  A description of each parameter follows:
2582%
2583%    o image: the image to be distorted.
2584%
2585%    o method: the method of image distortion.
2586%
2587%        ArcDistortion always ignores the source image offset, and always
2588%        'bestfit' the destination image with the top left corner offset
2589%        relative to the polar mapping center.
2590%
2591%        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2592%        style of image distortion.
2593%
2594%        Affine, Perspective, and Bilinear, do least squares fitting of the
2595%        distortion when more than the minimum number of control point pairs
2596%        are provided.
2597%
2598%        Perspective, and Bilinear, falls back to a Affine distortion when less
2599%        that 4 control point pairs are provided. While Affine distortions let
2600%        you use any number of control point pairs, that is Zero pairs is a
2601%        no-Op (viewport only) distrotion, one pair is a translation and two
2602%        pairs of control points do a scale-rotate-translate, without any
2603%        shearing.
2604%
2605%    o number_arguments: the number of arguments given for this distortion
2606%      method.
2607%
2608%    o arguments: the arguments for this distortion method.
2609%
2610%    o bestfit: Attempt to resize destination to fit distorted source.
2611%
2612*/
2613WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2614  const DistortImageMethod method,const size_t number_arguments,
2615  const double *arguments,const MagickBooleanType bestfit)
2616{
2617  Image
2618    *distort_image;
2619
2620  assert(wand != (MagickWand *) NULL);
2621  assert(wand->signature == WandSignature);
2622  if (IfMagickTrue(wand->debug))
2623    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2624  if (wand->images == (Image *) NULL)
2625    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2626  distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2627    bestfit,wand->exception);
2628  if (distort_image == (Image *) NULL)
2629    return(MagickFalse);
2630  ReplaceImageInList(&wand->images,distort_image);
2631  return(MagickTrue);
2632}
2633
2634/*
2635%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2636%                                                                             %
2637%                                                                             %
2638%                                                                             %
2639%   M a g i c k D r a w I m a g e                                             %
2640%                                                                             %
2641%                                                                             %
2642%                                                                             %
2643%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2644%
2645%  MagickDrawImage() renders the drawing wand on the current image.
2646%
2647%  The format of the MagickDrawImage method is:
2648%
2649%      MagickBooleanType MagickDrawImage(MagickWand *wand,
2650%        const DrawingWand *drawing_wand)
2651%
2652%  A description of each parameter follows:
2653%
2654%    o wand: the magick wand.
2655%
2656%    o drawing_wand: the draw wand.
2657%
2658*/
2659WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2660  const DrawingWand *drawing_wand)
2661{
2662  char
2663    *primitive;
2664
2665  DrawInfo
2666    *draw_info;
2667
2668  MagickBooleanType
2669    status;
2670
2671  assert(wand != (MagickWand *) NULL);
2672  assert(wand->signature == WandSignature);
2673  if (IfMagickTrue(wand->debug))
2674    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2675  if (wand->images == (Image *) NULL)
2676    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2677  draw_info=PeekDrawingWand(drawing_wand);
2678  if ((draw_info == (DrawInfo *) NULL) ||
2679      (draw_info->primitive == (char *) NULL))
2680    return(MagickFalse);
2681  primitive=AcquireString(draw_info->primitive);
2682  draw_info=DestroyDrawInfo(draw_info);
2683  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2684  draw_info->primitive=primitive;
2685  status=DrawImage(wand->images,draw_info,wand->exception);
2686  draw_info=DestroyDrawInfo(draw_info);
2687  return(status);
2688}
2689
2690/*
2691%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2692%                                                                             %
2693%                                                                             %
2694%                                                                             %
2695%   M a g i c k E d g e I m a g e                                             %
2696%                                                                             %
2697%                                                                             %
2698%                                                                             %
2699%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2700%
2701%  MagickEdgeImage() enhance edges within the image with a convolution filter
2702%  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2703%  radius for you.
2704%
2705%  The format of the MagickEdgeImage method is:
2706%
2707%      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2708%
2709%  A description of each parameter follows:
2710%
2711%    o wand: the magick wand.
2712%
2713%    o radius: the radius of the pixel neighborhood.
2714%
2715*/
2716WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2717  const double radius)
2718{
2719  Image
2720    *edge_image;
2721
2722  assert(wand != (MagickWand *) NULL);
2723  assert(wand->signature == WandSignature);
2724  if (IfMagickTrue(wand->debug))
2725    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2726  if (wand->images == (Image *) NULL)
2727    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2728  edge_image=EdgeImage(wand->images,radius,wand->exception);
2729  if (edge_image == (Image *) NULL)
2730    return(MagickFalse);
2731  ReplaceImageInList(&wand->images,edge_image);
2732  return(MagickTrue);
2733}
2734
2735/*
2736%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2737%                                                                             %
2738%                                                                             %
2739%                                                                             %
2740%   M a g i c k E m b o s s I m a g e                                         %
2741%                                                                             %
2742%                                                                             %
2743%                                                                             %
2744%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2745%
2746%  MagickEmbossImage() returns a grayscale image with a three-dimensional
2747%  effect.  We convolve the image with a Gaussian operator of the given radius
2748%  and standard deviation (sigma).  For reasonable results, radius should be
2749%  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2750%  radius for you.
2751%
2752%  The format of the MagickEmbossImage method is:
2753%
2754%      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2755%        const double sigma)
2756%
2757%  A description of each parameter follows:
2758%
2759%    o wand: the magick wand.
2760%
2761%    o radius: the radius of the Gaussian, in pixels, not counting the center
2762%      pixel.
2763%
2764%    o sigma: the standard deviation of the Gaussian, in pixels.
2765%
2766*/
2767WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2768  const double radius,const double sigma)
2769{
2770  Image
2771    *emboss_image;
2772
2773  assert(wand != (MagickWand *) NULL);
2774  assert(wand->signature == WandSignature);
2775  if (IfMagickTrue(wand->debug))
2776    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2777  if (wand->images == (Image *) NULL)
2778    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2779  emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2780  if (emboss_image == (Image *) NULL)
2781    return(MagickFalse);
2782  ReplaceImageInList(&wand->images,emboss_image);
2783  return(MagickTrue);
2784}
2785
2786/*
2787%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2788%                                                                             %
2789%                                                                             %
2790%                                                                             %
2791%   M a g i c k E n c i p h e r I m a g e                                     %
2792%                                                                             %
2793%                                                                             %
2794%                                                                             %
2795%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2796%
2797%  MagickEncipherImage() converts plaint pixels to cipher pixels.
2798%
2799%  The format of the MagickEncipherImage method is:
2800%
2801%      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2802%        const char *passphrase)
2803%
2804%  A description of each parameter follows:
2805%
2806%    o wand: the magick wand.
2807%
2808%    o passphrase: the passphrase.
2809%
2810*/
2811WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2812  const char *passphrase)
2813{
2814  assert(wand != (MagickWand *) NULL);
2815  assert(wand->signature == WandSignature);
2816  if (IfMagickTrue(wand->debug))
2817    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2818  if (wand->images == (Image *) NULL)
2819    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2820  return(EncipherImage(wand->images,passphrase,wand->exception));
2821}
2822
2823/*
2824%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2825%                                                                             %
2826%                                                                             %
2827%                                                                             %
2828%   M a g i c k E n h a n c e I m a g e                                       %
2829%                                                                             %
2830%                                                                             %
2831%                                                                             %
2832%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2833%
2834%  MagickEnhanceImage() applies a digital filter that improves the quality of a
2835%  noisy image.
2836%
2837%  The format of the MagickEnhanceImage method is:
2838%
2839%      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2840%
2841%  A description of each parameter follows:
2842%
2843%    o wand: the magick wand.
2844%
2845*/
2846WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2847{
2848  Image
2849    *enhance_image;
2850
2851  assert(wand != (MagickWand *) NULL);
2852  assert(wand->signature == WandSignature);
2853  if (IfMagickTrue(wand->debug))
2854    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2855  if (wand->images == (Image *) NULL)
2856    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2857  enhance_image=EnhanceImage(wand->images,wand->exception);
2858  if (enhance_image == (Image *) NULL)
2859    return(MagickFalse);
2860  ReplaceImageInList(&wand->images,enhance_image);
2861  return(MagickTrue);
2862}
2863
2864/*
2865%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2866%                                                                             %
2867%                                                                             %
2868%                                                                             %
2869%   M a g i c k E q u a l i z e I m a g e                                     %
2870%                                                                             %
2871%                                                                             %
2872%                                                                             %
2873%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2874%
2875%  MagickEqualizeImage() equalizes the image histogram.
2876%
2877%  The format of the MagickEqualizeImage method is:
2878%
2879%      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2880%
2881%  A description of each parameter follows:
2882%
2883%    o wand: the magick wand.
2884%
2885%    o channel: the image channel(s).
2886%
2887*/
2888WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2889{
2890  MagickBooleanType
2891    status;
2892
2893  assert(wand != (MagickWand *) NULL);
2894  assert(wand->signature == WandSignature);
2895  if (IfMagickTrue(wand->debug))
2896    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2897  if (wand->images == (Image *) NULL)
2898    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2899  status=EqualizeImage(wand->images,wand->exception);
2900  return(status);
2901}
2902
2903/*
2904%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2905%                                                                             %
2906%                                                                             %
2907%                                                                             %
2908%   M a g i c k E v a l u a t e I m a g e                                     %
2909%                                                                             %
2910%                                                                             %
2911%                                                                             %
2912%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2913%
2914%  MagickEvaluateImage() applys an arithmetic, relational, or logical
2915%  expression to an image.  Use these operators to lighten or darken an image,
2916%  to increase or decrease contrast in an image, or to produce the "negative"
2917%  of an image.
2918%
2919%  The format of the MagickEvaluateImage method is:
2920%
2921%      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2922%        const MagickEvaluateOperator operator,const double value)
2923%      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2924%        const MagickEvaluateOperator operator)
2925%
2926%  A description of each parameter follows:
2927%
2928%    o wand: the magick wand.
2929%
2930%    o op: A channel operator.
2931%
2932%    o value: A value value.
2933%
2934*/
2935
2936WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2937  const MagickEvaluateOperator op)
2938{
2939  Image
2940    *evaluate_image;
2941
2942  assert(wand != (MagickWand *) NULL);
2943  assert(wand->signature == WandSignature);
2944  if (IfMagickTrue(wand->debug))
2945    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2946  if (wand->images == (Image *) NULL)
2947    return((MagickWand *) NULL);
2948  evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2949  if (evaluate_image == (Image *) NULL)
2950    return((MagickWand *) NULL);
2951  return(CloneMagickWandFromImages(wand,evaluate_image));
2952}
2953
2954WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2955  const MagickEvaluateOperator op,const double value)
2956{
2957  MagickBooleanType
2958    status;
2959
2960  assert(wand != (MagickWand *) NULL);
2961  assert(wand->signature == WandSignature);
2962  if (IfMagickTrue(wand->debug))
2963    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2964  if (wand->images == (Image *) NULL)
2965    ThrowWandException(WandError,"ContainsNoImages",wand->name);
2966  status=EvaluateImage(wand->images,op,value,wand->exception);
2967  return(status);
2968}
2969
2970/*
2971%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2972%                                                                             %
2973%                                                                             %
2974%                                                                             %
2975%   M a g i c k E x p o r t I m a g e P i x e l s                             %
2976%                                                                             %
2977%                                                                             %
2978%                                                                             %
2979%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2980%
2981%  MagickExportImagePixels() extracts pixel data from an image and returns it
2982%  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2983%  an error is encountered.  The data is returned as char, short int, int,
2984%  ssize_t, float, or double in the order specified by map.
2985%
2986%  Suppose you want to extract the first scanline of a 640x480 image as
2987%  character data in red-green-blue order:
2988%
2989%      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
2990%
2991%  The format of the MagickExportImagePixels method is:
2992%
2993%      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2994%        const ssize_t x,const ssize_t y,const size_t columns,
2995%        const size_t rows,const char *map,const StorageType storage,
2996%        void *pixels)
2997%
2998%  A description of each parameter follows:
2999%
3000%    o wand: the magick wand.
3001%
3002%    o x, y, columns, rows:  These values define the perimeter
3003%      of a region of pixels you want to extract.
3004%
3005%    o map:  This string reflects the expected ordering of the pixel array.
3006%      It can be any combination or order of R = red, G = green, B = blue,
3007%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
3008%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3009%      P = pad.
3010%
3011%    o storage: Define the data type of the pixels.  Float and double types are
3012%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
3013%      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3014%      LongPixel, QuantumPixel, or ShortPixel.
3015%
3016%    o pixels: This array of values contain the pixel components as defined by
3017%      map and type.  You must preallocate this array where the expected
3018%      length varies depending on the values of width, height, map, and type.
3019%
3020*/
3021WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3022  const ssize_t x,const ssize_t y,const size_t columns,
3023  const size_t rows,const char *map,const StorageType storage,
3024  void *pixels)
3025{
3026  MagickBooleanType
3027    status;
3028
3029  assert(wand != (MagickWand *) NULL);
3030  assert(wand->signature == WandSignature);
3031  if (IfMagickTrue(wand->debug))
3032    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3033  if (wand->images == (Image *) NULL)
3034    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3035  status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3036    storage,pixels,wand->exception);
3037  return(status);
3038}
3039
3040/*
3041%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3042%                                                                             %
3043%                                                                             %
3044%                                                                             %
3045%   M a g i c k E x t e n t I m a g e                                         %
3046%                                                                             %
3047%                                                                             %
3048%                                                                             %
3049%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3050%
3051%  MagickExtentImage() extends the image as defined by the geometry, gravity,
3052%  and wand background color.  Set the (x,y) offset of the geometry to move
3053%  the original wand relative to the extended wand.
3054%
3055%  The format of the MagickExtentImage method is:
3056%
3057%      MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
3058%        const size_t height,const ssize_t x,const ssize_t y)
3059%
3060%  A description of each parameter follows:
3061%
3062%    o wand: the magick wand.
3063%
3064%    o width: the region width.
3065%
3066%    o height: the region height.
3067%
3068%    o x: the region x offset.
3069%
3070%    o y: the region y offset.
3071%
3072*/
3073WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3074  const size_t width,const size_t height,const ssize_t x,const ssize_t y)
3075{
3076  Image
3077    *extent_image;
3078
3079  RectangleInfo
3080    extent;
3081
3082  assert(wand != (MagickWand *) NULL);
3083  assert(wand->signature == WandSignature);
3084  if (IfMagickTrue(wand->debug))
3085    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3086  if (wand->images == (Image *) NULL)
3087    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3088  extent.width=width;
3089  extent.height=height;
3090  extent.x=x;
3091  extent.y=y;
3092  extent_image=ExtentImage(wand->images,&extent,wand->exception);
3093  if (extent_image == (Image *) NULL)
3094    return(MagickFalse);
3095  ReplaceImageInList(&wand->images,extent_image);
3096  return(MagickTrue);
3097}
3098
3099/*
3100%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3101%                                                                             %
3102%                                                                             %
3103%                                                                             %
3104%   M a g i c k F l i p I m a g e                                             %
3105%                                                                             %
3106%                                                                             %
3107%                                                                             %
3108%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3109%
3110%  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3111%  around the central x-axis.
3112%
3113%  The format of the MagickFlipImage method is:
3114%
3115%      MagickBooleanType MagickFlipImage(MagickWand *wand)
3116%
3117%  A description of each parameter follows:
3118%
3119%    o wand: the magick wand.
3120%
3121*/
3122WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3123{
3124  Image
3125    *flip_image;
3126
3127  assert(wand != (MagickWand *) NULL);
3128  assert(wand->signature == WandSignature);
3129  if (IfMagickTrue(wand->debug))
3130    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3131  if (wand->images == (Image *) NULL)
3132    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3133  flip_image=FlipImage(wand->images,wand->exception);
3134  if (flip_image == (Image *) NULL)
3135    return(MagickFalse);
3136  ReplaceImageInList(&wand->images,flip_image);
3137  return(MagickTrue);
3138}
3139
3140/*
3141%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3142%                                                                             %
3143%                                                                             %
3144%                                                                             %
3145%   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                         %
3146%                                                                             %
3147%                                                                             %
3148%                                                                             %
3149%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3150%
3151%  MagickFloodfillPaintImage() changes the color value of any pixel that matches
3152%  target and is an immediate neighbor.  If the method FillToBorderMethod is
3153%  specified, the color value is changed for any neighbor pixel that does not
3154%  match the bordercolor member of image.
3155%
3156%  The format of the MagickFloodfillPaintImage method is:
3157%
3158%      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3159%        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3160%        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3161%
3162%  A description of each parameter follows:
3163%
3164%    o wand: the magick wand.
3165%
3166%    o fill: the floodfill color pixel wand.
3167%
3168%    o fuzz: By default target must match a particular pixel color
3169%      exactly.  However, in many cases two colors may differ by a small amount.
3170%      The fuzz member of image defines how much tolerance is acceptable to
3171%      consider two colors as the same.  For example, set fuzz to 10 and the
3172%      color red at intensities of 100 and 102 respectively are now interpreted
3173%      as the same color for the purposes of the floodfill.
3174%
3175%    o bordercolor: the border color pixel wand.
3176%
3177%    o x,y: the starting location of the operation.
3178%
3179%    o invert: paint any pixel that does not match the target color.
3180%
3181*/
3182WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3183  const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3184  const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3185{
3186  DrawInfo
3187    *draw_info;
3188
3189  MagickBooleanType
3190    status;
3191
3192  PixelInfo
3193    target;
3194
3195  assert(wand != (MagickWand *) NULL);
3196  assert(wand->signature == WandSignature);
3197  if (IfMagickTrue(wand->debug))
3198    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3199  if (wand->images == (Image *) NULL)
3200    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3201  draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3202  PixelGetQuantumPacket(fill,&draw_info->fill);
3203  (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
3204    wand->images->columns,y % wand->images->rows,&target,wand->exception);
3205  if (bordercolor != (PixelWand *) NULL)
3206    PixelGetMagickColor(bordercolor,&target);
3207  wand->images->fuzz=fuzz;
3208  status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3209    wand->exception);
3210  draw_info=DestroyDrawInfo(draw_info);
3211  return(status);
3212}
3213
3214/*
3215%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3216%                                                                             %
3217%                                                                             %
3218%                                                                             %
3219%   M a g i c k F l o p I m a g e                                             %
3220%                                                                             %
3221%                                                                             %
3222%                                                                             %
3223%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3224%
3225%  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3226%  around the central y-axis.
3227%
3228%  The format of the MagickFlopImage method is:
3229%
3230%      MagickBooleanType MagickFlopImage(MagickWand *wand)
3231%
3232%  A description of each parameter follows:
3233%
3234%    o wand: the magick wand.
3235%
3236*/
3237WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3238{
3239  Image
3240    *flop_image;
3241
3242  assert(wand != (MagickWand *) NULL);
3243  assert(wand->signature == WandSignature);
3244  if (IfMagickTrue(wand->debug))
3245    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3246  if (wand->images == (Image *) NULL)
3247    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3248  flop_image=FlopImage(wand->images,wand->exception);
3249  if (flop_image == (Image *) NULL)
3250    return(MagickFalse);
3251  ReplaceImageInList(&wand->images,flop_image);
3252  return(MagickTrue);
3253}
3254
3255/*
3256%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3257%                                                                             %
3258%                                                                             %
3259%                                                                             %
3260%   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                     %
3261%                                                                             %
3262%                                                                             %
3263%                                                                             %
3264%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3265%
3266%  MagickForwardFourierTransformImage() implements the discrete Fourier
3267%  transform (DFT) of the image either as a magnitude / phase or real /
3268%  imaginary image pair.
3269%
3270%  The format of the MagickForwardFourierTransformImage method is:
3271%
3272%      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3273%        const MagickBooleanType magnitude)
3274%
3275%  A description of each parameter follows:
3276%
3277%    o wand: the magick wand.
3278%
3279%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3280%      imaginary image pair.
3281%
3282*/
3283WandExport MagickBooleanType MagickForwardFourierTransformImage(
3284  MagickWand *wand,const MagickBooleanType magnitude)
3285{
3286  Image
3287    *forward_image;
3288
3289  assert(wand != (MagickWand *) NULL);
3290  assert(wand->signature == WandSignature);
3291  if (IfMagickTrue(wand->debug))
3292    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3293  if (wand->images == (Image *) NULL)
3294    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3295  forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3296    wand->exception);
3297  if (forward_image == (Image *) NULL)
3298    return(MagickFalse);
3299  ReplaceImageInList(&wand->images,forward_image);
3300  return(MagickTrue);
3301}
3302
3303/*
3304%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3305%                                                                             %
3306%                                                                             %
3307%                                                                             %
3308%   M a g i c k F r a m e I m a g e                                           %
3309%                                                                             %
3310%                                                                             %
3311%                                                                             %
3312%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3313%
3314%  MagickFrameImage() adds a simulated three-dimensional border around the
3315%  image.  The width and height specify the border width of the vertical and
3316%  horizontal sides of the frame.  The inner and outer bevels indicate the
3317%  width of the inner and outer shadows of the frame.
3318%
3319%  The format of the MagickFrameImage method is:
3320%
3321%      MagickBooleanType MagickFrameImage(MagickWand *wand,
3322%        const PixelWand *matte_color,const size_t width,
3323%        const size_t height,const ssize_t inner_bevel,
3324%        const ssize_t outer_bevel,const CompositeOperator compose)
3325%
3326%  A description of each parameter follows:
3327%
3328%    o wand: the magick wand.
3329%
3330%    o matte_color: the frame color pixel wand.
3331%
3332%    o width: the border width.
3333%
3334%    o height: the border height.
3335%
3336%    o inner_bevel: the inner bevel width.
3337%
3338%    o outer_bevel: the outer bevel width.
3339%
3340%    o compose: the composite operator.
3341%
3342*/
3343WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3344  const PixelWand *matte_color,const size_t width,const size_t height,
3345  const ssize_t inner_bevel,const ssize_t outer_bevel,
3346  const CompositeOperator compose)
3347{
3348  Image
3349    *frame_image;
3350
3351  FrameInfo
3352    frame_info;
3353
3354  assert(wand != (MagickWand *) NULL);
3355  assert(wand->signature == WandSignature);
3356  if (IfMagickTrue(wand->debug))
3357    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3358  if (wand->images == (Image *) NULL)
3359    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3360  (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3361  frame_info.width=wand->images->columns+2*width;
3362  frame_info.height=wand->images->rows+2*height;
3363  frame_info.x=(ssize_t) width;
3364  frame_info.y=(ssize_t) height;
3365  frame_info.inner_bevel=inner_bevel;
3366  frame_info.outer_bevel=outer_bevel;
3367  PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3368  frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3369  if (frame_image == (Image *) NULL)
3370    return(MagickFalse);
3371  ReplaceImageInList(&wand->images,frame_image);
3372  return(MagickTrue);
3373}
3374
3375/*
3376%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3377%                                                                             %
3378%                                                                             %
3379%                                                                             %
3380%   M a g i c k F u n c t i o n I m a g e                                     %
3381%                                                                             %
3382%                                                                             %
3383%                                                                             %
3384%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3385%
3386%  MagickFunctionImage() applys an arithmetic, relational, or logical
3387%  expression to an image.  Use these operators to lighten or darken an image,
3388%  to increase or decrease contrast in an image, or to produce the "negative"
3389%  of an image.
3390%
3391%  The format of the MagickFunctionImage method is:
3392%
3393%      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3394%        const MagickFunction function,const size_t number_arguments,
3395%        const double *arguments)
3396%
3397%  A description of each parameter follows:
3398%
3399%    o wand: the magick wand.
3400%
3401%    o function: the image function.
3402%
3403%    o number_arguments: the number of function arguments.
3404%
3405%    o arguments: the function arguments.
3406%
3407*/
3408WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3409  const MagickFunction function,const size_t number_arguments,
3410  const double *arguments)
3411{
3412  MagickBooleanType
3413    status;
3414
3415  assert(wand != (MagickWand *) NULL);
3416  assert(wand->signature == WandSignature);
3417  if (IfMagickTrue(wand->debug))
3418    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3419  if (wand->images == (Image *) NULL)
3420    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3421  status=FunctionImage(wand->images,function,number_arguments,arguments,
3422    wand->exception);
3423  return(status);
3424}
3425
3426/*
3427%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3428%                                                                             %
3429%                                                                             %
3430%                                                                             %
3431%   M a g i c k F x I m a g e                                                 %
3432%                                                                             %
3433%                                                                             %
3434%                                                                             %
3435%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3436%
3437%  MagickFxImage() evaluate expression for each pixel in the image.
3438%
3439%  The format of the MagickFxImage method is:
3440%
3441%      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3442%
3443%  A description of each parameter follows:
3444%
3445%    o wand: the magick wand.
3446%
3447%    o expression: the expression.
3448%
3449*/
3450WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3451{
3452  Image
3453    *fx_image;
3454
3455  assert(wand != (MagickWand *) NULL);
3456  assert(wand->signature == WandSignature);
3457  if (IfMagickTrue(wand->debug))
3458    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3459  if (wand->images == (Image *) NULL)
3460    return((MagickWand *) NULL);
3461  fx_image=FxImage(wand->images,expression,wand->exception);
3462  if (fx_image == (Image *) NULL)
3463    return((MagickWand *) NULL);
3464  return(CloneMagickWandFromImages(wand,fx_image));
3465}
3466
3467/*
3468%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3469%                                                                             %
3470%                                                                             %
3471%                                                                             %
3472%   M a g i c k G a m m a I m a g e                                           %
3473%                                                                             %
3474%                                                                             %
3475%                                                                             %
3476%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3477%
3478%  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3479%  different devices will have perceptual differences in the way the image's
3480%  intensities are represented on the screen.  Specify individual gamma levels
3481%  for the red, green, and blue channels, or adjust all three with the gamma
3482%  parameter.  Values typically range from 0.8 to 2.3.
3483%
3484%  You can also reduce the influence of a particular channel with a gamma
3485%  value of 0.
3486%
3487%  The format of the MagickGammaImage method is:
3488%
3489%      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3490%
3491%  A description of each parameter follows:
3492%
3493%    o wand: the magick wand.
3494%
3495%    o level: Define the level of gamma correction.
3496%
3497*/
3498WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3499  const double gamma)
3500{
3501  MagickBooleanType
3502    status;
3503
3504  assert(wand != (MagickWand *) NULL);
3505  assert(wand->signature == WandSignature);
3506  if (IfMagickTrue(wand->debug))
3507    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3508  if (wand->images == (Image *) NULL)
3509    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3510  status=GammaImage(wand->images,gamma,wand->exception);
3511  return(status);
3512}
3513
3514/*
3515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3516%                                                                             %
3517%                                                                             %
3518%                                                                             %
3519%   M a g i c k G a u s s i a n B l u r I m a g e                             %
3520%                                                                             %
3521%                                                                             %
3522%                                                                             %
3523%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3524%
3525%  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3526%  Gaussian operator of the given radius and standard deviation (sigma).
3527%  For reasonable results, the radius should be larger than sigma.  Use a
3528%  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3529%
3530%  The format of the MagickGaussianBlurImage method is:
3531%
3532%      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3533%        const double radius,const double sigma)
3534%
3535%  A description of each parameter follows:
3536%
3537%    o wand: the magick wand.
3538%
3539%    o radius: the radius of the Gaussian, in pixels, not counting the center
3540%      pixel.
3541%
3542%    o sigma: the standard deviation of the Gaussian, in pixels.
3543%
3544*/
3545WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3546  const double radius,const double sigma)
3547{
3548  Image
3549    *blur_image;
3550
3551  assert(wand != (MagickWand *) NULL);
3552  assert(wand->signature == WandSignature);
3553  if (IfMagickTrue(wand->debug))
3554    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3555  if (wand->images == (Image *) NULL)
3556    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3557  blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3558  if (blur_image == (Image *) NULL)
3559    return(MagickFalse);
3560  ReplaceImageInList(&wand->images,blur_image);
3561  return(MagickTrue);
3562}
3563
3564/*
3565%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3566%                                                                             %
3567%                                                                             %
3568%                                                                             %
3569%   M a g i c k G e t I m a g e                                               %
3570%                                                                             %
3571%                                                                             %
3572%                                                                             %
3573%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3574%
3575%  MagickGetImage() gets the image at the current image index.
3576%
3577%  The format of the MagickGetImage method is:
3578%
3579%      MagickWand *MagickGetImage(MagickWand *wand)
3580%
3581%  A description of each parameter follows:
3582%
3583%    o wand: the magick wand.
3584%
3585*/
3586WandExport MagickWand *MagickGetImage(MagickWand *wand)
3587{
3588  Image
3589    *image;
3590
3591  assert(wand != (MagickWand *) NULL);
3592  assert(wand->signature == WandSignature);
3593  if (IfMagickTrue(wand->debug))
3594    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3595  if (wand->images == (Image *) NULL)
3596    {
3597      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3598        "ContainsNoImages","`%s'",wand->name);
3599      return((MagickWand *) NULL);
3600    }
3601  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3602  if (image == (Image *) NULL)
3603    return((MagickWand *) NULL);
3604  return(CloneMagickWandFromImages(wand,image));
3605}
3606
3607/*
3608%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3609%                                                                             %
3610%                                                                             %
3611%                                                                             %
3612%   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                       %
3613%                                                                             %
3614%                                                                             %
3615%                                                                             %
3616%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3617%
3618%  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3619%  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3620%  than CMYKA.
3621%
3622%  The format of the MagickGetImageAlphaChannel method is:
3623%
3624%      MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3625%
3626%  A description of each parameter follows:
3627%
3628%    o wand: the magick wand.
3629%
3630*/
3631WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3632{
3633  assert(wand != (MagickWand *) NULL);
3634  assert(wand->signature == WandSignature);
3635  if (IfMagickTrue(wand->debug))
3636    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3637  if (wand->images == (Image *) NULL)
3638    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3639  return(GetImageAlphaChannel(wand->images));
3640}
3641
3642/*
3643%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3644%                                                                             %
3645%                                                                             %
3646%                                                                             %
3647%   M a g i c k G e t I m a g e C l i p M a s k                               %
3648%                                                                             %
3649%                                                                             %
3650%                                                                             %
3651%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3652%
3653%  MagickGetImageMask() gets the image clip mask at the current image index.
3654%
3655%  The format of the MagickGetImageMask method is:
3656%
3657%      MagickWand *MagickGetImageMask(MagickWand *wand)
3658%
3659%  A description of each parameter follows:
3660%
3661%    o wand: the magick wand.
3662%
3663*/
3664WandExport MagickWand *MagickGetImageMask(MagickWand *wand)
3665{
3666  Image
3667    *image;
3668
3669  assert(wand != (MagickWand *) NULL);
3670  assert(wand->signature == WandSignature);
3671  if (IfMagickTrue(wand->debug))
3672    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3673  if (wand->images == (Image *) NULL)
3674    {
3675      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3676        "ContainsNoImages","`%s'",wand->name);
3677      return((MagickWand *) NULL);
3678    }
3679  image=GetImageMask(wand->images,wand->exception);
3680  if (image == (Image *) NULL)
3681    return((MagickWand *) NULL);
3682  return(CloneMagickWandFromImages(wand,image));
3683}
3684
3685/*
3686%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3687%                                                                             %
3688%                                                                             %
3689%                                                                             %
3690%   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                 %
3691%                                                                             %
3692%                                                                             %
3693%                                                                             %
3694%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3695%
3696%  MagickGetImageBackgroundColor() returns the image background color.
3697%
3698%  The format of the MagickGetImageBackgroundColor method is:
3699%
3700%      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3701%        PixelWand *background_color)
3702%
3703%  A description of each parameter follows:
3704%
3705%    o wand: the magick wand.
3706%
3707%    o background_color: Return the background color.
3708%
3709*/
3710WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3711  PixelWand *background_color)
3712{
3713  assert(wand != (MagickWand *) NULL);
3714  assert(wand->signature == WandSignature);
3715  if (IfMagickTrue(wand->debug))
3716    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3717  if (wand->images == (Image *) NULL)
3718    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3719  PixelSetPixelColor(background_color,&wand->images->background_color);
3720  return(MagickTrue);
3721}
3722
3723/*
3724%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3725%                                                                             %
3726%                                                                             %
3727%                                                                             %
3728%   M a g i c k G e t I m a g e B l o b                                       %
3729%                                                                             %
3730%                                                                             %
3731%                                                                             %
3732%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3733%
3734%  MagickGetImageBlob() implements direct to memory image formats.  It returns
3735%  the image as a blob (a formatted "file" in memory) and its length, starting
3736%  from the current position in the image sequence.  Use MagickSetImageFormat()
3737%  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3738%
3739%  Utilize MagickResetIterator() to ensure the write is from the beginning of
3740%  the image sequence.
3741%
3742%  Use MagickRelinquishMemory() to free the blob when you are done with it.
3743%
3744%  The format of the MagickGetImageBlob method is:
3745%
3746%      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3747%
3748%  A description of each parameter follows:
3749%
3750%    o wand: the magick wand.
3751%
3752%    o length: the length of the blob.
3753%
3754*/
3755WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3756{
3757  unsigned char
3758    *blob;
3759
3760  assert(wand != (MagickWand *) NULL);
3761  assert(wand->signature == WandSignature);
3762  if (IfMagickTrue(wand->debug))
3763    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3764  if (wand->images == (Image *) NULL)
3765    {
3766      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3767        "ContainsNoImages","`%s'",wand->name);
3768      return((unsigned char *) NULL);
3769    }
3770  blob=(unsigned char *) ImageToBlob(wand->image_info,wand->images,length,
3771    wand->exception);
3772  return(blob);
3773}
3774
3775/*
3776%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3777%                                                                             %
3778%                                                                             %
3779%                                                                             %
3780%   M a g i c k G e t I m a g e s B l o b                                     %
3781%                                                                             %
3782%                                                                             %
3783%                                                                             %
3784%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3785%
3786%  MagickGetImageBlob() implements direct to memory image formats.  It
3787%  returns the image sequence as a blob and its length.  The format of the image
3788%  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3789%  return a different image format, use MagickSetImageFormat().
3790%
3791%  Note, some image formats do not permit multiple images to the same image
3792%  stream (e.g. JPEG).  in this instance, just the first image of the
3793%  sequence is returned as a blob.
3794%
3795%  The format of the MagickGetImagesBlob method is:
3796%
3797%      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3798%
3799%  A description of each parameter follows:
3800%
3801%    o wand: the magick wand.
3802%
3803%    o length: the length of the blob.
3804%
3805*/
3806WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3807{
3808  unsigned char
3809    *blob;
3810
3811  assert(wand != (MagickWand *) NULL);
3812  assert(wand->signature == WandSignature);
3813  if (IfMagickTrue(wand->debug))
3814    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3815  if (wand->images == (Image *) NULL)
3816    {
3817      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3818        "ContainsNoImages","`%s'",wand->name);
3819      return((unsigned char *) NULL);
3820    }
3821  blob=(unsigned char *) ImagesToBlob(wand->image_info,GetFirstImageInList(
3822    wand->images),length,wand->exception);
3823  return(blob);
3824}
3825
3826/*
3827%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3828%                                                                             %
3829%                                                                             %
3830%                                                                             %
3831%   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                         %
3832%                                                                             %
3833%                                                                             %
3834%                                                                             %
3835%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3836%
3837%  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3838%  image.
3839%
3840%  The format of the MagickGetImageBluePrimary method is:
3841%
3842%      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3843%        double *y)
3844%
3845%  A description of each parameter follows:
3846%
3847%    o wand: the magick wand.
3848%
3849%    o x: the chromaticity blue primary x-point.
3850%
3851%    o y: the chromaticity blue primary y-point.
3852%
3853*/
3854WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3855  double *x,double *y)
3856{
3857  assert(wand != (MagickWand *) NULL);
3858  assert(wand->signature == WandSignature);
3859  if (IfMagickTrue(wand->debug))
3860    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3861  if (wand->images == (Image *) NULL)
3862    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3863  *x=wand->images->chromaticity.blue_primary.x;
3864  *y=wand->images->chromaticity.blue_primary.y;
3865  return(MagickTrue);
3866}
3867
3868/*
3869%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3870%                                                                             %
3871%                                                                             %
3872%                                                                             %
3873%   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                         %
3874%                                                                             %
3875%                                                                             %
3876%                                                                             %
3877%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3878%
3879%  MagickGetImageBorderColor() returns the image border color.
3880%
3881%  The format of the MagickGetImageBorderColor method is:
3882%
3883%      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3884%        PixelWand *border_color)
3885%
3886%  A description of each parameter follows:
3887%
3888%    o wand: the magick wand.
3889%
3890%    o border_color: Return the border color.
3891%
3892*/
3893WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3894  PixelWand *border_color)
3895{
3896  assert(wand != (MagickWand *) NULL);
3897  assert(wand->signature == WandSignature);
3898  if (IfMagickTrue(wand->debug))
3899    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3900  if (wand->images == (Image *) NULL)
3901    ThrowWandException(WandError,"ContainsNoImages",wand->name);
3902  PixelSetPixelColor(border_color,&wand->images->border_color);
3903  return(MagickTrue);
3904}
3905
3906/*
3907%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3908%                                                                             %
3909%                                                                             %
3910%                                                                             %
3911%   M a g i c k G e t I m a g e F e a t u r e s                               %
3912%                                                                             %
3913%                                                                             %
3914%                                                                             %
3915%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3916%
3917%  MagickGetImageFeatures() returns features for each channel in the
3918%  image in each of four directions (horizontal, vertical, left and right
3919%  diagonals) for the specified distance.  The features include the angular
3920%  second moment, contrast, correlation, sum of squares: variance, inverse
3921%  difference moment, sum average, sum varience, sum entropy, entropy,
3922%  difference variance, difference entropy, information measures of
3923%  correlation 1, information measures of correlation 2, and maximum
3924%  correlation coefficient.  You can access the red channel contrast, for
3925%  example, like this:
3926%
3927%      channel_features=MagickGetImageFeatures(wand,1);
3928%      contrast=channel_features[RedPixelChannel].contrast[0];
3929%
3930%  Use MagickRelinquishMemory() to free the statistics buffer.
3931%
3932%  The format of the MagickGetImageFeatures method is:
3933%
3934%      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3935%        const size_t distance)
3936%
3937%  A description of each parameter follows:
3938%
3939%    o wand: the magick wand.
3940%
3941%    o distance: the distance.
3942%
3943*/
3944WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3945  const size_t distance)
3946{
3947  assert(wand != (MagickWand *) NULL);
3948  assert(wand->signature == WandSignature);
3949  if (IfMagickTrue(wand->debug))
3950    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3951  if (wand->images == (Image *) NULL)
3952    {
3953      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3954        "ContainsNoImages","`%s'",wand->name);
3955      return((ChannelFeatures *) NULL);
3956    }
3957  return(GetImageFeatures(wand->images,distance,wand->exception));
3958}
3959
3960/*
3961%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3962%                                                                             %
3963%                                                                             %
3964%                                                                             %
3965%   M a g i c k G e t I m a g e K u r t o s i s                               %
3966%                                                                             %
3967%                                                                             %
3968%                                                                             %
3969%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3970%
3971%  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
3972%  more image channels.
3973%
3974%  The format of the MagickGetImageKurtosis method is:
3975%
3976%      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3977%        double *kurtosis,double *skewness)
3978%
3979%  A description of each parameter follows:
3980%
3981%    o wand: the magick wand.
3982%
3983%    o kurtosis:  The kurtosis for the specified channel(s).
3984%
3985%    o skewness:  The skewness for the specified channel(s).
3986%
3987*/
3988WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3989  double *kurtosis,double *skewness)
3990{
3991  MagickBooleanType
3992    status;
3993
3994  assert(wand != (MagickWand *) NULL);
3995  assert(wand->signature == WandSignature);
3996  if (IfMagickTrue(wand->debug))
3997    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3998  if (wand->images == (Image *) NULL)
3999    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4000  status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
4001  return(status);
4002}
4003
4004/*
4005%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4006%                                                                             %
4007%                                                                             %
4008%                                                                             %
4009%   M a g i c k G e t I m a g e M e a n                                       %
4010%                                                                             %
4011%                                                                             %
4012%                                                                             %
4013%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4014%
4015%  MagickGetImageMean() gets the mean and standard deviation of one or more
4016%  image channels.
4017%
4018%  The format of the MagickGetImageMean method is:
4019%
4020%      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4021%        double *standard_deviation)
4022%
4023%  A description of each parameter follows:
4024%
4025%    o wand: the magick wand.
4026%
4027%    o channel: the image channel(s).
4028%
4029%    o mean:  The mean pixel value for the specified channel(s).
4030%
4031%    o standard_deviation:  The standard deviation for the specified channel(s).
4032%
4033*/
4034WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4035  double *standard_deviation)
4036{
4037  MagickBooleanType
4038    status;
4039
4040  assert(wand != (MagickWand *) NULL);
4041  assert(wand->signature == WandSignature);
4042  if (IfMagickTrue(wand->debug))
4043    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4044  if (wand->images == (Image *) NULL)
4045    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4046  status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
4047  return(status);
4048}
4049
4050/*
4051%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4052%                                                                             %
4053%                                                                             %
4054%                                                                             %
4055%   M a g i c k G e t I m a g e R a n g e                                     %
4056%                                                                             %
4057%                                                                             %
4058%                                                                             %
4059%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4060%
4061%  MagickGetImageRange() gets the range for one or more image channels.
4062%
4063%  The format of the MagickGetImageRange method is:
4064%
4065%      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
4066%        double *maxima)
4067%
4068%  A description of each parameter follows:
4069%
4070%    o wand: the magick wand.
4071%
4072%    o minima:  The minimum pixel value for the specified channel(s).
4073%
4074%    o maxima:  The maximum pixel value for the specified channel(s).
4075%
4076*/
4077WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
4078  double *minima,double *maxima)
4079{
4080  MagickBooleanType
4081    status;
4082
4083  assert(wand != (MagickWand *) NULL);
4084  assert(wand->signature == WandSignature);
4085  if (IfMagickTrue(wand->debug))
4086    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4087  if (wand->images == (Image *) NULL)
4088    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4089  status=GetImageRange(wand->images,minima,maxima,wand->exception);
4090  return(status);
4091}
4092
4093/*
4094%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4095%                                                                             %
4096%                                                                             %
4097%                                                                             %
4098%   M a g i c k G e t I m a g e S t a t i s t i c s                           %
4099%                                                                             %
4100%                                                                             %
4101%                                                                             %
4102%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4103%
4104%  MagickGetImageStatistics() returns statistics for each channel in the
4105%  image.  The statistics include the channel depth, its minima and
4106%  maxima, the mean, the standard deviation, the kurtosis and the skewness.
4107%  You can access the red channel mean, for example, like this:
4108%
4109%      channel_statistics=MagickGetImageStatistics(wand);
4110%      red_mean=channel_statistics[RedPixelChannel].mean;
4111%
4112%  Use MagickRelinquishMemory() to free the statistics buffer.
4113%
4114%  The format of the MagickGetImageStatistics method is:
4115%
4116%      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4117%
4118%  A description of each parameter follows:
4119%
4120%    o wand: the magick wand.
4121%
4122*/
4123WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4124{
4125  assert(wand != (MagickWand *) NULL);
4126  assert(wand->signature == WandSignature);
4127  if (IfMagickTrue(wand->debug))
4128    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4129  if (wand->images == (Image *) NULL)
4130    {
4131      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4132        "ContainsNoImages","`%s'",wand->name);
4133      return((ChannelStatistics *) NULL);
4134    }
4135  return(GetImageStatistics(wand->images,wand->exception));
4136}
4137
4138/*
4139%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4140%                                                                             %
4141%                                                                             %
4142%                                                                             %
4143%   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                     %
4144%                                                                             %
4145%                                                                             %
4146%                                                                             %
4147%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4148%
4149%  MagickGetImageColormapColor() returns the color of the specified colormap
4150%  index.
4151%
4152%  The format of the MagickGetImageColormapColor method is:
4153%
4154%      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4155%        const size_t index,PixelWand *color)
4156%
4157%  A description of each parameter follows:
4158%
4159%    o wand: the magick wand.
4160%
4161%    o index: the offset into the image colormap.
4162%
4163%    o color: Return the colormap color in this wand.
4164%
4165*/
4166WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4167  const size_t index,PixelWand *color)
4168{
4169  assert(wand != (MagickWand *) NULL);
4170  assert(wand->signature == WandSignature);
4171  if (IfMagickTrue(wand->debug))
4172    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4173  if (wand->images == (Image *) NULL)
4174    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4175  if ((wand->images->colormap == (PixelInfo *) NULL) ||
4176      (index >= wand->images->colors))
4177    {
4178      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4179        "InvalidColormapIndex","`%s'",wand->name);
4180      return(MagickFalse);
4181    }
4182  PixelSetPixelColor(color,wand->images->colormap+index);
4183  return(MagickTrue);
4184}
4185
4186/*
4187%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4188%                                                                             %
4189%                                                                             %
4190%                                                                             %
4191%   M a g i c k G e t I m a g e C o l o r s                                   %
4192%                                                                             %
4193%                                                                             %
4194%                                                                             %
4195%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4196%
4197%  MagickGetImageColors() gets the number of unique colors in the image.
4198%
4199%  The format of the MagickGetImageColors method is:
4200%
4201%      size_t MagickGetImageColors(MagickWand *wand)
4202%
4203%  A description of each parameter follows:
4204%
4205%    o wand: the magick wand.
4206%
4207*/
4208WandExport size_t MagickGetImageColors(MagickWand *wand)
4209{
4210  assert(wand != (MagickWand *) NULL);
4211  assert(wand->signature == WandSignature);
4212  if (IfMagickTrue(wand->debug))
4213    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4214  if (wand->images == (Image *) NULL)
4215    {
4216      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4217        "ContainsNoImages","`%s'",wand->name);
4218      return(0);
4219    }
4220  return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4221}
4222
4223/*
4224%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4225%                                                                             %
4226%                                                                             %
4227%                                                                             %
4228%   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4229%                                                                             %
4230%                                                                             %
4231%                                                                             %
4232%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4233%
4234%  MagickGetImageColorspace() gets the image colorspace.
4235%
4236%  The format of the MagickGetImageColorspace method is:
4237%
4238%      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4239%
4240%  A description of each parameter follows:
4241%
4242%    o wand: the magick wand.
4243%
4244*/
4245WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4246{
4247  assert(wand != (MagickWand *) NULL);
4248  assert(wand->signature == WandSignature);
4249  if (IfMagickTrue(wand->debug))
4250    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4251  if (wand->images == (Image *) NULL)
4252    {
4253      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4254        "ContainsNoImages","`%s'",wand->name);
4255      return(UndefinedColorspace);
4256    }
4257  return(wand->images->colorspace);
4258}
4259
4260/*
4261%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4262%                                                                             %
4263%                                                                             %
4264%                                                                             %
4265%   M a g i c k G e t I m a g e C o m p o s e                                 %
4266%                                                                             %
4267%                                                                             %
4268%                                                                             %
4269%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4270%
4271%  MagickGetImageCompose() returns the composite operator associated with the
4272%  image.
4273%
4274%  The format of the MagickGetImageCompose method is:
4275%
4276%      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4277%
4278%  A description of each parameter follows:
4279%
4280%    o wand: the magick wand.
4281%
4282*/
4283WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4284{
4285  assert(wand != (MagickWand *) NULL);
4286  assert(wand->signature == WandSignature);
4287  if (IfMagickTrue(wand->debug))
4288    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4289  if (wand->images == (Image *) NULL)
4290    {
4291      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4292        "ContainsNoImages","`%s'",wand->name);
4293      return(UndefinedCompositeOp);
4294    }
4295  return(wand->images->compose);
4296}
4297
4298/*
4299%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4300%                                                                             %
4301%                                                                             %
4302%                                                                             %
4303%   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                         %
4304%                                                                             %
4305%                                                                             %
4306%                                                                             %
4307%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4308%
4309%  MagickGetImageCompression() gets the image compression.
4310%
4311%  The format of the MagickGetImageCompression method is:
4312%
4313%      CompressionType MagickGetImageCompression(MagickWand *wand)
4314%
4315%  A description of each parameter follows:
4316%
4317%    o wand: the magick wand.
4318%
4319*/
4320WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4321{
4322  assert(wand != (MagickWand *) NULL);
4323  assert(wand->signature == WandSignature);
4324  if (IfMagickTrue(wand->debug))
4325    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4326  if (wand->images == (Image *) NULL)
4327    {
4328      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4329        "ContainsNoImages","`%s'",wand->name);
4330      return(UndefinedCompression);
4331    }
4332  return(wand->images->compression);
4333}
4334
4335/*
4336%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4337%                                                                             %
4338%                                                                             %
4339%                                                                             %
4340%   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           %
4341%                                                                             %
4342%                                                                             %
4343%                                                                             %
4344%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4345%
4346%  MagickGetImageCompressionQuality() gets the image compression quality.
4347%
4348%  The format of the MagickGetImageCompressionQuality method is:
4349%
4350%      size_t MagickGetImageCompressionQuality(MagickWand *wand)
4351%
4352%  A description of each parameter follows:
4353%
4354%    o wand: the magick wand.
4355%
4356*/
4357WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4358{
4359  assert(wand != (MagickWand *) NULL);
4360  assert(wand->signature == WandSignature);
4361  if (IfMagickTrue(wand->debug))
4362    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4363  if (wand->images == (Image *) NULL)
4364    {
4365      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4366        "ContainsNoImages","`%s'",wand->name);
4367      return(0UL);
4368    }
4369  return(wand->images->quality);
4370}
4371
4372/*
4373%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4374%                                                                             %
4375%                                                                             %
4376%                                                                             %
4377%   M a g i c k G e t I m a g e D e l a y                                     %
4378%                                                                             %
4379%                                                                             %
4380%                                                                             %
4381%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4382%
4383%  MagickGetImageDelay() gets the image delay.
4384%
4385%  The format of the MagickGetImageDelay method is:
4386%
4387%      size_t MagickGetImageDelay(MagickWand *wand)
4388%
4389%  A description of each parameter follows:
4390%
4391%    o wand: the magick wand.
4392%
4393*/
4394WandExport size_t MagickGetImageDelay(MagickWand *wand)
4395{
4396  assert(wand != (MagickWand *) NULL);
4397  assert(wand->signature == WandSignature);
4398  if (IfMagickTrue(wand->debug))
4399    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4400  if (wand->images == (Image *) NULL)
4401    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4402  return(wand->images->delay);
4403}
4404
4405/*
4406%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4407%                                                                             %
4408%                                                                             %
4409%                                                                             %
4410%   M a g i c k G e t I m a g e D e p t h                                     %
4411%                                                                             %
4412%                                                                             %
4413%                                                                             %
4414%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4415%
4416%  MagickGetImageDepth() gets the image depth.
4417%
4418%  The format of the MagickGetImageDepth method is:
4419%
4420%      size_t MagickGetImageDepth(MagickWand *wand)
4421%
4422%  A description of each parameter follows:
4423%
4424%    o wand: the magick wand.
4425%
4426*/
4427WandExport size_t MagickGetImageDepth(MagickWand *wand)
4428{
4429  assert(wand != (MagickWand *) NULL);
4430  assert(wand->signature == WandSignature);
4431  if (IfMagickTrue(wand->debug))
4432    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4433  if (wand->images == (Image *) NULL)
4434    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4435  return(wand->images->depth);
4436}
4437
4438/*
4439%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4440%                                                                             %
4441%                                                                             %
4442%                                                                             %
4443%   M a g i c k G e t I m a g e D i s p o s e                                 %
4444%                                                                             %
4445%                                                                             %
4446%                                                                             %
4447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4448%
4449%  MagickGetImageDispose() gets the image disposal method.
4450%
4451%  The format of the MagickGetImageDispose method is:
4452%
4453%      DisposeType MagickGetImageDispose(MagickWand *wand)
4454%
4455%  A description of each parameter follows:
4456%
4457%    o wand: the magick wand.
4458%
4459*/
4460WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4461{
4462  assert(wand != (MagickWand *) NULL);
4463  assert(wand->signature == WandSignature);
4464  if (IfMagickTrue(wand->debug))
4465    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4466  if (wand->images == (Image *) NULL)
4467    {
4468      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4469        "ContainsNoImages","`%s'",wand->name);
4470      return(UndefinedDispose);
4471    }
4472  return((DisposeType) wand->images->dispose);
4473}
4474
4475/*
4476%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4477%                                                                             %
4478%                                                                             %
4479%                                                                             %
4480%   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4481%                                                                             %
4482%                                                                             %
4483%                                                                             %
4484%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4485%
4486%  MagickGetImageDistortion() compares an image to a reconstructed image and
4487%  returns the specified distortion metric.
4488%
4489%  The format of the MagickGetImageDistortion method is:
4490%
4491%      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4492%        const MagickWand *reference,const MetricType metric,
4493%        double *distortion)
4494%
4495%  A description of each parameter follows:
4496%
4497%    o wand: the magick wand.
4498%
4499%    o reference: the reference wand.
4500%
4501%    o metric: the metric.
4502%
4503%    o distortion: the computed distortion between the images.
4504%
4505*/
4506WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4507  const MagickWand *reference,const MetricType metric,double *distortion)
4508{
4509  MagickBooleanType
4510    status;
4511
4512  assert(wand != (MagickWand *) NULL);
4513  assert(wand->signature == WandSignature);
4514  if (IfMagickTrue(wand->debug))
4515    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4516  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4517    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4518  status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4519    wand->exception);
4520  return(status);
4521}
4522
4523/*
4524%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4525%                                                                             %
4526%                                                                             %
4527%                                                                             %
4528%   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                         %
4529%                                                                             %
4530%                                                                             %
4531%                                                                             %
4532%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4533%
4534%  MagickGetImageDistortions() compares one or more pixel channels of an
4535%  image to a reconstructed image and returns the specified distortion metrics.
4536%
4537%  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4538%
4539%  The format of the MagickGetImageDistortion method is:
4540%
4541%      double *MagickGetImageDistortion(MagickWand *wand,
4542%        const MagickWand *reference,const MetricType metric)
4543%
4544%  A description of each parameter follows:
4545%
4546%    o wand: the magick wand.
4547%
4548%    o reference: the reference wand.
4549%
4550%    o metric: the metric.
4551%
4552*/
4553WandExport double *MagickGetImageDistortions(MagickWand *wand,
4554  const MagickWand *reference,const MetricType metric)
4555{
4556  double
4557    *channel_distortion;
4558
4559  assert(wand != (MagickWand *) NULL);
4560  assert(wand->signature == WandSignature);
4561  if (IfMagickTrue(wand->debug))
4562    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4563  assert(reference != (MagickWand *) NULL);
4564  assert(reference->signature == WandSignature);
4565  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4566    {
4567      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4568        "ContainsNoImages","`%s'",wand->name);
4569      return((double *) NULL);
4570    }
4571  channel_distortion=GetImageDistortions(wand->images,reference->images,
4572    metric,wand->exception);
4573  return(channel_distortion);
4574}
4575
4576/*
4577%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4578%                                                                             %
4579%                                                                             %
4580%                                                                             %
4581%   M a g i c k G e t I m a g e E n d i a n                                   %
4582%                                                                             %
4583%                                                                             %
4584%                                                                             %
4585%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4586%
4587%  MagickGetImageEndian() gets the image endian.
4588%
4589%  The format of the MagickGetImageEndian method is:
4590%
4591%      EndianType MagickGetImageEndian(MagickWand *wand)
4592%
4593%  A description of each parameter follows:
4594%
4595%    o wand: the magick wand.
4596%
4597*/
4598WandExport EndianType MagickGetImageEndian(MagickWand *wand)
4599{
4600  assert(wand != (MagickWand *) NULL);
4601  assert(wand->signature == WandSignature);
4602  if (IfMagickTrue(wand->debug))
4603    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4604  if (wand->images == (Image *) NULL)
4605    {
4606      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4607        "ContainsNoImages","`%s'",wand->name);
4608      return(UndefinedEndian);
4609    }
4610  return(wand->images->endian);
4611}
4612
4613/*
4614%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4615%                                                                             %
4616%                                                                             %
4617%                                                                             %
4618%   M a g i c k G e t I m a g e F i l e n a m e                               %
4619%                                                                             %
4620%                                                                             %
4621%                                                                             %
4622%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4623%
4624%  MagickGetImageFilename() returns the filename of a particular image in a
4625%  sequence.
4626%
4627%  The format of the MagickGetImageFilename method is:
4628%
4629%      char *MagickGetImageFilename(MagickWand *wand)
4630%
4631%  A description of each parameter follows:
4632%
4633%    o wand: the magick wand.
4634%
4635*/
4636WandExport char *MagickGetImageFilename(MagickWand *wand)
4637{
4638  assert(wand != (MagickWand *) NULL);
4639  assert(wand->signature == WandSignature);
4640  if (IfMagickTrue(wand->debug))
4641    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4642  if (wand->images == (Image *) NULL)
4643    {
4644      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4645        "ContainsNoImages","`%s'",wand->name);
4646      return((char *) NULL);
4647    }
4648  return(AcquireString(wand->images->filename));
4649}
4650
4651/*
4652%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4653%                                                                             %
4654%                                                                             %
4655%                                                                             %
4656%   M a g i c k G e t I m a g e F o r m a t                                   %
4657%                                                                             %
4658%                                                                             %
4659%                                                                             %
4660%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4661%
4662%  MagickGetImageFormat() returns the format of a particular image in a
4663%  sequence.
4664%
4665%  The format of the MagickGetImageFormat method is:
4666%
4667%      char *MagickGetImageFormat(MagickWand *wand)
4668%
4669%  A description of each parameter follows:
4670%
4671%    o wand: the magick wand.
4672%
4673*/
4674WandExport char *MagickGetImageFormat(MagickWand *wand)
4675{
4676  assert(wand != (MagickWand *) NULL);
4677  assert(wand->signature == WandSignature);
4678  if (IfMagickTrue(wand->debug))
4679    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4680  if (wand->images == (Image *) NULL)
4681    {
4682      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4683        "ContainsNoImages","`%s'",wand->name);
4684      return((char *) NULL);
4685    }
4686  return(AcquireString(wand->images->magick));
4687}
4688
4689/*
4690%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4691%                                                                             %
4692%                                                                             %
4693%                                                                             %
4694%   M a g i c k G e t I m a g e F u z z                                       %
4695%                                                                             %
4696%                                                                             %
4697%                                                                             %
4698%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4699%
4700%  MagickGetImageFuzz() gets the image fuzz.
4701%
4702%  The format of the MagickGetImageFuzz method is:
4703%
4704%      double MagickGetImageFuzz(MagickWand *wand)
4705%
4706%  A description of each parameter follows:
4707%
4708%    o wand: the magick wand.
4709%
4710*/
4711WandExport double MagickGetImageFuzz(MagickWand *wand)
4712{
4713  assert(wand != (MagickWand *) NULL);
4714  assert(wand->signature == WandSignature);
4715  if (IfMagickTrue(wand->debug))
4716    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4717  if (wand->images == (Image *) NULL)
4718    {
4719      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4720        "ContainsNoImages","`%s'",wand->name);
4721      return(0.0);
4722    }
4723  return(wand->images->fuzz);
4724}
4725
4726/*
4727%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4728%                                                                             %
4729%                                                                             %
4730%                                                                             %
4731%   M a g i c k G e t I m a g e G a m m a                                     %
4732%                                                                             %
4733%                                                                             %
4734%                                                                             %
4735%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4736%
4737%  MagickGetImageGamma() gets the image gamma.
4738%
4739%  The format of the MagickGetImageGamma method is:
4740%
4741%      double MagickGetImageGamma(MagickWand *wand)
4742%
4743%  A description of each parameter follows:
4744%
4745%    o wand: the magick wand.
4746%
4747*/
4748WandExport double MagickGetImageGamma(MagickWand *wand)
4749{
4750  assert(wand != (MagickWand *) NULL);
4751  assert(wand->signature == WandSignature);
4752  if (IfMagickTrue(wand->debug))
4753    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4754  if (wand->images == (Image *) NULL)
4755    {
4756      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4757        "ContainsNoImages","`%s'",wand->name);
4758      return(0.0);
4759    }
4760  return(wand->images->gamma);
4761}
4762
4763/*
4764%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4765%                                                                             %
4766%                                                                             %
4767%                                                                             %
4768%   M a g i c k G e t I m a g e G r a v i t y                                 %
4769%                                                                             %
4770%                                                                             %
4771%                                                                             %
4772%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4773%
4774%  MagickGetImageGravity() gets the image gravity.
4775%
4776%  The format of the MagickGetImageGravity method is:
4777%
4778%      GravityType MagickGetImageGravity(MagickWand *wand)
4779%
4780%  A description of each parameter follows:
4781%
4782%    o wand: the magick wand.
4783%
4784*/
4785WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4786{
4787  assert(wand != (MagickWand *) NULL);
4788  assert(wand->signature == WandSignature);
4789  if (IfMagickTrue(wand->debug))
4790    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4791  if (wand->images == (Image *) NULL)
4792    {
4793      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4794        "ContainsNoImages","`%s'",wand->name);
4795      return(UndefinedGravity);
4796    }
4797  return(wand->images->gravity);
4798}
4799
4800/*
4801%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4802%                                                                             %
4803%                                                                             %
4804%                                                                             %
4805%   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                       %
4806%                                                                             %
4807%                                                                             %
4808%                                                                             %
4809%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4810%
4811%  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4812%
4813%  The format of the MagickGetImageGreenPrimary method is:
4814%
4815%      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4816%        double *y)
4817%
4818%  A description of each parameter follows:
4819%
4820%    o wand: the magick wand.
4821%
4822%    o x: the chromaticity green primary x-point.
4823%
4824%    o y: the chromaticity green primary y-point.
4825%
4826*/
4827WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4828  double *x,double *y)
4829{
4830  assert(wand != (MagickWand *) NULL);
4831  assert(wand->signature == WandSignature);
4832  if (IfMagickTrue(wand->debug))
4833    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4834  if (wand->images == (Image *) NULL)
4835    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4836  *x=wand->images->chromaticity.green_primary.x;
4837  *y=wand->images->chromaticity.green_primary.y;
4838  return(MagickTrue);
4839}
4840
4841/*
4842%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4843%                                                                             %
4844%                                                                             %
4845%                                                                             %
4846%   M a g i c k G e t I m a g e H e i g h t                                   %
4847%                                                                             %
4848%                                                                             %
4849%                                                                             %
4850%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4851%
4852%  MagickGetImageHeight() returns the image height.
4853%
4854%  The format of the MagickGetImageHeight method is:
4855%
4856%      size_t MagickGetImageHeight(MagickWand *wand)
4857%
4858%  A description of each parameter follows:
4859%
4860%    o wand: the magick wand.
4861%
4862*/
4863WandExport size_t MagickGetImageHeight(MagickWand *wand)
4864{
4865  assert(wand != (MagickWand *) NULL);
4866  assert(wand->signature == WandSignature);
4867  if (IfMagickTrue(wand->debug))
4868    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4869  if (wand->images == (Image *) NULL)
4870    ThrowWandException(WandError,"ContainsNoImages",wand->name);
4871  return(wand->images->rows);
4872}
4873
4874/*
4875%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4876%                                                                             %
4877%                                                                             %
4878%                                                                             %
4879%   M a g i c k G e t I m a g e H i s t o g r a m                             %
4880%                                                                             %
4881%                                                                             %
4882%                                                                             %
4883%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4884%
4885%  MagickGetImageHistogram() returns the image histogram as an array of
4886%  PixelWand wands.
4887%
4888%  The format of the MagickGetImageHistogram method is:
4889%
4890%      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4891%        size_t *number_colors)
4892%
4893%  A description of each parameter follows:
4894%
4895%    o wand: the magick wand.
4896%
4897%    o number_colors: the number of unique colors in the image and the number
4898%      of pixel wands returned.
4899%
4900*/
4901WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4902  size_t *number_colors)
4903{
4904  PixelInfo
4905    *histogram;
4906
4907  PixelWand
4908    **pixel_wands;
4909
4910  register ssize_t
4911    i;
4912
4913  assert(wand != (MagickWand *) NULL);
4914  assert(wand->signature == WandSignature);
4915  if (IfMagickTrue(wand->debug))
4916    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4917  if (wand->images == (Image *) NULL)
4918    {
4919      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4920        "ContainsNoImages","`%s'",wand->name);
4921      return((PixelWand **) NULL);
4922    }
4923  histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4924  if (histogram == (PixelInfo *) NULL)
4925    return((PixelWand **) NULL);
4926  pixel_wands=NewPixelWands(*number_colors);
4927  for (i=0; i < (ssize_t) *number_colors; i++)
4928  {
4929    PixelSetPixelColor(pixel_wands[i],&histogram[i]);
4930    PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4931  }
4932  histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
4933  return(pixel_wands);
4934}
4935
4936/*
4937%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4938%                                                                             %
4939%                                                                             %
4940%                                                                             %
4941%   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                 %
4942%                                                                             %
4943%                                                                             %
4944%                                                                             %
4945%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4946%
4947%  MagickGetImageInterlaceScheme() gets the image interlace scheme.
4948%
4949%  The format of the MagickGetImageInterlaceScheme method is:
4950%
4951%      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4952%
4953%  A description of each parameter follows:
4954%
4955%    o wand: the magick wand.
4956%
4957*/
4958WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4959{
4960  assert(wand != (MagickWand *) NULL);
4961  assert(wand->signature == WandSignature);
4962  if (IfMagickTrue(wand->debug))
4963    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4964  if (wand->images == (Image *) NULL)
4965    {
4966      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4967        "ContainsNoImages","`%s'",wand->name);
4968      return(UndefinedInterlace);
4969    }
4970  return(wand->images->interlace);
4971}
4972
4973/*
4974%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4975%                                                                             %
4976%                                                                             %
4977%                                                                             %
4978%   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             %
4979%                                                                             %
4980%                                                                             %
4981%                                                                             %
4982%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4983%
4984%  MagickGetImageInterpolateMethod() returns the interpolation method for the
4985%  sepcified image.
4986%
4987%  The format of the MagickGetImageInterpolateMethod method is:
4988%
4989%      PixelInterpolateMethod MagickGetImagePixelInterpolateMethod(
4990%        MagickWand *wand)
4991%
4992%  A description of each parameter follows:
4993%
4994%    o wand: the magick wand.
4995%
4996*/
4997WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
4998  MagickWand *wand)
4999{
5000  assert(wand != (MagickWand *) NULL);
5001  assert(wand->signature == WandSignature);
5002  if (IfMagickTrue(wand->debug))
5003    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5004  if (wand->images == (Image *) NULL)
5005    {
5006      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5007        "ContainsNoImages","`%s'",wand->name);
5008      return(UndefinedInterpolatePixel);
5009    }
5010  return(wand->images->interpolate);
5011}
5012
5013/*
5014%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5015%                                                                             %
5016%                                                                             %
5017%                                                                             %
5018%   M a g i c k G e t I m a g e I t e r a t i o n s                           %
5019%                                                                             %
5020%                                                                             %
5021%                                                                             %
5022%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5023%
5024%  MagickGetImageIterations() gets the image iterations.
5025%
5026%  The format of the MagickGetImageIterations method is:
5027%
5028%      size_t MagickGetImageIterations(MagickWand *wand)
5029%
5030%  A description of each parameter follows:
5031%
5032%    o wand: the magick wand.
5033%
5034*/
5035WandExport size_t MagickGetImageIterations(MagickWand *wand)
5036{
5037  assert(wand != (MagickWand *) NULL);
5038  assert(wand->signature == WandSignature);
5039  if (IfMagickTrue(wand->debug))
5040    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5041  if (wand->images == (Image *) NULL)
5042    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5043  return(wand->images->iterations);
5044}
5045
5046/*
5047%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5048%                                                                             %
5049%                                                                             %
5050%                                                                             %
5051%   M a g i c k G e t I m a g e L e n g t h                                   %
5052%                                                                             %
5053%                                                                             %
5054%                                                                             %
5055%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5056%
5057%  MagickGetImageLength() returns the image length in bytes.
5058%
5059%  The format of the MagickGetImageLength method is:
5060%
5061%      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5062%        MagickSizeType *length)
5063%
5064%  A description of each parameter follows:
5065%
5066%    o wand: the magick wand.
5067%
5068%    o length: the image length in bytes.
5069%
5070*/
5071WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5072  MagickSizeType *length)
5073{
5074  assert(wand != (MagickWand *) NULL);
5075  assert(wand->signature == WandSignature);
5076  if (IfMagickTrue(wand->debug))
5077    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5078  if (wand->images == (Image *) NULL)
5079    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5080  *length=GetBlobSize(wand->images);
5081  return(MagickTrue);
5082}
5083
5084/*
5085%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5086%                                                                             %
5087%                                                                             %
5088%                                                                             %
5089%   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5090%                                                                             %
5091%                                                                             %
5092%                                                                             %
5093%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5094%
5095%  MagickGetImageMatteColor() returns the image matte color.
5096%
5097%  The format of the MagickGetImageMatteColor method is:
5098%
5099%      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5100%        PixelWand *matte_color)
5101%
5102%  A description of each parameter follows:
5103%
5104%    o wand: the magick wand.
5105%
5106%    o matte_color: Return the matte color.
5107%
5108*/
5109WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5110  PixelWand *matte_color)
5111{
5112  assert(wand != (MagickWand *) NULL);
5113  assert(wand->signature == WandSignature);
5114  if (IfMagickTrue(wand->debug))
5115    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5116  if (wand->images == (Image *) NULL)
5117    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5118  PixelSetPixelColor(matte_color,&wand->images->matte_color);
5119  return(MagickTrue);
5120}
5121
5122/*
5123%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5124%                                                                             %
5125%                                                                             %
5126%                                                                             %
5127%   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                         %
5128%                                                                             %
5129%                                                                             %
5130%                                                                             %
5131%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5132%
5133%  MagickGetImageOrientation() returns the image orientation.
5134%
5135%  The format of the MagickGetImageOrientation method is:
5136%
5137%      OrientationType MagickGetImageOrientation(MagickWand *wand)
5138%
5139%  A description of each parameter follows:
5140%
5141%    o wand: the magick wand.
5142%
5143*/
5144WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5145{
5146  assert(wand != (MagickWand *) NULL);
5147  assert(wand->signature == WandSignature);
5148  if (IfMagickTrue(wand->debug))
5149    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5150  if (wand->images == (Image *) NULL)
5151    {
5152      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5153        "ContainsNoImages","`%s'",wand->name);
5154      return(UndefinedOrientation);
5155    }
5156  return(wand->images->orientation);
5157}
5158
5159/*
5160%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5161%                                                                             %
5162%                                                                             %
5163%                                                                             %
5164%   M a g i c k G e t I m a g e P a g e                                       %
5165%                                                                             %
5166%                                                                             %
5167%                                                                             %
5168%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5169%
5170%  MagickGetImagePage() returns the page geometry associated with the image.
5171%
5172%  The format of the MagickGetImagePage method is:
5173%
5174%      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5175%        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5176%
5177%  A description of each parameter follows:
5178%
5179%    o wand: the magick wand.
5180%
5181%    o width: the page width.
5182%
5183%    o height: the page height.
5184%
5185%    o x: the page x-offset.
5186%
5187%    o y: the page y-offset.
5188%
5189*/
5190WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5191  size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5192{
5193  assert(wand != (const MagickWand *) NULL);
5194  assert(wand->signature == WandSignature);
5195  if (IfMagickTrue(wand->debug))
5196    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5197  if (wand->images == (Image *) NULL)
5198    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5199  *width=wand->images->page.width;
5200  *height=wand->images->page.height;
5201  *x=wand->images->page.x;
5202  *y=wand->images->page.y;
5203  return(MagickTrue);
5204}
5205
5206/*
5207%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5208%                                                                             %
5209%                                                                             %
5210%                                                                             %
5211%   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5212%                                                                             %
5213%                                                                             %
5214%                                                                             %
5215%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5216%
5217%  MagickGetImagePixelColor() returns the color of the specified pixel.
5218%
5219%  The format of the MagickGetImagePixelColor method is:
5220%
5221%      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5222%        const ssize_t x,const ssize_t y,PixelWand *color)
5223%
5224%  A description of each parameter follows:
5225%
5226%    o wand: the magick wand.
5227%
5228%    o x,y: the pixel offset into the image.
5229%
5230%    o color: Return the colormap color in this wand.
5231%
5232*/
5233WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5234  const ssize_t x,const ssize_t y,PixelWand *color)
5235{
5236  register const Quantum
5237    *p;
5238
5239  CacheView
5240    *image_view;
5241
5242  assert(wand != (MagickWand *) NULL);
5243  assert(wand->signature == WandSignature);
5244  if (IfMagickTrue(wand->debug))
5245    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5246  if (wand->images == (Image *) NULL)
5247    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5248  image_view=AcquireVirtualCacheView(wand->images,wand->exception);
5249  p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5250  if (p == (const Quantum *) NULL)
5251    {
5252      image_view=DestroyCacheView(image_view);
5253      return(MagickFalse);
5254    }
5255  PixelSetQuantumPixel(wand->images,p,color);
5256  image_view=DestroyCacheView(image_view);
5257  return(MagickTrue);
5258}
5259
5260/*
5261%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5262%                                                                             %
5263%                                                                             %
5264%                                                                             %
5265%   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5266%                                                                             %
5267%                                                                             %
5268%                                                                             %
5269%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5270%
5271%  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5272%
5273%  The format of the MagickGetImageRedPrimary method is:
5274%
5275%      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5276%        double *y)
5277%
5278%  A description of each parameter follows:
5279%
5280%    o wand: the magick wand.
5281%
5282%    o x: the chromaticity red primary x-point.
5283%
5284%    o y: the chromaticity red primary y-point.
5285%
5286*/
5287WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5288  double *x,double *y)
5289{
5290  assert(wand != (MagickWand *) NULL);
5291  assert(wand->signature == WandSignature);
5292  if (IfMagickTrue(wand->debug))
5293    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5294  if (wand->images == (Image *) NULL)
5295    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5296  *x=wand->images->chromaticity.red_primary.x;
5297  *y=wand->images->chromaticity.red_primary.y;
5298  return(MagickTrue);
5299}
5300
5301/*
5302%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5303%                                                                             %
5304%                                                                             %
5305%                                                                             %
5306%   M a g i c k G e t I m a g e R e g i o n                                   %
5307%                                                                             %
5308%                                                                             %
5309%                                                                             %
5310%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5311%
5312%  MagickGetImageRegion() extracts a region of the image and returns it as a
5313%  a new wand.
5314%
5315%  The format of the MagickGetImageRegion method is:
5316%
5317%      MagickWand *MagickGetImageRegion(MagickWand *wand,
5318%        const size_t width,const size_t height,const ssize_t x,
5319%        const ssize_t y)
5320%
5321%  A description of each parameter follows:
5322%
5323%    o wand: the magick wand.
5324%
5325%    o width: the region width.
5326%
5327%    o height: the region height.
5328%
5329%    o x: the region x offset.
5330%
5331%    o y: the region y offset.
5332%
5333*/
5334WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5335  const size_t width,const size_t height,const ssize_t x,
5336  const ssize_t y)
5337{
5338  Image
5339    *region_image;
5340
5341  RectangleInfo
5342    region;
5343
5344  assert(wand != (MagickWand *) NULL);
5345  assert(wand->signature == WandSignature);
5346  if (IfMagickTrue(wand->debug))
5347    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5348  if (wand->images == (Image *) NULL)
5349    return((MagickWand *) NULL);
5350  region.width=width;
5351  region.height=height;
5352  region.x=x;
5353  region.y=y;
5354  region_image=CropImage(wand->images,&region,wand->exception);
5355  if (region_image == (Image *) NULL)
5356    return((MagickWand *) NULL);
5357  return(CloneMagickWandFromImages(wand,region_image));
5358}
5359
5360/*
5361%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5362%                                                                             %
5363%                                                                             %
5364%                                                                             %
5365%   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                 %
5366%                                                                             %
5367%                                                                             %
5368%                                                                             %
5369%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5370%
5371%  MagickGetImageRenderingIntent() gets the image rendering intent.
5372%
5373%  The format of the MagickGetImageRenderingIntent method is:
5374%
5375%      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5376%
5377%  A description of each parameter follows:
5378%
5379%    o wand: the magick wand.
5380%
5381*/
5382WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5383{
5384  assert(wand != (MagickWand *) NULL);
5385  assert(wand->signature == WandSignature);
5386  if (IfMagickTrue(wand->debug))
5387    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5388  if (wand->images == (Image *) NULL)
5389    {
5390      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5391        "ContainsNoImages","`%s'",wand->name);
5392      return(UndefinedIntent);
5393    }
5394  return((RenderingIntent) wand->images->rendering_intent);
5395}
5396
5397/*
5398%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5399%                                                                             %
5400%                                                                             %
5401%                                                                             %
5402%   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5403%                                                                             %
5404%                                                                             %
5405%                                                                             %
5406%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5407%
5408%  MagickGetImageResolution() gets the image X and Y resolution.
5409%
5410%  The format of the MagickGetImageResolution method is:
5411%
5412%      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5413%        double *y)
5414%
5415%  A description of each parameter follows:
5416%
5417%    o wand: the magick wand.
5418%
5419%    o x: the image x-resolution.
5420%
5421%    o y: the image y-resolution.
5422%
5423*/
5424WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5425  double *x,double *y)
5426{
5427  assert(wand != (MagickWand *) NULL);
5428  assert(wand->signature == WandSignature);
5429  if (IfMagickTrue(wand->debug))
5430    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5431  if (wand->images == (Image *) NULL)
5432    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5433  *x=wand->images->resolution.x;
5434  *y=wand->images->resolution.y;
5435  return(MagickTrue);
5436}
5437
5438/*
5439%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5440%                                                                             %
5441%                                                                             %
5442%                                                                             %
5443%   M a g i c k G e t I m a g e S c e n e                                     %
5444%                                                                             %
5445%                                                                             %
5446%                                                                             %
5447%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5448%
5449%  MagickGetImageScene() gets the image scene.
5450%
5451%  The format of the MagickGetImageScene method is:
5452%
5453%      size_t MagickGetImageScene(MagickWand *wand)
5454%
5455%  A description of each parameter follows:
5456%
5457%    o wand: the magick wand.
5458%
5459*/
5460WandExport size_t MagickGetImageScene(MagickWand *wand)
5461{
5462  assert(wand != (MagickWand *) NULL);
5463  assert(wand->signature == WandSignature);
5464  if (IfMagickTrue(wand->debug))
5465    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5466  if (wand->images == (Image *) NULL)
5467    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5468  return(wand->images->scene);
5469}
5470
5471/*
5472%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5473%                                                                             %
5474%                                                                             %
5475%                                                                             %
5476%   M a g i c k G e t I m a g e S i g n a t u r e                             %
5477%                                                                             %
5478%                                                                             %
5479%                                                                             %
5480%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5481%
5482%  MagickGetImageSignature() generates an SHA-256 message digest for the image
5483%  pixel stream.
5484%
5485%  The format of the MagickGetImageSignature method is:
5486%
5487%      char *MagickGetImageSignature(MagickWand *wand)
5488%
5489%  A description of each parameter follows:
5490%
5491%    o wand: the magick wand.
5492%
5493*/
5494WandExport char *MagickGetImageSignature(MagickWand *wand)
5495{
5496  const char
5497    *value;
5498
5499  MagickBooleanType
5500    status;
5501
5502  assert(wand != (MagickWand *) NULL);
5503  assert(wand->signature == WandSignature);
5504  if (IfMagickTrue(wand->debug))
5505    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5506  if (wand->images == (Image *) NULL)
5507    {
5508      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5509        "ContainsNoImages","`%s'",wand->name);
5510      return((char *) NULL);
5511    }
5512  status=SignatureImage(wand->images,wand->exception);
5513  if (IfMagickFalse(status))
5514    return((char *) NULL);
5515  value=GetImageProperty(wand->images,"signature",wand->exception);
5516  if (value == (const char *) NULL)
5517    return((char *) NULL);
5518  return(AcquireString(value));
5519}
5520
5521/*
5522%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5523%                                                                             %
5524%                                                                             %
5525%                                                                             %
5526%   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                   %
5527%                                                                             %
5528%                                                                             %
5529%                                                                             %
5530%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5531%
5532%  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5533%
5534%  The format of the MagickGetImageTicksPerSecond method is:
5535%
5536%      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5537%
5538%  A description of each parameter follows:
5539%
5540%    o wand: the magick wand.
5541%
5542*/
5543WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5544{
5545  assert(wand != (MagickWand *) NULL);
5546  assert(wand->signature == WandSignature);
5547  if (IfMagickTrue(wand->debug))
5548    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5549  if (wand->images == (Image *) NULL)
5550    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5551  return((size_t) wand->images->ticks_per_second);
5552}
5553
5554/*
5555%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5556%                                                                             %
5557%                                                                             %
5558%                                                                             %
5559%   M a g i c k G e t I m a g e T y p e                                       %
5560%                                                                             %
5561%                                                                             %
5562%                                                                             %
5563%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5564%
5565%  MagickGetImageType() gets the potential image type:
5566%
5567%        Bilevel        Grayscale       GrayscaleMatte
5568%        Palette        PaletteMatte    TrueColor
5569%        TrueColorMatte ColorSeparation ColorSeparationMatte
5570%
5571%  To ensure the image type matches its potential, use MagickSetImageType():
5572%
5573%    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5574%
5575%  The format of the MagickGetImageType method is:
5576%
5577%      ImageType MagickGetImageType(MagickWand *wand)
5578%
5579%  A description of each parameter follows:
5580%
5581%    o wand: the magick wand.
5582%
5583*/
5584WandExport ImageType MagickGetImageType(MagickWand *wand)
5585{
5586  assert(wand != (MagickWand *) NULL);
5587  assert(wand->signature == WandSignature);
5588  if (IfMagickTrue(wand->debug))
5589    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5590  if (wand->images == (Image *) NULL)
5591    {
5592      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5593        "ContainsNoImages","`%s'",wand->name);
5594      return(UndefinedType);
5595    }
5596  return(GetImageType(wand->images,wand->exception));
5597}
5598
5599/*
5600%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5601%                                                                             %
5602%                                                                             %
5603%                                                                             %
5604%   M a g i c k G e t I m a g e U n i t s                                     %
5605%                                                                             %
5606%                                                                             %
5607%                                                                             %
5608%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5609%
5610%  MagickGetImageUnits() gets the image units of resolution.
5611%
5612%  The format of the MagickGetImageUnits method is:
5613%
5614%      ResolutionType MagickGetImageUnits(MagickWand *wand)
5615%
5616%  A description of each parameter follows:
5617%
5618%    o wand: the magick wand.
5619%
5620*/
5621WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5622{
5623  assert(wand != (MagickWand *) NULL);
5624  assert(wand->signature == WandSignature);
5625  if (IfMagickTrue(wand->debug))
5626    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5627  if (wand->images == (Image *) NULL)
5628    {
5629      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5630        "ContainsNoImages","`%s'",wand->name);
5631      return(UndefinedResolution);
5632    }
5633  return(wand->images->units);
5634}
5635
5636/*
5637%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5638%                                                                             %
5639%                                                                             %
5640%                                                                             %
5641%   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           %
5642%                                                                             %
5643%                                                                             %
5644%                                                                             %
5645%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5646%
5647%  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5648%  sepcified image.
5649%
5650%  The format of the MagickGetImageVirtualPixelMethod method is:
5651%
5652%      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5653%
5654%  A description of each parameter follows:
5655%
5656%    o wand: the magick wand.
5657%
5658*/
5659WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5660{
5661  assert(wand != (MagickWand *) NULL);
5662  assert(wand->signature == WandSignature);
5663  if (IfMagickTrue(wand->debug))
5664    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5665  if (wand->images == (Image *) NULL)
5666    {
5667      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5668        "ContainsNoImages","`%s'",wand->name);
5669      return(UndefinedVirtualPixelMethod);
5670    }
5671  return(GetImageVirtualPixelMethod(wand->images));
5672}
5673
5674/*
5675%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5676%                                                                             %
5677%                                                                             %
5678%                                                                             %
5679%   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5680%                                                                             %
5681%                                                                             %
5682%                                                                             %
5683%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5684%
5685%  MagickGetImageWhitePoint() returns the chromaticy white point.
5686%
5687%  The format of the MagickGetImageWhitePoint method is:
5688%
5689%      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5690%        double *y)
5691%
5692%  A description of each parameter follows:
5693%
5694%    o wand: the magick wand.
5695%
5696%    o x: the chromaticity white x-point.
5697%
5698%    o y: the chromaticity white y-point.
5699%
5700*/
5701WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5702  double *x,double *y)
5703{
5704  assert(wand != (MagickWand *) NULL);
5705  assert(wand->signature == WandSignature);
5706  if (IfMagickTrue(wand->debug))
5707    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5708  if (wand->images == (Image *) NULL)
5709    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5710  *x=wand->images->chromaticity.white_point.x;
5711  *y=wand->images->chromaticity.white_point.y;
5712  return(MagickTrue);
5713}
5714
5715/*
5716%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5717%                                                                             %
5718%                                                                             %
5719%                                                                             %
5720%   M a g i c k G e t I m a g e W i d t h                                     %
5721%                                                                             %
5722%                                                                             %
5723%                                                                             %
5724%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5725%
5726%  MagickGetImageWidth() returns the image width.
5727%
5728%  The format of the MagickGetImageWidth method is:
5729%
5730%      size_t MagickGetImageWidth(MagickWand *wand)
5731%
5732%  A description of each parameter follows:
5733%
5734%    o wand: the magick wand.
5735%
5736*/
5737WandExport size_t MagickGetImageWidth(MagickWand *wand)
5738{
5739  assert(wand != (MagickWand *) NULL);
5740  assert(wand->signature == WandSignature);
5741  if (IfMagickTrue(wand->debug))
5742    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5743  if (wand->images == (Image *) NULL)
5744    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5745  return(wand->images->columns);
5746}
5747
5748/*
5749%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5750%                                                                             %
5751%                                                                             %
5752%                                                                             %
5753%   M a g i c k G e t N u m b e r I m a g e s                                 %
5754%                                                                             %
5755%                                                                             %
5756%                                                                             %
5757%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5758%
5759%  MagickGetNumberImages() returns the number of images associated with a
5760%  magick wand.
5761%
5762%  The format of the MagickGetNumberImages method is:
5763%
5764%      size_t MagickGetNumberImages(MagickWand *wand)
5765%
5766%  A description of each parameter follows:
5767%
5768%    o wand: the magick wand.
5769%
5770*/
5771WandExport size_t MagickGetNumberImages(MagickWand *wand)
5772{
5773  assert(wand != (MagickWand *) NULL);
5774  assert(wand->signature == WandSignature);
5775  if (IfMagickTrue(wand->debug))
5776    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5777  return(GetImageListLength(wand->images));
5778}
5779
5780/*
5781%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5782%                                                                             %
5783%                                                                             %
5784%                                                                             %
5785%   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                 %
5786%                                                                             %
5787%                                                                             %
5788%                                                                             %
5789%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5790%
5791%  MagickGetImageTotalInkDensity() gets the image total ink density.
5792%
5793%  The format of the MagickGetImageTotalInkDensity method is:
5794%
5795%      double MagickGetImageTotalInkDensity(MagickWand *wand)
5796%
5797%  A description of each parameter follows:
5798%
5799%    o wand: the magick wand.
5800%
5801*/
5802WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5803{
5804  assert(wand != (MagickWand *) NULL);
5805  assert(wand->signature == WandSignature);
5806  if (IfMagickTrue(wand->debug))
5807    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5808  if (wand->images == (Image *) NULL)
5809    {
5810      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5811        "ContainsNoImages","`%s'",wand->name);
5812      return(0.0);
5813    }
5814  return(GetImageTotalInkDensity(wand->images,wand->exception));
5815}
5816
5817/*
5818%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5819%                                                                             %
5820%                                                                             %
5821%                                                                             %
5822%   M a g i c k H a l d C l u t I m a g e                                     %
5823%                                                                             %
5824%                                                                             %
5825%                                                                             %
5826%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5827%
5828%  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5829%  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5830%  dimensions.  Create it with the HALD coder.  You can apply any color
5831%  transformation to the Hald image and then use this method to apply the
5832%  transform to the image.
5833%
5834%  The format of the MagickHaldClutImage method is:
5835%
5836%      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5837%        const MagickWand *hald_wand)
5838%
5839%  A description of each parameter follows:
5840%
5841%    o wand: the magick wand.
5842%
5843%    o hald_image: the hald CLUT image.
5844%
5845*/
5846WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5847  const MagickWand *hald_wand)
5848{
5849  MagickBooleanType
5850    status;
5851
5852  assert(wand != (MagickWand *) NULL);
5853  assert(wand->signature == WandSignature);
5854  if (IfMagickTrue(wand->debug))
5855    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5856  if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5857    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5858  status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
5859  return(status);
5860}
5861
5862/*
5863%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5864%                                                                             %
5865%                                                                             %
5866%                                                                             %
5867%   M a g i c k H a s N e x t I m a g e                                       %
5868%                                                                             %
5869%                                                                             %
5870%                                                                             %
5871%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5872%
5873%  MagickHasNextImage() returns MagickTrue if the wand has more images when
5874%  traversing the list in the forward direction
5875%
5876%  The format of the MagickHasNextImage method is:
5877%
5878%      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5879%
5880%  A description of each parameter follows:
5881%
5882%    o wand: the magick wand.
5883%
5884*/
5885WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5886{
5887  assert(wand != (MagickWand *) NULL);
5888  assert(wand->signature == WandSignature);
5889  if (IfMagickTrue(wand->debug))
5890    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5891  if (wand->images == (Image *) NULL)
5892    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5893  if (GetNextImageInList(wand->images) == (Image *) NULL)
5894    return(MagickFalse);
5895  return(MagickTrue);
5896}
5897
5898/*
5899%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5900%                                                                             %
5901%                                                                             %
5902%                                                                             %
5903%   M a g i c k H a s P r e v i o u s I m a g e                               %
5904%                                                                             %
5905%                                                                             %
5906%                                                                             %
5907%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5908%
5909%  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5910%  traversing the list in the reverse direction
5911%
5912%  The format of the MagickHasPreviousImage method is:
5913%
5914%      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5915%
5916%  A description of each parameter follows:
5917%
5918%    o wand: the magick wand.
5919%
5920*/
5921WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5922{
5923  assert(wand != (MagickWand *) NULL);
5924  assert(wand->signature == WandSignature);
5925  if (IfMagickTrue(wand->debug))
5926    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5927  if (wand->images == (Image *) NULL)
5928    ThrowWandException(WandError,"ContainsNoImages",wand->name);
5929  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5930    return(MagickFalse);
5931  return(MagickTrue);
5932}
5933
5934/*
5935%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5936%                                                                             %
5937%                                                                             %
5938%                                                                             %
5939%   M a g i c k I d e n t i f y I m a g e                                     %
5940%                                                                             %
5941%                                                                             %
5942%                                                                             %
5943%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5944%
5945%  MagickIdentifyImage() identifies an image by printing its attributes to the
5946%  file.  Attributes include the image width, height, size, and others.
5947%
5948%  The format of the MagickIdentifyImage method is:
5949%
5950%      const char *MagickIdentifyImage(MagickWand *wand)
5951%
5952%  A description of each parameter follows:
5953%
5954%    o wand: the magick wand.
5955%
5956*/
5957WandExport char *MagickIdentifyImage(MagickWand *wand)
5958{
5959  char
5960    *description,
5961    filename[MagickPathExtent];
5962
5963  FILE
5964    *file;
5965
5966  int
5967    unique_file;
5968
5969  assert(wand != (MagickWand *) NULL);
5970  assert(wand->signature == WandSignature);
5971  if (IfMagickTrue(wand->debug))
5972    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5973  if (wand->images == (Image *) NULL)
5974    {
5975      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5976        "ContainsNoImages","`%s'",wand->name);
5977      return((char *) NULL);
5978    }
5979  description=(char *) NULL;
5980  unique_file=AcquireUniqueFileResource(filename);
5981  file=(FILE *) NULL;
5982  if (unique_file != -1)
5983    file=fdopen(unique_file,"wb");
5984  if ((unique_file == -1) || (file == (FILE *) NULL))
5985    {
5986      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5987        "UnableToCreateTemporaryFile","`%s'",wand->name);
5988      return((char *) NULL);
5989    }
5990  (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
5991  (void) fclose(file);
5992  description=FileToString(filename,~0UL,wand->exception);
5993  (void) RelinquishUniqueFileResource(filename);
5994  return(description);
5995}
5996
5997/*
5998%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5999%                                                                             %
6000%                                                                             %
6001%                                                                             %
6002%   M a g i c k I m p l o d e I m a g e                                       %
6003%                                                                             %
6004%                                                                             %
6005%                                                                             %
6006%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6007%
6008%  MagickImplodeImage() creates a new image that is a copy of an existing
6009%  one with the image pixels "implode" by the specified percentage.  It
6010%  allocates the memory necessary for the new Image structure and returns a
6011%  pointer to the new image.
6012%
6013%  The format of the MagickImplodeImage method is:
6014%
6015%      MagickBooleanType MagickImplodeImage(MagickWand *wand,
6016%        const double radius,const PixelInterpolateMethod method)
6017%
6018%  A description of each parameter follows:
6019%
6020%    o wand: the magick wand.
6021%
6022%    o amount: Define the extent of the implosion.
6023%
6024%    o method: the pixel interpolation method.
6025%
6026*/
6027WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6028  const double amount,const PixelInterpolateMethod method)
6029{
6030  Image
6031    *implode_image;
6032
6033  assert(wand != (MagickWand *) NULL);
6034  assert(wand->signature == WandSignature);
6035  if (IfMagickTrue(wand->debug))
6036    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6037  if (wand->images == (Image *) NULL)
6038    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6039  implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
6040  if (implode_image == (Image *) NULL)
6041    return(MagickFalse);
6042  ReplaceImageInList(&wand->images,implode_image);
6043  return(MagickTrue);
6044}
6045
6046/*
6047%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6048%                                                                             %
6049%                                                                             %
6050%                                                                             %
6051%   M a g i c k I m p o r t I m a g e P i x e l s                             %
6052%                                                                             %
6053%                                                                             %
6054%                                                                             %
6055%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6056%
6057%  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6058%  location you specify.  The method returns MagickFalse on success otherwise
6059%  MagickTrue if an error is encountered.  The pixel data can be either char,
6060%  short int, int, ssize_t, float, or double in the order specified by map.
6061%
6062%  Suppose your want to upload the first scanline of a 640x480 image from
6063%  character data in red-green-blue order:
6064%
6065%      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6066%
6067%  The format of the MagickImportImagePixels method is:
6068%
6069%      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6070%        const ssize_t x,const ssize_t y,const size_t columns,
6071%        const size_t rows,const char *map,const StorageType storage,
6072%        const void *pixels)
6073%
6074%  A description of each parameter follows:
6075%
6076%    o wand: the magick wand.
6077%
6078%    o x, y, columns, rows:  These values define the perimeter of a region
6079%      of pixels you want to define.
6080%
6081%    o map:  This string reflects the expected ordering of the pixel array.
6082%      It can be any combination or order of R = red, G = green, B = blue,
6083%      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
6084%      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6085%      P = pad.
6086%
6087%    o storage: Define the data type of the pixels.  Float and double types are
6088%      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6089%      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6090%      or DoublePixel.
6091%
6092%    o pixels: This array of values contain the pixel components as defined by
6093%      map and type.  You must preallocate this array where the expected
6094%      length varies depending on the values of width, height, map, and type.
6095%
6096*/
6097WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6098  const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
6099  const char *map,const StorageType storage,const void *pixels)
6100{
6101  MagickBooleanType
6102    status;
6103
6104  assert(wand != (MagickWand *) NULL);
6105  assert(wand->signature == WandSignature);
6106  if (IfMagickTrue(wand->debug))
6107    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6108  if (wand->images == (Image *) NULL)
6109    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6110  status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
6111    wand->exception);
6112  return(status);
6113}
6114
6115/*
6116%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6117%                                                                             %
6118%                                                                             %
6119%                                                                             %
6120%   M a g i c k I n t e r p o l a t i v e R e s i z e I m a g e               %
6121%                                                                             %
6122%                                                                             %
6123%                                                                             %
6124%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6125%
6126%  MagickInterpolativeResizeImage() resize image using a interpolative
6127%  method.
6128%
6129%      MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6130%        const size_t columns,const size_t rows,
6131%        const PixelInterpolateMethod method)
6132%
6133%  A description of each parameter follows:
6134%
6135%    o wand: the magick wand.
6136%
6137%    o columns: the number of columns in the scaled image.
6138%
6139%    o rows: the number of rows in the scaled image.
6140%
6141%    o interpolate: the pixel interpolation method.
6142%
6143*/
6144WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6145  const size_t columns,const size_t rows,const PixelInterpolateMethod method)
6146{
6147  Image
6148    *resize_image;
6149
6150  assert(wand != (MagickWand *) NULL);
6151  assert(wand->signature == WandSignature);
6152  if (IfMagickTrue(wand->debug))
6153    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6154  if (wand->images == (Image *) NULL)
6155    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6156  resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
6157    wand->exception);
6158  if (resize_image == (Image *) NULL)
6159    return(MagickFalse);
6160  ReplaceImageInList(&wand->images,resize_image);
6161  return(MagickTrue);
6162}
6163
6164/*
6165%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6166%                                                                             %
6167%                                                                             %
6168%                                                                             %
6169%   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       %
6170%                                                                             %
6171%                                                                             %
6172%                                                                             %
6173%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6174%
6175%  MagickInverseFourierTransformImage() implements the inverse discrete
6176%  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6177%  imaginary image pair.
6178%
6179%  The format of the MagickInverseFourierTransformImage method is:
6180%
6181%      MagickBooleanType MagickInverseFourierTransformImage(
6182%        MagickWand *magnitude_wand,MagickWand *phase_wand,
6183%        const MagickBooleanType magnitude)
6184%
6185%  A description of each parameter follows:
6186%
6187%    o magnitude_wand: the magnitude or real wand.
6188%
6189%    o phase_wand: the phase or imaginary wand.
6190%
6191%    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6192%      imaginary image pair.
6193%
6194*/
6195WandExport MagickBooleanType MagickInverseFourierTransformImage(
6196  MagickWand *magnitude_wand,MagickWand *phase_wand,
6197  const MagickBooleanType magnitude)
6198{
6199  Image
6200    *inverse_image;
6201
6202  MagickWand
6203    *wand;
6204
6205  assert(magnitude_wand != (MagickWand *) NULL);
6206  assert(magnitude_wand->signature == WandSignature);
6207  if (IfMagickTrue(magnitude_wand->debug))
6208    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6209      magnitude_wand->name);
6210  wand=magnitude_wand;
6211  if (magnitude_wand->images == (Image *) NULL)
6212    ThrowWandException(WandError,"ContainsNoImages",
6213      magnitude_wand->name);
6214  assert(phase_wand != (MagickWand *) NULL);
6215  assert(phase_wand->signature == WandSignature);
6216  inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6217    phase_wand->images,magnitude,wand->exception);
6218  if (inverse_image == (Image *) NULL)
6219    return(MagickFalse);
6220  ReplaceImageInList(&wand->images,inverse_image);
6221  return(MagickTrue);
6222}
6223
6224/*
6225%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6226%                                                                             %
6227%                                                                             %
6228%                                                                             %
6229%   M a g i c k L a b e l I m a g e                                           %
6230%                                                                             %
6231%                                                                             %
6232%                                                                             %
6233%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6234%
6235%  MagickLabelImage() adds a label to your image.
6236%
6237%  The format of the MagickLabelImage method is:
6238%
6239%      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6240%
6241%  A description of each parameter follows:
6242%
6243%    o wand: the magick wand.
6244%
6245%    o label: the image label.
6246%
6247*/
6248WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6249  const char *label)
6250{
6251  MagickBooleanType
6252    status;
6253
6254  assert(wand != (MagickWand *) NULL);
6255  assert(wand->signature == WandSignature);
6256  if (IfMagickTrue(wand->debug))
6257    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6258  if (wand->images == (Image *) NULL)
6259    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6260  status=SetImageProperty(wand->images,"label",label,wand->exception);
6261  return(status);
6262}
6263
6264/*
6265%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6266%                                                                             %
6267%                                                                             %
6268%                                                                             %
6269%   M a g i c k L e v e l I m a g e                                           %
6270%                                                                             %
6271%                                                                             %
6272%                                                                             %
6273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6274%
6275%  MagickLevelImage() adjusts the levels of an image by scaling the colors
6276%  falling between specified white and black points to the full available
6277%  quantum range. The parameters provided represent the black, mid, and white
6278%  points. The black point specifies the darkest color in the image. Colors
6279%  darker than the black point are set to zero. Mid point specifies a gamma
6280%  correction to apply to the image.  White point specifies the lightest color
6281%  in the image. Colors brighter than the white point are set to the maximum
6282%  quantum value.
6283%
6284%  The format of the MagickLevelImage method is:
6285%
6286%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6287%        const double black_point,const double gamma,const double white_point)
6288%      MagickBooleanType MagickLevelImage(MagickWand *wand,
6289%        const ChannelType channel,const double black_point,const double gamma,
6290%        const double white_point)
6291%
6292%  A description of each parameter follows:
6293%
6294%    o wand: the magick wand.
6295%
6296%    o channel: Identify which channel to level: RedPixelChannel,
6297%      GreenPixelChannel, etc.
6298%
6299%    o black_point: the black point.
6300%
6301%    o gamma: the gamma.
6302%
6303%    o white_point: the white point.
6304%
6305*/
6306WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6307  const double black_point,const double gamma,const double white_point)
6308{
6309  MagickBooleanType
6310    status;
6311
6312  assert(wand != (MagickWand *) NULL);
6313  assert(wand->signature == WandSignature);
6314  if (IfMagickTrue(wand->debug))
6315    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6316  if (wand->images == (Image *) NULL)
6317    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6318  status=LevelImage(wand->images,black_point,white_point,gamma,
6319    wand->exception);
6320  return(status);
6321}
6322
6323/*
6324%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6325%                                                                             %
6326%                                                                             %
6327%                                                                             %
6328%   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6329%                                                                             %
6330%                                                                             %
6331%                                                                             %
6332%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6333%
6334%  MagickLinearStretchImage() stretches with saturation the image intensity.
6335%
6336%  You can also reduce the influence of a particular channel with a gamma
6337%  value of 0.
6338%
6339%  The format of the MagickLinearStretchImage method is:
6340%
6341%      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6342%        const double black_point,const double white_point)
6343%
6344%  A description of each parameter follows:
6345%
6346%    o wand: the magick wand.
6347%
6348%    o black_point: the black point.
6349%
6350%    o white_point: the white point.
6351%
6352*/
6353WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6354  const double black_point,const double white_point)
6355{
6356  MagickBooleanType
6357    status;
6358
6359  assert(wand != (MagickWand *) NULL);
6360  assert(wand->signature == WandSignature);
6361  if (IfMagickTrue(wand->debug))
6362    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6363  if (wand->images == (Image *) NULL)
6364    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6365  status=LinearStretchImage(wand->images,black_point,white_point,
6366    wand->exception);
6367  return(status);
6368}
6369
6370/*
6371%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6372%                                                                             %
6373%                                                                             %
6374%                                                                             %
6375%   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6376%                                                                             %
6377%                                                                             %
6378%                                                                             %
6379%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6380%
6381%  MagickLiquidRescaleImage() rescales image with seam carving.
6382%
6383%      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6384%        const size_t columns,const size_t rows,
6385%        const double delta_x,const double rigidity)
6386%
6387%  A description of each parameter follows:
6388%
6389%    o wand: the magick wand.
6390%
6391%    o columns: the number of columns in the scaled image.
6392%
6393%    o rows: the number of rows in the scaled image.
6394%
6395%    o delta_x: maximum seam transversal step (0 means straight seams).
6396%
6397%    o rigidity: introduce a bias for non-straight seams (typically 0).
6398%
6399*/
6400WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6401  const size_t columns,const size_t rows,const double delta_x,
6402  const double rigidity)
6403{
6404  Image
6405    *rescale_image;
6406
6407  assert(wand != (MagickWand *) NULL);
6408  assert(wand->signature == WandSignature);
6409  if (IfMagickTrue(wand->debug))
6410    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6411  if (wand->images == (Image *) NULL)
6412    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6413  rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6414    rigidity,wand->exception);
6415  if (rescale_image == (Image *) NULL)
6416    return(MagickFalse);
6417  ReplaceImageInList(&wand->images,rescale_image);
6418  return(MagickTrue);
6419}
6420
6421/*
6422%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6423%                                                                             %
6424%                                                                             %
6425%                                                                             %
6426%   M a g i c k M a g n i f y I m a g e                                       %
6427%                                                                             %
6428%                                                                             %
6429%                                                                             %
6430%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6431%
6432%  MagickMagnifyImage() is a convenience method that scales an image
6433%  proportionally to twice its original size.
6434%
6435%  The format of the MagickMagnifyImage method is:
6436%
6437%      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6438%
6439%  A description of each parameter follows:
6440%
6441%    o wand: the magick wand.
6442%
6443*/
6444WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6445{
6446  Image
6447    *magnify_image;
6448
6449  assert(wand != (MagickWand *) NULL);
6450  assert(wand->signature == WandSignature);
6451  if (IfMagickTrue(wand->debug))
6452    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6453  if (wand->images == (Image *) NULL)
6454    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6455  magnify_image=MagnifyImage(wand->images,wand->exception);
6456  if (magnify_image == (Image *) NULL)
6457    return(MagickFalse);
6458  ReplaceImageInList(&wand->images,magnify_image);
6459  return(MagickTrue);
6460}
6461
6462/*
6463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6464%                                                                             %
6465%                                                                             %
6466%                                                                             %
6467%   M a g i c k M e r g e I m a g e L a y e r s                               %
6468%                                                                             %
6469%                                                                             %
6470%                                                                             %
6471%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6472%
6473%  MagickMergeImageLayers() composes all the image layers from the current
6474%  given image onward to produce a single image of the merged layers.
6475%
6476%  The inital canvas's size depends on the given LayerMethod, and is
6477%  initialized using the first images background color.  The images
6478%  are then compositied onto that image in sequence using the given
6479%  composition that has been assigned to each individual image.
6480%
6481%  The format of the MagickMergeImageLayers method is:
6482%
6483%      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6484%        const LayerMethod method)
6485%
6486%  A description of each parameter follows:
6487%
6488%    o wand: the magick wand.
6489%
6490%    o method: the method of selecting the size of the initial canvas.
6491%
6492%        MergeLayer: Merge all layers onto a canvas just large enough
6493%           to hold all the actual images. The virtual canvas of the
6494%           first image is preserved but otherwise ignored.
6495%
6496%        FlattenLayer: Use the virtual canvas size of first image.
6497%           Images which fall outside this canvas is clipped.
6498%           This can be used to 'fill out' a given virtual canvas.
6499%
6500%        MosaicLayer: Start with the virtual canvas of the first image,
6501%           enlarging left and right edges to contain all images.
6502%           Images with negative offsets will be clipped.
6503%
6504*/
6505WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6506  const LayerMethod method)
6507{
6508  Image
6509    *mosaic_image;
6510
6511  assert(wand != (MagickWand *) NULL);
6512  assert(wand->signature == WandSignature);
6513  if (IfMagickTrue(wand->debug))
6514    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6515  if (wand->images == (Image *) NULL)
6516    return((MagickWand *) NULL);
6517  mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6518  if (mosaic_image == (Image *) NULL)
6519    return((MagickWand *) NULL);
6520  return(CloneMagickWandFromImages(wand,mosaic_image));
6521}
6522
6523/*
6524%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6525%                                                                             %
6526%                                                                             %
6527%                                                                             %
6528%   M a g i c k M i n i f y I m a g e                                         %
6529%                                                                             %
6530%                                                                             %
6531%                                                                             %
6532%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6533%
6534%  MagickMinifyImage() is a convenience method that scales an image
6535%  proportionally to one-half its original size
6536%
6537%  The format of the MagickMinifyImage method is:
6538%
6539%      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6540%
6541%  A description of each parameter follows:
6542%
6543%    o wand: the magick wand.
6544%
6545*/
6546WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6547{
6548  Image
6549    *minify_image;
6550
6551  assert(wand != (MagickWand *) NULL);
6552  assert(wand->signature == WandSignature);
6553  if (IfMagickTrue(wand->debug))
6554    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6555  if (wand->images == (Image *) NULL)
6556    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6557  minify_image=MinifyImage(wand->images,wand->exception);
6558  if (minify_image == (Image *) NULL)
6559    return(MagickFalse);
6560  ReplaceImageInList(&wand->images,minify_image);
6561  return(MagickTrue);
6562}
6563
6564/*
6565%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6566%                                                                             %
6567%                                                                             %
6568%                                                                             %
6569%   M a g i c k M o d u l a t e I m a g e                                     %
6570%                                                                             %
6571%                                                                             %
6572%                                                                             %
6573%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6574%
6575%  MagickModulateImage() lets you control the brightness, saturation, and hue
6576%  of an image.  Hue is the percentage of absolute rotation from the current
6577%  position.  For example 50 results in a counter-clockwise rotation of 90
6578%  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6579%  both resulting in a rotation of 180 degrees.
6580%
6581%  To increase the color brightness by 20% and decrease the color saturation by
6582%  10% and leave the hue unchanged, use: 120,90,100.
6583%
6584%  The format of the MagickModulateImage method is:
6585%
6586%      MagickBooleanType MagickModulateImage(MagickWand *wand,
6587%        const double brightness,const double saturation,const double hue)
6588%
6589%  A description of each parameter follows:
6590%
6591%    o wand: the magick wand.
6592%
6593%    o brightness: the percent change in brighness.
6594%
6595%    o saturation: the percent change in saturation.
6596%
6597%    o hue: the percent change in hue.
6598%
6599*/
6600WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6601  const double brightness,const double saturation,const double hue)
6602{
6603  char
6604    modulate[MagickPathExtent];
6605
6606  MagickBooleanType
6607    status;
6608
6609  assert(wand != (MagickWand *) NULL);
6610  assert(wand->signature == WandSignature);
6611  if (IfMagickTrue(wand->debug))
6612    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6613  if (wand->images == (Image *) NULL)
6614    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6615  (void) FormatLocaleString(modulate,MagickPathExtent,"%g,%g,%g",
6616    brightness,saturation,hue);
6617  status=ModulateImage(wand->images,modulate,wand->exception);
6618  return(status);
6619}
6620
6621/*
6622%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6623%                                                                             %
6624%                                                                             %
6625%                                                                             %
6626%   M a g i c k M o n t a g e I m a g e                                       %
6627%                                                                             %
6628%                                                                             %
6629%                                                                             %
6630%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6631%
6632%  MagickMontageImage() creates a composite image by combining several
6633%  separate images. The images are tiled on the composite image with the name
6634%  of the image optionally appearing just below the individual tile.
6635%
6636%  The format of the MagickMontageImage method is:
6637%
6638%      MagickWand *MagickMontageImage(MagickWand *wand,
6639%        const DrawingWand drawing_wand,const char *tile_geometry,
6640%        const char *thumbnail_geometry,const MontageMode mode,
6641%        const char *frame)
6642%
6643%  A description of each parameter follows:
6644%
6645%    o wand: the magick wand.
6646%
6647%    o drawing_wand: the drawing wand.  The font name, size, and color are
6648%      obtained from this wand.
6649%
6650%    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6651%
6652%    o thumbnail_geometry: Preferred image size and border size of each
6653%      thumbnail (e.g. 120x120+4+3>).
6654%
6655%    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6656%
6657%    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6658%      The frame color is that of the thumbnail's matte color.
6659%
6660*/
6661WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6662  const DrawingWand *drawing_wand,const char *tile_geometry,
6663  const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6664{
6665  char
6666    *font;
6667
6668  Image
6669    *montage_image;
6670
6671  MontageInfo
6672    *montage_info;
6673
6674  PixelWand
6675    *pixel_wand;
6676
6677  assert(wand != (MagickWand *) NULL);
6678  assert(wand->signature == WandSignature);
6679  if (IfMagickTrue(wand->debug))
6680    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6681  if (wand->images == (Image *) NULL)
6682    return((MagickWand *) NULL);
6683  montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6684  switch (mode)
6685  {
6686    case FrameMode:
6687    {
6688      (void) CloneString(&montage_info->frame,"15x15+3+3");
6689      montage_info->shadow=MagickTrue;
6690      break;
6691    }
6692    case UnframeMode:
6693    {
6694      montage_info->frame=(char *) NULL;
6695      montage_info->shadow=MagickFalse;
6696      montage_info->border_width=0;
6697      break;
6698    }
6699    case ConcatenateMode:
6700    {
6701      montage_info->frame=(char *) NULL;
6702      montage_info->shadow=MagickFalse;
6703      (void) CloneString(&montage_info->geometry,"+0+0");
6704      montage_info->border_width=0;
6705      break;
6706    }
6707    default:
6708      break;
6709  }
6710  font=DrawGetFont(drawing_wand);
6711  if (font != (char *) NULL)
6712    (void) CloneString(&montage_info->font,font);
6713  if (frame != (char *) NULL)
6714    (void) CloneString(&montage_info->frame,frame);
6715  montage_info->pointsize=DrawGetFontSize(drawing_wand);
6716  pixel_wand=NewPixelWand();
6717  DrawGetFillColor(drawing_wand,pixel_wand);
6718  PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6719  DrawGetStrokeColor(drawing_wand,pixel_wand);
6720  PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6721  pixel_wand=DestroyPixelWand(pixel_wand);
6722  if (thumbnail_geometry != (char *) NULL)
6723    (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6724  if (tile_geometry != (char *) NULL)
6725    (void) CloneString(&montage_info->tile,tile_geometry);
6726  montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6727    wand->exception);
6728  montage_info=DestroyMontageInfo(montage_info);
6729  if (montage_image == (Image *) NULL)
6730    return((MagickWand *) NULL);
6731  return(CloneMagickWandFromImages(wand,montage_image));
6732}
6733
6734/*
6735%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6736%                                                                             %
6737%                                                                             %
6738%                                                                             %
6739%   M a g i c k M o r p h I m a g e s                                         %
6740%                                                                             %
6741%                                                                             %
6742%                                                                             %
6743%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6744%
6745%  MagickMorphImages() method morphs a set of images.  Both the image pixels
6746%  and size are linearly interpolated to give the appearance of a
6747%  meta-morphosis from one image to the next.
6748%
6749%  The format of the MagickMorphImages method is:
6750%
6751%      MagickWand *MagickMorphImages(MagickWand *wand,
6752%        const size_t number_frames)
6753%
6754%  A description of each parameter follows:
6755%
6756%    o wand: the magick wand.
6757%
6758%    o number_frames: the number of in-between images to generate.
6759%
6760*/
6761WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6762  const size_t number_frames)
6763{
6764  Image
6765    *morph_image;
6766
6767  assert(wand != (MagickWand *) NULL);
6768  assert(wand->signature == WandSignature);
6769  if (IfMagickTrue(wand->debug))
6770    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6771  if (wand->images == (Image *) NULL)
6772    return((MagickWand *) NULL);
6773  morph_image=MorphImages(wand->images,number_frames,wand->exception);
6774  if (morph_image == (Image *) NULL)
6775    return((MagickWand *) NULL);
6776  return(CloneMagickWandFromImages(wand,morph_image));
6777}
6778
6779/*
6780%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6781%                                                                             %
6782%                                                                             %
6783%                                                                             %
6784%   M a g i c k M o r p h o l o g y I m a g e                                 %
6785%                                                                             %
6786%                                                                             %
6787%                                                                             %
6788%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6789%
6790%  MagickMorphologyImage() applies a user supplied kernel to the image
6791%  according to the given mophology method.
6792%
6793%  The format of the MagickMorphologyImage method is:
6794%
6795%      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6796%        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6797%
6798%  A description of each parameter follows:
6799%
6800%    o wand: the magick wand.
6801%
6802%    o method: the morphology method to be applied.
6803%
6804%    o iterations: apply the operation this many times (or no change).
6805%      A value of -1 means loop until no change found.  How this is applied
6806%      may depend on the morphology method.  Typically this is a value of 1.
6807%
6808%    o kernel: An array of doubles representing the morphology kernel.
6809%
6810*/
6811WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6812  MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6813{
6814  Image
6815    *morphology_image;
6816
6817  assert(wand != (MagickWand *) NULL);
6818  assert(wand->signature == WandSignature);
6819  if (IfMagickTrue(wand->debug))
6820    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6821  if (kernel == (const KernelInfo *) NULL)
6822    return(MagickFalse);
6823  if (wand->images == (Image *) NULL)
6824    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6825  morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6826    wand->exception);
6827  if (morphology_image == (Image *) NULL)
6828    return(MagickFalse);
6829  ReplaceImageInList(&wand->images,morphology_image);
6830  return(MagickTrue);
6831}
6832
6833/*
6834%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6835%                                                                             %
6836%                                                                             %
6837%                                                                             %
6838%   M a g i c k M o t i o n B l u r I m a g e                                 %
6839%                                                                             %
6840%                                                                             %
6841%                                                                             %
6842%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6843%
6844%  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6845%  Gaussian operator of the given radius and standard deviation (sigma).
6846%  For reasonable results, radius should be larger than sigma.  Use a
6847%  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6848%  Angle gives the angle of the blurring motion.
6849%
6850%  The format of the MagickMotionBlurImage method is:
6851%
6852%      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6853%        const double radius,const double sigma,const double angle)
6854%
6855%  A description of each parameter follows:
6856%
6857%    o wand: the magick wand.
6858%
6859%    o radius: the radius of the Gaussian, in pixels, not counting
6860%      the center pixel.
6861%
6862%    o sigma: the standard deviation of the Gaussian, in pixels.
6863%
6864%    o angle: Apply the effect along this angle.
6865%
6866*/
6867WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6868  const double radius,const double sigma,const double angle)
6869{
6870  Image
6871    *blur_image;
6872
6873  assert(wand != (MagickWand *) NULL);
6874  assert(wand->signature == WandSignature);
6875  if (IfMagickTrue(wand->debug))
6876    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6877  if (wand->images == (Image *) NULL)
6878    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6879  blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
6880  if (blur_image == (Image *) NULL)
6881    return(MagickFalse);
6882  ReplaceImageInList(&wand->images,blur_image);
6883  return(MagickTrue);
6884}
6885
6886/*
6887%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6888%                                                                             %
6889%                                                                             %
6890%                                                                             %
6891%   M a g i c k N e g a t e I m a g e                                         %
6892%                                                                             %
6893%                                                                             %
6894%                                                                             %
6895%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6896%
6897%  MagickNegateImage() negates the colors in the reference image.  The
6898%  Grayscale option means that only grayscale values within the image are
6899%  negated.
6900%
6901%  You can also reduce the influence of a particular channel with a gamma
6902%  value of 0.
6903%
6904%  The format of the MagickNegateImage method is:
6905%
6906%      MagickBooleanType MagickNegateImage(MagickWand *wand,
6907%        const MagickBooleanType gray)
6908%
6909%  A description of each parameter follows:
6910%
6911%    o wand: the magick wand.
6912%
6913%    o gray: If MagickTrue, only negate grayscale pixels within the image.
6914%
6915*/
6916WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6917  const MagickBooleanType gray)
6918{
6919  MagickBooleanType
6920    status;
6921
6922  assert(wand != (MagickWand *) NULL);
6923  assert(wand->signature == WandSignature);
6924  if (IfMagickTrue(wand->debug))
6925    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6926  if (wand->images == (Image *) NULL)
6927    ThrowWandException(WandError,"ContainsNoImages",wand->name);
6928  status=NegateImage(wand->images,gray,wand->exception);
6929  return(status);
6930}
6931
6932/*
6933%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6934%                                                                             %
6935%                                                                             %
6936%                                                                             %
6937%   M a g i c k N e w I m a g e                                               %
6938%                                                                             %
6939%                                                                             %
6940%                                                                             %
6941%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6942%
6943%  MagickNewImage() adds a blank image canvas of the specified size and
6944%  background color to the wand.
6945%
6946%  The format of the MagickNewImage method is:
6947%
6948%      MagickBooleanType MagickNewImage(MagickWand *wand,
6949%        const size_t columns,const size_t rows,
6950%        const PixelWand *background)
6951%
6952%  A description of each parameter follows:
6953%
6954%    o wand: the magick wand.
6955%
6956%    o width: the image width.
6957%
6958%    o height: the image height.
6959%
6960%    o background: the image color.
6961%
6962*/
6963WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
6964  const size_t height,const PixelWand *background)
6965{
6966  Image
6967    *images;
6968
6969  PixelInfo
6970    pixel;
6971
6972  assert(wand != (MagickWand *) NULL);
6973  assert(wand->signature == WandSignature);
6974  if (IfMagickTrue(wand->debug))
6975    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6976  PixelGetMagickColor(background,&pixel);
6977  images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
6978  if (images == (Image *) NULL)
6979    return(MagickFalse);
6980  return(InsertImageInWand(wand,images));
6981}
6982
6983/*
6984%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6985%                                                                             %
6986%                                                                             %
6987%                                                                             %
6988%   M a g i c k N e x t I m a g e                                             %
6989%                                                                             %
6990%                                                                             %
6991%                                                                             %
6992%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6993%
6994%  MagickNextImage() sets the next image in the wand as the current image.
6995%
6996%  It is typically used after MagickResetIterator(), after which its first use
6997%  will set the first image as the current image (unless the wand is empty).
6998%
6999%  It will return MagickFalse when no more images are left to be returned
7000%  which happens when the wand is empty, or the current image is the last
7001%  image.
7002%
7003%  When the above condition (end of image list) is reached, the iterator is
7004%  automaticall set so that you can start using MagickPreviousImage() to
7005%  again iterate over the images in the reverse direction, starting with the
7006%  last image (again).  You can jump to this condition immeditally using
7007%  MagickSetLastIterator().
7008%
7009%  The format of the MagickNextImage method is:
7010%
7011%      MagickBooleanType MagickNextImage(MagickWand *wand)
7012%
7013%  A description of each parameter follows:
7014%
7015%    o wand: the magick wand.
7016%
7017*/
7018WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7019{
7020  assert(wand != (MagickWand *) NULL);
7021  assert(wand->signature == WandSignature);
7022  if (IfMagickTrue(wand->debug))
7023    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7024  if (wand->images == (Image *) NULL)
7025    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7026  wand->insert_before=MagickFalse; /* Inserts is now appended */
7027  if (IfMagickTrue(wand->image_pending))
7028    {
7029      wand->image_pending=MagickFalse;
7030      return(MagickTrue);
7031    }
7032  if (GetNextImageInList(wand->images) == (Image *) NULL)
7033    {
7034      wand->image_pending=MagickTrue; /* No image, PreviousImage re-gets */
7035      return(MagickFalse);
7036    }
7037  wand->images=GetNextImageInList(wand->images);
7038  return(MagickTrue);
7039}
7040
7041/*
7042%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7043%                                                                             %
7044%                                                                             %
7045%                                                                             %
7046%   M a g i c k N o r m a l i z e I m a g e                                   %
7047%                                                                             %
7048%                                                                             %
7049%                                                                             %
7050%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7051%
7052%  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7053%  the pixels color to span the entire range of colors available
7054%
7055%  You can also reduce the influence of a particular channel with a gamma
7056%  value of 0.
7057%
7058%  The format of the MagickNormalizeImage method is:
7059%
7060%      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7061%
7062%  A description of each parameter follows:
7063%
7064%    o wand: the magick wand.
7065%
7066*/
7067WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7068{
7069  MagickBooleanType
7070    status;
7071
7072  assert(wand != (MagickWand *) NULL);
7073  assert(wand->signature == WandSignature);
7074  if (IfMagickTrue(wand->debug))
7075    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7076  if (wand->images == (Image *) NULL)
7077    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7078  status=NormalizeImage(wand->images,wand->exception);
7079  return(status);
7080}
7081
7082/*
7083%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7084%                                                                             %
7085%                                                                             %
7086%                                                                             %
7087%   M a g i c k O i l P a i n t I m a g e                                     %
7088%                                                                             %
7089%                                                                             %
7090%                                                                             %
7091%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7092%
7093%  MagickOilPaintImage() applies a special effect filter that simulates an oil
7094%  painting.  Each pixel is replaced by the most frequent color occurring
7095%  in a circular region defined by radius.
7096%
7097%  The format of the MagickOilPaintImage method is:
7098%
7099%      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7100%        const double radius,const double sigma)
7101%
7102%  A description of each parameter follows:
7103%
7104%    o wand: the magick wand.
7105%
7106%    o radius: the radius of the circular neighborhood.
7107%
7108%    o sigma: the standard deviation of the Gaussian, in pixels.
7109%
7110*/
7111WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7112  const double radius,const double sigma)
7113{
7114  Image
7115    *paint_image;
7116
7117  assert(wand != (MagickWand *) NULL);
7118  assert(wand->signature == WandSignature);
7119  if (IfMagickTrue(wand->debug))
7120    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7121  if (wand->images == (Image *) NULL)
7122    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7123  paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
7124  if (paint_image == (Image *) NULL)
7125    return(MagickFalse);
7126  ReplaceImageInList(&wand->images,paint_image);
7127  return(MagickTrue);
7128}
7129
7130/*
7131%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7132%                                                                             %
7133%                                                                             %
7134%                                                                             %
7135%   M a g i c k O p a q u e P a i n t I m a g e                               %
7136%                                                                             %
7137%                                                                             %
7138%                                                                             %
7139%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7140%
7141%  MagickOpaquePaintImage() changes any pixel that matches color with the color
7142%  defined by fill.
7143%
7144%  The format of the MagickOpaquePaintImage method is:
7145%
7146%      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7147%        const PixelWand *target,const PixelWand *fill,const double fuzz,
7148%        const MagickBooleanType invert)
7149%
7150%  A description of each parameter follows:
7151%
7152%    o wand: the magick wand.
7153%
7154%    o target: Change this target color to the fill color within the image.
7155%
7156%    o fill: the fill pixel wand.
7157%
7158%    o fuzz: By default target must match a particular pixel color
7159%      exactly.  However, in many cases two colors may differ by a small amount.
7160%      The fuzz member of image defines how much tolerance is acceptable to
7161%      consider two colors as the same.  For example, set fuzz to 10 and the
7162%      color red at intensities of 100 and 102 respectively are now interpreted
7163%      as the same color for the purposes of the floodfill.
7164%
7165%    o invert: paint any pixel that does not match the target color.
7166%
7167*/
7168WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7169  const PixelWand *target,const PixelWand *fill,const double fuzz,
7170  const MagickBooleanType invert)
7171{
7172  MagickBooleanType
7173    status;
7174
7175  PixelInfo
7176    fill_pixel,
7177    target_pixel;
7178
7179  assert(wand != (MagickWand *) NULL);
7180  assert(wand->signature == WandSignature);
7181  if (IfMagickTrue(wand->debug))
7182    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7183  if (wand->images == (Image *) NULL)
7184    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7185  PixelGetMagickColor(target,&target_pixel);
7186  PixelGetMagickColor(fill,&fill_pixel);
7187  wand->images->fuzz=fuzz;
7188  status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
7189    wand->exception);
7190  return(status);
7191}
7192
7193/*
7194%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7195%                                                                             %
7196%                                                                             %
7197%                                                                             %
7198%   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                         %
7199%                                                                             %
7200%                                                                             %
7201%                                                                             %
7202%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7203%
7204%  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7205%  previous image in the sequence.  From this it attempts to select the
7206%  smallest cropped image to replace each frame, while preserving the results
7207%  of the animation.
7208%
7209%  The format of the MagickOptimizeImageLayers method is:
7210%
7211%      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7212%
7213%  A description of each parameter follows:
7214%
7215%    o wand: the magick wand.
7216%
7217*/
7218WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7219{
7220  Image
7221    *optimize_image;
7222
7223  assert(wand != (MagickWand *) NULL);
7224  assert(wand->signature == WandSignature);
7225  if (IfMagickTrue(wand->debug))
7226    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7227  if (wand->images == (Image *) NULL)
7228    return((MagickWand *) NULL);
7229  optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7230  if (optimize_image == (Image *) NULL)
7231    return((MagickWand *) NULL);
7232  return(CloneMagickWandFromImages(wand,optimize_image));
7233}
7234
7235/*
7236%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7237%                                                                             %
7238%                                                                             %
7239%                                                                             %
7240%   M a g i c k O p t i m i z e I m a g e T r a n s p a r e n c y             %
7241%                                                                             %
7242%                                                                             %
7243%                                                                             %
7244%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7245%
7246%  MagickOptimizeImageTransparency() takes a frame optimized GIF animation, and
7247%  compares the overlayed pixels against the disposal image resulting from all
7248%  the previous frames in the animation.  Any pixel that does not change the
7249%  disposal image (and thus does not effect the outcome of an overlay) is made
7250%  transparent.
7251%
7252%  WARNING: This modifies the current images directly, rather than generate
7253%  a new image sequence.
7254%  The format of the MagickOptimizeImageTransparency method is:
7255%
7256%      MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7257%
7258%  A description of each parameter follows:
7259%
7260%    o wand: the magick wand.
7261%
7262*/
7263WandExport MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7264{
7265  assert(wand != (MagickWand *) NULL);
7266  assert(wand->signature == WandSignature);
7267  if (IfMagickTrue(wand->debug))
7268    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7269  if (wand->images == (Image *) NULL)
7270    return(MagickFalse);
7271  OptimizeImageTransparency(wand->images,wand->exception);
7272  return(MagickTrue);
7273}
7274
7275/*
7276%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7277%                                                                             %
7278%                                                                             %
7279%                                                                             %
7280%     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                   %
7281%                                                                             %
7282%                                                                             %
7283%                                                                             %
7284%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7285%
7286%  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7287%  of pre-defined dithering threshold maps, but over multiple intensity levels,
7288%  which can be different for different channels, according to the input
7289%  arguments.
7290%
7291%  The format of the MagickOrderedPosterizeImage method is:
7292%
7293%      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7294%        const char *threshold_map)
7295%
7296%  A description of each parameter follows:
7297%
7298%    o image: the image.
7299%
7300%    o threshold_map: A string containing the name of the threshold dither
7301%      map to use, followed by zero or more numbers representing the number of
7302%      color levels tho dither between.
7303%
7304%      Any level number less than 2 is equivalent to 2, and means only binary
7305%      dithering will be applied to each color channel.
7306%
7307%      No numbers also means a 2 level (bitmap) dither will be applied to all
7308%      channels, while a single number is the number of levels applied to each
7309%      channel in sequence.  More numbers will be applied in turn to each of
7310%      the color channels.
7311%
7312%      For example: "o3x3,6" generates a 6 level posterization of the image
7313%      with a ordered 3x3 diffused pixel dither being applied between each
7314%      level. While checker,8,8,4 will produce a 332 colormaped image with
7315%      only a single checkerboard hash pattern (50% grey) between each color
7316%      level, to basically double the number of color levels with a bare
7317%      minimim of dithering.
7318%
7319*/
7320WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7321  const char *threshold_map)
7322{
7323  MagickBooleanType
7324    status;
7325
7326  assert(wand != (MagickWand *) NULL);
7327  assert(wand->signature == WandSignature);
7328  if (IfMagickTrue(wand->debug))
7329    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7330  if (wand->images == (Image *) NULL)
7331    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7332  status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7333  return(status);
7334}
7335
7336/*
7337%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7338%                                                                             %
7339%                                                                             %
7340%                                                                             %
7341%   M a g i c k P i n g I m a g e                                             %
7342%                                                                             %
7343%                                                                             %
7344%                                                                             %
7345%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7346%
7347%  MagickPingImage() is the same as MagickReadImage() except the only valid
7348%  information returned is the image width, height, size, and format.  It
7349%  is designed to efficiently obtain this information from a file without
7350%  reading the entire image sequence into memory.
7351%
7352%  The format of the MagickPingImage method is:
7353%
7354%      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7355%
7356%  A description of each parameter follows:
7357%
7358%    o wand: the magick wand.
7359%
7360%    o filename: the image filename.
7361%
7362*/
7363WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7364  const char *filename)
7365{
7366  Image
7367    *images;
7368
7369  ImageInfo
7370    *ping_info;
7371
7372  assert(wand != (MagickWand *) NULL);
7373  assert(wand->signature == WandSignature);
7374  if (IfMagickTrue(wand->debug))
7375    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7376  ping_info=CloneImageInfo(wand->image_info);
7377  if (filename != (const char *) NULL)
7378    (void) CopyMagickString(ping_info->filename,filename,MagickPathExtent);
7379  images=PingImage(ping_info,wand->exception);
7380  ping_info=DestroyImageInfo(ping_info);
7381  if (images == (Image *) NULL)
7382    return(MagickFalse);
7383  return(InsertImageInWand(wand,images));
7384}
7385
7386/*
7387%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7388%                                                                             %
7389%                                                                             %
7390%                                                                             %
7391%   M a g i c k P i n g I m a g e B l o b                                     %
7392%                                                                             %
7393%                                                                             %
7394%                                                                             %
7395%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7396%
7397%  MagickPingImageBlob() pings an image or image sequence from a blob.
7398%
7399%  The format of the MagickPingImageBlob method is:
7400%
7401%      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7402%        const void *blob,const size_t length)
7403%
7404%  A description of each parameter follows:
7405%
7406%    o wand: the magick wand.
7407%
7408%    o blob: the blob.
7409%
7410%    o length: the blob length.
7411%
7412*/
7413WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7414  const void *blob,const size_t length)
7415{
7416  Image
7417    *images;
7418
7419  ImageInfo
7420    *read_info;
7421
7422  assert(wand != (MagickWand *) NULL);
7423  assert(wand->signature == WandSignature);
7424  if (wand->debug != MagickFalse)
7425    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7426  read_info=CloneImageInfo(wand->image_info);
7427  SetImageInfoBlob(read_info,blob,length);
7428  images=PingImage(read_info,wand->exception);
7429  read_info=DestroyImageInfo(read_info);
7430  if (images == (Image *) NULL)
7431    return(MagickFalse);
7432  return(InsertImageInWand(wand,images));
7433}
7434
7435/*
7436%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7437%                                                                             %
7438%                                                                             %
7439%                                                                             %
7440%   M a g i c k P i n g I m a g e F i l e                                     %
7441%                                                                             %
7442%                                                                             %
7443%                                                                             %
7444%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7445%
7446%  MagickPingImageFile() pings an image or image sequence from an open file
7447%  descriptor.
7448%
7449%  The format of the MagickPingImageFile method is:
7450%
7451%      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7452%
7453%  A description of each parameter follows:
7454%
7455%    o wand: the magick wand.
7456%
7457%    o file: the file descriptor.
7458%
7459*/
7460WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7461{
7462  Image
7463    *images;
7464
7465  ImageInfo
7466    *read_info;
7467
7468  assert(wand != (MagickWand *) NULL);
7469  assert(wand->signature == WandSignature);
7470  assert(file != (FILE *) NULL);
7471  if (IfMagickTrue(wand->debug))
7472    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7473  read_info=CloneImageInfo(wand->image_info);
7474  SetImageInfoFile(read_info,file);
7475  images=PingImage(read_info,wand->exception);
7476  read_info=DestroyImageInfo(read_info);
7477  if (images == (Image *) NULL)
7478    return(MagickFalse);
7479  return(InsertImageInWand(wand,images));
7480}
7481
7482/*
7483%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7484%                                                                             %
7485%                                                                             %
7486%                                                                             %
7487%   M a g i c k P o l a r o i d I m a g e                                     %
7488%                                                                             %
7489%                                                                             %
7490%                                                                             %
7491%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7492%
7493%  MagickPolaroidImage() simulates a Polaroid picture.
7494%
7495%  The format of the MagickPolaroidImage method is:
7496%
7497%      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7498%        const DrawingWand *drawing_wand,const char *caption,const double angle,
7499%        const PixelInterpolateMethod method)
7500%
7501%  A description of each parameter follows:
7502%
7503%    o wand: the magick wand.
7504%
7505%    o drawing_wand: the draw wand.
7506%
7507%    o caption: the Polaroid caption.
7508%
7509%    o angle: Apply the effect along this angle.
7510%
7511%    o method: the pixel interpolation method.
7512%
7513*/
7514WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7515  const DrawingWand *drawing_wand,const char *caption,const double angle,
7516  const PixelInterpolateMethod method)
7517{
7518  DrawInfo
7519    *draw_info;
7520
7521  Image
7522    *polaroid_image;
7523
7524  assert(wand != (MagickWand *) NULL);
7525  assert(wand->signature == WandSignature);
7526  if (IfMagickTrue(wand->debug))
7527    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7528  if (wand->images == (Image *) NULL)
7529    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7530  draw_info=PeekDrawingWand(drawing_wand);
7531  if (draw_info == (DrawInfo *) NULL)
7532    return(MagickFalse);
7533  polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
7534    wand->exception);
7535  if (polaroid_image == (Image *) NULL)
7536    return(MagickFalse);
7537  ReplaceImageInList(&wand->images,polaroid_image);
7538  return(MagickTrue);
7539}
7540
7541/*
7542%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7543%                                                                             %
7544%                                                                             %
7545%                                                                             %
7546%   M a g i c k P o s t e r i z e I m a g e                                   %
7547%                                                                             %
7548%                                                                             %
7549%                                                                             %
7550%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7551%
7552%  MagickPosterizeImage() reduces the image to a limited number of color level.
7553%
7554%  The format of the MagickPosterizeImage method is:
7555%
7556%      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7557%        const size_t levels,const DitherMethod method)
7558%
7559%  A description of each parameter follows:
7560%
7561%    o wand: the magick wand.
7562%
7563%    o levels: Number of color levels allowed in each channel.  Very low values
7564%      (2, 3, or 4) have the most visible effect.
7565%
7566%    o method: choose the dither method: UndefinedDitherMethod,
7567%      NoDitherMethod, RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7568%
7569*/
7570WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7571  const size_t levels,const DitherMethod dither)
7572{
7573  MagickBooleanType
7574    status;
7575
7576  assert(wand != (MagickWand *) NULL);
7577  assert(wand->signature == WandSignature);
7578  if (IfMagickTrue(wand->debug))
7579    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7580  if (wand->images == (Image *) NULL)
7581    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7582  status=PosterizeImage(wand->images,levels,dither,wand->exception);
7583  return(status);
7584}
7585
7586/*
7587%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7588%                                                                             %
7589%                                                                             %
7590%                                                                             %
7591%   M a g i c k P r e v i e w I m a g e s                                     %
7592%                                                                             %
7593%                                                                             %
7594%                                                                             %
7595%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7596%
7597%  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7598%  image processing operation applied at varying strengths.  This helpful
7599%  to quickly pin-point an appropriate parameter for an image processing
7600%  operation.
7601%
7602%  The format of the MagickPreviewImages method is:
7603%
7604%      MagickWand *MagickPreviewImages(MagickWand *wand,
7605%        const PreviewType preview)
7606%
7607%  A description of each parameter follows:
7608%
7609%    o wand: the magick wand.
7610%
7611%    o preview: the preview type.
7612%
7613*/
7614WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7615  const PreviewType preview)
7616{
7617  Image
7618    *preview_image;
7619
7620  assert(wand != (MagickWand *) NULL);
7621  assert(wand->signature == WandSignature);
7622  if (IfMagickTrue(wand->debug))
7623    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7624  if (wand->images == (Image *) NULL)
7625    return((MagickWand *) NULL);
7626  preview_image=PreviewImage(wand->images,preview,wand->exception);
7627  if (preview_image == (Image *) NULL)
7628    return((MagickWand *) NULL);
7629  return(CloneMagickWandFromImages(wand,preview_image));
7630}
7631
7632/*
7633%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7634%                                                                             %
7635%                                                                             %
7636%                                                                             %
7637%   M a g i c k P r e v i o u s I m a g e                                     %
7638%                                                                             %
7639%                                                                             %
7640%                                                                             %
7641%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7642%
7643%  MagickPreviousImage() sets the previous image in the wand as the current
7644%  image.
7645%
7646%  It is typically used after MagickSetLastIterator(), after which its first
7647%  use will set the last image as the current image (unless the wand is empty).
7648%
7649%  It will return MagickFalse when no more images are left to be returned
7650%  which happens when the wand is empty, or the current image is the first
7651%  image.  At that point the iterator is than reset to again process images in
7652%  the forward direction, again starting with the first image in list. Images
7653%  added at this point are prepended.
7654%
7655%  Also at that point any images added to the wand using MagickAddImages() or
7656%  MagickReadImages() will be prepended before the first image. In this sense
7657%  the condition is not quite exactly the same as MagickResetIterator().
7658%
7659%  The format of the MagickPreviousImage method is:
7660%
7661%      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7662%
7663%  A description of each parameter follows:
7664%
7665%    o wand: the magick wand.
7666%
7667*/
7668WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7669{
7670  assert(wand != (MagickWand *) NULL);
7671  assert(wand->signature == WandSignature);
7672  if (IfMagickTrue(wand->debug))
7673    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7674  if (wand->images == (Image *) NULL)
7675    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7676  if (IfMagickTrue(wand->image_pending))
7677    {
7678      wand->image_pending=MagickFalse;  /* image returned no longer pending */
7679      return(MagickTrue);
7680    }
7681  if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7682    {
7683      wand->image_pending=MagickTrue;   /* Next now re-gets first image */
7684      wand->insert_before=MagickTrue;   /* insert/add prepends new images */
7685      return(MagickFalse);
7686    }
7687  wand->images=GetPreviousImageInList(wand->images);
7688  return(MagickTrue);
7689}
7690
7691/*
7692%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7693%                                                                             %
7694%                                                                             %
7695%                                                                             %
7696%   M a g i c k Q u a n t i z e I m a g e                                     %
7697%                                                                             %
7698%                                                                             %
7699%                                                                             %
7700%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7701%
7702%  MagickQuantizeImage() analyzes the colors within a reference image and
7703%  chooses a fixed number of colors to represent the image.  The goal of the
7704%  algorithm is to minimize the color difference between the input and output
7705%  image while minimizing the processing time.
7706%
7707%  The format of the MagickQuantizeImage method is:
7708%
7709%      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7710%        const size_t number_colors,const ColorspaceType colorspace,
7711%        const size_t treedepth,const DitherMethod dither_method,
7712%        const MagickBooleanType measure_error)
7713%
7714%  A description of each parameter follows:
7715%
7716%    o wand: the magick wand.
7717%
7718%    o number_colors: the number of colors.
7719%
7720%    o colorspace: Perform color reduction in this colorspace, typically
7721%      RGBColorspace.
7722%
7723%    o treedepth: Normally, this integer value is zero or one.  A zero or
7724%      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
7725%      reference image with the least amount of memory and the fastest
7726%      computational speed.  In some cases, such as an image with low color
7727%      dispersion (a few number of colors), a value other than
7728%      Log4(number_colors) is required.  To expand the color tree completely,
7729%      use a value of 8.
7730%
7731%    o dither_method: choose from UndefinedDitherMethod, NoDitherMethod,
7732%      RiemersmaDitherMethod, FloydSteinbergDitherMethod.
7733%
7734%    o measure_error: A value other than zero measures the difference between
7735%      the original and quantized images.  This difference is the total
7736%      quantization error.  The error is computed by summing over all pixels
7737%      in an image the distance squared in RGB space between each reference
7738%      pixel value and its quantized value.
7739%
7740*/
7741WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7742  const size_t number_colors,const ColorspaceType colorspace,
7743  const size_t treedepth,const DitherMethod dither_method,
7744  const MagickBooleanType measure_error)
7745{
7746  MagickBooleanType
7747    status;
7748
7749  QuantizeInfo
7750    *quantize_info;
7751
7752  assert(wand != (MagickWand *) NULL);
7753  assert(wand->signature == WandSignature);
7754  if (IfMagickTrue(wand->debug))
7755    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7756  if (wand->images == (Image *) NULL)
7757    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7758  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7759  quantize_info->number_colors=number_colors;
7760  quantize_info->dither_method=dither_method;
7761  quantize_info->tree_depth=treedepth;
7762  quantize_info->colorspace=colorspace;
7763  quantize_info->measure_error=measure_error;
7764  status=QuantizeImage(quantize_info,wand->images,wand->exception);
7765  quantize_info=DestroyQuantizeInfo(quantize_info);
7766  return(status);
7767}
7768
7769/*
7770%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7771%                                                                             %
7772%                                                                             %
7773%                                                                             %
7774%   M a g i c k Q u a n t i z e I m a g e s                                   %
7775%                                                                             %
7776%                                                                             %
7777%                                                                             %
7778%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7779%
7780%  MagickQuantizeImages() analyzes the colors within a sequence of images and
7781%  chooses a fixed number of colors to represent the image.  The goal of the
7782%  algorithm is to minimize the color difference between the input and output
7783%  image while minimizing the processing time.
7784%
7785%  The format of the MagickQuantizeImages method is:
7786%
7787%      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7788%        const size_t number_colors,const ColorspaceType colorspace,
7789%        const size_t treedepth,const DitherMethod dither_method,
7790%        const MagickBooleanType measure_error)
7791%
7792%  A description of each parameter follows:
7793%
7794%    o wand: the magick wand.
7795%
7796%    o number_colors: the number of colors.
7797%
7798%    o colorspace: Perform color reduction in this colorspace, typically
7799%      RGBColorspace.
7800%
7801%    o treedepth: Normally, this integer value is zero or one.  A zero or
7802%      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
7803%      reference image with the least amount of memory and the fastest
7804%      computational speed.  In some cases, such as an image with low color
7805%      dispersion (a few number of colors), a value other than
7806%      Log4(number_colors) is required.  To expand the color tree completely,
7807%      use a value of 8.
7808%
7809%    o dither_method: choose from these dither methods: NoDitherMethod,
7810%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7811%
7812%    o measure_error: A value other than zero measures the difference between
7813%      the original and quantized images.  This difference is the total
7814%      quantization error.  The error is computed by summing over all pixels
7815%      in an image the distance squared in RGB space between each reference
7816%      pixel value and its quantized value.
7817%
7818*/
7819WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7820  const size_t number_colors,const ColorspaceType colorspace,
7821  const size_t treedepth,const DitherMethod dither_method,
7822  const MagickBooleanType measure_error)
7823{
7824  MagickBooleanType
7825    status;
7826
7827  QuantizeInfo
7828    *quantize_info;
7829
7830  assert(wand != (MagickWand *) NULL);
7831  assert(wand->signature == WandSignature);
7832  if (IfMagickTrue(wand->debug))
7833    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7834  if (wand->images == (Image *) NULL)
7835    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7836  quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7837  quantize_info->number_colors=number_colors;
7838  quantize_info->dither_method=dither_method;
7839  quantize_info->tree_depth=treedepth;
7840  quantize_info->colorspace=colorspace;
7841  quantize_info->measure_error=measure_error;
7842  status=QuantizeImages(quantize_info,wand->images,wand->exception);
7843  quantize_info=DestroyQuantizeInfo(quantize_info);
7844  return(status);
7845}
7846
7847/*
7848%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7849%                                                                             %
7850%                                                                             %
7851%                                                                             %
7852%   M a g i c k R o t a t i o n a l B l u r I m a g e                         %
7853%                                                                             %
7854%                                                                             %
7855%                                                                             %
7856%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7857%
7858%  MagickRotationalBlurImage() rotational blurs an image.
7859%
7860%  The format of the MagickRotationalBlurImage method is:
7861%
7862%      MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
7863%        const double angle)
7864%
7865%  A description of each parameter follows:
7866%
7867%    o wand: the magick wand.
7868%
7869%    o angle: the angle of the blur in degrees.
7870%
7871*/
7872WandExport MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
7873  const double angle)
7874{
7875  Image
7876    *blur_image;
7877
7878  assert(wand != (MagickWand *) NULL);
7879  assert(wand->signature == WandSignature);
7880  if (IfMagickTrue(wand->debug))
7881    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7882  if (wand->images == (Image *) NULL)
7883    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7884  blur_image=RotationalBlurImage(wand->images,angle,wand->exception);
7885  if (blur_image == (Image *) NULL)
7886    return(MagickFalse);
7887  ReplaceImageInList(&wand->images,blur_image);
7888  return(MagickTrue);
7889}
7890
7891/*
7892%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7893%                                                                             %
7894%                                                                             %
7895%                                                                             %
7896%   M a g i c k R a i s e I m a g e                                           %
7897%                                                                             %
7898%                                                                             %
7899%                                                                             %
7900%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7901%
7902%  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7903%  by lightening and darkening the edges of the image.  Members width and
7904%  height of raise_info define the width of the vertical and horizontal
7905%  edge of the effect.
7906%
7907%  The format of the MagickRaiseImage method is:
7908%
7909%      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7910%        const size_t width,const size_t height,const ssize_t x,
7911%        const ssize_t y,const MagickBooleanType raise)
7912%
7913%  A description of each parameter follows:
7914%
7915%    o wand: the magick wand.
7916%
7917%    o width,height,x,y:  Define the dimensions of the area to raise.
7918%
7919%    o raise: A value other than zero creates a 3-D raise effect,
7920%      otherwise it has a lowered effect.
7921%
7922*/
7923WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7924  const size_t width,const size_t height,const ssize_t x,
7925  const ssize_t y,const MagickBooleanType raise)
7926{
7927  MagickBooleanType
7928    status;
7929
7930  RectangleInfo
7931    raise_info;
7932
7933  assert(wand != (MagickWand *) NULL);
7934  assert(wand->signature == WandSignature);
7935  if (IfMagickTrue(wand->debug))
7936    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7937  if (wand->images == (Image *) NULL)
7938    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7939  raise_info.width=width;
7940  raise_info.height=height;
7941  raise_info.x=x;
7942  raise_info.y=y;
7943  status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
7944  return(status);
7945}
7946
7947/*
7948%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7949%                                                                             %
7950%                                                                             %
7951%                                                                             %
7952%   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                       %
7953%                                                                             %
7954%                                                                             %
7955%                                                                             %
7956%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7957%
7958%  MagickRandomThresholdImage() changes the value of individual pixels based on
7959%  the intensity of each pixel compared to threshold.  The result is a
7960%  high-contrast, two color image.
7961%
7962%  The format of the MagickRandomThresholdImage method is:
7963%
7964%      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7965%        const double low,const double high)
7966%
7967%  A description of each parameter follows:
7968%
7969%    o wand: the magick wand.
7970%
7971%    o low,high: Specify the high and low thresholds.  These values range from
7972%      0 to QuantumRange.
7973%
7974*/
7975WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7976  const double low,const double high)
7977{
7978  char
7979    threshold[MagickPathExtent];
7980
7981  assert(wand != (MagickWand *) NULL);
7982  assert(wand->signature == WandSignature);
7983  if (IfMagickTrue(wand->debug))
7984    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7985  if (wand->images == (Image *) NULL)
7986    ThrowWandException(WandError,"ContainsNoImages",wand->name);
7987  (void) FormatLocaleString(threshold,MagickPathExtent,"%gx%g",low,high);
7988  return(RandomThresholdImage(wand->images,threshold,wand->exception));
7989}
7990
7991/*
7992%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7993%                                                                             %
7994%                                                                             %
7995%                                                                             %
7996%   M a g i c k R e a d I m a g e                                             %
7997%                                                                             %
7998%                                                                             %
7999%                                                                             %
8000%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8001%
8002%  MagickReadImage() reads an image or image sequence.  The images are inserted
8003%  jjust before the current image pointer position.
8004%
8005%  Use MagickSetFirstIterator(), to insert new images before all the current
8006%  images in the wand, MagickSetLastIterator() to append add to the end,
8007%  MagickSetIteratorIndex() to place images just after the given index.
8008%
8009%  The format of the MagickReadImage method is:
8010%
8011%      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8012%
8013%  A description of each parameter follows:
8014%
8015%    o wand: the magick wand.
8016%
8017%    o filename: the image filename.
8018%
8019*/
8020WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8021  const char *filename)
8022{
8023  Image
8024    *images;
8025
8026  ImageInfo
8027    *read_info;
8028
8029  assert(wand != (MagickWand *) NULL);
8030  assert(wand->signature == WandSignature);
8031  if (IfMagickTrue(wand->debug))
8032    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8033  read_info=CloneImageInfo(wand->image_info);
8034  if (filename != (const char *) NULL)
8035    (void) CopyMagickString(read_info->filename,filename,MagickPathExtent);
8036  images=ReadImage(read_info,wand->exception);
8037  read_info=DestroyImageInfo(read_info);
8038  if (images == (Image *) NULL)
8039    return(MagickFalse);
8040  return(InsertImageInWand(wand,images));
8041}
8042
8043/*
8044%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8045%                                                                             %
8046%                                                                             %
8047%                                                                             %
8048%   M a g i c k R e a d I m a g e B l o b                                     %
8049%                                                                             %
8050%                                                                             %
8051%                                                                             %
8052%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8053%
8054%  MagickReadImageBlob() reads an image or image sequence from a blob.
8055%  In all other respects it is like MagickReadImage().
8056%
8057%  The format of the MagickReadImageBlob method is:
8058%
8059%      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8060%        const void *blob,const size_t length)
8061%
8062%  A description of each parameter follows:
8063%
8064%    o wand: the magick wand.
8065%
8066%    o blob: the blob.
8067%
8068%    o length: the blob length.
8069%
8070*/
8071WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8072  const void *blob,const size_t length)
8073{
8074  Image
8075    *images;
8076
8077  assert(wand != (MagickWand *) NULL);
8078  assert(wand->signature == WandSignature);
8079  if (IfMagickTrue(wand->debug))
8080    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8081  images=BlobToImage(wand->image_info,blob,length,wand->exception);
8082  if (images == (Image *) NULL)
8083    return(MagickFalse);
8084  return(InsertImageInWand(wand,images));
8085}
8086
8087/*
8088%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8089%                                                                             %
8090%                                                                             %
8091%                                                                             %
8092%   M a g i c k R e a d I m a g e F i l e                                     %
8093%                                                                             %
8094%                                                                             %
8095%                                                                             %
8096%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8097%
8098%  MagickReadImageFile() reads an image or image sequence from an already
8099%  opened file descriptor.  Otherwise it is like MagickReadImage().
8100%
8101%  The format of the MagickReadImageFile method is:
8102%
8103%      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8104%
8105%  A description of each parameter follows:
8106%
8107%    o wand: the magick wand.
8108%
8109%    o file: the file descriptor.
8110%
8111*/
8112WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8113{
8114  Image
8115    *images;
8116
8117  ImageInfo
8118    *read_info;
8119
8120  assert(wand != (MagickWand *) NULL);
8121  assert(wand->signature == WandSignature);
8122  assert(file != (FILE *) NULL);
8123  if (IfMagickTrue(wand->debug))
8124    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8125  read_info=CloneImageInfo(wand->image_info);
8126  SetImageInfoFile(read_info,file);
8127  images=ReadImage(read_info,wand->exception);
8128  read_info=DestroyImageInfo(read_info);
8129  if (images == (Image *) NULL)
8130    return(MagickFalse);
8131  return(InsertImageInWand(wand,images));
8132}
8133
8134/*
8135%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8136%                                                                             %
8137%                                                                             %
8138%                                                                             %
8139%   M a g i c k R e m a p I m a g e                                           %
8140%                                                                             %
8141%                                                                             %
8142%                                                                             %
8143%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8144%
8145%  MagickRemapImage() replaces the colors of an image with the closest color
8146%  from a reference image.
8147%
8148%  The format of the MagickRemapImage method is:
8149%
8150%      MagickBooleanType MagickRemapImage(MagickWand *wand,
8151%        const MagickWand *remap_wand,const DitherMethod method)
8152%
8153%  A description of each parameter follows:
8154%
8155%    o wand: the magick wand.
8156%
8157%    o affinity: the affinity wand.
8158%
8159%    o method: choose from these dither methods: NoDitherMethod,
8160%      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8161%
8162*/
8163WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8164  const MagickWand *remap_wand,const DitherMethod dither_method)
8165{
8166  MagickBooleanType
8167    status;
8168
8169  QuantizeInfo
8170    *quantize_info;
8171
8172  assert(wand != (MagickWand *) NULL);
8173  assert(wand->signature == WandSignature);
8174  if (IfMagickTrue(wand->debug))
8175    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8176  if ((wand->images == (Image *) NULL) ||
8177      (remap_wand->images == (Image *) NULL))
8178    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8179  quantize_info=AcquireQuantizeInfo(wand->image_info);
8180  quantize_info->dither_method=dither_method;
8181  status=RemapImage(quantize_info,wand->images,remap_wand->images,
8182    wand->exception);
8183  quantize_info=DestroyQuantizeInfo(quantize_info);
8184  return(status);
8185}
8186
8187/*
8188%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8189%                                                                             %
8190%                                                                             %
8191%                                                                             %
8192%   M a g i c k R e m o v e I m a g e                                         %
8193%                                                                             %
8194%                                                                             %
8195%                                                                             %
8196%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8197%
8198%  MagickRemoveImage() removes an image from the image list.
8199%
8200%  The format of the MagickRemoveImage method is:
8201%
8202%      MagickBooleanType MagickRemoveImage(MagickWand *wand)
8203%
8204%  A description of each parameter follows:
8205%
8206%    o wand: the magick wand.
8207%
8208%    o insert: the splice wand.
8209%
8210*/
8211WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8212{
8213  assert(wand != (MagickWand *) NULL);
8214  assert(wand->signature == WandSignature);
8215  if (IfMagickTrue(wand->debug))
8216    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8217  if (wand->images == (Image *) NULL)
8218    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8219  DeleteImageFromList(&wand->images);
8220  return(MagickTrue);
8221}
8222
8223/*
8224%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8225%                                                                             %
8226%                                                                             %
8227%                                                                             %
8228%   M a g i c k R e s a m p l e I m a g e                                     %
8229%                                                                             %
8230%                                                                             %
8231%                                                                             %
8232%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8233%
8234%  MagickResampleImage() resample image to desired resolution.
8235%
8236%    Bessel   Blackman   Box
8237%    Catrom   Cubic      Gaussian
8238%    Hanning  Hermite    Lanczos
8239%    Mitchell Point      Quandratic
8240%    Sinc     Triangle
8241%
8242%  Most of the filters are FIR (finite impulse response), however, Bessel,
8243%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8244%  are windowed (brought down to zero) with the Blackman filter.
8245%
8246%  The format of the MagickResampleImage method is:
8247%
8248%      MagickBooleanType MagickResampleImage(MagickWand *wand,
8249%        const double x_resolution,const double y_resolution,
8250%        const FilterTypes filter)
8251%
8252%  A description of each parameter follows:
8253%
8254%    o wand: the magick wand.
8255%
8256%    o x_resolution: the new image x resolution.
8257%
8258%    o y_resolution: the new image y resolution.
8259%
8260%    o filter: Image filter to use.
8261%
8262*/
8263WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8264  const double x_resolution,const double y_resolution,const FilterTypes filter)
8265{
8266  Image
8267    *resample_image;
8268
8269  assert(wand != (MagickWand *) NULL);
8270  assert(wand->signature == WandSignature);
8271  if (IfMagickTrue(wand->debug))
8272    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8273  if (wand->images == (Image *) NULL)
8274    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8275  resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8276    wand->exception);
8277  if (resample_image == (Image *) NULL)
8278    return(MagickFalse);
8279  ReplaceImageInList(&wand->images,resample_image);
8280  return(MagickTrue);
8281}
8282
8283/*
8284%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8285%                                                                             %
8286%                                                                             %
8287%                                                                             %
8288%   M a g i c k R e s e t I m a g e P a g e                                   %
8289%                                                                             %
8290%                                                                             %
8291%                                                                             %
8292%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8293%
8294%  MagickResetImagePage() resets the Wand page canvas and position.
8295%
8296%  The format of the MagickResetImagePage method is:
8297%
8298%      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8299%        const char *page)
8300%
8301%  A description of each parameter follows:
8302%
8303%    o wand: the magick wand.
8304%
8305%    o page: the relative page specification.
8306%
8307*/
8308WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8309  const char *page)
8310{
8311  assert(wand != (MagickWand *) NULL);
8312  assert(wand->signature == WandSignature);
8313  if (IfMagickTrue(wand->debug))
8314    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8315  if (wand->images == (Image *) NULL)
8316    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8317  if ((page == (char *) NULL) || (*page == '\0'))
8318    {
8319      (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8320      return(MagickTrue);
8321    }
8322  return(ResetImagePage(wand->images,page));
8323}
8324
8325/*
8326%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8327%                                                                             %
8328%                                                                             %
8329%                                                                             %
8330%   M a g i c k R e s i z e I m a g e                                         %
8331%                                                                             %
8332%                                                                             %
8333%                                                                             %
8334%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8335%
8336%  MagickResizeImage() scales an image to the desired dimensions with one of
8337%  these filters:
8338%
8339%    Bessel   Blackman   Box
8340%    Catrom   Cubic      Gaussian
8341%    Hanning  Hermite    Lanczos
8342%    Mitchell Point      Quandratic
8343%    Sinc     Triangle
8344%
8345%  Most of the filters are FIR (finite impulse response), however, Bessel,
8346%  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8347%  are windowed (brought down to zero) with the Blackman filter.
8348%
8349%  The format of the MagickResizeImage method is:
8350%
8351%      MagickBooleanType MagickResizeImage(MagickWand *wand,
8352%        const size_t columns,const size_t rows,const FilterTypes filter)
8353%
8354%  A description of each parameter follows:
8355%
8356%    o wand: the magick wand.
8357%
8358%    o columns: the number of columns in the scaled image.
8359%
8360%    o rows: the number of rows in the scaled image.
8361%
8362%    o filter: Image filter to use.
8363%
8364*/
8365WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8366  const size_t columns,const size_t rows,const FilterTypes filter)
8367{
8368  Image
8369    *resize_image;
8370
8371  assert(wand != (MagickWand *) NULL);
8372  assert(wand->signature == WandSignature);
8373  if (IfMagickTrue(wand->debug))
8374    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8375  if (wand->images == (Image *) NULL)
8376    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8377  resize_image=ResizeImage(wand->images,columns,rows,filter,wand->exception);
8378  if (resize_image == (Image *) NULL)
8379    return(MagickFalse);
8380  ReplaceImageInList(&wand->images,resize_image);
8381  return(MagickTrue);
8382}
8383
8384/*
8385%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8386%                                                                             %
8387%                                                                             %
8388%                                                                             %
8389%   M a g i c k R o l l I m a g e                                             %
8390%                                                                             %
8391%                                                                             %
8392%                                                                             %
8393%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8394%
8395%  MagickRollImage() offsets an image as defined by x and y.
8396%
8397%  The format of the MagickRollImage method is:
8398%
8399%      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8400%        const size_t y)
8401%
8402%  A description of each parameter follows:
8403%
8404%    o wand: the magick wand.
8405%
8406%    o x: the x offset.
8407%
8408%    o y: the y offset.
8409%
8410%
8411*/
8412WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8413  const ssize_t x,const ssize_t y)
8414{
8415  Image
8416    *roll_image;
8417
8418  assert(wand != (MagickWand *) NULL);
8419  assert(wand->signature == WandSignature);
8420  if (IfMagickTrue(wand->debug))
8421    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8422  if (wand->images == (Image *) NULL)
8423    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8424  roll_image=RollImage(wand->images,x,y,wand->exception);
8425  if (roll_image == (Image *) NULL)
8426    return(MagickFalse);
8427  ReplaceImageInList(&wand->images,roll_image);
8428  return(MagickTrue);
8429}
8430
8431/*
8432%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8433%                                                                             %
8434%                                                                             %
8435%                                                                             %
8436%   M a g i c k R o t a t e I m a g e                                         %
8437%                                                                             %
8438%                                                                             %
8439%                                                                             %
8440%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8441%
8442%  MagickRotateImage() rotates an image the specified number of degrees. Empty
8443%  triangles left over from rotating the image are filled with the
8444%  background color.
8445%
8446%  The format of the MagickRotateImage method is:
8447%
8448%      MagickBooleanType MagickRotateImage(MagickWand *wand,
8449%        const PixelWand *background,const double degrees)
8450%
8451%  A description of each parameter follows:
8452%
8453%    o wand: the magick wand.
8454%
8455%    o background: the background pixel wand.
8456%
8457%    o degrees: the number of degrees to rotate the image.
8458%
8459%
8460*/
8461WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8462  const PixelWand *background,const double degrees)
8463{
8464  Image
8465    *rotate_image;
8466
8467  assert(wand != (MagickWand *) NULL);
8468  assert(wand->signature == WandSignature);
8469  if (IfMagickTrue(wand->debug))
8470    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8471  if (wand->images == (Image *) NULL)
8472    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8473  PixelGetQuantumPacket(background,&wand->images->background_color);
8474  rotate_image=RotateImage(wand->images,degrees,wand->exception);
8475  if (rotate_image == (Image *) NULL)
8476    return(MagickFalse);
8477  ReplaceImageInList(&wand->images,rotate_image);
8478  return(MagickTrue);
8479}
8480
8481/*
8482%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8483%                                                                             %
8484%                                                                             %
8485%                                                                             %
8486%   M a g i c k S a m p l e I m a g e                                         %
8487%                                                                             %
8488%                                                                             %
8489%                                                                             %
8490%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8491%
8492%  MagickSampleImage() scales an image to the desired dimensions with pixel
8493%  sampling.  Unlike other scaling methods, this method does not introduce
8494%  any additional color into the scaled image.
8495%
8496%  The format of the MagickSampleImage method is:
8497%
8498%      MagickBooleanType MagickSampleImage(MagickWand *wand,
8499%        const size_t columns,const size_t rows)
8500%
8501%  A description of each parameter follows:
8502%
8503%    o wand: the magick wand.
8504%
8505%    o columns: the number of columns in the scaled image.
8506%
8507%    o rows: the number of rows in the scaled image.
8508%
8509%
8510*/
8511WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8512  const size_t columns,const size_t rows)
8513{
8514  Image
8515    *sample_image;
8516
8517  assert(wand != (MagickWand *) NULL);
8518  assert(wand->signature == WandSignature);
8519  if (IfMagickTrue(wand->debug))
8520    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8521  if (wand->images == (Image *) NULL)
8522    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8523  sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8524  if (sample_image == (Image *) NULL)
8525    return(MagickFalse);
8526  ReplaceImageInList(&wand->images,sample_image);
8527  return(MagickTrue);
8528}
8529
8530/*
8531%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8532%                                                                             %
8533%                                                                             %
8534%                                                                             %
8535%   M a g i c k S c a l e I m a g e                                           %
8536%                                                                             %
8537%                                                                             %
8538%                                                                             %
8539%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8540%
8541%  MagickScaleImage() scales the size of an image to the given dimensions.
8542%
8543%  The format of the MagickScaleImage method is:
8544%
8545%      MagickBooleanType MagickScaleImage(MagickWand *wand,
8546%        const size_t columns,const size_t rows)
8547%
8548%  A description of each parameter follows:
8549%
8550%    o wand: the magick wand.
8551%
8552%    o columns: the number of columns in the scaled image.
8553%
8554%    o rows: the number of rows in the scaled image.
8555%
8556%
8557*/
8558WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8559  const size_t columns,const size_t rows)
8560{
8561  Image
8562    *scale_image;
8563
8564  assert(wand != (MagickWand *) NULL);
8565  assert(wand->signature == WandSignature);
8566  if (IfMagickTrue(wand->debug))
8567    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8568  if (wand->images == (Image *) NULL)
8569    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8570  scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8571  if (scale_image == (Image *) NULL)
8572    return(MagickFalse);
8573  ReplaceImageInList(&wand->images,scale_image);
8574  return(MagickTrue);
8575}
8576
8577/*
8578%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8579%                                                                             %
8580%                                                                             %
8581%                                                                             %
8582%   M a g i c k S e g m e n t I m a g e                                       %
8583%                                                                             %
8584%                                                                             %
8585%                                                                             %
8586%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8587%
8588%  MagickSegmentImage() segments an image by analyzing the histograms of the
8589%  color components and identifying units that are homogeneous with the fuzzy
8590%  C-means technique.
8591%
8592%  The format of the SegmentImage method is:
8593%
8594%      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8595%        const ColorspaceType colorspace,const MagickBooleanType verbose,
8596%        const double cluster_threshold,const double smooth_threshold)
8597%
8598%  A description of each parameter follows.
8599%
8600%    o wand: the wand.
8601%
8602%    o colorspace: the image colorspace.
8603%
8604%    o verbose:  Set to MagickTrue to print detailed information about the
8605%      identified classes.
8606%
8607%    o cluster_threshold:  This represents the minimum number of pixels
8608%      contained in a hexahedra before it can be considered valid (expressed as
8609%      a percentage).
8610%
8611%    o smooth_threshold: the smoothing threshold eliminates noise in the second
8612%      derivative of the histogram.  As the value is increased, you can expect a
8613%      smoother second derivative.
8614%
8615*/
8616MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8617  const ColorspaceType colorspace,const MagickBooleanType verbose,
8618  const double cluster_threshold,const double smooth_threshold)
8619{
8620  MagickBooleanType
8621    status;
8622
8623  assert(wand != (MagickWand *) NULL);
8624  assert(wand->signature == WandSignature);
8625  if (IfMagickTrue(wand->debug))
8626    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8627  if (wand->images == (Image *) NULL)
8628    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8629  status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8630    smooth_threshold,wand->exception);
8631  return(status);
8632}
8633
8634/*
8635%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8636%                                                                             %
8637%                                                                             %
8638%                                                                             %
8639%   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8640%                                                                             %
8641%                                                                             %
8642%                                                                             %
8643%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8644%
8645%  MagickSelectiveBlurImage() selectively blur an image within a contrast
8646%  threshold. It is similar to the unsharpen mask that sharpens everything with
8647%  contrast above a certain threshold.
8648%
8649%  The format of the MagickSelectiveBlurImage method is:
8650%
8651%      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8652%        const double radius,const double sigma,const double threshold)
8653%
8654%  A description of each parameter follows:
8655%
8656%    o wand: the magick wand.
8657%
8658%    o radius: the radius of the gaussian, in pixels, not counting the center
8659%      pixel.
8660%
8661%    o sigma: the standard deviation of the gaussian, in pixels.
8662%
8663%    o threshold: only pixels within this contrast threshold are included
8664%      in the blur operation.
8665%
8666*/
8667WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8668  const double radius,const double sigma,const double threshold)
8669{
8670  Image
8671    *blur_image;
8672
8673  assert(wand != (MagickWand *) NULL);
8674  assert(wand->signature == WandSignature);
8675  if (IfMagickTrue(wand->debug))
8676    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8677  if (wand->images == (Image *) NULL)
8678    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8679  blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
8680    wand->exception);
8681  if (blur_image == (Image *) NULL)
8682    return(MagickFalse);
8683  ReplaceImageInList(&wand->images,blur_image);
8684  return(MagickTrue);
8685}
8686
8687/*
8688%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8689%                                                                             %
8690%                                                                             %
8691%                                                                             %
8692%   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                       %
8693%                                                                             %
8694%                                                                             %
8695%                                                                             %
8696%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8697%
8698%  MagickSeparateImage() separates a channel from the image and returns a
8699%  grayscale image.  A channel is a particular color component of each pixel
8700%  in the image.
8701%
8702%  The format of the MagickSeparateImage method is:
8703%
8704%      MagickBooleanType MagickSeparateImage(MagickWand *wand,
8705%        const ChannelType channel)
8706%
8707%  A description of each parameter follows:
8708%
8709%    o wand: the magick wand.
8710%
8711%    o channel: the channel.
8712%
8713*/
8714WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
8715  const ChannelType channel)
8716{
8717  Image
8718    *separate_image;
8719
8720  assert(wand != (MagickWand *) NULL);
8721  assert(wand->signature == WandSignature);
8722  if (IfMagickTrue(wand->debug))
8723    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8724  if (wand->images == (Image *) NULL)
8725    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8726  separate_image=SeparateImage(wand->images,channel,wand->exception);
8727  if (separate_image == (Image *) NULL)
8728    return(MagickFalse);
8729  ReplaceImageInList(&wand->images,separate_image);
8730  return(MagickTrue);
8731}
8732
8733/*
8734%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8735%                                                                             %
8736%                                                                             %
8737%                                                                             %
8738%     M a g i c k S e p i a T o n e I m a g e                                 %
8739%                                                                             %
8740%                                                                             %
8741%                                                                             %
8742%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8743%
8744%  MagickSepiaToneImage() applies a special effect to the image, similar to the
8745%  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8746%  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8747%  threshold of 80% is a good starting point for a reasonable tone.
8748%
8749%  The format of the MagickSepiaToneImage method is:
8750%
8751%      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8752%        const double threshold)
8753%
8754%  A description of each parameter follows:
8755%
8756%    o wand: the magick wand.
8757%
8758%    o threshold:  Define the extent of the sepia toning.
8759%
8760*/
8761WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8762  const double threshold)
8763{
8764  Image
8765    *sepia_image;
8766
8767  assert(wand != (MagickWand *) NULL);
8768  assert(wand->signature == WandSignature);
8769  if (IfMagickTrue(wand->debug))
8770    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8771  if (wand->images == (Image *) NULL)
8772    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8773  sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8774  if (sepia_image == (Image *) NULL)
8775    return(MagickFalse);
8776  ReplaceImageInList(&wand->images,sepia_image);
8777  return(MagickTrue);
8778}
8779
8780/*
8781%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8782%                                                                             %
8783%                                                                             %
8784%                                                                             %
8785%   M a g i c k S e t I m a g e                                               %
8786%                                                                             %
8787%                                                                             %
8788%                                                                             %
8789%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8790%
8791%  MagickSetImage() replaces the last image returned by MagickSetIteratorIndex(),
8792%  MagickNextImage(), MagickPreviousImage() with the images from the specified
8793%  wand.
8794%
8795%  The format of the MagickSetImage method is:
8796%
8797%      MagickBooleanType MagickSetImage(MagickWand *wand,
8798%        const MagickWand *set_wand)
8799%
8800%  A description of each parameter follows:
8801%
8802%    o wand: the magick wand.
8803%
8804%    o set_wand: the set_wand wand.
8805%
8806*/
8807WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8808  const MagickWand *set_wand)
8809{
8810  Image
8811    *images;
8812
8813  assert(wand != (MagickWand *) NULL);
8814  assert(wand->signature == WandSignature);
8815  if (IfMagickTrue(wand->debug))
8816    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8817  assert(set_wand != (MagickWand *) NULL);
8818  assert(set_wand->signature == WandSignature);
8819  if (IfMagickTrue(wand->debug))
8820    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8821  if (set_wand->images == (Image *) NULL)
8822    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8823  images=CloneImageList(set_wand->images,wand->exception);
8824  if (images == (Image *) NULL)
8825    return(MagickFalse);
8826  ReplaceImageInList(&wand->images,images);
8827  return(MagickTrue);
8828}
8829
8830/*
8831%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8832%                                                                             %
8833%                                                                             %
8834%                                                                             %
8835%   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                       %
8836%                                                                             %
8837%                                                                             %
8838%                                                                             %
8839%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8840%
8841%  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8842%  alpha channel.
8843%
8844%  The format of the MagickSetImageAlphaChannel method is:
8845%
8846%      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8847%        const AlphaChannelOption alpha_type)
8848%
8849%  A description of each parameter follows:
8850%
8851%    o wand: the magick wand.
8852%
8853%    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8854%      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8855%
8856*/
8857WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8858  const AlphaChannelOption alpha_type)
8859{
8860  assert(wand != (MagickWand *) NULL);
8861  assert(wand->signature == WandSignature);
8862  if (IfMagickTrue(wand->debug))
8863    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8864  if (wand->images == (Image *) NULL)
8865    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8866  return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
8867}
8868
8869/*
8870%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8871%                                                                             %
8872%                                                                             %
8873%                                                                             %
8874%   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                 %
8875%                                                                             %
8876%                                                                             %
8877%                                                                             %
8878%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8879%
8880%  MagickSetImageBackgroundColor() sets the image background color.
8881%
8882%  The format of the MagickSetImageBackgroundColor method is:
8883%
8884%      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8885%        const PixelWand *background)
8886%
8887%  A description of each parameter follows:
8888%
8889%    o wand: the magick wand.
8890%
8891%    o background: the background pixel wand.
8892%
8893*/
8894WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8895  const PixelWand *background)
8896{
8897  assert(wand != (MagickWand *) NULL);
8898  assert(wand->signature == WandSignature);
8899  if (IfMagickTrue(wand->debug))
8900    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8901  if (wand->images == (Image *) NULL)
8902    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8903  PixelGetQuantumPacket(background,&wand->images->background_color);
8904  return(MagickTrue);
8905}
8906
8907/*
8908%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8909%                                                                             %
8910%                                                                             %
8911%                                                                             %
8912%   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                         %
8913%                                                                             %
8914%                                                                             %
8915%                                                                             %
8916%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8917%
8918%  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8919%
8920%  The format of the MagickSetImageBluePrimary method is:
8921%
8922%      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8923%        const double x,const double y)
8924%
8925%  A description of each parameter follows:
8926%
8927%    o wand: the magick wand.
8928%
8929%    o x: the blue primary x-point.
8930%
8931%    o y: the blue primary y-point.
8932%
8933*/
8934WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8935  const double x,const double y)
8936{
8937  assert(wand != (MagickWand *) NULL);
8938  assert(wand->signature == WandSignature);
8939  if (IfMagickTrue(wand->debug))
8940    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8941  if (wand->images == (Image *) NULL)
8942    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8943  wand->images->chromaticity.blue_primary.x=x;
8944  wand->images->chromaticity.blue_primary.y=y;
8945  return(MagickTrue);
8946}
8947
8948/*
8949%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8950%                                                                             %
8951%                                                                             %
8952%                                                                             %
8953%   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                         %
8954%                                                                             %
8955%                                                                             %
8956%                                                                             %
8957%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8958%
8959%  MagickSetImageBorderColor() sets the image border color.
8960%
8961%  The format of the MagickSetImageBorderColor method is:
8962%
8963%      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8964%        const PixelWand *border)
8965%
8966%  A description of each parameter follows:
8967%
8968%    o wand: the magick wand.
8969%
8970%    o border: the border pixel wand.
8971%
8972*/
8973WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8974  const PixelWand *border)
8975{
8976  assert(wand != (MagickWand *) NULL);
8977  assert(wand->signature == WandSignature);
8978  if (IfMagickTrue(wand->debug))
8979    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8980  if (wand->images == (Image *) NULL)
8981    ThrowWandException(WandError,"ContainsNoImages",wand->name);
8982  PixelGetQuantumPacket(border,&wand->images->border_color);
8983  return(MagickTrue);
8984}
8985
8986/*
8987%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8988%                                                                             %
8989%                                                                             %
8990%                                                                             %
8991%   M a g i c k S e t I m a g e C h a n n e l M a s k                         %
8992%                                                                             %
8993%                                                                             %
8994%                                                                             %
8995%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8996%
8997%  MagickSetImageChannelMask() sets image channel mask.
8998%
8999%  The format of the MagickSetImageChannelMask method is:
9000%
9001%      ChannelType MagickSetImageChannelMask(MagickWand *wand,
9002%        const ChannelType channel_mask)
9003%
9004%  A description of each parameter follows:
9005%
9006%    o wand: the magick wand.
9007%
9008%    o channel_mask: the channel_mask wand.
9009%
9010*/
9011WandExport ChannelType MagickSetImageChannelMask(MagickWand *wand,
9012  const ChannelType channel_mask)
9013{
9014  assert(wand != (MagickWand *) NULL);
9015  assert(wand->signature == WandSignature);
9016  if (IfMagickTrue(wand->debug))
9017    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9018  return(SetImageChannelMask(wand->images,channel_mask));
9019}
9020
9021/*
9022%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9023%                                                                             %
9024%                                                                             %
9025%                                                                             %
9026%   M a g i c k S e t I m a g e M a s k                                       %
9027%                                                                             %
9028%                                                                             %
9029%                                                                             %
9030%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9031%
9032%  MagickSetImageMask() sets image clip mask.
9033%
9034%  The format of the MagickSetImageMask method is:
9035%
9036%      MagickBooleanType MagickSetImageMask(MagickWand *wand,
9037%        const MagickWand *clip_mask)
9038%
9039%  A description of each parameter follows:
9040%
9041%    o wand: the magick wand.
9042%
9043%    o clip_mask: the clip_mask wand.
9044%
9045*/
9046WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
9047  const MagickWand *clip_mask)
9048{
9049  assert(wand != (MagickWand *) NULL);
9050  assert(wand->signature == WandSignature);
9051  if (IfMagickTrue(wand->debug))
9052    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9053  assert(clip_mask != (MagickWand *) NULL);
9054  assert(clip_mask->signature == WandSignature);
9055  if (IfMagickTrue(clip_mask->debug))
9056    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9057  if (clip_mask->images == (Image *) NULL)
9058    ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
9059  return(SetImageMask(wand->images,clip_mask->images,wand->exception));
9060}
9061
9062/*
9063%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9064%                                                                             %
9065%                                                                             %
9066%                                                                             %
9067%   M a g i c k S e t I m a g e C o l o r                                     %
9068%                                                                             %
9069%                                                                             %
9070%                                                                             %
9071%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9072%
9073%  MagickSetImageColor() set the entire wand canvas to the specified color.
9074%
9075%  The format of the MagickSetImageColor method is:
9076%
9077%      MagickBooleanType MagickSetImageColor(MagickWand *wand,
9078%        const PixelWand *color)
9079%
9080%  A description of each parameter follows:
9081%
9082%    o wand: the magick wand.
9083%
9084%    o background: the image color.
9085%
9086*/
9087WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9088  const PixelWand *color)
9089{
9090  PixelInfo
9091    pixel;
9092
9093  assert(wand != (MagickWand *) NULL);
9094  assert(wand->signature == WandSignature);
9095  if (IfMagickTrue(wand->debug))
9096    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9097  PixelGetMagickColor(color,&pixel);
9098  return(SetImageColor(wand->images,&pixel,wand->exception));
9099}
9100
9101/*
9102%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9103%                                                                             %
9104%                                                                             %
9105%                                                                             %
9106%   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                     %
9107%                                                                             %
9108%                                                                             %
9109%                                                                             %
9110%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9111%
9112%  MagickSetImageColormapColor() sets the color of the specified colormap
9113%  index.
9114%
9115%  The format of the MagickSetImageColormapColor method is:
9116%
9117%      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9118%        const size_t index,const PixelWand *color)
9119%
9120%  A description of each parameter follows:
9121%
9122%    o wand: the magick wand.
9123%
9124%    o index: the offset into the image colormap.
9125%
9126%    o color: Return the colormap color in this wand.
9127%
9128*/
9129WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9130  const size_t index,const PixelWand *color)
9131{
9132  assert(wand != (MagickWand *) NULL);
9133  assert(wand->signature == WandSignature);
9134  if (IfMagickTrue(wand->debug))
9135    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9136  if (wand->images == (Image *) NULL)
9137    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9138  if ((wand->images->colormap == (PixelInfo *) NULL) ||
9139      (index >= wand->images->colors))
9140    ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9141  PixelGetQuantumPacket(color,wand->images->colormap+index);
9142  return(SyncImage(wand->images,wand->exception));
9143}
9144
9145/*
9146%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9147%                                                                             %
9148%                                                                             %
9149%                                                                             %
9150%   M a g i c k S e t I m a g e C o l o r s p a c e                           %
9151%                                                                             %
9152%                                                                             %
9153%                                                                             %
9154%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9155%
9156%  MagickSetImageColorspace() sets the image colorspace. But does not modify
9157%  the image data.
9158%
9159%  The format of the MagickSetImageColorspace method is:
9160%
9161%      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9162%        const ColorspaceType colorspace)
9163%
9164%  A description of each parameter follows:
9165%
9166%    o wand: the magick wand.
9167%
9168%    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
9169%      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9170%      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9171%      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9172%      HSLColorspace, or HWBColorspace.
9173%
9174*/
9175WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9176  const ColorspaceType colorspace)
9177{
9178  assert(wand != (MagickWand *) NULL);
9179  assert(wand->signature == WandSignature);
9180  if (IfMagickTrue(wand->debug))
9181    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9182  if (wand->images == (Image *) NULL)
9183    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9184  return(SetImageColorspace(wand->images,colorspace,wand->exception));
9185}
9186
9187/*
9188%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9189%                                                                             %
9190%                                                                             %
9191%                                                                             %
9192%   M a g i c k S e t I m a g e C o m p o s e                                 %
9193%                                                                             %
9194%                                                                             %
9195%                                                                             %
9196%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9197%
9198%  MagickSetImageCompose() sets the image composite operator, useful for
9199%  specifying how to composite the image thumbnail when using the
9200%  MagickMontageImage() method.
9201%
9202%  The format of the MagickSetImageCompose method is:
9203%
9204%      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9205%        const CompositeOperator compose)
9206%
9207%  A description of each parameter follows:
9208%
9209%    o wand: the magick wand.
9210%
9211%    o compose: the image composite operator.
9212%
9213*/
9214WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9215  const CompositeOperator compose)
9216{
9217  assert(wand != (MagickWand *) NULL);
9218  assert(wand->signature == WandSignature);
9219  if (IfMagickTrue(wand->debug))
9220    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9221  if (wand->images == (Image *) NULL)
9222    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9223  wand->images->compose=compose;
9224  return(MagickTrue);
9225}
9226
9227/*
9228%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9229%                                                                             %
9230%                                                                             %
9231%                                                                             %
9232%   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                         %
9233%                                                                             %
9234%                                                                             %
9235%                                                                             %
9236%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9237%
9238%  MagickSetImageCompression() sets the image compression.
9239%
9240%  The format of the MagickSetImageCompression method is:
9241%
9242%      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9243%        const CompressionType compression)
9244%
9245%  A description of each parameter follows:
9246%
9247%    o wand: the magick wand.
9248%
9249%    o compression: the image compression type.
9250%
9251*/
9252WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9253  const CompressionType compression)
9254{
9255  assert(wand != (MagickWand *) NULL);
9256  assert(wand->signature == WandSignature);
9257  if (IfMagickTrue(wand->debug))
9258    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9259  if (wand->images == (Image *) NULL)
9260    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9261  wand->images->compression=compression;
9262  return(MagickTrue);
9263}
9264
9265/*
9266%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9267%                                                                             %
9268%                                                                             %
9269%                                                                             %
9270%   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           %
9271%                                                                             %
9272%                                                                             %
9273%                                                                             %
9274%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9275%
9276%  MagickSetImageCompressionQuality() sets the image compression quality.
9277%
9278%  The format of the MagickSetImageCompressionQuality method is:
9279%
9280%      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9281%        const size_t quality)
9282%
9283%  A description of each parameter follows:
9284%
9285%    o wand: the magick wand.
9286%
9287%    o quality: the image compression tlityype.
9288%
9289*/
9290WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9291  const size_t quality)
9292{
9293  assert(wand != (MagickWand *) NULL);
9294  assert(wand->signature == WandSignature);
9295  if (IfMagickTrue(wand->debug))
9296    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9297  if (wand->images == (Image *) NULL)
9298    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9299  wand->images->quality=quality;
9300  return(MagickTrue);
9301}
9302
9303/*
9304%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9305%                                                                             %
9306%                                                                             %
9307%                                                                             %
9308%   M a g i c k S e t I m a g e D e l a y                                     %
9309%                                                                             %
9310%                                                                             %
9311%                                                                             %
9312%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9313%
9314%  MagickSetImageDelay() sets the image delay.
9315%
9316%  The format of the MagickSetImageDelay method is:
9317%
9318%      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9319%        const size_t delay)
9320%
9321%  A description of each parameter follows:
9322%
9323%    o wand: the magick wand.
9324%
9325%    o delay: the image delay in ticks-per-second units.
9326%
9327*/
9328WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9329  const size_t delay)
9330{
9331  assert(wand != (MagickWand *) NULL);
9332  assert(wand->signature == WandSignature);
9333  if (IfMagickTrue(wand->debug))
9334    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9335  if (wand->images == (Image *) NULL)
9336    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9337  wand->images->delay=delay;
9338  return(MagickTrue);
9339}
9340
9341/*
9342%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9343%                                                                             %
9344%                                                                             %
9345%                                                                             %
9346%   M a g i c k S e t I m a g e D e p t h                                     %
9347%                                                                             %
9348%                                                                             %
9349%                                                                             %
9350%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9351%
9352%  MagickSetImageDepth() sets the image depth.
9353%
9354%  The format of the MagickSetImageDepth method is:
9355%
9356%      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9357%        const size_t depth)
9358%
9359%  A description of each parameter follows:
9360%
9361%    o wand: the magick wand.
9362%
9363%    o depth: the image depth in bits: 8, 16, or 32.
9364%
9365*/
9366WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9367  const size_t depth)
9368{
9369  assert(wand != (MagickWand *) NULL);
9370  assert(wand->signature == WandSignature);
9371  if (IfMagickTrue(wand->debug))
9372    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9373  if (wand->images == (Image *) NULL)
9374    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9375  return(SetImageDepth(wand->images,depth,wand->exception));
9376}
9377
9378/*
9379%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9380%                                                                             %
9381%                                                                             %
9382%                                                                             %
9383%   M a g i c k S e t I m a g e D i s p o s e                                 %
9384%                                                                             %
9385%                                                                             %
9386%                                                                             %
9387%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9388%
9389%  MagickSetImageDispose() sets the image disposal method.
9390%
9391%  The format of the MagickSetImageDispose method is:
9392%
9393%      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9394%        const DisposeType dispose)
9395%
9396%  A description of each parameter follows:
9397%
9398%    o wand: the magick wand.
9399%
9400%    o dispose: the image disposeal type.
9401%
9402*/
9403WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9404  const DisposeType dispose)
9405{
9406  assert(wand != (MagickWand *) NULL);
9407  assert(wand->signature == WandSignature);
9408  if (IfMagickTrue(wand->debug))
9409    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9410  if (wand->images == (Image *) NULL)
9411    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9412  wand->images->dispose=dispose;
9413  return(MagickTrue);
9414}
9415
9416/*
9417%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9418%                                                                             %
9419%                                                                             %
9420%                                                                             %
9421%   M a g i c k S e t I m a g e E n d i a n                                   %
9422%                                                                             %
9423%                                                                             %
9424%                                                                             %
9425%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9426%
9427%  MagickSetImageEndian() sets the image endian method.
9428%
9429%  The format of the MagickSetImageEndian method is:
9430%
9431%      MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9432%        const EndianType endian)
9433%
9434%  A description of each parameter follows:
9435%
9436%    o wand: the magick wand.
9437%
9438%    o endian: the image endian type.
9439%
9440*/
9441WandExport MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9442  const EndianType endian)
9443{
9444  assert(wand != (MagickWand *) NULL);
9445  assert(wand->signature == WandSignature);
9446  if (wand->debug != MagickFalse)
9447    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9448  if (wand->images == (Image *) NULL)
9449    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9450  wand->images->endian=endian;
9451  return(MagickTrue);
9452}
9453
9454/*
9455%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9456%                                                                             %
9457%                                                                             %
9458%                                                                             %
9459%   M a g i c k S e t I m a g e E x t e n t                                   %
9460%                                                                             %
9461%                                                                             %
9462%                                                                             %
9463%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9464%
9465%  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9466%
9467%  The format of the MagickSetImageExtent method is:
9468%
9469%      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9470%        const size_t columns,const unsigned rows)
9471%
9472%  A description of each parameter follows:
9473%
9474%    o wand: the magick wand.
9475%
9476%    o columns:  The image width in pixels.
9477%
9478%    o rows:  The image height in pixels.
9479%
9480*/
9481WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9482  const size_t columns,const size_t rows)
9483{
9484  assert(wand != (MagickWand *) NULL);
9485  assert(wand->signature == WandSignature);
9486  if (IfMagickTrue(wand->debug))
9487    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9488  if (wand->images == (Image *) NULL)
9489    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9490  return(SetImageExtent(wand->images,columns,rows,wand->exception));
9491}
9492
9493/*
9494%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9495%                                                                             %
9496%                                                                             %
9497%                                                                             %
9498%   M a g i c k S e t I m a g e F i l e n a m e                               %
9499%                                                                             %
9500%                                                                             %
9501%                                                                             %
9502%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9503%
9504%  MagickSetImageFilename() sets the filename of a particular image in a
9505%  sequence.
9506%
9507%  The format of the MagickSetImageFilename method is:
9508%
9509%      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9510%        const char *filename)
9511%
9512%  A description of each parameter follows:
9513%
9514%    o wand: the magick wand.
9515%
9516%    o filename: the image filename.
9517%
9518*/
9519WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9520  const char *filename)
9521{
9522  assert(wand != (MagickWand *) NULL);
9523  assert(wand->signature == WandSignature);
9524  if (IfMagickTrue(wand->debug))
9525    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9526  if (wand->images == (Image *) NULL)
9527    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9528  if (filename != (const char *) NULL)
9529    (void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
9530  return(MagickTrue);
9531}
9532
9533/*
9534%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9535%                                                                             %
9536%                                                                             %
9537%                                                                             %
9538%   M a g i c k S e t I m a g e F o r m a t                                   %
9539%                                                                             %
9540%                                                                             %
9541%                                                                             %
9542%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9543%
9544%  MagickSetImageFormat() sets the format of a particular image in a
9545%  sequence.
9546%
9547%  The format of the MagickSetImageFormat method is:
9548%
9549%      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9550%        const char *format)
9551%
9552%  A description of each parameter follows:
9553%
9554%    o wand: the magick wand.
9555%
9556%    o format: the image format.
9557%
9558*/
9559WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9560  const char *format)
9561{
9562  const MagickInfo
9563    *magick_info;
9564
9565  assert(wand != (MagickWand *) NULL);
9566  assert(wand->signature == WandSignature);
9567  if (IfMagickTrue(wand->debug))
9568    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9569  if (wand->images == (Image *) NULL)
9570    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9571  if ((format == (char *) NULL) || (*format == '\0'))
9572    {
9573      *wand->images->magick='\0';
9574      return(MagickTrue);
9575    }
9576  magick_info=GetMagickInfo(format,wand->exception);
9577  if (magick_info == (const MagickInfo *) NULL)
9578    return(MagickFalse);
9579  ClearMagickException(wand->exception);
9580  (void) CopyMagickString(wand->images->magick,format,MagickPathExtent);
9581  return(MagickTrue);
9582}
9583
9584/*
9585%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9586%                                                                             %
9587%                                                                             %
9588%                                                                             %
9589%   M a g i c k S e t I m a g e F u z z                                       %
9590%                                                                             %
9591%                                                                             %
9592%                                                                             %
9593%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9594%
9595%  MagickSetImageFuzz() sets the image fuzz.
9596%
9597%  The format of the MagickSetImageFuzz method is:
9598%
9599%      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9600%        const double fuzz)
9601%
9602%  A description of each parameter follows:
9603%
9604%    o wand: the magick wand.
9605%
9606%    o fuzz: the image fuzz.
9607%
9608*/
9609WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9610  const double fuzz)
9611{
9612  assert(wand != (MagickWand *) NULL);
9613  assert(wand->signature == WandSignature);
9614  if (IfMagickTrue(wand->debug))
9615    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9616  if (wand->images == (Image *) NULL)
9617    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9618  wand->images->fuzz=fuzz;
9619  return(MagickTrue);
9620}
9621
9622/*
9623%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9624%                                                                             %
9625%                                                                             %
9626%                                                                             %
9627%   M a g i c k S e t I m a g e G a m m a                                     %
9628%                                                                             %
9629%                                                                             %
9630%                                                                             %
9631%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9632%
9633%  MagickSetImageGamma() sets the image gamma.
9634%
9635%  The format of the MagickSetImageGamma method is:
9636%
9637%      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9638%        const double gamma)
9639%
9640%  A description of each parameter follows:
9641%
9642%    o wand: the magick wand.
9643%
9644%    o gamma: the image gamma.
9645%
9646*/
9647WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9648  const double gamma)
9649{
9650  assert(wand != (MagickWand *) NULL);
9651  assert(wand->signature == WandSignature);
9652  if (IfMagickTrue(wand->debug))
9653    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9654  if (wand->images == (Image *) NULL)
9655    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9656  wand->images->gamma=gamma;
9657  return(MagickTrue);
9658}
9659
9660/*
9661%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9662%                                                                             %
9663%                                                                             %
9664%                                                                             %
9665%   M a g i c k S e t I m a g e G r a v i t y                                 %
9666%                                                                             %
9667%                                                                             %
9668%                                                                             %
9669%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9670%
9671%  MagickSetImageGravity() sets the image gravity type.
9672%
9673%  The format of the MagickSetImageGravity method is:
9674%
9675%      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9676%        const GravityType gravity)
9677%
9678%  A description of each parameter follows:
9679%
9680%    o wand: the magick wand.
9681%
9682%    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9683%      PlaneInterlace, PartitionInterlace.
9684%
9685*/
9686WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9687  const GravityType gravity)
9688{
9689  assert(wand != (MagickWand *) NULL);
9690  assert(wand->signature == WandSignature);
9691  if (IfMagickTrue(wand->debug))
9692    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9693  if (wand->images == (Image *) NULL)
9694    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9695  wand->images->gravity=gravity;
9696  return(MagickTrue);
9697}
9698
9699/*
9700%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9701%                                                                             %
9702%                                                                             %
9703%                                                                             %
9704%   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                       %
9705%                                                                             %
9706%                                                                             %
9707%                                                                             %
9708%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9709%
9710%  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9711%  point.
9712%
9713%  The format of the MagickSetImageGreenPrimary method is:
9714%
9715%      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9716%        const double x,const double y)
9717%
9718%  A description of each parameter follows:
9719%
9720%    o wand: the magick wand.
9721%
9722%    o x: the green primary x-point.
9723%
9724%    o y: the green primary y-point.
9725%
9726%
9727*/
9728WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9729  const double x,const double y)
9730{
9731  assert(wand != (MagickWand *) NULL);
9732  assert(wand->signature == WandSignature);
9733  if (IfMagickTrue(wand->debug))
9734    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9735  if (wand->images == (Image *) NULL)
9736    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9737  wand->images->chromaticity.green_primary.x=x;
9738  wand->images->chromaticity.green_primary.y=y;
9739  return(MagickTrue);
9740}
9741
9742/*
9743%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9744%                                                                             %
9745%                                                                             %
9746%                                                                             %
9747%   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                 %
9748%                                                                             %
9749%                                                                             %
9750%                                                                             %
9751%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9752%
9753%  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9754%
9755%  The format of the MagickSetImageInterlaceScheme method is:
9756%
9757%      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9758%        const InterlaceType interlace)
9759%
9760%  A description of each parameter follows:
9761%
9762%    o wand: the magick wand.
9763%
9764%    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9765%      PlaneInterlace, PartitionInterlace.
9766%
9767*/
9768WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9769  const InterlaceType interlace)
9770{
9771  assert(wand != (MagickWand *) NULL);
9772  assert(wand->signature == WandSignature);
9773  if (IfMagickTrue(wand->debug))
9774    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9775  if (wand->images == (Image *) NULL)
9776    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9777  wand->images->interlace=interlace;
9778  return(MagickTrue);
9779}
9780
9781/*
9782%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9783%                                                                             %
9784%                                                                             %
9785%                                                                             %
9786%   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             %
9787%                                                                             %
9788%                                                                             %
9789%                                                                             %
9790%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9791%
9792%  MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel
9793%  method.
9794%
9795%  The format of the MagickSetImagePixelInterpolateMethod method is:
9796%
9797%      MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9798%        const PixelInterpolateMethod method)
9799%
9800%  A description of each parameter follows:
9801%
9802%    o wand: the magick wand.
9803%
9804%    o method: the image interpole pixel methods: choose from Undefined,
9805%      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9806%
9807*/
9808WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(
9809  MagickWand *wand,const PixelInterpolateMethod method)
9810{
9811  assert(wand != (MagickWand *) NULL);
9812  assert(wand->signature == WandSignature);
9813  if (IfMagickTrue(wand->debug))
9814    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9815  if (wand->images == (Image *) NULL)
9816    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9817  wand->images->interpolate=method;
9818  return(MagickTrue);
9819}
9820
9821/*
9822%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9823%                                                                             %
9824%                                                                             %
9825%                                                                             %
9826%   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9827%                                                                             %
9828%                                                                             %
9829%                                                                             %
9830%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9831%
9832%  MagickSetImageIterations() sets the image iterations.
9833%
9834%  The format of the MagickSetImageIterations method is:
9835%
9836%      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9837%        const size_t iterations)
9838%
9839%  A description of each parameter follows:
9840%
9841%    o wand: the magick wand.
9842%
9843%    o delay: the image delay in 1/100th of a second.
9844%
9845*/
9846WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9847  const size_t iterations)
9848{
9849  assert(wand != (MagickWand *) NULL);
9850  assert(wand->signature == WandSignature);
9851  if (IfMagickTrue(wand->debug))
9852    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9853  if (wand->images == (Image *) NULL)
9854    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9855  wand->images->iterations=iterations;
9856  return(MagickTrue);
9857}
9858
9859/*
9860%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9861%                                                                             %
9862%                                                                             %
9863%                                                                             %
9864%   M a g i c k S e t I m a g e M a t t e                                     %
9865%                                                                             %
9866%                                                                             %
9867%                                                                             %
9868%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9869%
9870%  MagickSetImageMatte() sets the image matte channel.
9871%
9872%  The format of the MagickSetImageMatteColor method is:
9873%
9874%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9875%        const MagickBooleanType *matte)
9876%
9877%  A description of each parameter follows:
9878%
9879%    o wand: the magick wand.
9880%
9881%    o matte: Set to MagickTrue to enable the image matte channel otherwise
9882%      MagickFalse.
9883%
9884*/
9885WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9886  const MagickBooleanType matte)
9887{
9888  assert(wand != (MagickWand *) NULL);
9889  assert(wand->signature == WandSignature);
9890  if (IfMagickTrue(wand->debug))
9891    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9892  if (wand->images == (Image *) NULL)
9893    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9894  if ((wand->images->alpha_trait == UndefinedPixelTrait) && IsMagickTrue(matte))
9895    (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
9896  wand->images->alpha_trait=matte != MagickFalse ? BlendPixelTrait :
9897    UndefinedPixelTrait;
9898  return(MagickTrue);
9899}
9900
9901/*
9902%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9903%                                                                             %
9904%                                                                             %
9905%                                                                             %
9906%   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9907%                                                                             %
9908%                                                                             %
9909%                                                                             %
9910%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9911%
9912%  MagickSetImageMatteColor() sets the image matte color.
9913%
9914%  The format of the MagickSetImageMatteColor method is:
9915%
9916%      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9917%        const PixelWand *matte)
9918%
9919%  A description of each parameter follows:
9920%
9921%    o wand: the magick wand.
9922%
9923%    o matte: the matte pixel wand.
9924%
9925*/
9926WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9927  const PixelWand *matte)
9928{
9929  assert(wand != (MagickWand *) NULL);
9930  assert(wand->signature == WandSignature);
9931  if (IfMagickTrue(wand->debug))
9932    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9933  if (wand->images == (Image *) NULL)
9934    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9935  PixelGetQuantumPacket(matte,&wand->images->matte_color);
9936  return(MagickTrue);
9937}
9938
9939/*
9940%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9941%                                                                             %
9942%                                                                             %
9943%                                                                             %
9944%   M a g i c k S e t I m a g e O p a c i t y                                 %
9945%                                                                             %
9946%                                                                             %
9947%                                                                             %
9948%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9949%
9950%  MagickSetImageAlpha() sets the image to the specified alpha level.
9951%
9952%  The format of the MagickSetImageAlpha method is:
9953%
9954%      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9955%        const double alpha)
9956%
9957%  A description of each parameter follows:
9958%
9959%    o wand: the magick wand.
9960%
9961%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9962%      transparent.
9963%
9964*/
9965WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9966  const double alpha)
9967{
9968  MagickBooleanType
9969    status;
9970
9971  assert(wand != (MagickWand *) NULL);
9972  assert(wand->signature == WandSignature);
9973  if (IfMagickTrue(wand->debug))
9974    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9975  if (wand->images == (Image *) NULL)
9976    ThrowWandException(WandError,"ContainsNoImages",wand->name);
9977  status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
9978    wand->exception);
9979  return(status);
9980}
9981
9982/*
9983%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9984%                                                                             %
9985%                                                                             %
9986%                                                                             %
9987%   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                         %
9988%                                                                             %
9989%                                                                             %
9990%                                                                             %
9991%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9992%
9993%  MagickSetImageOrientation() sets the image orientation.
9994%
9995%  The format of the MagickSetImageOrientation method is:
9996%
9997%      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9998%        const OrientationType orientation)
9999%
10000%  A description of each parameter follows:
10001%
10002%    o wand: the magick wand.
10003%
10004%    o orientation: the image orientation type.
10005%
10006*/
10007WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10008  const OrientationType orientation)
10009{
10010  assert(wand != (MagickWand *) NULL);
10011  assert(wand->signature == WandSignature);
10012  if (IfMagickTrue(wand->debug))
10013    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10014  if (wand->images == (Image *) NULL)
10015    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10016  wand->images->orientation=orientation;
10017  return(MagickTrue);
10018}
10019
10020/*
10021%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10022%                                                                             %
10023%                                                                             %
10024%                                                                             %
10025%   M a g i c k S e t I m a g e P a g e                                       %
10026%                                                                             %
10027%                                                                             %
10028%                                                                             %
10029%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10030%
10031%  MagickSetImagePage() sets the page geometry of the image.
10032%
10033%  The format of the MagickSetImagePage method is:
10034%
10035%      MagickBooleanType MagickSetImagePage(MagickWand *wand,const size_t width,%        const size_t height,const ssize_t x,const ssize_t y)
10036%
10037%  A description of each parameter follows:
10038%
10039%    o wand: the magick wand.
10040%
10041%    o width: the page width.
10042%
10043%    o height: the page height.
10044%
10045%    o x: the page x-offset.
10046%
10047%    o y: the page y-offset.
10048%
10049*/
10050WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
10051  const size_t width,const size_t height,const ssize_t x,
10052  const ssize_t y)
10053{
10054  assert(wand != (MagickWand *) NULL);
10055  assert(wand->signature == WandSignature);
10056  if (IfMagickTrue(wand->debug))
10057    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10058  if (wand->images == (Image *) NULL)
10059    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10060  wand->images->page.width=width;
10061  wand->images->page.height=height;
10062  wand->images->page.x=x;
10063  wand->images->page.y=y;
10064  return(MagickTrue);
10065}
10066
10067/*
10068%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10069%                                                                             %
10070%                                                                             %
10071%                                                                             %
10072%   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                 %
10073%                                                                             %
10074%                                                                             %
10075%                                                                             %
10076%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10077%
10078%  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10079%  specified method and returns the previous progress monitor if any.  The
10080%  progress monitor method looks like this:
10081%
10082%    MagickBooleanType MagickProgressMonitor(const char *text,
10083%      const MagickOffsetType offset,const MagickSizeType span,
10084%      void *client_data)
10085%
10086%  If the progress monitor returns MagickFalse, the current operation is
10087%  interrupted.
10088%
10089%  The format of the MagickSetImageProgressMonitor method is:
10090%
10091%      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10092%        const MagickProgressMonitor progress_monitor,void *client_data)
10093%
10094%  A description of each parameter follows:
10095%
10096%    o wand: the magick wand.
10097%
10098%    o progress_monitor: Specifies a pointer to a method to monitor progress
10099%      of an image operation.
10100%
10101%    o client_data: Specifies a pointer to any client data.
10102%
10103*/
10104WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10105  const MagickProgressMonitor progress_monitor,void *client_data)
10106{
10107  MagickProgressMonitor
10108    previous_monitor;
10109
10110  assert(wand != (MagickWand *) NULL);
10111  assert(wand->signature == WandSignature);
10112  if (IfMagickTrue(wand->debug))
10113    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10114  if (wand->images == (Image *) NULL)
10115    {
10116      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10117        "ContainsNoImages","`%s'",wand->name);
10118      return((MagickProgressMonitor) NULL);
10119    }
10120  previous_monitor=SetImageProgressMonitor(wand->images,
10121    progress_monitor,client_data);
10122  return(previous_monitor);
10123}
10124
10125/*
10126%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10127%                                                                             %
10128%                                                                             %
10129%                                                                             %
10130%   M a g i c k S e t I m a g e R e d P r i m a r y                           %
10131%                                                                             %
10132%                                                                             %
10133%                                                                             %
10134%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10135%
10136%  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10137%
10138%  The format of the MagickSetImageRedPrimary method is:
10139%
10140%      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10141%        const double x,const double y)
10142%
10143%  A description of each parameter follows:
10144%
10145%    o wand: the magick wand.
10146%
10147%    o x: the red primary x-point.
10148%
10149%    o y: the red primary y-point.
10150%
10151*/
10152WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10153  const double x,const double y)
10154{
10155  assert(wand != (MagickWand *) NULL);
10156  assert(wand->signature == WandSignature);
10157  if (IfMagickTrue(wand->debug))
10158    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10159  if (wand->images == (Image *) NULL)
10160    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10161  wand->images->chromaticity.red_primary.x=x;
10162  wand->images->chromaticity.red_primary.y=y;
10163  return(MagickTrue);
10164}
10165
10166/*
10167%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10168%                                                                             %
10169%                                                                             %
10170%                                                                             %
10171%   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                 %
10172%                                                                             %
10173%                                                                             %
10174%                                                                             %
10175%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10176%
10177%  MagickSetImageRenderingIntent() sets the image rendering intent.
10178%
10179%  The format of the MagickSetImageRenderingIntent method is:
10180%
10181%      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10182%        const RenderingIntent rendering_intent)
10183%
10184%  A description of each parameter follows:
10185%
10186%    o wand: the magick wand.
10187%
10188%    o rendering_intent: the image rendering intent: UndefinedIntent,
10189%      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10190%
10191*/
10192WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10193  const RenderingIntent rendering_intent)
10194{
10195  assert(wand != (MagickWand *) NULL);
10196  assert(wand->signature == WandSignature);
10197  if (IfMagickTrue(wand->debug))
10198    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10199  if (wand->images == (Image *) NULL)
10200    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10201  wand->images->rendering_intent=rendering_intent;
10202  return(MagickTrue);
10203}
10204
10205/*
10206%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10207%                                                                             %
10208%                                                                             %
10209%                                                                             %
10210%   M a g i c k S e t I m a g e R e s o l u t i o n                           %
10211%                                                                             %
10212%                                                                             %
10213%                                                                             %
10214%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10215%
10216%  MagickSetImageResolution() sets the image resolution.
10217%
10218%  The format of the MagickSetImageResolution method is:
10219%
10220%      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10221%        const double x_resolution,const double y_resolution)
10222%
10223%  A description of each parameter follows:
10224%
10225%    o wand: the magick wand.
10226%
10227%    o x_resolution: the image x resolution.
10228%
10229%    o y_resolution: the image y resolution.
10230%
10231*/
10232WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10233  const double x_resolution,const double y_resolution)
10234{
10235  assert(wand != (MagickWand *) NULL);
10236  assert(wand->signature == WandSignature);
10237  if (IfMagickTrue(wand->debug))
10238    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10239  if (wand->images == (Image *) NULL)
10240    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10241  wand->images->resolution.x=x_resolution;
10242  wand->images->resolution.y=y_resolution;
10243  return(MagickTrue);
10244}
10245
10246/*
10247%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10248%                                                                             %
10249%                                                                             %
10250%                                                                             %
10251%   M a g i c k S e t I m a g e S c e n e                                     %
10252%                                                                             %
10253%                                                                             %
10254%                                                                             %
10255%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10256%
10257%  MagickSetImageScene() sets the image scene.
10258%
10259%  The format of the MagickSetImageScene method is:
10260%
10261%      MagickBooleanType MagickSetImageScene(MagickWand *wand,
10262%        const size_t scene)
10263%
10264%  A description of each parameter follows:
10265%
10266%    o wand: the magick wand.
10267%
10268%    o delay: the image scene number.
10269%
10270*/
10271WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
10272  const size_t scene)
10273{
10274  assert(wand != (MagickWand *) NULL);
10275  assert(wand->signature == WandSignature);
10276  if (IfMagickTrue(wand->debug))
10277    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10278  if (wand->images == (Image *) NULL)
10279    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10280  wand->images->scene=scene;
10281  return(MagickTrue);
10282}
10283
10284/*
10285%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10286%                                                                             %
10287%                                                                             %
10288%                                                                             %
10289%   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                   %
10290%                                                                             %
10291%                                                                             %
10292%                                                                             %
10293%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10294%
10295%  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10296%
10297%  The format of the MagickSetImageTicksPerSecond method is:
10298%
10299%      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10300%        const ssize_t ticks_per-second)
10301%
10302%  A description of each parameter follows:
10303%
10304%    o wand: the magick wand.
10305%
10306%    o ticks_per_second: the units to use for the image delay.
10307%
10308*/
10309WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10310  const ssize_t ticks_per_second)
10311{
10312  assert(wand != (MagickWand *) NULL);
10313  assert(wand->signature == WandSignature);
10314  if (IfMagickTrue(wand->debug))
10315    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10316  if (wand->images == (Image *) NULL)
10317    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10318  wand->images->ticks_per_second=ticks_per_second;
10319  return(MagickTrue);
10320}
10321
10322/*
10323%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10324%                                                                             %
10325%                                                                             %
10326%                                                                             %
10327%   M a g i c k S e t I m a g e T y p e                                       %
10328%                                                                             %
10329%                                                                             %
10330%                                                                             %
10331%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10332%
10333%  MagickSetImageType() sets the image type.
10334%
10335%  The format of the MagickSetImageType method is:
10336%
10337%      MagickBooleanType MagickSetImageType(MagickWand *wand,
10338%        const ImageType image_type)
10339%
10340%  A description of each parameter follows:
10341%
10342%    o wand: the magick wand.
10343%
10344%    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10345%      GrayscaleAlphaType, PaletteType, PaletteAlphaType, TrueColorType,
10346%      TrueColorAlphaType, ColorSeparationType, ColorSeparationAlphaType,
10347%      or OptimizeType.
10348%
10349*/
10350WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10351  const ImageType image_type)
10352{
10353  assert(wand != (MagickWand *) NULL);
10354  assert(wand->signature == WandSignature);
10355  if (IfMagickTrue(wand->debug))
10356    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10357  if (wand->images == (Image *) NULL)
10358    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10359  return(SetImageType(wand->images,image_type,wand->exception));
10360}
10361
10362/*
10363%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10364%                                                                             %
10365%                                                                             %
10366%                                                                             %
10367%   M a g i c k S e t I m a g e U n i t s                                     %
10368%                                                                             %
10369%                                                                             %
10370%                                                                             %
10371%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10372%
10373%  MagickSetImageUnits() sets the image units of resolution.
10374%
10375%  The format of the MagickSetImageUnits method is:
10376%
10377%      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10378%        const ResolutionType units)
10379%
10380%  A description of each parameter follows:
10381%
10382%    o wand: the magick wand.
10383%
10384%    o units: the image units of resolution : UndefinedResolution,
10385%      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10386%
10387*/
10388WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10389  const ResolutionType units)
10390{
10391  assert(wand != (MagickWand *) NULL);
10392  assert(wand->signature == WandSignature);
10393  if (IfMagickTrue(wand->debug))
10394    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10395  if (wand->images == (Image *) NULL)
10396    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10397  wand->images->units=units;
10398  return(MagickTrue);
10399}
10400
10401/*
10402%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10403%                                                                             %
10404%                                                                             %
10405%                                                                             %
10406%   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           %
10407%                                                                             %
10408%                                                                             %
10409%                                                                             %
10410%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10411%
10412%  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10413%
10414%  The format of the MagickSetImageVirtualPixelMethod method is:
10415%
10416%      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10417%        const VirtualPixelMethod method)
10418%
10419%  A description of each parameter follows:
10420%
10421%    o wand: the magick wand.
10422%
10423%    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10424%      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10425%      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10426%
10427*/
10428WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10429  const VirtualPixelMethod method)
10430{
10431  assert(wand != (MagickWand *) NULL);
10432  assert(wand->signature == WandSignature);
10433  if (IfMagickTrue(wand->debug))
10434    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10435  if (wand->images == (Image *) NULL)
10436    return(UndefinedVirtualPixelMethod);
10437  return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
10438}
10439
10440/*
10441%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10442%                                                                             %
10443%                                                                             %
10444%                                                                             %
10445%   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10446%                                                                             %
10447%                                                                             %
10448%                                                                             %
10449%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10450%
10451%  MagickSetImageWhitePoint() sets the image chromaticity white point.
10452%
10453%  The format of the MagickSetImageWhitePoint method is:
10454%
10455%      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10456%        const double x,const double y)
10457%
10458%  A description of each parameter follows:
10459%
10460%    o wand: the magick wand.
10461%
10462%    o x: the white x-point.
10463%
10464%    o y: the white y-point.
10465%
10466*/
10467WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10468  const double x,const double y)
10469{
10470  assert(wand != (MagickWand *) NULL);
10471  assert(wand->signature == WandSignature);
10472  if (IfMagickTrue(wand->debug))
10473    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10474  if (wand->images == (Image *) NULL)
10475    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10476  wand->images->chromaticity.white_point.x=x;
10477  wand->images->chromaticity.white_point.y=y;
10478  return(MagickTrue);
10479}
10480
10481/*
10482%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10483%                                                                             %
10484%                                                                             %
10485%                                                                             %
10486%   M a g i c k S h a d e I m a g e C h a n n e l                             %
10487%                                                                             %
10488%                                                                             %
10489%                                                                             %
10490%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10491%
10492%  MagickShadeImage() shines a distant light on an image to create a
10493%  three-dimensional effect. You control the positioning of the light with
10494%  azimuth and elevation; azimuth is measured in degrees off the x axis
10495%  and elevation is measured in pixels above the Z axis.
10496%
10497%  The format of the MagickShadeImage method is:
10498%
10499%      MagickBooleanType MagickShadeImage(MagickWand *wand,
10500%        const MagickBooleanType gray,const double azimuth,
10501%        const double elevation)
10502%
10503%  A description of each parameter follows:
10504%
10505%    o wand: the magick wand.
10506%
10507%    o gray: A value other than zero shades the intensity of each pixel.
10508%
10509%    o azimuth, elevation:  Define the light source direction.
10510%
10511*/
10512WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10513  const MagickBooleanType gray,const double asimuth,const double elevation)
10514{
10515  Image
10516    *shade_image;
10517
10518  assert(wand != (MagickWand *) NULL);
10519  assert(wand->signature == WandSignature);
10520  if (IfMagickTrue(wand->debug))
10521    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10522  if (wand->images == (Image *) NULL)
10523    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10524  shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10525  if (shade_image == (Image *) NULL)
10526    return(MagickFalse);
10527  ReplaceImageInList(&wand->images,shade_image);
10528  return(MagickTrue);
10529}
10530
10531/*
10532%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10533%                                                                             %
10534%                                                                             %
10535%                                                                             %
10536%   M a g i c k S h a d o w I m a g e                                         %
10537%                                                                             %
10538%                                                                             %
10539%                                                                             %
10540%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10541%
10542%  MagickShadowImage() simulates an image shadow.
10543%
10544%  The format of the MagickShadowImage method is:
10545%
10546%      MagickBooleanType MagickShadowImage(MagickWand *wand,const double alpha,
10547%        const double sigma,const ssize_t x,const ssize_t y)
10548%
10549%  A description of each parameter follows:
10550%
10551%    o wand: the magick wand.
10552%
10553%    o alpha: percentage transparency.
10554%
10555%    o sigma: the standard deviation of the Gaussian, in pixels.
10556%
10557%    o x: the shadow x-offset.
10558%
10559%    o y: the shadow y-offset.
10560%
10561*/
10562WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10563  const double alpha,const double sigma,const ssize_t x,const ssize_t y)
10564{
10565  Image
10566    *shadow_image;
10567
10568  assert(wand != (MagickWand *) NULL);
10569  assert(wand->signature == WandSignature);
10570  if (IfMagickTrue(wand->debug))
10571    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10572  if (wand->images == (Image *) NULL)
10573    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10574  shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
10575  if (shadow_image == (Image *) NULL)
10576    return(MagickFalse);
10577  ReplaceImageInList(&wand->images,shadow_image);
10578  return(MagickTrue);
10579}
10580
10581/*
10582%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10583%                                                                             %
10584%                                                                             %
10585%                                                                             %
10586%   M a g i c k S h a r p e n I m a g e                                       %
10587%                                                                             %
10588%                                                                             %
10589%                                                                             %
10590%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10591%
10592%  MagickSharpenImage() sharpens an image.  We convolve the image with a
10593%  Gaussian operator of the given radius and standard deviation (sigma).
10594%  For reasonable results, the radius should be larger than sigma.  Use a
10595%  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10596%
10597%  The format of the MagickSharpenImage method is:
10598%
10599%      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10600%        const double radius,const double sigma)
10601%
10602%  A description of each parameter follows:
10603%
10604%    o wand: the magick wand.
10605%
10606%    o radius: the radius of the Gaussian, in pixels, not counting the center
10607%      pixel.
10608%
10609%    o sigma: the standard deviation of the Gaussian, in pixels.
10610%
10611*/
10612WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10613  const double radius,const double sigma)
10614{
10615  Image
10616    *sharp_image;
10617
10618  assert(wand != (MagickWand *) NULL);
10619  assert(wand->signature == WandSignature);
10620  if (IfMagickTrue(wand->debug))
10621    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10622  if (wand->images == (Image *) NULL)
10623    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10624  sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
10625  if (sharp_image == (Image *) NULL)
10626    return(MagickFalse);
10627  ReplaceImageInList(&wand->images,sharp_image);
10628  return(MagickTrue);
10629}
10630
10631/*
10632%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10633%                                                                             %
10634%                                                                             %
10635%                                                                             %
10636%   M a g i c k S h a v e I m a g e                                           %
10637%                                                                             %
10638%                                                                             %
10639%                                                                             %
10640%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10641%
10642%  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10643%  memory necessary for the new Image structure and returns a pointer to the
10644%  new image.
10645%
10646%  The format of the MagickShaveImage method is:
10647%
10648%      MagickBooleanType MagickShaveImage(MagickWand *wand,
10649%        const size_t columns,const size_t rows)
10650%
10651%  A description of each parameter follows:
10652%
10653%    o wand: the magick wand.
10654%
10655%    o columns: the number of columns in the scaled image.
10656%
10657%    o rows: the number of rows in the scaled image.
10658%
10659%
10660*/
10661WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10662  const size_t columns,const size_t rows)
10663{
10664  Image
10665    *shave_image;
10666
10667  RectangleInfo
10668    shave_info;
10669
10670  assert(wand != (MagickWand *) NULL);
10671  assert(wand->signature == WandSignature);
10672  if (IfMagickTrue(wand->debug))
10673    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10674  if (wand->images == (Image *) NULL)
10675    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10676  shave_info.width=columns;
10677  shave_info.height=rows;
10678  shave_info.x=0;
10679  shave_info.y=0;
10680  shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10681  if (shave_image == (Image *) NULL)
10682    return(MagickFalse);
10683  ReplaceImageInList(&wand->images,shave_image);
10684  return(MagickTrue);
10685}
10686
10687/*
10688%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10689%                                                                             %
10690%                                                                             %
10691%                                                                             %
10692%   M a g i c k S h e a r I m a g e                                           %
10693%                                                                             %
10694%                                                                             %
10695%                                                                             %
10696%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10697%
10698%  MagickShearImage() slides one edge of an image along the X or Y axis,
10699%  creating a parallelogram.  An X direction shear slides an edge along the X
10700%  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10701%  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10702%  is measured relative to the Y axis, and similarly, for Y direction shears
10703%  y_shear is measured relative to the X axis.  Empty triangles left over from
10704%  shearing the image are filled with the background color.
10705%
10706%  The format of the MagickShearImage method is:
10707%
10708%      MagickBooleanType MagickShearImage(MagickWand *wand,
10709%        const PixelWand *background,const double x_shear,const double y_shear)
10710%
10711%  A description of each parameter follows:
10712%
10713%    o wand: the magick wand.
10714%
10715%    o background: the background pixel wand.
10716%
10717%    o x_shear: the number of degrees to shear the image.
10718%
10719%    o y_shear: the number of degrees to shear the image.
10720%
10721*/
10722WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10723  const PixelWand *background,const double x_shear,const double y_shear)
10724{
10725  Image
10726    *shear_image;
10727
10728  assert(wand != (MagickWand *) NULL);
10729  assert(wand->signature == WandSignature);
10730  if (IfMagickTrue(wand->debug))
10731    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10732  if (wand->images == (Image *) NULL)
10733    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10734  PixelGetQuantumPacket(background,&wand->images->background_color);
10735  shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10736  if (shear_image == (Image *) NULL)
10737    return(MagickFalse);
10738  ReplaceImageInList(&wand->images,shear_image);
10739  return(MagickTrue);
10740}
10741
10742/*
10743%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10744%                                                                             %
10745%                                                                             %
10746%                                                                             %
10747%   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                   %
10748%                                                                             %
10749%                                                                             %
10750%                                                                             %
10751%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10752%
10753%  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10754%  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10755%  image using a sigmoidal transfer function without saturating highlights or
10756%  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10757%  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10758%  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10759%  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10760%  is reduced.
10761%
10762%  The format of the MagickSigmoidalContrastImage method is:
10763%
10764%      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10765%        const MagickBooleanType sharpen,const double alpha,const double beta)
10766%
10767%  A description of each parameter follows:
10768%
10769%    o wand: the magick wand.
10770%
10771%    o sharpen: Increase or decrease image contrast.
10772%
10773%    o alpha: strength of the contrast, the larger the number the more
10774%      'threshold-like' it becomes.
10775%
10776%    o beta: midpoint of the function as a color value 0 to QuantumRange.
10777%
10778*/
10779WandExport MagickBooleanType MagickSigmoidalContrastImage(
10780  MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10781  const double beta)
10782{
10783  MagickBooleanType
10784    status;
10785
10786  assert(wand != (MagickWand *) NULL);
10787  assert(wand->signature == WandSignature);
10788  if (IfMagickTrue(wand->debug))
10789    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10790  if (wand->images == (Image *) NULL)
10791    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10792  status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10793    wand->exception);
10794  return(status);
10795}
10796
10797/*
10798%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10799%                                                                             %
10800%                                                                             %
10801%                                                                             %
10802%   M a g i c k S i m i l a r i t y I m a g e                                 %
10803%                                                                             %
10804%                                                                             %
10805%                                                                             %
10806%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10807%
10808%  MagickSimilarityImage() compares the reference image of the image and
10809%  returns the best match offset.  In addition, it returns a similarity image
10810%  such that an exact match location is completely white and if none of the
10811%  pixels match, black, otherwise some gray level in-between.
10812%
10813%  The format of the MagickSimilarityImage method is:
10814%
10815%      MagickWand *MagickSimilarityImage(MagickWand *wand,
10816%        const MagickWand *reference,const MetricType metric,
10817%        const double similarity_threshold,RectangeInfo *offset,
10818%        double *similarity)
10819%
10820%  A description of each parameter follows:
10821%
10822%    o wand: the magick wand.
10823%
10824%    o reference: the reference wand.
10825%
10826%    o metric: the metric.
10827%
10828%    o similarity_threshold: minimum distortion for (sub)image match.
10829%
10830%    o offset: the best match offset of the reference image within the image.
10831%
10832%    o similarity: the computed similarity between the images.
10833%
10834*/
10835WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10836  const MagickWand *reference,const MetricType metric,
10837  const double similarity_threshold,RectangleInfo *offset,double *similarity)
10838{
10839  Image
10840    *similarity_image;
10841
10842  assert(wand != (MagickWand *) NULL);
10843  assert(wand->signature == WandSignature);
10844  if (IfMagickTrue(wand->debug))
10845    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10846  if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10847    {
10848      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10849        "ContainsNoImages","`%s'",wand->name);
10850      return((MagickWand *) NULL);
10851    }
10852  similarity_image=SimilarityImage(wand->images,reference->images,metric,
10853    similarity_threshold,offset,similarity,wand->exception);
10854  if (similarity_image == (Image *) NULL)
10855    return((MagickWand *) NULL);
10856  return(CloneMagickWandFromImages(wand,similarity_image));
10857}
10858
10859/*
10860%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10861%                                                                             %
10862%                                                                             %
10863%                                                                             %
10864%   M a g i c k S k e t c h I m a g e                                         %
10865%                                                                             %
10866%                                                                             %
10867%                                                                             %
10868%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10869%
10870%  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10871%  a Gaussian operator of the given radius and standard deviation (sigma).
10872%  For reasonable results, radius should be larger than sigma.  Use a
10873%  radius of 0 and SketchImage() selects a suitable radius for you.
10874%  Angle gives the angle of the blurring motion.
10875%
10876%  The format of the MagickSketchImage method is:
10877%
10878%      MagickBooleanType MagickSketchImage(MagickWand *wand,
10879%        const double radius,const double sigma,const double angle)
10880%
10881%  A description of each parameter follows:
10882%
10883%    o wand: the magick wand.
10884%
10885%    o radius: the radius of the Gaussian, in pixels, not counting
10886%      the center pixel.
10887%
10888%    o sigma: the standard deviation of the Gaussian, in pixels.
10889%
10890%    o angle: apply the effect along this angle.
10891%
10892*/
10893WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10894  const double radius,const double sigma,const double angle)
10895{
10896  Image
10897    *sketch_image;
10898
10899  assert(wand != (MagickWand *) NULL);
10900  assert(wand->signature == WandSignature);
10901  if (IfMagickTrue(wand->debug))
10902    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10903  if (wand->images == (Image *) NULL)
10904    ThrowWandException(WandError,"ContainsNoImages",wand->name);
10905  sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
10906  if (sketch_image == (Image *) NULL)
10907    return(MagickFalse);
10908  ReplaceImageInList(&wand->images,sketch_image);
10909  return(MagickTrue);
10910}
10911
10912/*
10913%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10914%                                                                             %
10915%                                                                             %
10916%                                                                             %
10917%   M a g i c k S m u s h I m a g e s                                         %
10918%                                                                             %
10919%                                                                             %
10920%                                                                             %
10921%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10922%
10923%  MagickSmushImages() takes all images from the current image pointer to the
10924%  end of the image list and smushs them to each other top-to-bottom if the
10925%  stack parameter is true, otherwise left-to-right.
10926%
10927%  The format of the MagickSmushImages method is:
10928%
10929%      MagickWand *MagickSmushImages(MagickWand *wand,
10930%        const MagickBooleanType stack,const ssize_t offset)
10931%
10932%  A description of each parameter follows:
10933%
10934%    o wand: the magick wand.
10935%
10936%    o stack: By default, images are stacked left-to-right. Set stack to
10937%      MagickTrue to stack them top-to-bottom.
10938%
10939%    o offset: minimum distance in pixels between images.
10940%
10941*/
10942WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10943  const MagickBooleanType stack,const ssize_t offset)
10944{
10945  Image
10946    *smush_image;
10947
10948  assert(wand != (MagickWand *) NULL);
10949  assert(wand->signature == WandSignature);
10950  if (IfMagickTrue(wand->debug))
10951    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10952  if (wand->images == (Image *) NULL)
10953    return((MagickWand *) NULL);
10954  smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10955  if (smush_image == (Image *) NULL)
10956    return((MagickWand *) NULL);
10957  return(CloneMagickWandFromImages(wand,smush_image));
10958}
10959
10960/*
10961%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10962%                                                                             %
10963%                                                                             %
10964%                                                                             %
10965%     M a g i c k S o l a r i z e I m a g e                                   %
10966%                                                                             %
10967%                                                                             %
10968%                                                                             %
10969%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10970%
10971%  MagickSolarizeImage() applies a special effect to the image, similar to the
10972%  effect achieved in a photo darkroom by selectively exposing areas of photo
10973%  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
10974%  measure of the extent of the solarization.
10975%
10976%  The format of the MagickSolarizeImage method is:
10977%
10978%      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10979%        const double threshold)
10980%
10981%  A description of each parameter follows:
10982%
10983%    o wand: the magick wand.
10984%
10985%    o threshold:  Define the extent of the solarization.
10986%
10987*/
10988WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10989  const double threshold)
10990{
10991  MagickBooleanType
10992    status;
10993
10994  assert(wand != (MagickWand *) NULL);
10995  assert(wand->signature == WandSignature);
10996  if (IfMagickTrue(wand->debug))
10997    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10998  if (wand->images == (Image *) NULL)
10999    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11000  status=SolarizeImage(wand->images,threshold,wand->exception);
11001  return(status);
11002}
11003
11004/*
11005%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11006%                                                                             %
11007%                                                                             %
11008%                                                                             %
11009%   M a g i c k S p a r s e C o l o r I m a g e                               %
11010%                                                                             %
11011%                                                                             %
11012%                                                                             %
11013%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11014%
11015%  MagickSparseColorImage(), given a set of coordinates, interpolates the
11016%  colors found at those coordinates, across the whole image, using various
11017%  methods.
11018%
11019%  The format of the MagickSparseColorImage method is:
11020%
11021%      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11022%        const SparseColorMethod method,const size_t number_arguments,
11023%        const double *arguments)
11024%
11025%  A description of each parameter follows:
11026%
11027%    o image: the image to be sparseed.
11028%
11029%    o method: the method of image sparseion.
11030%
11031%        ArcSparseColorion will always ignore source image offset, and always
11032%        'bestfit' the destination image with the top left corner offset
11033%        relative to the polar mapping center.
11034%
11035%        Bilinear has no simple inverse mapping so will not allow 'bestfit'
11036%        style of image sparseion.
11037%
11038%        Affine, Perspective, and Bilinear, will do least squares fitting of
11039%        the distrotion when more than the minimum number of control point
11040%        pairs are provided.
11041%
11042%        Perspective, and Bilinear, will fall back to a Affine sparseion when
11043%        less than 4 control point pairs are provided. While Affine sparseions
11044%        will let you use any number of control point pairs, that is Zero pairs
11045%        is a No-Op (viewport only) distrotion, one pair is a translation and
11046%        two pairs of control points will do a scale-rotate-translate, without
11047%        any shearing.
11048%
11049%    o number_arguments: the number of arguments given for this sparseion
11050%      method.
11051%
11052%    o arguments: the arguments for this sparseion method.
11053%
11054*/
11055WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11056  const SparseColorMethod method,const size_t number_arguments,
11057  const double *arguments)
11058{
11059  Image
11060    *sparse_image;
11061
11062  assert(wand != (MagickWand *) NULL);
11063  assert(wand->signature == WandSignature);
11064  if (IfMagickTrue(wand->debug))
11065    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11066  if (wand->images == (Image *) NULL)
11067    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11068  sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
11069    wand->exception);
11070  if (sparse_image == (Image *) NULL)
11071    return(MagickFalse);
11072  ReplaceImageInList(&wand->images,sparse_image);
11073  return(MagickTrue);
11074}
11075
11076/*
11077%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11078%                                                                             %
11079%                                                                             %
11080%                                                                             %
11081%   M a g i c k S p l i c e I m a g e                                         %
11082%                                                                             %
11083%                                                                             %
11084%                                                                             %
11085%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11086%
11087%  MagickSpliceImage() splices a solid color into the image.
11088%
11089%  The format of the MagickSpliceImage method is:
11090%
11091%      MagickBooleanType MagickSpliceImage(MagickWand *wand,
11092%        const size_t width,const size_t height,const ssize_t x,
11093%        const ssize_t y)
11094%
11095%  A description of each parameter follows:
11096%
11097%    o wand: the magick wand.
11098%
11099%    o width: the region width.
11100%
11101%    o height: the region height.
11102%
11103%    o x: the region x offset.
11104%
11105%    o y: the region y offset.
11106%
11107*/
11108WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
11109  const size_t width,const size_t height,const ssize_t x,
11110  const ssize_t y)
11111{
11112  Image
11113    *splice_image;
11114
11115  RectangleInfo
11116    splice;
11117
11118  assert(wand != (MagickWand *) NULL);
11119  assert(wand->signature == WandSignature);
11120  if (IfMagickTrue(wand->debug))
11121    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11122  if (wand->images == (Image *) NULL)
11123    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11124  splice.width=width;
11125  splice.height=height;
11126  splice.x=x;
11127  splice.y=y;
11128  splice_image=SpliceImage(wand->images,&splice,wand->exception);
11129  if (splice_image == (Image *) NULL)
11130    return(MagickFalse);
11131  ReplaceImageInList(&wand->images,splice_image);
11132  return(MagickTrue);
11133}
11134
11135/*
11136%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11137%                                                                             %
11138%                                                                             %
11139%                                                                             %
11140%   M a g i c k S p r e a d I m a g e                                         %
11141%                                                                             %
11142%                                                                             %
11143%                                                                             %
11144%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11145%
11146%  MagickSpreadImage() is a special effects method that randomly displaces each
11147%  pixel in a block defined by the radius parameter.
11148%
11149%  The format of the MagickSpreadImage method is:
11150%
11151%      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius,
11152%        const PixelInterpolateMethod method)
11153%
11154%  A description of each parameter follows:
11155%
11156%    o wand: the magick wand.
11157%
11158%    o radius:  Choose a random pixel in a neighborhood of this extent.
11159%
11160%    o method: the pixel interpolation method.
11161%
11162*/
11163WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11164  const double radius,const PixelInterpolateMethod method)
11165{
11166  Image
11167    *spread_image;
11168
11169  assert(wand != (MagickWand *) NULL);
11170  assert(wand->signature == WandSignature);
11171  if (IfMagickTrue(wand->debug))
11172    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11173  if (wand->images == (Image *) NULL)
11174    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11175  spread_image=SpreadImage(wand->images,radius,method,wand->exception);
11176  if (spread_image == (Image *) NULL)
11177    return(MagickFalse);
11178  ReplaceImageInList(&wand->images,spread_image);
11179  return(MagickTrue);
11180}
11181
11182/*
11183%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11184%                                                                             %
11185%                                                                             %
11186%                                                                             %
11187%   M a g i c k S t a t i s t i c I m a g e                                   %
11188%                                                                             %
11189%                                                                             %
11190%                                                                             %
11191%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11192%
11193%  MagickStatisticImage() replace each pixel with corresponding statistic from
11194%  the neighborhood of the specified width and height.
11195%
11196%  The format of the MagickStatisticImage method is:
11197%
11198%      MagickBooleanType MagickStatisticImage(MagickWand *wand,
11199%        const StatisticType type,const double width,const size_t height)
11200%
11201%  A description of each parameter follows:
11202%
11203%    o wand: the magick wand.
11204%
11205%    o type: the statistic type (e.g. median, mode, etc.).
11206%
11207%    o width: the width of the pixel neighborhood.
11208%
11209%    o height: the height of the pixel neighborhood.
11210%
11211*/
11212WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
11213  const StatisticType type,const size_t width,const size_t height)
11214{
11215  Image
11216    *statistic_image;
11217
11218  assert(wand != (MagickWand *) NULL);
11219  assert(wand->signature == WandSignature);
11220  if (IfMagickTrue(wand->debug))
11221    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11222  if (wand->images == (Image *) NULL)
11223    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11224  statistic_image=StatisticImage(wand->images,type,width,height,
11225    wand->exception);
11226  if (statistic_image == (Image *) NULL)
11227    return(MagickFalse);
11228  ReplaceImageInList(&wand->images,statistic_image);
11229  return(MagickTrue);
11230}
11231
11232/*
11233%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11234%                                                                             %
11235%                                                                             %
11236%                                                                             %
11237%   M a g i c k S t e g a n o I m a g e                                       %
11238%                                                                             %
11239%                                                                             %
11240%                                                                             %
11241%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11242%
11243%  MagickSteganoImage() hides a digital watermark within the image.
11244%  Recover the hidden watermark later to prove that the authenticity of
11245%  an image.  Offset defines the start position within the image to hide
11246%  the watermark.
11247%
11248%  The format of the MagickSteganoImage method is:
11249%
11250%      MagickWand *MagickSteganoImage(MagickWand *wand,
11251%        const MagickWand *watermark_wand,const ssize_t offset)
11252%
11253%  A description of each parameter follows:
11254%
11255%    o wand: the magick wand.
11256%
11257%    o watermark_wand: the watermark wand.
11258%
11259%    o offset: Start hiding at this offset into the image.
11260%
11261*/
11262WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
11263  const MagickWand *watermark_wand,const ssize_t offset)
11264{
11265  Image
11266    *stegano_image;
11267
11268  assert(wand != (MagickWand *) NULL);
11269  assert(wand->signature == WandSignature);
11270  if (IfMagickTrue(wand->debug))
11271    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11272  if ((wand->images == (Image *) NULL) ||
11273      (watermark_wand->images == (Image *) NULL))
11274    {
11275      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11276        "ContainsNoImages","`%s'",wand->name);
11277      return((MagickWand *) NULL);
11278    }
11279  wand->images->offset=offset;
11280  stegano_image=SteganoImage(wand->images,watermark_wand->images,
11281    wand->exception);
11282  if (stegano_image == (Image *) NULL)
11283    return((MagickWand *) NULL);
11284  return(CloneMagickWandFromImages(wand,stegano_image));
11285}
11286
11287/*
11288%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11289%                                                                             %
11290%                                                                             %
11291%                                                                             %
11292%   M a g i c k S t e r e o I m a g e                                         %
11293%                                                                             %
11294%                                                                             %
11295%                                                                             %
11296%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11297%
11298%  MagickStereoImage() composites two images and produces a single image that
11299%  is the composite of a left and right image of a stereo pair
11300%
11301%  The format of the MagickStereoImage method is:
11302%
11303%      MagickWand *MagickStereoImage(MagickWand *wand,
11304%        const MagickWand *offset_wand)
11305%
11306%  A description of each parameter follows:
11307%
11308%    o wand: the magick wand.
11309%
11310%    o offset_wand: Another image wand.
11311%
11312*/
11313WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11314  const MagickWand *offset_wand)
11315{
11316  Image
11317    *stereo_image;
11318
11319  assert(wand != (MagickWand *) NULL);
11320  assert(wand->signature == WandSignature);
11321  if (IfMagickTrue(wand->debug))
11322    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11323  if ((wand->images == (Image *) NULL) ||
11324      (offset_wand->images == (Image *) NULL))
11325    {
11326      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11327        "ContainsNoImages","`%s'",wand->name);
11328      return((MagickWand *) NULL);
11329    }
11330  stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11331  if (stereo_image == (Image *) NULL)
11332    return((MagickWand *) NULL);
11333  return(CloneMagickWandFromImages(wand,stereo_image));
11334}
11335
11336/*
11337%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11338%                                                                             %
11339%                                                                             %
11340%                                                                             %
11341%   M a g i c k S t r i p I m a g e                                           %
11342%                                                                             %
11343%                                                                             %
11344%                                                                             %
11345%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11346%
11347%  MagickStripImage() strips an image of all profiles and comments.
11348%
11349%  The format of the MagickStripImage method is:
11350%
11351%      MagickBooleanType MagickStripImage(MagickWand *wand)
11352%
11353%  A description of each parameter follows:
11354%
11355%    o wand: the magick wand.
11356%
11357*/
11358WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11359{
11360  assert(wand != (MagickWand *) NULL);
11361  assert(wand->signature == WandSignature);
11362  if (IfMagickTrue(wand->debug))
11363    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11364  if (wand->images == (Image *) NULL)
11365    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11366  return(StripImage(wand->images,wand->exception));
11367}
11368
11369/*
11370%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11371%                                                                             %
11372%                                                                             %
11373%                                                                             %
11374%   M a g i c k S w i r l I m a g e                                           %
11375%                                                                             %
11376%                                                                             %
11377%                                                                             %
11378%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11379%
11380%  MagickSwirlImage() swirls the pixels about the center of the image, where
11381%  degrees indicates the sweep of the arc through which each pixel is moved.
11382%  You get a more dramatic effect as the degrees move from 1 to 360.
11383%
11384%  The format of the MagickSwirlImage method is:
11385%
11386%      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11387%        const PixelInterpolateMethod method)
11388%
11389%  A description of each parameter follows:
11390%
11391%    o wand: the magick wand.
11392%
11393%    o degrees: Define the tightness of the swirling effect.
11394%
11395%    o method: the pixel interpolation method.
11396%
11397*/
11398WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11399  const double degrees,const PixelInterpolateMethod method)
11400{
11401  Image
11402    *swirl_image;
11403
11404  assert(wand != (MagickWand *) NULL);
11405  assert(wand->signature == WandSignature);
11406  if (IfMagickTrue(wand->debug))
11407    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11408  if (wand->images == (Image *) NULL)
11409    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11410  swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
11411  if (swirl_image == (Image *) NULL)
11412    return(MagickFalse);
11413  ReplaceImageInList(&wand->images,swirl_image);
11414  return(MagickTrue);
11415}
11416
11417/*
11418%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11419%                                                                             %
11420%                                                                             %
11421%                                                                             %
11422%   M a g i c k T e x t u r e I m a g e                                       %
11423%                                                                             %
11424%                                                                             %
11425%                                                                             %
11426%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11427%
11428%  MagickTextureImage() repeatedly tiles the texture image across and down the
11429%  image canvas.
11430%
11431%  The format of the MagickTextureImage method is:
11432%
11433%      MagickWand *MagickTextureImage(MagickWand *wand,
11434%        const MagickWand *texture_wand)
11435%
11436%  A description of each parameter follows:
11437%
11438%    o wand: the magick wand.
11439%
11440%    o texture_wand: the texture wand
11441%
11442*/
11443WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11444  const MagickWand *texture_wand)
11445{
11446  Image
11447    *texture_image;
11448
11449  MagickBooleanType
11450    status;
11451
11452  assert(wand != (MagickWand *) NULL);
11453  assert(wand->signature == WandSignature);
11454  if (IfMagickTrue(wand->debug))
11455    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11456  if ((wand->images == (Image *) NULL) ||
11457      (texture_wand->images == (Image *) NULL))
11458    {
11459      (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11460        "ContainsNoImages","`%s'",wand->name);
11461      return((MagickWand *) NULL);
11462    }
11463  texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11464  if (texture_image == (Image *) NULL)
11465    return((MagickWand *) NULL);
11466  status=TextureImage(texture_image,texture_wand->images,wand->exception);
11467  if (IfMagickFalse(status))
11468    {
11469      texture_image=DestroyImage(texture_image);
11470      return((MagickWand *) NULL);
11471    }
11472  return(CloneMagickWandFromImages(wand,texture_image));
11473}
11474
11475/*
11476%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11477%                                                                             %
11478%                                                                             %
11479%                                                                             %
11480%   M a g i c k T h r e s h o l d I m a g e                                   %
11481%                                                                             %
11482%                                                                             %
11483%                                                                             %
11484%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11485%
11486%  MagickThresholdImage() changes the value of individual pixels based on
11487%  the intensity of each pixel compared to threshold.  The result is a
11488%  high-contrast, two color image.
11489%
11490%  The format of the MagickThresholdImage method is:
11491%
11492%      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11493%        const double threshold)
11494%      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11495%        const ChannelType channel,const double threshold)
11496%
11497%  A description of each parameter follows:
11498%
11499%    o wand: the magick wand.
11500%
11501%    o channel: the image channel(s).
11502%
11503%    o threshold: Define the threshold value.
11504%
11505*/
11506WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11507  const double threshold)
11508{
11509  MagickBooleanType
11510    status;
11511
11512  status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11513  return(status);
11514}
11515
11516WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11517  const ChannelType channel,const double threshold)
11518{
11519  MagickBooleanType
11520    status;
11521
11522  assert(wand != (MagickWand *) NULL);
11523  assert(wand->signature == WandSignature);
11524  if (IfMagickTrue(wand->debug))
11525    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11526  if (wand->images == (Image *) NULL)
11527    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11528  status=BilevelImage(wand->images,threshold,wand->exception);
11529  return(status);
11530}
11531
11532/*
11533%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11534%                                                                             %
11535%                                                                             %
11536%                                                                             %
11537%   M a g i c k T h u m b n a i l I m a g e                                   %
11538%                                                                             %
11539%                                                                             %
11540%                                                                             %
11541%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11542%
11543%  MagickThumbnailImage()  changes the size of an image to the given dimensions
11544%  and removes any associated profiles.  The goal is to produce small low cost
11545%  thumbnail images suited for display on the Web.
11546%
11547%  The format of the MagickThumbnailImage method is:
11548%
11549%      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11550%        const size_t columns,const size_t rows)
11551%
11552%  A description of each parameter follows:
11553%
11554%    o wand: the magick wand.
11555%
11556%    o columns: the number of columns in the scaled image.
11557%
11558%    o rows: the number of rows in the scaled image.
11559%
11560*/
11561WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11562  const size_t columns,const size_t rows)
11563{
11564  Image
11565    *thumbnail_image;
11566
11567  assert(wand != (MagickWand *) NULL);
11568  assert(wand->signature == WandSignature);
11569  if (IfMagickTrue(wand->debug))
11570    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11571  if (wand->images == (Image *) NULL)
11572    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11573  thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11574  if (thumbnail_image == (Image *) NULL)
11575    return(MagickFalse);
11576  ReplaceImageInList(&wand->images,thumbnail_image);
11577  return(MagickTrue);
11578}
11579
11580/*
11581%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11582%                                                                             %
11583%                                                                             %
11584%                                                                             %
11585%   M a g i c k T i n t I m a g e                                             %
11586%                                                                             %
11587%                                                                             %
11588%                                                                             %
11589%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11590%
11591%  MagickTintImage() applies a color vector to each pixel in the image.  The
11592%  length of the vector is 0 for black and white and at its maximum for the
11593%  midtones.  The vector weighting function is
11594%  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11595%
11596%  The format of the MagickTintImage method is:
11597%
11598%      MagickBooleanType MagickTintImage(MagickWand *wand,
11599%        const PixelWand *tint,const PixelWand *blend)
11600%
11601%  A description of each parameter follows:
11602%
11603%    o wand: the magick wand.
11604%
11605%    o tint: the tint pixel wand.
11606%
11607%    o alpha: the alpha pixel wand.
11608%
11609*/
11610WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11611  const PixelWand *tint,const PixelWand *blend)
11612{
11613  char
11614    percent_blend[MagickPathExtent];
11615
11616  Image
11617    *tint_image;
11618
11619  PixelInfo
11620    target;
11621
11622  assert(wand != (MagickWand *) NULL);
11623  assert(wand->signature == WandSignature);
11624  if (IfMagickTrue(wand->debug))
11625    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11626  if (wand->images == (Image *) NULL)
11627    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11628  if (wand->images->colorspace != CMYKColorspace)
11629    (void) FormatLocaleString(percent_blend,MagickPathExtent,
11630      "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11631      PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11632      PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11633      PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11634      PixelGetAlphaQuantum(blend)));
11635  else
11636    (void) FormatLocaleString(percent_blend,MagickPathExtent,
11637      "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
11638      PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11639      PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11640      PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11641      PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11642      PixelGetAlphaQuantum(blend)));
11643  target=PixelGetPixel(tint);
11644  tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
11645  if (tint_image == (Image *) NULL)
11646    return(MagickFalse);
11647  ReplaceImageInList(&wand->images,tint_image);
11648  return(MagickTrue);
11649}
11650
11651/*
11652%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11653%                                                                             %
11654%                                                                             %
11655%                                                                             %
11656%   M a g i c k T r a n s f o r m I m a g e                                   %
11657%                                                                             %
11658%                                                                             %
11659%                                                                             %
11660%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11661%
11662%  MagickTransformImage() is a convenience method that behaves like
11663%  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11664%  information as a region geometry specification.  If the operation fails,
11665%  a NULL image handle is returned.
11666%
11667%  The format of the MagickTransformImage method is:
11668%
11669%      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11670%        const char *geometry)
11671%
11672%  A description of each parameter follows:
11673%
11674%    o wand: the magick wand.
11675%
11676%    o crop: A crop geometry string.  This geometry defines a subregion of the
11677%      image to crop.
11678%
11679%    o geometry: An image geometry string.  This geometry defines the final
11680%      size of the image.
11681%
11682*/
11683WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11684  const char *crop,const char *geometry)
11685{
11686  Image
11687    *transform_image;
11688
11689  MagickBooleanType
11690    status;
11691
11692  assert(wand != (MagickWand *) NULL);
11693  assert(wand->signature == WandSignature);
11694  if (IfMagickTrue(wand->debug))
11695    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11696  if (wand->images == (Image *) NULL)
11697    return((MagickWand *) NULL);
11698  transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11699  if (transform_image == (Image *) NULL)
11700    return((MagickWand *) NULL);
11701  status=TransformImage(&transform_image,crop,geometry,wand->exception);
11702  if (IfMagickFalse(status))
11703    {
11704      transform_image=DestroyImage(transform_image);
11705      return((MagickWand *) NULL);
11706    }
11707  return(CloneMagickWandFromImages(wand,transform_image));
11708}
11709
11710/*
11711%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11712%                                                                             %
11713%                                                                             %
11714%                                                                             %
11715%   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               %
11716%                                                                             %
11717%                                                                             %
11718%                                                                             %
11719%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11720%
11721%  MagickTransformImageColorspace() transform the image colorspace, setting
11722%  the images colorspace while transforming the images data to that
11723%  colorspace.
11724%
11725%  The format of the MagickTransformImageColorspace method is:
11726%
11727%      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11728%        const ColorspaceType colorspace)
11729%
11730%  A description of each parameter follows:
11731%
11732%    o wand: the magick wand.
11733%
11734%    o colorspace: the image colorspace:   UndefinedColorspace,
11735%      sRGBColorspace, RGBColorspace, GRAYColorspace,
11736%      OHTAColorspace, XYZColorspace, YCbCrColorspace,
11737%      YCCColorspace, YIQColorspace, YPbPrColorspace,
11738%      YPbPrColorspace, YUVColorspace, CMYKColorspace,
11739%      HSLColorspace, HWBColorspace.
11740%
11741*/
11742WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11743  const ColorspaceType colorspace)
11744{
11745  assert(wand != (MagickWand *) NULL);
11746  assert(wand->signature == WandSignature);
11747  if (IfMagickTrue(wand->debug))
11748    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11749  if (wand->images == (Image *) NULL)
11750    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11751  return(TransformImageColorspace(wand->images,colorspace,wand->exception));
11752}
11753
11754/*
11755%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11756%                                                                             %
11757%                                                                             %
11758%                                                                             %
11759%   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                     %
11760%                                                                             %
11761%                                                                             %
11762%                                                                             %
11763%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11764%
11765%  MagickTransparentPaintImage() changes any pixel that matches color with the
11766%  color defined by fill.
11767%
11768%  The format of the MagickTransparentPaintImage method is:
11769%
11770%      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11771%        const PixelWand *target,const double alpha,const double fuzz,
11772%        const MagickBooleanType invert)
11773%
11774%  A description of each parameter follows:
11775%
11776%    o wand: the magick wand.
11777%
11778%    o target: Change this target color to specified alpha value within
11779%      the image.
11780%
11781%    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11782%      transparent.
11783%
11784%    o fuzz: By default target must match a particular pixel color
11785%      exactly.  However, in many cases two colors may differ by a small amount.
11786%      The fuzz member of image defines how much tolerance is acceptable to
11787%      consider two colors as the same.  For example, set fuzz to 10 and the
11788%      color red at intensities of 100 and 102 respectively are now interpreted
11789%      as the same color for the purposes of the floodfill.
11790%
11791%    o invert: paint any pixel that does not match the target color.
11792%
11793*/
11794WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11795  const PixelWand *target,const double alpha,const double fuzz,
11796  const MagickBooleanType invert)
11797{
11798  MagickBooleanType
11799    status;
11800
11801  PixelInfo
11802    target_pixel;
11803
11804  assert(wand != (MagickWand *) NULL);
11805  assert(wand->signature == WandSignature);
11806  if (IfMagickTrue(wand->debug))
11807    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11808  if (wand->images == (Image *) NULL)
11809    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11810  PixelGetMagickColor(target,&target_pixel);
11811  wand->images->fuzz=fuzz;
11812  status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11813    QuantumRange*alpha),invert,wand->exception);
11814  return(status);
11815}
11816
11817/*
11818%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11819%                                                                             %
11820%                                                                             %
11821%                                                                             %
11822%   M a g i c k T r a n s p o s e I m a g e                                   %
11823%                                                                             %
11824%                                                                             %
11825%                                                                             %
11826%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11827%
11828%  MagickTransposeImage() creates a vertical mirror image by reflecting the
11829%  pixels around the central x-axis while rotating them 90-degrees.
11830%
11831%  The format of the MagickTransposeImage method is:
11832%
11833%      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11834%
11835%  A description of each parameter follows:
11836%
11837%    o wand: the magick wand.
11838%
11839*/
11840WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11841{
11842  Image
11843    *transpose_image;
11844
11845  assert(wand != (MagickWand *) NULL);
11846  assert(wand->signature == WandSignature);
11847  if (IfMagickTrue(wand->debug))
11848    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11849  if (wand->images == (Image *) NULL)
11850    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11851  transpose_image=TransposeImage(wand->images,wand->exception);
11852  if (transpose_image == (Image *) NULL)
11853    return(MagickFalse);
11854  ReplaceImageInList(&wand->images,transpose_image);
11855  return(MagickTrue);
11856}
11857
11858/*
11859%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11860%                                                                             %
11861%                                                                             %
11862%                                                                             %
11863%   M a g i c k T r a n s v e r s e I m a g e                                 %
11864%                                                                             %
11865%                                                                             %
11866%                                                                             %
11867%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11868%
11869%  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11870%  pixels around the central y-axis while rotating them 270-degrees.
11871%
11872%  The format of the MagickTransverseImage method is:
11873%
11874%      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11875%
11876%  A description of each parameter follows:
11877%
11878%    o wand: the magick wand.
11879%
11880*/
11881WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11882{
11883  Image
11884    *transverse_image;
11885
11886  assert(wand != (MagickWand *) NULL);
11887  assert(wand->signature == WandSignature);
11888  if (IfMagickTrue(wand->debug))
11889    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11890  if (wand->images == (Image *) NULL)
11891    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11892  transverse_image=TransverseImage(wand->images,wand->exception);
11893  if (transverse_image == (Image *) NULL)
11894    return(MagickFalse);
11895  ReplaceImageInList(&wand->images,transverse_image);
11896  return(MagickTrue);
11897}
11898
11899/*
11900%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11901%                                                                             %
11902%                                                                             %
11903%                                                                             %
11904%   M a g i c k T r i m I m a g e                                             %
11905%                                                                             %
11906%                                                                             %
11907%                                                                             %
11908%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11909%
11910%  MagickTrimImage() remove edges that are the background color from the image.
11911%
11912%  The format of the MagickTrimImage method is:
11913%
11914%      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11915%
11916%  A description of each parameter follows:
11917%
11918%    o wand: the magick wand.
11919%
11920%    o fuzz: By default target must match a particular pixel color
11921%      exactly.  However, in many cases two colors may differ by a small amount.
11922%      The fuzz member of image defines how much tolerance is acceptable to
11923%      consider two colors as the same.  For example, set fuzz to 10 and the
11924%      color red at intensities of 100 and 102 respectively are now interpreted
11925%      as the same color for the purposes of the floodfill.
11926%
11927*/
11928WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11929{
11930  Image
11931    *trim_image;
11932
11933  assert(wand != (MagickWand *) NULL);
11934  assert(wand->signature == WandSignature);
11935  if (IfMagickTrue(wand->debug))
11936    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11937  if (wand->images == (Image *) NULL)
11938    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11939  wand->images->fuzz=fuzz;
11940  trim_image=TrimImage(wand->images,wand->exception);
11941  if (trim_image == (Image *) NULL)
11942    return(MagickFalse);
11943  ReplaceImageInList(&wand->images,trim_image);
11944  return(MagickTrue);
11945}
11946
11947/*
11948%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11949%                                                                             %
11950%                                                                             %
11951%                                                                             %
11952%   M a g i c k U n i q u e I m a g e C o l o r s                             %
11953%                                                                             %
11954%                                                                             %
11955%                                                                             %
11956%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11957%
11958%  MagickUniqueImageColors() discards all but one of any pixel color.
11959%
11960%  The format of the MagickUniqueImageColors method is:
11961%
11962%      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11963%
11964%  A description of each parameter follows:
11965%
11966%    o wand: the magick wand.
11967%
11968*/
11969WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11970{
11971  Image
11972    *unique_image;
11973
11974  assert(wand != (MagickWand *) NULL);
11975  assert(wand->signature == WandSignature);
11976  if (IfMagickTrue(wand->debug))
11977    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11978  if (wand->images == (Image *) NULL)
11979    ThrowWandException(WandError,"ContainsNoImages",wand->name);
11980  unique_image=UniqueImageColors(wand->images,wand->exception);
11981  if (unique_image == (Image *) NULL)
11982    return(MagickFalse);
11983  ReplaceImageInList(&wand->images,unique_image);
11984  return(MagickTrue);
11985}
11986
11987/*
11988%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11989%                                                                             %
11990%                                                                             %
11991%                                                                             %
11992%   M a g i c k U n s h a r p M a s k I m a g e                               %
11993%                                                                             %
11994%                                                                             %
11995%                                                                             %
11996%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11997%
11998%  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
11999%  Gaussian operator of the given radius and standard deviation (sigma).
12000%  For reasonable results, radius should be larger than sigma.  Use a radius
12001%  of 0 and UnsharpMaskImage() selects a suitable radius for you.
12002%
12003%  The format of the MagickUnsharpMaskImage method is:
12004%
12005%      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12006%        const double radius,const double sigma,const double gain,
12007%        const double threshold)
12008%
12009%  A description of each parameter follows:
12010%
12011%    o wand: the magick wand.
12012%
12013%    o radius: the radius of the Gaussian, in pixels, not counting the center
12014%      pixel.
12015%
12016%    o sigma: the standard deviation of the Gaussian, in pixels.
12017%
12018%    o gain: the percentage of the difference between the original and the
12019%      blur image that is added back into the original.
12020%
12021%    o threshold: the threshold in pixels needed to apply the diffence gain.
12022%
12023*/
12024WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12025  const double radius,const double sigma,const double gain,
12026  const double threshold)
12027{
12028  Image
12029    *unsharp_image;
12030
12031  assert(wand != (MagickWand *) NULL);
12032  assert(wand->signature == WandSignature);
12033  if (IfMagickTrue(wand->debug))
12034    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12035  if (wand->images == (Image *) NULL)
12036    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12037  unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,gain,threshold,
12038    wand->exception);
12039  if (unsharp_image == (Image *) NULL)
12040    return(MagickFalse);
12041  ReplaceImageInList(&wand->images,unsharp_image);
12042  return(MagickTrue);
12043}
12044
12045/*
12046%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12047%                                                                             %
12048%                                                                             %
12049%                                                                             %
12050%   M a g i c k V i g n e t t e I m a g e                                     %
12051%                                                                             %
12052%                                                                             %
12053%                                                                             %
12054%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12055%
12056%  MagickVignetteImage() softens the edges of the image in vignette style.
12057%
12058%  The format of the MagickVignetteImage method is:
12059%
12060%      MagickBooleanType MagickVignetteImage(MagickWand *wand,
12061%        const double radius,const double sigma,const ssize_t x,
12062%        const ssize_t y)
12063%
12064%  A description of each parameter follows:
12065%
12066%    o wand: the magick wand.
12067%
12068%    o radius: the radius.
12069%
12070%    o sigma: the sigma.
12071%
12072%    o x, y:  Define the x and y ellipse offset.
12073%
12074*/
12075WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
12076  const double radius,const double sigma,const ssize_t x,const ssize_t y)
12077{
12078  Image
12079    *vignette_image;
12080
12081  assert(wand != (MagickWand *) NULL);
12082  assert(wand->signature == WandSignature);
12083  if (IfMagickTrue(wand->debug))
12084    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12085  if (wand->images == (Image *) NULL)
12086    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12087  vignette_image=VignetteImage(wand->images,radius,sigma,x,y,wand->exception);
12088  if (vignette_image == (Image *) NULL)
12089    return(MagickFalse);
12090  ReplaceImageInList(&wand->images,vignette_image);
12091  return(MagickTrue);
12092}
12093
12094/*
12095%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12096%                                                                             %
12097%                                                                             %
12098%                                                                             %
12099%   M a g i c k W a v e I m a g e                                             %
12100%                                                                             %
12101%                                                                             %
12102%                                                                             %
12103%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12104%
12105%  MagickWaveImage()  creates a "ripple" effect in the image by shifting
12106%  the pixels vertically along a sine wave whose amplitude and wavelength
12107%  is specified by the given parameters.
12108%
12109%  The format of the MagickWaveImage method is:
12110%
12111%      MagickBooleanType MagickWaveImage(MagickWand *wand,
12112%        const double amplitude,const double wave_length,
12113%        const PixelInterpolateMethod method)
12114%
12115%  A description of each parameter follows:
12116%
12117%    o wand: the magick wand.
12118%
12119%    o amplitude, wave_length:  Define the amplitude and wave length of the
12120%      sine wave.
12121%
12122%    o method: the pixel interpolation method.
12123%
12124*/
12125WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12126  const double amplitude,const double wave_length,
12127  const PixelInterpolateMethod method)
12128{
12129  Image
12130    *wave_image;
12131
12132  assert(wand != (MagickWand *) NULL);
12133  assert(wand->signature == WandSignature);
12134  if (IfMagickTrue(wand->debug))
12135    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12136  if (wand->images == (Image *) NULL)
12137    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12138  wave_image=WaveImage(wand->images,amplitude,wave_length,method,
12139    wand->exception);
12140  if (wave_image == (Image *) NULL)
12141    return(MagickFalse);
12142  ReplaceImageInList(&wand->images,wave_image);
12143  return(MagickTrue);
12144}
12145
12146/*
12147%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12148%                                                                             %
12149%                                                                             %
12150%                                                                             %
12151%   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                         %
12152%                                                                             %
12153%                                                                             %
12154%                                                                             %
12155%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12156%
12157%  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
12158%  above the threshold into white while leaving all pixels below the threshold
12159%  unchanged.
12160%
12161%  The format of the MagickWhiteThresholdImage method is:
12162%
12163%      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12164%        const PixelWand *threshold)
12165%
12166%  A description of each parameter follows:
12167%
12168%    o wand: the magick wand.
12169%
12170%    o threshold: the pixel wand.
12171%
12172*/
12173WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12174  const PixelWand *threshold)
12175{
12176  char
12177    thresholds[MagickPathExtent];
12178
12179  assert(wand != (MagickWand *) NULL);
12180  assert(wand->signature == WandSignature);
12181  if (IfMagickTrue(wand->debug))
12182    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12183  if (wand->images == (Image *) NULL)
12184    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12185  (void) FormatLocaleString(thresholds,MagickPathExtent,
12186    QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12187    PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12188    PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
12189  return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
12190}
12191
12192/*
12193%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12194%                                                                             %
12195%                                                                             %
12196%                                                                             %
12197%   M a g i c k W r i t e I m a g e                                           %
12198%                                                                             %
12199%                                                                             %
12200%                                                                             %
12201%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12202%
12203%  MagickWriteImage() writes an image to the specified filename.  If the
12204%  filename parameter is NULL, the image is written to the filename set
12205%  by MagickReadImage() or MagickSetImageFilename().
12206%
12207%  The format of the MagickWriteImage method is:
12208%
12209%      MagickBooleanType MagickWriteImage(MagickWand *wand,
12210%        const char *filename)
12211%
12212%  A description of each parameter follows:
12213%
12214%    o wand: the magick wand.
12215%
12216%    o filename: the image filename.
12217%
12218%
12219*/
12220WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12221  const char *filename)
12222{
12223  Image
12224    *image;
12225
12226  ImageInfo
12227    *write_info;
12228
12229  MagickBooleanType
12230    status;
12231
12232  assert(wand != (MagickWand *) NULL);
12233  assert(wand->signature == WandSignature);
12234  if (IfMagickTrue(wand->debug))
12235    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12236  if (wand->images == (Image *) NULL)
12237    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12238  if (filename != (const char *) NULL)
12239    (void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
12240  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12241  if (image == (Image *) NULL)
12242    return(MagickFalse);
12243  write_info=CloneImageInfo(wand->image_info);
12244  write_info->adjoin=MagickTrue;
12245  status=WriteImage(write_info,image,wand->exception);
12246  image=DestroyImage(image);
12247  write_info=DestroyImageInfo(write_info);
12248  return(status);
12249}
12250
12251/*
12252%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12253%                                                                             %
12254%                                                                             %
12255%                                                                             %
12256%   M a g i c k W r i t e I m a g e F i l e                                   %
12257%                                                                             %
12258%                                                                             %
12259%                                                                             %
12260%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12261%
12262%  MagickWriteImageFile() writes an image to an open file descriptor.
12263%
12264%  The format of the MagickWriteImageFile method is:
12265%
12266%      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12267%
12268%  A description of each parameter follows:
12269%
12270%    o wand: the magick wand.
12271%
12272%    o file: the file descriptor.
12273%
12274*/
12275WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12276{
12277  Image
12278    *image;
12279
12280  ImageInfo
12281    *write_info;
12282
12283  MagickBooleanType
12284    status;
12285
12286  assert(wand != (MagickWand *) NULL);
12287  assert(wand->signature == WandSignature);
12288  assert(file != (FILE *) NULL);
12289  if (IfMagickTrue(wand->debug))
12290    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12291  if (wand->images == (Image *) NULL)
12292    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12293  image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12294  if (image == (Image *) NULL)
12295    return(MagickFalse);
12296  write_info=CloneImageInfo(wand->image_info);
12297  SetImageInfoFile(write_info,file);
12298  write_info->adjoin=MagickTrue;
12299  status=WriteImage(write_info,image,wand->exception);
12300  write_info=DestroyImageInfo(write_info);
12301  image=DestroyImage(image);
12302  return(status);
12303}
12304
12305/*
12306%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12307%                                                                             %
12308%                                                                             %
12309%                                                                             %
12310%   M a g i c k W r i t e I m a g e s                                         %
12311%                                                                             %
12312%                                                                             %
12313%                                                                             %
12314%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12315%
12316%  MagickWriteImages() writes an image or image sequence.
12317%
12318%  The format of the MagickWriteImages method is:
12319%
12320%      MagickBooleanType MagickWriteImages(MagickWand *wand,
12321%        const char *filename,const MagickBooleanType adjoin)
12322%
12323%  A description of each parameter follows:
12324%
12325%    o wand: the magick wand.
12326%
12327%    o filename: the image filename.
12328%
12329%    o adjoin: join images into a single multi-image file.
12330%
12331*/
12332WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12333  const char *filename,const MagickBooleanType adjoin)
12334{
12335  ImageInfo
12336    *write_info;
12337
12338  MagickBooleanType
12339    status;
12340
12341  assert(wand != (MagickWand *) NULL);
12342  assert(wand->signature == WandSignature);
12343  if (IfMagickTrue(wand->debug))
12344    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12345  if (wand->images == (Image *) NULL)
12346    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12347  write_info=CloneImageInfo(wand->image_info);
12348  write_info->adjoin=adjoin;
12349  status=WriteImages(write_info,wand->images,filename,wand->exception);
12350  write_info=DestroyImageInfo(write_info);
12351  return(status);
12352}
12353
12354/*
12355%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12356%                                                                             %
12357%                                                                             %
12358%                                                                             %
12359%   M a g i c k W r i t e I m a g e s F i l e                                 %
12360%                                                                             %
12361%                                                                             %
12362%                                                                             %
12363%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12364%
12365%  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12366%
12367%  The format of the MagickWriteImagesFile method is:
12368%
12369%      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12370%
12371%  A description of each parameter follows:
12372%
12373%    o wand: the magick wand.
12374%
12375%    o file: the file descriptor.
12376%
12377*/
12378WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12379{
12380  ImageInfo
12381    *write_info;
12382
12383  MagickBooleanType
12384    status;
12385
12386  assert(wand != (MagickWand *) NULL);
12387  assert(wand->signature == WandSignature);
12388  if (IfMagickTrue(wand->debug))
12389    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12390  if (wand->images == (Image *) NULL)
12391    ThrowWandException(WandError,"ContainsNoImages",wand->name);
12392  write_info=CloneImageInfo(wand->image_info);
12393  SetImageInfoFile(write_info,file);
12394  write_info->adjoin=MagickTrue;
12395  status=WriteImages(write_info,wand->images,(const char *) NULL,
12396    wand->exception);
12397  write_info=DestroyImageInfo(write_info);
12398  return(status);
12399}
12400