]> granicus.if.org Git - imagemagick/blob - MagickWand/magick-image.c
(no commit message)
[imagemagick] / MagickWand / magick-image.c
1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %                                                                             %
4 %                                                                             %
5 %                                                                             %
6 %                 M   M   AAA    GGGG  IIIII   CCCC  K   K                    %
7 %                 MM MM  A   A  G        I    C      K  K                     %
8 %                 M M M  AAAAA  G GGG    I    C      KKK                      %
9 %                 M   M  A   A  G   G    I    C      K  K                     %
10 %                 M   M  A   A   GGGG  IIIII   CCCC  K   K                    %
11 %                                                                             %
12 %                     IIIII  M   M   AAA    GGGG  EEEEE                       %
13 %                       I    MM MM  A   A  G      E                           %
14 %                       I    M M M  AAAAA  G  GG  EEE                         %
15 %                       I    M   M  A   A  G   G  E                           %
16 %                     IIIII  M   M  A   A   GGGG  EEEEE                       %
17 %                                                                             %
18 %                                                                             %
19 %                          MagickWand Image Methods                           %
20 %                                                                             %
21 %                               Software Design                               %
22 %                                 John Cristy                                 %
23 %                                 August 2003                                 %
24 %                                                                             %
25 %                                                                             %
26 %  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
27 %  dedicated to making software imaging solutions freely available.           %
28 %                                                                             %
29 %  You may not use this file except in compliance with the License.  You may  %
30 %  obtain a copy of the License at                                            %
31 %                                                                             %
32 %    http://www.imagemagick.org/script/license.php                            %
33 %                                                                             %
34 %  Unless required by applicable law or agreed to in writing, software        %
35 %  distributed under the License is distributed on an "AS IS" BASIS,          %
36 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
37 %  See the License for the specific language governing permissions and        %
38 %  limitations under the License.                                             %
39 %                                                                             %
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 %
42 %
43 %
44 */
45 \f
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 \f
55 /*
56   Define declarations.
57 */
58 #define ThrowWandException(severity,tag,context) \
59 { \
60   (void) ThrowMagickException(wand->exception,GetMagickModule(),severity, \
61     tag,"`%s'",context); \
62   return(MagickFalse); \
63 }
64 #define MagickWandId  "MagickWand"
65 \f
66 /*
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68 %                                                                             %
69 %                                                                             %
70 %                                                                             %
71 +   C l o n e M a g i c k W a n d F r o m I m a g e s                         %
72 %                                                                             %
73 %                                                                             %
74 %                                                                             %
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76 %
77 %  CloneMagickWandFromImages() clones the magick wand and inserts a new image
78 %  list.
79 %
80 %  The format of the CloneMagickWandFromImages method is:
81 %
82 %      MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
83 %        Image *images)
84 %
85 %  A description of each parameter follows:
86 %
87 %    o wand: the magick wand.
88 %
89 %    o images: replace the image list with these image(s).
90 %
91 */
92 static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
93   Image *images)
94 {
95   MagickWand
96     *clone_wand;
97
98   assert(wand != (MagickWand *) NULL);
99   assert(wand->signature == WandSignature);
100   if (wand->debug != MagickFalse)
101     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
102   clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
103   if (clone_wand == (MagickWand *) NULL)
104     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
105       images->filename);
106   (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
107   clone_wand->id=AcquireWandId();
108   (void) FormatLocaleString(clone_wand->name,MaxTextExtent,"%s-%.20g",
109     MagickWandId,(double) clone_wand->id);
110   clone_wand->exception=AcquireExceptionInfo();
111   InheritException(clone_wand->exception,wand->exception);
112   clone_wand->image_info=CloneImageInfo(wand->image_info);
113   clone_wand->quantize_info=CloneQuantizeInfo(wand->quantize_info);
114   clone_wand->images=images;
115   clone_wand->debug=IsEventLogging();
116   if (clone_wand->debug != MagickFalse)
117     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
118   clone_wand->signature=WandSignature;
119   return(clone_wand);
120 }
121 \f
122 /*
123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
124 %                                                                             %
125 %                                                                             %
126 %                                                                             %
127 %   G e t I m a g e F r o m M a g i c k W a n d                               %
128 %                                                                             %
129 %                                                                             %
130 %                                                                             %
131 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
132 %
133 %  GetImageFromMagickWand() returns the current image from the magick wand.
134 %
135 %  The format of the GetImageFromMagickWand method is:
136 %
137 %      Image *GetImageFromMagickWand(const MagickWand *wand)
138 %
139 %  A description of each parameter follows:
140 %
141 %    o wand: the magick wand.
142 %
143 */
144 WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
145 {
146   assert(wand != (MagickWand *) NULL);
147   assert(wand->signature == WandSignature);
148   if (wand->debug != MagickFalse)
149     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
150   if (wand->images == (Image *) NULL)
151     {
152       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
153         "ContainsNoImages","`%s'",wand->name);
154       return((Image *) NULL);
155     }
156   return(wand->images);
157 }
158 \f
159 /*
160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
161 %                                                                             %
162 %                                                                             %
163 %                                                                             %
164 %   M a g i c k A d a p t i v e S h a r p e n I m a g e                       %
165 %                                                                             %
166 %                                                                             %
167 %                                                                             %
168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
169 %
170 %  MagickAdaptiveBlurImage() adaptively blurs the image by blurring
171 %  less intensely near image edges and more intensely far from edges. We
172 %  blur the image with a Gaussian operator of the given radius and standard
173 %  deviation (sigma).  For reasonable results, radius should be larger than
174 %  sigma.  Use a radius of 0 and MagickAdaptiveBlurImage() selects a
175 %  suitable radius for you.
176 %
177 %  The format of the MagickAdaptiveBlurImage method is:
178 %
179 %      MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
180 %        const double radius,const double sigma,const double bias)
181 %
182 %  A description of each parameter follows:
183 %
184 %    o wand: the magick wand.
185 %
186 %    o radius: the radius of the Gaussian, in pixels, not counting the center
187 %      pixel.
188 %
189 %    o sigma: the standard deviation of the Gaussian, in pixels.
190 %
191 %    o bias: the bias.
192 %
193 */
194 WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
195   const double radius,const double sigma,const double bias)
196 {
197   Image
198     *sharp_image;
199
200   assert(wand != (MagickWand *) NULL);
201   assert(wand->signature == WandSignature);
202   if (wand->debug != MagickFalse)
203     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
204   if (wand->images == (Image *) NULL)
205     ThrowWandException(WandError,"ContainsNoImages",wand->name);
206   sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,bias,wand->exception);
207   if (sharp_image == (Image *) NULL)
208     return(MagickFalse);
209   ReplaceImageInList(&wand->images,sharp_image);
210   return(MagickTrue);
211 }
212 \f
213 /*
214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
215 %                                                                             %
216 %                                                                             %
217 %                                                                             %
218 %   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                         %
219 %                                                                             %
220 %                                                                             %
221 %                                                                             %
222 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
223 %
224 %  MagickAdaptiveResizeImage() adaptively resize image with data dependent
225 %  triangulation.
226 %
227 %      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
228 %        const size_t columns,const size_t rows,
229 %        const PixelInterpolateMethod method)
230 %
231 %  A description of each parameter follows:
232 %
233 %    o wand: the magick wand.
234 %
235 %    o columns: the number of columns in the scaled image.
236 %
237 %    o rows: the number of rows in the scaled image.
238 %
239 %    o interpolate: the pixel interpolation method.
240 %
241 */
242 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
243   const size_t columns,const size_t rows,const PixelInterpolateMethod method)
244 {
245   Image
246     *resize_image;
247
248   assert(wand != (MagickWand *) NULL);
249   assert(wand->signature == WandSignature);
250   if (wand->debug != MagickFalse)
251     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
252   if (wand->images == (Image *) NULL)
253     ThrowWandException(WandError,"ContainsNoImages",wand->name);
254   resize_image=AdaptiveResizeImage(wand->images,columns,rows,method,
255     wand->exception);
256   if (resize_image == (Image *) NULL)
257     return(MagickFalse);
258   ReplaceImageInList(&wand->images,resize_image);
259   return(MagickTrue);
260 }
261 \f
262 /*
263 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
264 %                                                                             %
265 %                                                                             %
266 %                                                                             %
267 %   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                       %
268 %                                                                             %
269 %                                                                             %
270 %                                                                             %
271 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
272 %
273 %  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
274 %  more intensely near image edges and less intensely far from edges. We
275 %  sharpen the image with a Gaussian operator of the given radius and standard
276 %  deviation (sigma).  For reasonable results, radius should be larger than
277 %  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
278 %  suitable radius for you.
279 %
280 %  The format of the MagickAdaptiveSharpenImage method is:
281 %
282 %      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
283 %        const double radius,const double sigma,const double bias)
284 %
285 %  A description of each parameter follows:
286 %
287 %    o wand: the magick wand.
288 %
289 %    o radius: the radius of the Gaussian, in pixels, not counting the center
290 %      pixel.
291 %
292 %    o sigma: the standard deviation of the Gaussian, in pixels.
293 %
294 %    o bias: the bias.
295 %
296 */
297 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
298   const double radius,const double sigma,const double bias)
299 {
300   Image
301     *sharp_image;
302
303   assert(wand != (MagickWand *) NULL);
304   assert(wand->signature == WandSignature);
305   if (wand->debug != MagickFalse)
306     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
307   if (wand->images == (Image *) NULL)
308     ThrowWandException(WandError,"ContainsNoImages",wand->name);
309   sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,bias,
310     wand->exception);
311   if (sharp_image == (Image *) NULL)
312     return(MagickFalse);
313   ReplaceImageInList(&wand->images,sharp_image);
314   return(MagickTrue);
315 }
316 \f
317 /*
318 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
319 %                                                                             %
320 %                                                                             %
321 %                                                                             %
322 %   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                   %
323 %                                                                             %
324 %                                                                             %
325 %                                                                             %
326 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
327 %
328 %  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
329 %  based on the range of intensity values in its local neighborhood.  This
330 %  allows for thresholding of an image whose global intensity histogram
331 %  doesn't contain distinctive peaks.
332 %
333 %  The format of the AdaptiveThresholdImage method is:
334 %
335 %      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
336 %        const size_t width,const size_t height,const double bias)
337 %
338 %  A description of each parameter follows:
339 %
340 %    o wand: the magick wand.
341 %
342 %    o width: the width of the local neighborhood.
343 %
344 %    o height: the height of the local neighborhood.
345 %
346 %    o offset: the mean bias.
347 %
348 */
349 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
350   const size_t width,const size_t height,const double bias)
351 {
352   Image
353     *threshold_image;
354
355   assert(wand != (MagickWand *) NULL);
356   assert(wand->signature == WandSignature);
357   if (wand->debug != MagickFalse)
358     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
359   if (wand->images == (Image *) NULL)
360     ThrowWandException(WandError,"ContainsNoImages",wand->name);
361   threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
362     wand->exception);
363   if (threshold_image == (Image *) NULL)
364     return(MagickFalse);
365   ReplaceImageInList(&wand->images,threshold_image);
366   return(MagickTrue);
367 }
368 \f
369 /*
370 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
371 %                                                                             %
372 %                                                                             %
373 %                                                                             %
374 %   M a g i c k A d d I m a g e                                               %
375 %                                                                             %
376 %                                                                             %
377 %                                                                             %
378 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
379 %
380 %  MagickAddImage() adds a clone of the images in the second wand and
381 %  inserts them into the first wand, at the current image location.
382 %
383 %  Use MagickSetFirstIterator(), to insert new images before all the current
384 %  images in the wand, otherwise image is placed after the current image.
385 %
386 %  The format of the MagickAddImage method is:
387 %
388 %      MagickBooleanType MagickAddImage(MagickWand *wand,
389 %        const MagickWand *add_wand)
390 %
391 %  A description of each parameter follows:
392 %
393 %    o wand: the magick wand.
394 %
395 %    o add_wand: A wand that contains images to add at the current image
396 %      location.
397 %
398 */
399
400 static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
401   Image *images)
402 {
403   Image
404     *current;
405
406   current=wand->images;  /* note the current image */
407
408   /* if no images in wand, just add them and set first image as current */
409   if (current == (Image *) NULL)
410     {
411       wand->images=GetFirstImageInList(images);
412       return(MagickTrue);
413     }
414
415   /* user jumped to first image, so prepend new images - remain active */
416   if ((wand->set_first != MagickFalse) &&
417        (current->previous == (Image *) NULL) )
418     {
419       PrependImageToList(&current,images);
420       wand->images=GetFirstImageInList(images);
421       return(MagickTrue);
422     }
423   wand->set_first = MagickFalse; /* flag no longer valid */
424
425   /* Current image was flaged as 'pending' iterative processing. */
426   if (wand->image_pending != MagickFalse)
427     {
428       /* current pending image is the last, append new images */
429       if (current->next == (Image *) NULL)
430         {
431           AppendImageToList(&current,images);
432           wand->images=GetLastImageInList(images);
433           return(MagickTrue);
434         }
435       /* current pending image is the first image, prepend it */
436       if (current->previous == (Image *) NULL)
437         {
438           PrependImageToList(&current,images);
439           wand->images=GetFirstImageInList(images);
440           return(MagickTrue);
441         }
442     }
443
444   /* if at last image append new images */
445   if (current->next == (Image *) NULL)
446     {
447       InsertImageInList(&current,images);
448       wand->images=GetLastImageInList(images);
449       return(MagickTrue);
450     }
451   /* otherwise just insert image, just after the current image */
452   InsertImageInList(&current,images);
453   wand->images=GetFirstImageInList(images);
454   return(MagickTrue);
455 }
456
457 WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
458   const MagickWand *add_wand)
459 {
460   Image
461     *images;
462
463   assert(wand != (MagickWand *) NULL);
464   assert(wand->signature == WandSignature);
465   if (wand->debug != MagickFalse)
466     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
467   assert(add_wand != (MagickWand *) NULL);
468   assert(add_wand->signature == WandSignature);
469   if (add_wand->images == (Image *) NULL)
470     ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
471
472   /* clone images in second wand, and insert into first */
473   images=CloneImageList(add_wand->images,wand->exception);
474   if (images == (Image *) NULL)
475     return(MagickFalse);
476   return(InsertImageInWand(wand,images));
477 }
478 \f
479 /*
480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
481 %                                                                             %
482 %                                                                             %
483 %                                                                             %
484 %     M a g i c k A d d N o i s e I m a g e                                   %
485 %                                                                             %
486 %                                                                             %
487 %                                                                             %
488 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
489 %
490 %  MagickAddNoiseImage() adds random noise to the image.
491 %
492 %  The format of the MagickAddNoiseImage method is:
493 %
494 %      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
495 %        const NoiseType noise_type,const double attenuate)
496 %
497 %  A description of each parameter follows:
498 %
499 %    o wand: the magick wand.
500 %
501 %    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
502 %      Impulse, Laplacian, or Poisson.
503 %
504 %    o attenuate:  attenuate the random distribution.
505 %
506 */
507 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
508   const NoiseType noise_type,const double attenuate)
509 {
510   Image
511     *noise_image;
512
513   assert(wand != (MagickWand *) NULL);
514   assert(wand->signature == WandSignature);
515   if (wand->debug != MagickFalse)
516     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
517   if (wand->images == (Image *) NULL)
518     ThrowWandException(WandError,"ContainsNoImages",wand->name);
519   noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
520   if (noise_image == (Image *) NULL)
521     return(MagickFalse);
522   ReplaceImageInList(&wand->images,noise_image);
523   return(MagickTrue);
524 }
525 \f
526 /*
527 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
528 %                                                                             %
529 %                                                                             %
530 %                                                                             %
531 %   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                       %
532 %                                                                             %
533 %                                                                             %
534 %                                                                             %
535 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
536 %
537 %  MagickAffineTransformImage() transforms an image as dictated by the affine
538 %  matrix of the drawing wand.
539 %
540 %  The format of the MagickAffineTransformImage method is:
541 %
542 %      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
543 %        const DrawingWand *drawing_wand)
544 %
545 %  A description of each parameter follows:
546 %
547 %    o wand: the magick wand.
548 %
549 %    o drawing_wand: the draw wand.
550 %
551 */
552 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
553   const DrawingWand *drawing_wand)
554 {
555   DrawInfo
556     *draw_info;
557
558   Image
559     *affine_image;
560
561   assert(wand != (MagickWand *) NULL);
562   assert(wand->signature == WandSignature);
563   if (wand->debug != MagickFalse)
564     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
565   if (wand->images == (Image *) NULL)
566     ThrowWandException(WandError,"ContainsNoImages",wand->name);
567   draw_info=PeekDrawingWand(drawing_wand);
568   if (draw_info == (DrawInfo *) NULL)
569     return(MagickFalse);
570   affine_image=AffineTransformImage(wand->images,&draw_info->affine,
571     wand->exception);
572   draw_info=DestroyDrawInfo(draw_info);
573   if (affine_image == (Image *) NULL)
574     return(MagickFalse);
575   ReplaceImageInList(&wand->images,affine_image);
576   return(MagickTrue);
577 }
578 \f
579 /*
580 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
581 %                                                                             %
582 %                                                                             %
583 %                                                                             %
584 %   M a g i c k A n n o t a t e I m a g e                                     %
585 %                                                                             %
586 %                                                                             %
587 %                                                                             %
588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
589 %
590 %  MagickAnnotateImage() annotates an image with text.
591 %
592 %  The format of the MagickAnnotateImage method is:
593 %
594 %      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
595 %        const DrawingWand *drawing_wand,const double x,const double y,
596 %        const double angle,const char *text)
597 %
598 %  A description of each parameter follows:
599 %
600 %    o wand: the magick wand.
601 %
602 %    o drawing_wand: the draw wand.
603 %
604 %    o x: x ordinate to left of text
605 %
606 %    o y: y ordinate to text baseline
607 %
608 %    o angle: rotate text relative to this angle.
609 %
610 %    o text: text to draw
611 %
612 */
613 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
614   const DrawingWand *drawing_wand,const double x,const double y,
615   const double angle,const char *text)
616 {
617   char
618     geometry[MaxTextExtent];
619
620   DrawInfo
621     *draw_info;
622
623   MagickBooleanType
624     status;
625
626   assert(wand != (MagickWand *) NULL);
627   assert(wand->signature == WandSignature);
628   if (wand->debug != MagickFalse)
629     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
630   if (wand->images == (Image *) NULL)
631     ThrowWandException(WandError,"ContainsNoImages",wand->name);
632   draw_info=PeekDrawingWand(drawing_wand);
633   if (draw_info == (DrawInfo *) NULL)
634     return(MagickFalse);
635   (void) CloneString(&draw_info->text,text);
636   (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",x,y);
637   draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0)));
638   draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0)));
639   draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0))));
640   draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0)));
641   (void) CloneString(&draw_info->geometry,geometry);
642   status=AnnotateImage(wand->images,draw_info,&wand->images->exception);
643   draw_info=DestroyDrawInfo(draw_info);
644   return(status);
645 }
646 \f
647 /*
648 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
649 %                                                                             %
650 %                                                                             %
651 %                                                                             %
652 %   M a g i c k A n i m a t e I m a g e s                                     %
653 %                                                                             %
654 %                                                                             %
655 %                                                                             %
656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
657 %
658 %  MagickAnimateImages() animates an image or image sequence.
659 %
660 %  The format of the MagickAnimateImages method is:
661 %
662 %      MagickBooleanType MagickAnimateImages(MagickWand *wand,
663 %        const char *server_name)
664 %
665 %  A description of each parameter follows:
666 %
667 %    o wand: the magick wand.
668 %
669 %    o server_name: the X server name.
670 %
671 */
672 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
673   const char *server_name)
674 {
675   MagickBooleanType
676     status;
677
678   assert(wand != (MagickWand *) NULL);
679   assert(wand->signature == WandSignature);
680   if (wand->debug != MagickFalse)
681     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
682   (void) CloneString(&wand->image_info->server_name,server_name);
683   status=AnimateImages(wand->image_info,wand->images,&wand->images->exception);
684   return(status);
685 }
686 \f
687 /*
688 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
689 %                                                                             %
690 %                                                                             %
691 %                                                                             %
692 %   M a g i c k A p p e n d I m a g e s                                       %
693 %                                                                             %
694 %                                                                             %
695 %                                                                             %
696 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
697 %
698 %  MagickAppendImages() append a set of images.
699 %
700 %  The format of the MagickAppendImages method is:
701 %
702 %      MagickWand *MagickAppendImages(MagickWand *wand,
703 %        const MagickBooleanType stack)
704 %
705 %  A description of each parameter follows:
706 %
707 %    o wand: the magick wand.
708 %
709 %    o stack: By default, images are stacked left-to-right. Set stack to
710 %      MagickTrue to stack them top-to-bottom.
711 %
712 */
713 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
714   const MagickBooleanType stack)
715 {
716   Image
717     *append_image;
718
719   assert(wand != (MagickWand *) NULL);
720   assert(wand->signature == WandSignature);
721   if (wand->debug != MagickFalse)
722     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
723   if (wand->images == (Image *) NULL)
724     return((MagickWand *) NULL);
725   append_image=AppendImages(wand->images,stack,wand->exception);
726   if (append_image == (Image *) NULL)
727     return((MagickWand *) NULL);
728   return(CloneMagickWandFromImages(wand,append_image));
729 }
730 \f
731 /*
732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
733 %                                                                             %
734 %                                                                             %
735 %                                                                             %
736 %   M a g i c k A u t o G a m m a I m a g e                                   %
737 %                                                                             %
738 %                                                                             %
739 %                                                                             %
740 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
741 %
742 %  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
743 %  image to try make set its gamma appropriatally.
744 %
745 %  The format of the MagickAutoGammaImage method is:
746 %
747 %      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
748 %
749 %  A description of each parameter follows:
750 %
751 %    o wand: the magick wand.
752 %
753 */
754 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
755 {
756   MagickBooleanType
757     status;
758
759   assert(wand != (MagickWand *) NULL);
760   assert(wand->signature == WandSignature);
761   if (wand->debug != MagickFalse)
762     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
763   if (wand->images == (Image *) NULL)
764     ThrowWandException(WandError,"ContainsNoImages",wand->name);
765   status=AutoGammaImage(wand->images,&wand->images->exception);
766   return(status);
767 }
768 \f
769 /*
770 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
771 %                                                                             %
772 %                                                                             %
773 %                                                                             %
774 %   M a g i c k A u t o L e v e l I m a g e                                   %
775 %                                                                             %
776 %                                                                             %
777 %                                                                             %
778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
779 %
780 %  MagickAutoLevelImage() adjusts the levels of a particular image channel by
781 %  scaling the minimum and maximum values to the full quantum range.
782 %
783 %  The format of the MagickAutoLevelImage method is:
784 %
785 %      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
786 %
787 %  A description of each parameter follows:
788 %
789 %    o wand: the magick wand.
790 %
791 */
792 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
793 {
794   MagickBooleanType
795     status;
796
797   assert(wand != (MagickWand *) NULL);
798   assert(wand->signature == WandSignature);
799   if (wand->debug != MagickFalse)
800     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
801   if (wand->images == (Image *) NULL)
802     ThrowWandException(WandError,"ContainsNoImages",wand->name);
803   status=AutoLevelImage(wand->images,&wand->images->exception);
804   return(status);
805 }
806 \f
807 /*
808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
809 %                                                                             %
810 %                                                                             %
811 %                                                                             %
812 %   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                         %
813 %                                                                             %
814 %                                                                             %
815 %                                                                             %
816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
817 %
818 %  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
819 %  pixels below the threshold into black while leaving all pixels above the
820 %  threshold unchanged.
821 %
822 %  The format of the MagickBlackThresholdImage method is:
823 %
824 %      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
825 %        const PixelWand *threshold)
826 %
827 %  A description of each parameter follows:
828 %
829 %    o wand: the magick wand.
830 %
831 %    o threshold: the pixel wand.
832 %
833 */
834 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
835   const PixelWand *threshold)
836 {
837   char
838     thresholds[MaxTextExtent];
839
840   MagickBooleanType
841     status;
842
843   assert(wand != (MagickWand *) NULL);
844   assert(wand->signature == WandSignature);
845   if (wand->debug != MagickFalse)
846     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
847   if (wand->images == (Image *) NULL)
848     ThrowWandException(WandError,"ContainsNoImages",wand->name);
849   (void) FormatLocaleString(thresholds,MaxTextExtent,
850     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
851     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
852     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
853   status=BlackThresholdImage(wand->images,thresholds,&wand->images->exception);
854   if (status == MagickFalse)
855     InheritException(wand->exception,&wand->images->exception);
856   return(status);
857 }
858 \f
859 /*
860 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
861 %                                                                             %
862 %                                                                             %
863 %                                                                             %
864 %   M a g i c k B l u e S h i f t I m a g e                                   %
865 %                                                                             %
866 %                                                                             %
867 %                                                                             %
868 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
869 %
870 %  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
871 %  nighttime in the moonlight.
872 %
873 %  The format of the MagickBlueShiftImage method is:
874 %
875 %      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
876 %        const double factor)
877 %
878 %  A description of each parameter follows:
879 %
880 %    o wand: the magick wand.
881 %
882 %    o factor: the blue shift factor (default 1.5)
883 %
884 */
885 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
886   const double factor)
887 {
888   Image
889     *shift_image;
890
891   assert(wand != (MagickWand *) NULL);
892   assert(wand->signature == WandSignature);
893   if (wand->debug != MagickFalse)
894     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
895   if (wand->images == (Image *) NULL)
896     ThrowWandException(WandError,"ContainsNoImages",wand->name);
897   shift_image=BlueShiftImage(wand->images,factor,wand->exception);
898   if (shift_image == (Image *) NULL)
899     return(MagickFalse);
900   ReplaceImageInList(&wand->images,shift_image);
901   return(MagickTrue);
902 }
903 \f
904 /*
905 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
906 %                                                                             %
907 %                                                                             %
908 %                                                                             %
909 %   M a g i c k B l u r I m a g e                                             %
910 %                                                                             %
911 %                                                                             %
912 %                                                                             %
913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
914 %
915 %  MagickBlurImage() blurs an image.  We convolve the image with a
916 %  gaussian operator of the given radius and standard deviation (sigma).
917 %  For reasonable results, the radius should be larger than sigma.  Use a
918 %  radius of 0 and BlurImage() selects a suitable radius for you.
919 %
920 %  The format of the MagickBlurImage method is:
921 %
922 %      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
923 %        const double sigmaconst double bias)
924 %
925 %  A description of each parameter follows:
926 %
927 %    o wand: the magick wand.
928 %
929 %    o radius: the radius of the , in pixels, not counting the center
930 %      pixel.
931 %
932 %    o sigma: the standard deviation of the , in pixels.
933 %
934 %    o bias: the bias.
935 %
936 */
937 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
938   const double radius,const double sigma,const double bias)
939 {
940   Image
941     *blur_image;
942
943   assert(wand != (MagickWand *) NULL);
944   assert(wand->signature == WandSignature);
945   if (wand->debug != MagickFalse)
946     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
947   if (wand->images == (Image *) NULL)
948     ThrowWandException(WandError,"ContainsNoImages",wand->name);
949   blur_image=BlurImage(wand->images,radius,sigma,bias,wand->exception);
950   if (blur_image == (Image *) NULL)
951     return(MagickFalse);
952   ReplaceImageInList(&wand->images,blur_image);
953   return(MagickTrue);
954 }
955 \f
956 /*
957 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
958 %                                                                             %
959 %                                                                             %
960 %                                                                             %
961 %   M a g i c k B o r d e r I m a g e                                         %
962 %                                                                             %
963 %                                                                             %
964 %                                                                             %
965 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
966 %
967 %  MagickBorderImage() surrounds the image with a border of the color defined
968 %  by the bordercolor pixel wand.
969 %
970 %  The format of the MagickBorderImage method is:
971 %
972 %      MagickBooleanType MagickBorderImage(MagickWand *wand,
973 %        const PixelWand *bordercolor,const size_t width,
974 %        const size_t height,const CompositeOperator compose)
975 %
976 %  A description of each parameter follows:
977 %
978 %    o wand: the magick wand.
979 %
980 %    o bordercolor: the border color pixel wand.
981 %
982 %    o width: the border width.
983 %
984 %    o height: the border height.
985 %
986 %    o compose: the composite operator.
987 %
988 */
989 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
990   const PixelWand *bordercolor,const size_t width,const size_t height,
991   const CompositeOperator compose)
992 {
993   Image
994     *border_image;
995
996   RectangleInfo
997     border_info;
998
999   assert(wand != (MagickWand *) NULL);
1000   assert(wand->signature == WandSignature);
1001   if (wand->debug != MagickFalse)
1002     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1003   if (wand->images == (Image *) NULL)
1004     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1005   border_info.width=width;
1006   border_info.height=height;
1007   border_info.x=0;
1008   border_info.y=0;
1009   PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
1010   border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
1011   if (border_image == (Image *) NULL)
1012     return(MagickFalse);
1013   ReplaceImageInList(&wand->images,border_image);
1014   return(MagickTrue);
1015 }
1016 \f
1017 /*
1018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1019 %                                                                             %
1020 %                                                                             %
1021 %                                                                             %
1022 %   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   %
1023 %                                                                             %
1024 %                                                                             %
1025 %                                                                             %
1026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1027 %
1028 %  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1029 %  of an image.  It converts the brightness and contrast parameters into slope
1030 %  and intercept and calls a polynomical function to apply to the image.
1031
1032 %
1033 %  The format of the MagickBrightnessContrastImage method is:
1034 %
1035 %      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1036 %        const double brightness,const double contrast)
1037 %
1038 %  A description of each parameter follows:
1039 %
1040 %    o wand: the magick wand.
1041 %
1042 %    o brightness: the brightness percent (-100 .. 100).
1043 %
1044 %    o contrast: the contrast percent (-100 .. 100).
1045 %
1046 */
1047 WandExport MagickBooleanType MagickBrightnessContrastImage(
1048   MagickWand *wand,const double brightness,const double contrast)
1049 {
1050   MagickBooleanType
1051     status;
1052
1053   assert(wand != (MagickWand *) NULL);
1054   assert(wand->signature == WandSignature);
1055   if (wand->debug != MagickFalse)
1056     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1057   if (wand->images == (Image *) NULL)
1058     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1059   status=BrightnessContrastImage(wand->images,brightness,contrast,
1060     &wand->images->exception);
1061   return(status);
1062 }
1063 \f
1064 /*
1065 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1066 %                                                                             %
1067 %                                                                             %
1068 %                                                                             %
1069 %   M a g i c k C h a r c o a l I m a g e                                     %
1070 %                                                                             %
1071 %                                                                             %
1072 %                                                                             %
1073 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1074 %
1075 %  MagickCharcoalImage() simulates a charcoal drawing.
1076 %
1077 %  The format of the MagickCharcoalImage method is:
1078 %
1079 %      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1080 %        const double radius,const double sigma,const double bias)
1081 %
1082 %  A description of each parameter follows:
1083 %
1084 %    o wand: the magick wand.
1085 %
1086 %    o radius: the radius of the Gaussian, in pixels, not counting the center
1087 %      pixel.
1088 %
1089 %    o sigma: the standard deviation of the Gaussian, in pixels.
1090 %
1091 %    o bias: the bias.
1092 %
1093 */
1094 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1095   const double radius,const double sigma,const double bias)
1096 {
1097   Image
1098     *charcoal_image;
1099
1100   assert(wand != (MagickWand *) NULL);
1101   assert(wand->signature == WandSignature);
1102   if (wand->debug != MagickFalse)
1103     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1104   if (wand->images == (Image *) NULL)
1105     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1106   charcoal_image=CharcoalImage(wand->images,radius,sigma,bias,wand->exception);
1107   if (charcoal_image == (Image *) NULL)
1108     return(MagickFalse);
1109   ReplaceImageInList(&wand->images,charcoal_image);
1110   return(MagickTrue);
1111 }
1112 \f
1113 /*
1114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1115 %                                                                             %
1116 %                                                                             %
1117 %                                                                             %
1118 %   M a g i c k C h o p I m a g e                                             %
1119 %                                                                             %
1120 %                                                                             %
1121 %                                                                             %
1122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1123 %
1124 %  MagickChopImage() removes a region of an image and collapses the image to
1125 %  occupy the removed portion
1126 %
1127 %  The format of the MagickChopImage method is:
1128 %
1129 %      MagickBooleanType MagickChopImage(MagickWand *wand,
1130 %        const size_t width,const size_t height,const ssize_t x,
1131 %        const ssize_t y)
1132 %
1133 %  A description of each parameter follows:
1134 %
1135 %    o wand: the magick wand.
1136 %
1137 %    o width: the region width.
1138 %
1139 %    o height: the region height.
1140 %
1141 %    o x: the region x offset.
1142 %
1143 %    o y: the region y offset.
1144 %
1145 %
1146 */
1147 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1148   const size_t width,const size_t height,const ssize_t x,
1149   const ssize_t y)
1150 {
1151   Image
1152     *chop_image;
1153
1154   RectangleInfo
1155     chop;
1156
1157   assert(wand != (MagickWand *) NULL);
1158   assert(wand->signature == WandSignature);
1159   if (wand->debug != MagickFalse)
1160     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1161   if (wand->images == (Image *) NULL)
1162     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1163   chop.width=width;
1164   chop.height=height;
1165   chop.x=x;
1166   chop.y=y;
1167   chop_image=ChopImage(wand->images,&chop,wand->exception);
1168   if (chop_image == (Image *) NULL)
1169     return(MagickFalse);
1170   ReplaceImageInList(&wand->images,chop_image);
1171   return(MagickTrue);
1172 }
1173 \f
1174 /*
1175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1176 %                                                                             %
1177 %                                                                             %
1178 %                                                                             %
1179 %   M a g i c k C l a m p I m a g e                                           %
1180 %                                                                             %
1181 %                                                                             %
1182 %                                                                             %
1183 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1184 %
1185 %  MagickClampImage() restricts the color range from 0 to the quantum depth.
1186 %
1187 %  The format of the MagickClampImage method is:
1188 %
1189 %      MagickBooleanType MagickClampImage(MagickWand *wand)
1190 %
1191 %  A description of each parameter follows:
1192 %
1193 %    o wand: the magick wand.
1194 %
1195 %    o channel: the channel.
1196 %
1197 */
1198 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1199 {
1200   MagickBooleanType
1201     status;
1202
1203   assert(wand != (MagickWand *) NULL);
1204   assert(wand->signature == WandSignature);
1205   if (wand->debug != MagickFalse)
1206     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1207   if (wand->images == (Image *) NULL)
1208     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1209   status=ClampImage(wand->images);
1210   if (status == MagickFalse)
1211     InheritException(wand->exception,&wand->images->exception);
1212   return(status);
1213 }
1214 \f
1215 /*
1216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1217 %                                                                             %
1218 %                                                                             %
1219 %                                                                             %
1220 %   M a g i c k C l i p I m a g e                                             %
1221 %                                                                             %
1222 %                                                                             %
1223 %                                                                             %
1224 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1225 %
1226 %  MagickClipImage() clips along the first path from the 8BIM profile, if
1227 %  present.
1228 %
1229 %  The format of the MagickClipImage method is:
1230 %
1231 %      MagickBooleanType MagickClipImage(MagickWand *wand)
1232 %
1233 %  A description of each parameter follows:
1234 %
1235 %    o wand: the magick wand.
1236 %
1237 */
1238 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1239 {
1240   MagickBooleanType
1241     status;
1242
1243   assert(wand != (MagickWand *) NULL);
1244   assert(wand->signature == WandSignature);
1245   if (wand->debug != MagickFalse)
1246     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1247   if (wand->images == (Image *) NULL)
1248     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1249   status=ClipImage(wand->images,wand->exception);
1250   return(status);
1251 }
1252 \f
1253 /*
1254 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1255 %                                                                             %
1256 %                                                                             %
1257 %                                                                             %
1258 %   M a g i c k C l i p I m a g e P a t h                                     %
1259 %                                                                             %
1260 %                                                                             %
1261 %                                                                             %
1262 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1263 %
1264 %  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1265 %  present. Later operations take effect inside the path.  Id may be a number
1266 %  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1267 %  path.
1268 %
1269 %  The format of the MagickClipImagePath method is:
1270 %
1271 %      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1272 %        const char *pathname,const MagickBooleanType inside)
1273 %
1274 %  A description of each parameter follows:
1275 %
1276 %    o wand: the magick wand.
1277 %
1278 %    o pathname: name of clipping path resource. If name is preceded by #, use
1279 %      clipping path numbered by name.
1280 %
1281 %    o inside: if non-zero, later operations take effect inside clipping path.
1282 %      Otherwise later operations take effect outside clipping path.
1283 %
1284 */
1285 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1286   const char *pathname,const MagickBooleanType inside)
1287 {
1288   MagickBooleanType
1289     status;
1290
1291   assert(wand != (MagickWand *) NULL);
1292   assert(wand->signature == WandSignature);
1293   if (wand->debug != MagickFalse)
1294     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1295   if (wand->images == (Image *) NULL)
1296     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1297   status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1298   return(status);
1299 }
1300 \f
1301 /*
1302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1303 %                                                                             %
1304 %                                                                             %
1305 %                                                                             %
1306 %   M a g i c k C l u t I m a g e                                             %
1307 %                                                                             %
1308 %                                                                             %
1309 %                                                                             %
1310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1311 %
1312 %  MagickClutImage() replaces colors in the image from a color lookup table.
1313 %
1314 %  The format of the MagickClutImage method is:
1315 %
1316 %      MagickBooleanType MagickClutImage(MagickWand *wand,
1317 %        const MagickWand *clut_wand,const PixelInterpolateMethod method)
1318 %
1319 %  A description of each parameter follows:
1320 %
1321 %    o wand: the magick wand.
1322 %
1323 %    o clut_image: the clut image.
1324 %
1325 %    o method: the pixel interpolation method.
1326 %
1327 */
1328 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1329   const MagickWand *clut_wand,const PixelInterpolateMethod method)
1330 {
1331   MagickBooleanType
1332     status;
1333
1334   assert(wand != (MagickWand *) NULL);
1335   assert(wand->signature == WandSignature);
1336   if (wand->debug != MagickFalse)
1337     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1338   if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1339     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1340   status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1341   return(status);
1342 }
1343 \f
1344 /*
1345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1346 %                                                                             %
1347 %                                                                             %
1348 %                                                                             %
1349 %   M a g i c k C o a l e s c e I m a g e s                                   %
1350 %                                                                             %
1351 %                                                                             %
1352 %                                                                             %
1353 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1354 %
1355 %  MagickCoalesceImages() composites a set of images while respecting any page
1356 %  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1357 %  typically start with an image background and each subsequent image
1358 %  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1359 %  where each image in the sequence is the same size as the first and
1360 %  composited with the next image in the sequence.
1361 %
1362 %  The format of the MagickCoalesceImages method is:
1363 %
1364 %      MagickWand *MagickCoalesceImages(MagickWand *wand)
1365 %
1366 %  A description of each parameter follows:
1367 %
1368 %    o wand: the magick wand.
1369 %
1370 */
1371 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1372 {
1373   Image
1374     *coalesce_image;
1375
1376   assert(wand != (MagickWand *) NULL);
1377   assert(wand->signature == WandSignature);
1378   if (wand->debug != MagickFalse)
1379     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1380   if (wand->images == (Image *) NULL)
1381     return((MagickWand *) NULL);
1382   coalesce_image=CoalesceImages(wand->images,wand->exception);
1383   if (coalesce_image == (Image *) NULL)
1384     return((MagickWand *) NULL);
1385   return(CloneMagickWandFromImages(wand,coalesce_image));
1386 }
1387 \f
1388 /*
1389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1390 %                                                                             %
1391 %                                                                             %
1392 %                                                                             %
1393 %   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1394 %                                                                             %
1395 %                                                                             %
1396 %                                                                             %
1397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1398 %
1399 %  MagickColorDecisionListImage() accepts a lightweight Color Correction
1400 %  Collection (CCC) file which solely contains one or more color corrections
1401 %  and applies the color correction to the image.  Here is a sample CCC file:
1402 %
1403 %    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1404 %          <ColorCorrection id="cc03345">
1405 %                <SOPNode>
1406 %                     <Slope> 0.9 1.2 0.5 </Slope>
1407 %                     <Offset> 0.4 -0.5 0.6 </Offset>
1408 %                     <Power> 1.0 0.8 1.5 </Power>
1409 %                </SOPNode>
1410 %                <SATNode>
1411 %                     <Saturation> 0.85 </Saturation>
1412 %                </SATNode>
1413 %          </ColorCorrection>
1414 %    </ColorCorrectionCollection>
1415 %
1416 %  which includes the offset, slope, and power for each of the RGB channels
1417 %  as well as the saturation.
1418 %
1419 %  The format of the MagickColorDecisionListImage method is:
1420 %
1421 %      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1422 %        const double gamma)
1423 %
1424 %  A description of each parameter follows:
1425 %
1426 %    o wand: the magick wand.
1427 %
1428 %    o color_correction_collection: the color correction collection in XML.
1429 %
1430 */
1431 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1432   const char *color_correction_collection)
1433 {
1434   MagickBooleanType
1435     status;
1436
1437   assert(wand != (MagickWand *) NULL);
1438   assert(wand->signature == WandSignature);
1439   if (wand->debug != MagickFalse)
1440     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1441   if (wand->images == (Image *) NULL)
1442     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1443   status=ColorDecisionListImage(wand->images,color_correction_collection,
1444     &wand->images->exception);
1445   return(status);
1446 }
1447 \f
1448 /*
1449 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1450 %                                                                             %
1451 %                                                                             %
1452 %                                                                             %
1453 %   M a g i c k C o l o r i z e I m a g e                                     %
1454 %                                                                             %
1455 %                                                                             %
1456 %                                                                             %
1457 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1458 %
1459 %  MagickColorizeImage() blends the fill color with each pixel in the image.
1460 %
1461 %  The format of the MagickColorizeImage method is:
1462 %
1463 %      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1464 %        const PixelWand *colorize,const PixelWand *blend)
1465 %
1466 %  A description of each parameter follows:
1467 %
1468 %    o wand: the magick wand.
1469 %
1470 %    o colorize: the colorize pixel wand.
1471 %
1472 %    o alpha: the alpha pixel wand.
1473 %
1474 */
1475 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1476   const PixelWand *colorize,const PixelWand *blend)
1477 {
1478   char
1479     percent_blend[MaxTextExtent];
1480
1481   Image
1482     *colorize_image;
1483
1484   PixelInfo
1485     target;
1486
1487   assert(wand != (MagickWand *) NULL);
1488   assert(wand->signature == WandSignature);
1489   if (wand->debug != MagickFalse)
1490     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1491   if (wand->images == (Image *) NULL)
1492     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1493   GetPixelInfo(wand->images,&target);
1494   if (target.colorspace != CMYKColorspace)
1495     (void) FormatLocaleString(percent_blend,MaxTextExtent,
1496       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1497       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1498       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1499       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1500       PixelGetAlphaQuantum(blend)));
1501   else
1502     (void) FormatLocaleString(percent_blend,MaxTextExtent,
1503       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1504       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1505       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1506       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1507       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1508       PixelGetAlphaQuantum(blend)));
1509   target=PixelGetPixel(colorize);
1510   colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1511     wand->exception);
1512   if (colorize_image == (Image *) NULL)
1513     return(MagickFalse);
1514   ReplaceImageInList(&wand->images,colorize_image);
1515   return(MagickTrue);
1516 }
1517 \f
1518 /*
1519 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1520 %                                                                             %
1521 %                                                                             %
1522 %                                                                             %
1523 %   M a g i c k C o l o r M a t r i x I m a g e                               %
1524 %                                                                             %
1525 %                                                                             %
1526 %                                                                             %
1527 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1528 %
1529 %  MagickColorMatrixImage() apply color transformation to an image. The method
1530 %  permits saturation changes, hue rotation, luminance to alpha, and various
1531 %  other effects.  Although variable-sized transformation matrices can be used,
1532 %  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1533 %  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1534 %  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1535 %  and offsets are normalized (divide Flash offset by 255).
1536 %
1537 %  The format of the MagickColorMatrixImage method is:
1538 %
1539 %      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1540 %        const KernelInfo *color_matrix)
1541 %
1542 %  A description of each parameter follows:
1543 %
1544 %    o wand: the magick wand.
1545 %
1546 %    o color_matrix:  the color matrix.
1547 %
1548 */
1549 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1550   const KernelInfo *color_matrix)
1551 {
1552   Image
1553     *color_image;
1554
1555   assert(wand != (MagickWand *) NULL);
1556   assert(wand->signature == WandSignature);
1557   if (wand->debug != MagickFalse)
1558     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1559   if (color_matrix == (const KernelInfo *) NULL)
1560     return(MagickFalse);
1561   if (wand->images == (Image *) NULL)
1562     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1563   color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1564   if (color_image == (Image *) NULL)
1565     return(MagickFalse);
1566   ReplaceImageInList(&wand->images,color_image);
1567   return(MagickTrue);
1568 }
1569 \f
1570 /*
1571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1572 %                                                                             %
1573 %                                                                             %
1574 %                                                                             %
1575 %   M a g i c k C o m b i n e I m a g e s                                     %
1576 %                                                                             %
1577 %                                                                             %
1578 %                                                                             %
1579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1580 %
1581 %  MagickCombineImages() combines one or more images into a single image.  The
1582 %  grayscale value of the pixels of each image in the sequence is assigned in
1583 %  order to the specified  hannels of the combined image.   The typical
1584 %  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1585 %
1586 %  The format of the MagickCombineImages method is:
1587 %
1588 %      MagickWand *MagickCombineImages(MagickWand *wand)
1589 %
1590 %  A description of each parameter follows:
1591 %
1592 %    o wand: the magick wand.
1593 %
1594 */
1595 WandExport MagickWand *MagickCombineImages(MagickWand *wand)
1596 {
1597   Image
1598     *combine_image;
1599
1600   assert(wand != (MagickWand *) NULL);
1601   assert(wand->signature == WandSignature);
1602   if (wand->debug != MagickFalse)
1603     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1604   if (wand->images == (Image *) NULL)
1605     return((MagickWand *) NULL);
1606   combine_image=CombineImages(wand->images,wand->exception);
1607   if (combine_image == (Image *) NULL)
1608     return((MagickWand *) NULL);
1609   return(CloneMagickWandFromImages(wand,combine_image));
1610 }
1611 \f
1612 /*
1613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1614 %                                                                             %
1615 %                                                                             %
1616 %                                                                             %
1617 %   M a g i c k C o m m e n t I m a g e                                       %
1618 %                                                                             %
1619 %                                                                             %
1620 %                                                                             %
1621 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1622 %
1623 %  MagickCommentImage() adds a comment to your image.
1624 %
1625 %  The format of the MagickCommentImage method is:
1626 %
1627 %      MagickBooleanType MagickCommentImage(MagickWand *wand,
1628 %        const char *comment)
1629 %
1630 %  A description of each parameter follows:
1631 %
1632 %    o wand: the magick wand.
1633 %
1634 %    o comment: the image comment.
1635 %
1636 */
1637 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1638   const char *comment)
1639 {
1640   MagickBooleanType
1641     status;
1642
1643   assert(wand != (MagickWand *) NULL);
1644   assert(wand->signature == WandSignature);
1645   if (wand->debug != MagickFalse)
1646     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1647   if (wand->images == (Image *) NULL)
1648     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1649   status=SetImageProperty(wand->images,"comment",comment);
1650   if (status == MagickFalse)
1651     InheritException(wand->exception,&wand->images->exception);
1652   return(status);
1653 }
1654 \f
1655 /*
1656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1657 %                                                                             %
1658 %                                                                             %
1659 %                                                                             %
1660 %   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1661 %                                                                             %
1662 %                                                                             %
1663 %                                                                             %
1664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1665 %
1666 %  MagickCompareImagesLayers() compares each image with the next in a sequence
1667 %  and returns the maximum bounding region of any pixel differences it
1668 %  discovers.
1669 %
1670 %  The format of the MagickCompareImagesLayers method is:
1671 %
1672 %      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1673 %        const ImageLayerMethod method)
1674 %
1675 %  A description of each parameter follows:
1676 %
1677 %    o wand: the magick wand.
1678 %
1679 %    o method: the compare method.
1680 %
1681 */
1682 WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1683   const ImageLayerMethod method)
1684 {
1685   Image
1686     *layers_image;
1687
1688   assert(wand != (MagickWand *) NULL);
1689   assert(wand->signature == WandSignature);
1690   if (wand->debug != MagickFalse)
1691     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1692   if (wand->images == (Image *) NULL)
1693     return((MagickWand *) NULL);
1694   layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1695   if (layers_image == (Image *) NULL)
1696     return((MagickWand *) NULL);
1697   return(CloneMagickWandFromImages(wand,layers_image));
1698 }
1699 \f
1700 /*
1701 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1702 %                                                                             %
1703 %                                                                             %
1704 %                                                                             %
1705 %   M a g i c k C o m p a r e I m a g e s                                     %
1706 %                                                                             %
1707 %                                                                             %
1708 %                                                                             %
1709 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1710 %
1711 %  MagickCompareImages() compares an image to a reconstructed image and returns
1712 %  the specified difference image.
1713 %
1714 %  The format of the MagickCompareImages method is:
1715 %
1716 %      MagickWand *MagickCompareImages(MagickWand *wand,
1717 %        const MagickWand *reference,const MetricType metric,
1718 %        double *distortion)
1719 %
1720 %  A description of each parameter follows:
1721 %
1722 %    o wand: the magick wand.
1723 %
1724 %    o reference: the reference wand.
1725 %
1726 %    o metric: the metric.
1727 %
1728 %    o distortion: the computed distortion between the images.
1729 %
1730 */
1731 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1732   const MagickWand *reference,const MetricType metric,double *distortion)
1733 {
1734   Image
1735     *compare_image;
1736
1737
1738   assert(wand != (MagickWand *) NULL);
1739   assert(wand->signature == WandSignature);
1740   if (wand->debug != MagickFalse)
1741     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1742   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1743     {
1744       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1745         "ContainsNoImages","`%s'",wand->name);
1746       return((MagickWand *) NULL);
1747     }
1748   compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1749     &wand->images->exception);
1750   if (compare_image == (Image *) NULL)
1751     return((MagickWand *) NULL);
1752   return(CloneMagickWandFromImages(wand,compare_image));
1753 }
1754 \f
1755 /*
1756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1757 %                                                                             %
1758 %                                                                             %
1759 %                                                                             %
1760 %   M a g i c k C o m p o s i t e I m a g e                                   %
1761 %                                                                             %
1762 %                                                                             %
1763 %                                                                             %
1764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1765 %
1766 %  MagickCompositeImage() composite one image onto another at the specified
1767 %  offset.
1768 %
1769 %  The format of the MagickCompositeImage method is:
1770 %
1771 %      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1772 %        const MagickWand *composite_wand,const CompositeOperator compose,
1773 %        const ssize_t x,const ssize_t y)
1774 %
1775 %  A description of each parameter follows:
1776 %
1777 %    o wand: the magick wand.
1778 %
1779 %    o composite_image: the composite image.
1780 %
1781 %    o compose: This operator affects how the composite is applied to the
1782 %      image.  The default is Over.  Choose from these operators:
1783 %
1784 %        OverCompositeOp       InCompositeOp         OutCompositeOp
1785 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1786 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1787 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1788 %        DisplaceCompositeOp
1789 %
1790 %    o x: the column offset of the composited image.
1791 %
1792 %    o y: the row offset of the composited image.
1793 %
1794 */
1795 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1796   const MagickWand *composite_wand,const CompositeOperator compose,
1797   const ssize_t x,const ssize_t y)
1798 {
1799   MagickBooleanType
1800     status;
1801
1802   assert(wand != (MagickWand *) NULL);
1803   assert(wand->signature == WandSignature);
1804   if (wand->debug != MagickFalse)
1805     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1806   if ((wand->images == (Image *) NULL) ||
1807       (composite_wand->images == (Image *) NULL))
1808     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1809   status=CompositeImage(wand->images,compose,composite_wand->images,x,y);
1810   if (status == MagickFalse)
1811     InheritException(wand->exception,&wand->images->exception);
1812   return(status);
1813 }
1814 \f
1815 /*
1816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1817 %                                                                             %
1818 %                                                                             %
1819 %                                                                             %
1820 %   M a g i c k C o n t r a s t I m a g e                                     %
1821 %                                                                             %
1822 %                                                                             %
1823 %                                                                             %
1824 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1825 %
1826 %  MagickContrastImage() enhances the intensity differences between the lighter
1827 %  and darker elements of the image.  Set sharpen to a value other than 0 to
1828 %  increase the image contrast otherwise the contrast is reduced.
1829 %
1830 %  The format of the MagickContrastImage method is:
1831 %
1832 %      MagickBooleanType MagickContrastImage(MagickWand *wand,
1833 %        const MagickBooleanType sharpen)
1834 %
1835 %  A description of each parameter follows:
1836 %
1837 %    o wand: the magick wand.
1838 %
1839 %    o sharpen: Increase or decrease image contrast.
1840 %
1841 %
1842 */
1843 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1844   const MagickBooleanType sharpen)
1845 {
1846   MagickBooleanType
1847     status;
1848
1849   assert(wand != (MagickWand *) NULL);
1850   assert(wand->signature == WandSignature);
1851   if (wand->debug != MagickFalse)
1852     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1853   if (wand->images == (Image *) NULL)
1854     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1855   status=ContrastImage(wand->images,sharpen,&wand->images->exception);
1856   return(status);
1857 }
1858 \f
1859 /*
1860 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1861 %                                                                             %
1862 %                                                                             %
1863 %                                                                             %
1864 %   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                       %
1865 %                                                                             %
1866 %                                                                             %
1867 %                                                                             %
1868 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1869 %
1870 %  MagickContrastStretchImage() enhances the contrast of a color image by
1871 %  adjusting the pixels color to span the entire range of colors available.
1872 %  You can also reduce the influence of a particular channel with a gamma
1873 %  value of 0.
1874 %
1875 %  The format of the MagickContrastStretchImage method is:
1876 %
1877 %      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1878 %        const double black_point,const double white_point)
1879 %
1880 %  A description of each parameter follows:
1881 %
1882 %    o wand: the magick wand.
1883 %
1884 %    o black_point: the black point.
1885 %
1886 %    o white_point: the white point.
1887 %
1888 */
1889 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1890   const double black_point,const double white_point)
1891 {
1892   MagickBooleanType
1893     status;
1894
1895   assert(wand != (MagickWand *) NULL);
1896   assert(wand->signature == WandSignature);
1897   if (wand->debug != MagickFalse)
1898     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1899   if (wand->images == (Image *) NULL)
1900     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1901   status=ContrastStretchImage(wand->images,black_point,white_point,
1902     &wand->images->exception);
1903   return(status);
1904 }
1905 \f
1906 /*
1907 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1908 %                                                                             %
1909 %                                                                             %
1910 %                                                                             %
1911 %   M a g i c k C o n v o l v e I m a g e                                     %
1912 %                                                                             %
1913 %                                                                             %
1914 %                                                                             %
1915 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1916 %
1917 %  MagickConvolveImage() applies a custom convolution kernel to the image.
1918 %
1919 %  The format of the MagickConvolveImage method is:
1920 %
1921 %      MagickBooleanType MagickConvolveImage(MagickWand *wand,
1922 %        const KernelInfo *kernel)
1923 %
1924 %  A description of each parameter follows:
1925 %
1926 %    o wand: the magick wand.
1927 %
1928 %    o kernel: An array of doubles representing the convolution kernel.
1929 %
1930 */
1931 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
1932   const KernelInfo *kernel)
1933 {
1934   Image
1935     *filter_image;
1936
1937   assert(wand != (MagickWand *) NULL);
1938   assert(wand->signature == WandSignature);
1939   if (wand->debug != MagickFalse)
1940     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1941   if (kernel == (const KernelInfo *) NULL)
1942     return(MagickFalse);
1943   if (wand->images == (Image *) NULL)
1944     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1945   filter_image=ConvolveImage(wand->images,kernel,wand->exception);
1946   if (filter_image == (Image *) NULL)
1947     return(MagickFalse);
1948   ReplaceImageInList(&wand->images,filter_image);
1949   return(MagickTrue);
1950 }
1951 \f
1952 /*
1953 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1954 %                                                                             %
1955 %                                                                             %
1956 %                                                                             %
1957 %   M a g i c k C r o p I m a g e                                             %
1958 %                                                                             %
1959 %                                                                             %
1960 %                                                                             %
1961 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1962 %
1963 %  MagickCropImage() extracts a region of the image.
1964 %
1965 %  The format of the MagickCropImage method is:
1966 %
1967 %      MagickBooleanType MagickCropImage(MagickWand *wand,
1968 %        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1969 %
1970 %  A description of each parameter follows:
1971 %
1972 %    o wand: the magick wand.
1973 %
1974 %    o width: the region width.
1975 %
1976 %    o height: the region height.
1977 %
1978 %    o x: the region x-offset.
1979 %
1980 %    o y: the region y-offset.
1981 %
1982 */
1983 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
1984   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1985 {
1986   Image
1987     *crop_image;
1988
1989   RectangleInfo
1990     crop;
1991
1992   assert(wand != (MagickWand *) NULL);
1993   assert(wand->signature == WandSignature);
1994   if (wand->debug != MagickFalse)
1995     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1996   if (wand->images == (Image *) NULL)
1997     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1998   crop.width=width;
1999   crop.height=height;
2000   crop.x=x;
2001   crop.y=y;
2002   crop_image=CropImage(wand->images,&crop,wand->exception);
2003   if (crop_image == (Image *) NULL)
2004     return(MagickFalse);
2005   ReplaceImageInList(&wand->images,crop_image);
2006   return(MagickTrue);
2007 }
2008 \f
2009 /*
2010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2011 %                                                                             %
2012 %                                                                             %
2013 %                                                                             %
2014 %   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2015 %                                                                             %
2016 %                                                                             %
2017 %                                                                             %
2018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2019 %
2020 %  MagickCycleColormapImage() displaces an image's colormap by a given number
2021 %  of positions.  If you cycle the colormap a number of times you can produce
2022 %  a psychodelic effect.
2023 %
2024 %  The format of the MagickCycleColormapImage method is:
2025 %
2026 %      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2027 %        const ssize_t displace)
2028 %
2029 %  A description of each parameter follows:
2030 %
2031 %    o wand: the magick wand.
2032 %
2033 %    o pixel_wand: the pixel wand.
2034 %
2035 */
2036 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2037   const ssize_t displace)
2038 {
2039   MagickBooleanType
2040     status;
2041
2042   assert(wand != (MagickWand *) NULL);
2043   assert(wand->signature == WandSignature);
2044   if (wand->debug != MagickFalse)
2045     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2046   if (wand->images == (Image *) NULL)
2047     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2048   status=CycleColormapImage(wand->images,displace,wand->exception);
2049   return(status);
2050 }
2051 \f
2052 /*
2053 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2054 %                                                                             %
2055 %                                                                             %
2056 %                                                                             %
2057 %   M a g i c k C o n s t i t u t e I m a g e                                 %
2058 %                                                                             %
2059 %                                                                             %
2060 %                                                                             %
2061 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2062 %
2063 %  MagickConstituteImage() adds an image to the wand comprised of the pixel
2064 %  data you supply.  The pixel data must be in scanline order top-to-bottom.
2065 %  The data can be char, short int, int, float, or double.  Float and double
2066 %  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2067 %  is the maximum value the type can accomodate (e.g. 255 for char).  For
2068 %  example, to create a 640x480 image from unsigned red-green-blue character
2069 %  data, use
2070 %
2071 %      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2072 %
2073 %  The format of the MagickConstituteImage method is:
2074 %
2075 %      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2076 %        const size_t columns,const size_t rows,const char *map,
2077 %        const StorageType storage,void *pixels)
2078 %
2079 %  A description of each parameter follows:
2080 %
2081 %    o wand: the magick wand.
2082 %
2083 %    o columns: width in pixels of the image.
2084 %
2085 %    o rows: height in pixels of the image.
2086 %
2087 %    o map:  This string reflects the expected ordering of the pixel array.
2088 %      It can be any combination or order of R = red, G = green, B = blue,
2089 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2090 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2091 %      P = pad.
2092 %
2093 %    o storage: Define the data type of the pixels.  Float and double types are
2094 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2095 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2096 %      LongPixel, QuantumPixel, or ShortPixel.
2097 %
2098 %    o pixels: This array of values contain the pixel components as defined by
2099 %      map and type.  You must preallocate this array where the expected
2100 %      length varies depending on the values of width, height, map, and type.
2101 %
2102 %
2103 */
2104 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2105   const size_t columns,const size_t rows,const char *map,
2106   const StorageType storage,const void *pixels)
2107 {
2108   Image
2109     *images;
2110
2111   assert(wand != (MagickWand *) NULL);
2112   assert(wand->signature == WandSignature);
2113   if (wand->debug != MagickFalse)
2114     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2115   images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2116   if (images == (Image *) NULL)
2117     return(MagickFalse);
2118   return(InsertImageInWand(wand,images));
2119 }
2120 \f
2121 /*
2122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2123 %                                                                             %
2124 %                                                                             %
2125 %                                                                             %
2126 %   M a g i c k D e c i p h e r I m a g e                                     %
2127 %                                                                             %
2128 %                                                                             %
2129 %                                                                             %
2130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2131 %
2132 %  MagickDecipherImage() converts cipher pixels to plain pixels.
2133 %
2134 %  The format of the MagickDecipherImage method is:
2135 %
2136 %      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2137 %        const char *passphrase)
2138 %
2139 %  A description of each parameter follows:
2140 %
2141 %    o wand: the magick wand.
2142 %
2143 %    o passphrase: the passphrase.
2144 %
2145 */
2146 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2147   const char *passphrase)
2148 {
2149   assert(wand != (MagickWand *) NULL);
2150   assert(wand->signature == WandSignature);
2151   if (wand->debug != MagickFalse)
2152     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2153   if (wand->images == (Image *) NULL)
2154     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2155   return(DecipherImage(wand->images,passphrase,&wand->images->exception));
2156 }
2157 \f
2158 /*
2159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2160 %                                                                             %
2161 %                                                                             %
2162 %                                                                             %
2163 %   M a g i c k D e c o n s t r u c t I m a g e s                             %
2164 %                                                                             %
2165 %                                                                             %
2166 %                                                                             %
2167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2168 %
2169 %  MagickDeconstructImages() compares each image with the next in a sequence
2170 %  and returns the maximum bounding region of any pixel differences it
2171 %  discovers.
2172 %
2173 %  The format of the MagickDeconstructImages method is:
2174 %
2175 %      MagickWand *MagickDeconstructImages(MagickWand *wand)
2176 %
2177 %  A description of each parameter follows:
2178 %
2179 %    o wand: the magick wand.
2180 %
2181 */
2182 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2183 {
2184   Image
2185     *deconstruct_image;
2186
2187   assert(wand != (MagickWand *) NULL);
2188   assert(wand->signature == WandSignature);
2189   if (wand->debug != MagickFalse)
2190     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2191   if (wand->images == (Image *) NULL)
2192     return((MagickWand *) NULL);
2193   deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2194     wand->exception);
2195   if (deconstruct_image == (Image *) NULL)
2196     return((MagickWand *) NULL);
2197   return(CloneMagickWandFromImages(wand,deconstruct_image));
2198 }
2199 \f
2200 /*
2201 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2202 %                                                                             %
2203 %                                                                             %
2204 %                                                                             %
2205 %     M a g i c k D e s k e w I m a g e                                       %
2206 %                                                                             %
2207 %                                                                             %
2208 %                                                                             %
2209 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2210 %
2211 %  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2212 %  occurs in scanned images because of the camera being misaligned,
2213 %  imperfections in the scanning or surface, or simply because the paper was
2214 %  not placed completely flat when scanned.
2215 %
2216 %  The format of the MagickDeskewImage method is:
2217 %
2218 %      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2219 %        const double threshold)
2220 %
2221 %  A description of each parameter follows:
2222 %
2223 %    o wand: the magick wand.
2224 %
2225 %    o threshold: separate background from foreground.
2226 %
2227 */
2228 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2229   const double threshold)
2230 {
2231   Image
2232     *sepia_image;
2233
2234   assert(wand != (MagickWand *) NULL);
2235   assert(wand->signature == WandSignature);
2236   if (wand->debug != MagickFalse)
2237     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2238   if (wand->images == (Image *) NULL)
2239     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2240   sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2241   if (sepia_image == (Image *) NULL)
2242     return(MagickFalse);
2243   ReplaceImageInList(&wand->images,sepia_image);
2244   return(MagickTrue);
2245 }
2246 \f
2247 /*
2248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2249 %                                                                             %
2250 %                                                                             %
2251 %                                                                             %
2252 %     M a g i c k D e s p e c k l e I m a g e                                 %
2253 %                                                                             %
2254 %                                                                             %
2255 %                                                                             %
2256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2257 %
2258 %  MagickDespeckleImage() reduces the speckle noise in an image while
2259 %  perserving the edges of the original image.
2260 %
2261 %  The format of the MagickDespeckleImage method is:
2262 %
2263 %      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2264 %
2265 %  A description of each parameter follows:
2266 %
2267 %    o wand: the magick wand.
2268 %
2269 */
2270 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2271 {
2272   Image
2273     *despeckle_image;
2274
2275   assert(wand != (MagickWand *) NULL);
2276   assert(wand->signature == WandSignature);
2277   if (wand->debug != MagickFalse)
2278     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2279   if (wand->images == (Image *) NULL)
2280     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2281   despeckle_image=DespeckleImage(wand->images,wand->exception);
2282   if (despeckle_image == (Image *) NULL)
2283     return(MagickFalse);
2284   ReplaceImageInList(&wand->images,despeckle_image);
2285   return(MagickTrue);
2286 }
2287 \f
2288 /*
2289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2290 %                                                                             %
2291 %                                                                             %
2292 %                                                                             %
2293 %   M a g i c k D e s t r o y I m a g e                                       %
2294 %                                                                             %
2295 %                                                                             %
2296 %                                                                             %
2297 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2298 %
2299 %  MagickDestroyImage() dereferences an image, deallocating memory associated
2300 %  with the image if the reference count becomes zero.
2301 %
2302 %  The format of the MagickDestroyImage method is:
2303 %
2304 %      Image *MagickDestroyImage(Image *image)
2305 %
2306 %  A description of each parameter follows:
2307 %
2308 %    o image: the image.
2309 %
2310 */
2311 WandExport Image *MagickDestroyImage(Image *image)
2312 {
2313   return(DestroyImage(image));
2314 }
2315 \f
2316 /*
2317 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2318 %                                                                             %
2319 %                                                                             %
2320 %                                                                             %
2321 %   M a g i c k D i s p l a y I m a g e                                       %
2322 %                                                                             %
2323 %                                                                             %
2324 %                                                                             %
2325 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2326 %
2327 %  MagickDisplayImage() displays an image.
2328 %
2329 %  The format of the MagickDisplayImage method is:
2330 %
2331 %      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2332 %        const char *server_name)
2333 %
2334 %  A description of each parameter follows:
2335 %
2336 %    o wand: the magick wand.
2337 %
2338 %    o server_name: the X server name.
2339 %
2340 */
2341 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2342   const char *server_name)
2343 {
2344   Image
2345     *image;
2346
2347   MagickBooleanType
2348     status;
2349
2350   assert(wand != (MagickWand *) NULL);
2351   assert(wand->signature == WandSignature);
2352   if (wand->debug != MagickFalse)
2353     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2354   if (wand->images == (Image *) NULL)
2355     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2356   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2357   if (image == (Image *) NULL)
2358     return(MagickFalse);
2359   (void) CloneString(&wand->image_info->server_name,server_name);
2360   status=DisplayImages(wand->image_info,image,&image->exception);
2361   image=DestroyImage(image);
2362   return(status);
2363 }
2364 \f
2365 /*
2366 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2367 %                                                                             %
2368 %                                                                             %
2369 %                                                                             %
2370 %   M a g i c k D i s p l a y I m a g e s                                     %
2371 %                                                                             %
2372 %                                                                             %
2373 %                                                                             %
2374 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2375 %
2376 %  MagickDisplayImages() displays an image or image sequence.
2377 %
2378 %  The format of the MagickDisplayImages method is:
2379 %
2380 %      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2381 %        const char *server_name)
2382 %
2383 %  A description of each parameter follows:
2384 %
2385 %    o wand: the magick wand.
2386 %
2387 %    o server_name: the X server name.
2388 %
2389 */
2390 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2391   const char *server_name)
2392 {
2393   MagickBooleanType
2394     status;
2395
2396   assert(wand != (MagickWand *) NULL);
2397   assert(wand->signature == WandSignature);
2398   if (wand->debug != MagickFalse)
2399     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2400   (void) CloneString(&wand->image_info->server_name,server_name);
2401   status=DisplayImages(wand->image_info,wand->images,&wand->images->exception);
2402   return(status);
2403 }
2404 \f
2405 /*
2406 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2407 %                                                                             %
2408 %                                                                             %
2409 %                                                                             %
2410 %   M a g i c k D i s t o r t I m a g e                                       %
2411 %                                                                             %
2412 %                                                                             %
2413 %                                                                             %
2414 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2415 %
2416 %  MagickDistortImage() distorts an image using various distortion methods, by
2417 %  mapping color lookups of the source image to a new destination image
2418 %  usally of the same size as the source image, unless 'bestfit' is set to
2419 %  true.
2420 %
2421 %  If 'bestfit' is enabled, and distortion allows it, the destination image is
2422 %  adjusted to ensure the whole source 'image' will just fit within the final
2423 %  destination image, which will be sized and offset accordingly.  Also in
2424 %  many cases the virtual offset of the source image will be taken into
2425 %  account in the mapping.
2426 %
2427 %  The format of the MagickDistortImage method is:
2428 %
2429 %      MagickBooleanType MagickDistortImage(MagickWand *wand,
2430 %        const DistortImageMethod method,const size_t number_arguments,
2431 %        const double *arguments,const MagickBooleanType bestfit)
2432 %
2433 %  A description of each parameter follows:
2434 %
2435 %    o image: the image to be distorted.
2436 %
2437 %    o method: the method of image distortion.
2438 %
2439 %        ArcDistortion always ignores the source image offset, and always
2440 %        'bestfit' the destination image with the top left corner offset
2441 %        relative to the polar mapping center.
2442 %
2443 %        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2444 %        style of image distortion.
2445 %
2446 %        Affine, Perspective, and Bilinear, do least squares fitting of the
2447 %        distortion when more than the minimum number of control point pairs
2448 %        are provided.
2449 %
2450 %        Perspective, and Bilinear, falls back to a Affine distortion when less
2451 %        that 4 control point pairs are provided. While Affine distortions let
2452 %        you use any number of control point pairs, that is Zero pairs is a
2453 %        no-Op (viewport only) distrotion, one pair is a translation and two
2454 %        pairs of control points do a scale-rotate-translate, without any
2455 %        shearing.
2456 %
2457 %    o number_arguments: the number of arguments given for this distortion
2458 %      method.
2459 %
2460 %    o arguments: the arguments for this distortion method.
2461 %
2462 %    o bestfit: Attempt to resize destination to fit distorted source.
2463 %
2464 */
2465 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2466   const DistortImageMethod method,const size_t number_arguments,
2467   const double *arguments,const MagickBooleanType bestfit)
2468 {
2469   Image
2470     *distort_image;
2471
2472   assert(wand != (MagickWand *) NULL);
2473   assert(wand->signature == WandSignature);
2474   if (wand->debug != MagickFalse)
2475     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2476   if (wand->images == (Image *) NULL)
2477     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2478   distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2479     bestfit,wand->exception);
2480   if (distort_image == (Image *) NULL)
2481     return(MagickFalse);
2482   ReplaceImageInList(&wand->images,distort_image);
2483   return(MagickTrue);
2484 }
2485 \f
2486 /*
2487 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2488 %                                                                             %
2489 %                                                                             %
2490 %                                                                             %
2491 %   M a g i c k D r a w I m a g e                                             %
2492 %                                                                             %
2493 %                                                                             %
2494 %                                                                             %
2495 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2496 %
2497 %  MagickDrawImage() renders the drawing wand on the current image.
2498 %
2499 %  The format of the MagickDrawImage method is:
2500 %
2501 %      MagickBooleanType MagickDrawImage(MagickWand *wand,
2502 %        const DrawingWand *drawing_wand)
2503 %
2504 %  A description of each parameter follows:
2505 %
2506 %    o wand: the magick wand.
2507 %
2508 %    o drawing_wand: the draw wand.
2509 %
2510 */
2511 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2512   const DrawingWand *drawing_wand)
2513 {
2514   char
2515     *primitive;
2516
2517   DrawInfo
2518     *draw_info;
2519
2520   MagickBooleanType
2521     status;
2522
2523   assert(wand != (MagickWand *) NULL);
2524   assert(wand->signature == WandSignature);
2525   if (wand->debug != MagickFalse)
2526     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2527   if (wand->images == (Image *) NULL)
2528     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2529   draw_info=PeekDrawingWand(drawing_wand);
2530   if ((draw_info == (DrawInfo *) NULL) ||
2531       (draw_info->primitive == (char *) NULL))
2532     return(MagickFalse);
2533   primitive=AcquireString(draw_info->primitive);
2534   draw_info=DestroyDrawInfo(draw_info);
2535   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2536   draw_info->primitive=primitive;
2537   status=DrawImage(wand->images,draw_info,wand->exception);
2538   draw_info=DestroyDrawInfo(draw_info);
2539   return(status);
2540 }
2541 \f
2542 /*
2543 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2544 %                                                                             %
2545 %                                                                             %
2546 %                                                                             %
2547 %   M a g i c k E d g e I m a g e                                             %
2548 %                                                                             %
2549 %                                                                             %
2550 %                                                                             %
2551 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2552 %
2553 %  MagickEdgeImage() enhance edges within the image with a convolution filter
2554 %  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2555 %  radius for you.
2556 %
2557 %  The format of the MagickEdgeImage method is:
2558 %
2559 %      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius,
2560 %        const double sigma)
2561 %
2562 %  A description of each parameter follows:
2563 %
2564 %    o wand: the magick wand.
2565 %
2566 %    o radius: the radius of the pixel neighborhood.
2567 %
2568 %    o sigma: the standard deviation of the Gaussian, in pixels.
2569 %
2570 */
2571 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2572   const double radius,const double sigma)
2573 {
2574   Image
2575     *edge_image;
2576
2577   assert(wand != (MagickWand *) NULL);
2578   assert(wand->signature == WandSignature);
2579   if (wand->debug != MagickFalse)
2580     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2581   if (wand->images == (Image *) NULL)
2582     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2583   edge_image=EdgeImage(wand->images,radius,sigma,wand->exception);
2584   if (edge_image == (Image *) NULL)
2585     return(MagickFalse);
2586   ReplaceImageInList(&wand->images,edge_image);
2587   return(MagickTrue);
2588 }
2589 \f
2590 /*
2591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2592 %                                                                             %
2593 %                                                                             %
2594 %                                                                             %
2595 %   M a g i c k E m b o s s I m a g e                                         %
2596 %                                                                             %
2597 %                                                                             %
2598 %                                                                             %
2599 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2600 %
2601 %  MagickEmbossImage() returns a grayscale image with a three-dimensional
2602 %  effect.  We convolve the image with a Gaussian operator of the given radius
2603 %  and standard deviation (sigma).  For reasonable results, radius should be
2604 %  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2605 %  radius for you.
2606 %
2607 %  The format of the MagickEmbossImage method is:
2608 %
2609 %      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2610 %        const double sigma)
2611 %
2612 %  A description of each parameter follows:
2613 %
2614 %    o wand: the magick wand.
2615 %
2616 %    o radius: the radius of the Gaussian, in pixels, not counting the center
2617 %      pixel.
2618 %
2619 %    o sigma: the standard deviation of the Gaussian, in pixels.
2620 %
2621 */
2622 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2623   const double radius,const double sigma)
2624 {
2625   Image
2626     *emboss_image;
2627
2628   assert(wand != (MagickWand *) NULL);
2629   assert(wand->signature == WandSignature);
2630   if (wand->debug != MagickFalse)
2631     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2632   if (wand->images == (Image *) NULL)
2633     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2634   emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2635   if (emboss_image == (Image *) NULL)
2636     return(MagickFalse);
2637   ReplaceImageInList(&wand->images,emboss_image);
2638   return(MagickTrue);
2639 }
2640 \f
2641 /*
2642 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2643 %                                                                             %
2644 %                                                                             %
2645 %                                                                             %
2646 %   M a g i c k E n c i p h e r I m a g e                                     %
2647 %                                                                             %
2648 %                                                                             %
2649 %                                                                             %
2650 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2651 %
2652 %  MagickEncipherImage() converts plaint pixels to cipher pixels.
2653 %
2654 %  The format of the MagickEncipherImage method is:
2655 %
2656 %      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2657 %        const char *passphrase)
2658 %
2659 %  A description of each parameter follows:
2660 %
2661 %    o wand: the magick wand.
2662 %
2663 %    o passphrase: the passphrase.
2664 %
2665 */
2666 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2667   const char *passphrase)
2668 {
2669   assert(wand != (MagickWand *) NULL);
2670   assert(wand->signature == WandSignature);
2671   if (wand->debug != MagickFalse)
2672     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2673   if (wand->images == (Image *) NULL)
2674     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2675   return(EncipherImage(wand->images,passphrase,&wand->images->exception));
2676 }
2677 \f
2678 /*
2679 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2680 %                                                                             %
2681 %                                                                             %
2682 %                                                                             %
2683 %   M a g i c k E n h a n c e I m a g e                                       %
2684 %                                                                             %
2685 %                                                                             %
2686 %                                                                             %
2687 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2688 %
2689 %  MagickEnhanceImage() applies a digital filter that improves the quality of a
2690 %  noisy image.
2691 %
2692 %  The format of the MagickEnhanceImage method is:
2693 %
2694 %      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2695 %
2696 %  A description of each parameter follows:
2697 %
2698 %    o wand: the magick wand.
2699 %
2700 */
2701 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2702 {
2703   Image
2704     *enhance_image;
2705
2706   assert(wand != (MagickWand *) NULL);
2707   assert(wand->signature == WandSignature);
2708   if (wand->debug != MagickFalse)
2709     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2710   if (wand->images == (Image *) NULL)
2711     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2712   enhance_image=EnhanceImage(wand->images,wand->exception);
2713   if (enhance_image == (Image *) NULL)
2714     return(MagickFalse);
2715   ReplaceImageInList(&wand->images,enhance_image);
2716   return(MagickTrue);
2717 }
2718 \f
2719 /*
2720 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2721 %                                                                             %
2722 %                                                                             %
2723 %                                                                             %
2724 %   M a g i c k E q u a l i z e I m a g e                                     %
2725 %                                                                             %
2726 %                                                                             %
2727 %                                                                             %
2728 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2729 %
2730 %  MagickEqualizeImage() equalizes the image histogram.
2731 %
2732 %  The format of the MagickEqualizeImage method is:
2733 %
2734 %      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2735 %
2736 %  A description of each parameter follows:
2737 %
2738 %    o wand: the magick wand.
2739 %
2740 %    o channel: the image channel(s).
2741 %
2742 */
2743 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2744 {
2745   MagickBooleanType
2746     status;
2747
2748   assert(wand != (MagickWand *) NULL);
2749   assert(wand->signature == WandSignature);
2750   if (wand->debug != MagickFalse)
2751     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2752   if (wand->images == (Image *) NULL)
2753     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2754   status=EqualizeImage(wand->images,&wand->images->exception);
2755   return(status);
2756 }
2757 \f
2758 /*
2759 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2760 %                                                                             %
2761 %                                                                             %
2762 %                                                                             %
2763 %   M a g i c k E v a l u a t e I m a g e                                     %
2764 %                                                                             %
2765 %                                                                             %
2766 %                                                                             %
2767 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2768 %
2769 %  MagickEvaluateImage() applys an arithmetic, relational, or logical
2770 %  expression to an image.  Use these operators to lighten or darken an image,
2771 %  to increase or decrease contrast in an image, or to produce the "negative"
2772 %  of an image.
2773 %
2774 %  The format of the MagickEvaluateImage method is:
2775 %
2776 %      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2777 %        const MagickEvaluateOperator operator,const double value)
2778 %      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2779 %        const MagickEvaluateOperator operator)
2780 %
2781 %  A description of each parameter follows:
2782 %
2783 %    o wand: the magick wand.
2784 %
2785 %    o op: A channel operator.
2786 %
2787 %    o value: A value value.
2788 %
2789 */
2790
2791 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2792   const MagickEvaluateOperator op)
2793 {
2794   Image
2795     *evaluate_image;
2796
2797   assert(wand != (MagickWand *) NULL);
2798   assert(wand->signature == WandSignature);
2799   if (wand->debug != MagickFalse)
2800     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2801   if (wand->images == (Image *) NULL)
2802     return((MagickWand *) NULL);
2803   evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2804   if (evaluate_image == (Image *) NULL)
2805     return((MagickWand *) NULL);
2806   return(CloneMagickWandFromImages(wand,evaluate_image));
2807 }
2808
2809 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2810   const MagickEvaluateOperator op,const double value)
2811 {
2812   MagickBooleanType
2813     status;
2814
2815   assert(wand != (MagickWand *) NULL);
2816   assert(wand->signature == WandSignature);
2817   if (wand->debug != MagickFalse)
2818     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2819   if (wand->images == (Image *) NULL)
2820     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2821   status=EvaluateImage(wand->images,op,value,&wand->images->exception);
2822   return(status);
2823 }
2824 \f
2825 /*
2826 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2827 %                                                                             %
2828 %                                                                             %
2829 %                                                                             %
2830 %   M a g i c k E x p o r t I m a g e P i x e l s                             %
2831 %                                                                             %
2832 %                                                                             %
2833 %                                                                             %
2834 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2835 %
2836 %  MagickExportImagePixels() extracts pixel data from an image and returns it
2837 %  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2838 %  an error is encountered.  The data is returned as char, short int, int,
2839 %  ssize_t, float, or double in the order specified by map.
2840 %
2841 %  Suppose you want to extract the first scanline of a 640x480 image as
2842 %  character data in red-green-blue order:
2843 %
2844 %      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
2845 %
2846 %  The format of the MagickExportImagePixels method is:
2847 %
2848 %      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2849 %        const ssize_t x,const ssize_t y,const size_t columns,
2850 %        const size_t rows,const char *map,const StorageType storage,
2851 %        void *pixels)
2852 %
2853 %  A description of each parameter follows:
2854 %
2855 %    o wand: the magick wand.
2856 %
2857 %    o x, y, columns, rows:  These values define the perimeter
2858 %      of a region of pixels you want to extract.
2859 %
2860 %    o map:  This string reflects the expected ordering of the pixel array.
2861 %      It can be any combination or order of R = red, G = green, B = blue,
2862 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2863 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2864 %      P = pad.
2865 %
2866 %    o storage: Define the data type of the pixels.  Float and double types are
2867 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2868 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2869 %      LongPixel, QuantumPixel, or ShortPixel.
2870 %
2871 %    o pixels: This array of values contain the pixel components as defined by
2872 %      map and type.  You must preallocate this array where the expected
2873 %      length varies depending on the values of width, height, map, and type.
2874 %
2875 */
2876 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2877   const ssize_t x,const ssize_t y,const size_t columns,
2878   const size_t rows,const char *map,const StorageType storage,
2879   void *pixels)
2880 {
2881   MagickBooleanType
2882     status;
2883
2884   assert(wand != (MagickWand *) NULL);
2885   assert(wand->signature == WandSignature);
2886   if (wand->debug != MagickFalse)
2887     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2888   if (wand->images == (Image *) NULL)
2889     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2890   status=ExportImagePixels(wand->images,x,y,columns,rows,map,
2891     storage,pixels,wand->exception);
2892   if (status == MagickFalse)
2893     InheritException(wand->exception,&wand->images->exception);
2894   return(status);
2895 }
2896 \f
2897 /*
2898 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2899 %                                                                             %
2900 %                                                                             %
2901 %                                                                             %
2902 %   M a g i c k E x t e n t I m a g e                                         %
2903 %                                                                             %
2904 %                                                                             %
2905 %                                                                             %
2906 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2907 %
2908 %  MagickExtentImage() extends the image as defined by the geometry, gravity,
2909 %  and wand background color.  Set the (x,y) offset of the geometry to move
2910 %  the original wand relative to the extended wand.
2911 %
2912 %  The format of the MagickExtentImage method is:
2913 %
2914 %      MagickBooleanType MagickExtentImage(MagickWand *wand,
2915 %        const size_t width,const size_t height,const ssize_t x,
2916 %        const ssize_t y)
2917 %
2918 %  A description of each parameter follows:
2919 %
2920 %    o wand: the magick wand.
2921 %
2922 %    o width: the region width.
2923 %
2924 %    o height: the region height.
2925 %
2926 %    o x: the region x offset.
2927 %
2928 %    o y: the region y offset.
2929 %
2930 */
2931 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
2932   const size_t width,const size_t height,const ssize_t x,
2933   const ssize_t y)
2934 {
2935   Image
2936     *extent_image;
2937
2938   RectangleInfo
2939     extent;
2940
2941   assert(wand != (MagickWand *) NULL);
2942   assert(wand->signature == WandSignature);
2943   if (wand->debug != MagickFalse)
2944     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2945   if (wand->images == (Image *) NULL)
2946     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2947   extent.width=width;
2948   extent.height=height;
2949   extent.x=x;
2950   extent.y=y;
2951   extent_image=ExtentImage(wand->images,&extent,wand->exception);
2952   if (extent_image == (Image *) NULL)
2953     return(MagickFalse);
2954   ReplaceImageInList(&wand->images,extent_image);
2955   return(MagickTrue);
2956 }
2957 \f
2958 /*
2959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2960 %                                                                             %
2961 %                                                                             %
2962 %                                                                             %
2963 %   M a g i c k F l i p I m a g e                                             %
2964 %                                                                             %
2965 %                                                                             %
2966 %                                                                             %
2967 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2968 %
2969 %  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
2970 %  around the central x-axis.
2971 %
2972 %  The format of the MagickFlipImage method is:
2973 %
2974 %      MagickBooleanType MagickFlipImage(MagickWand *wand)
2975 %
2976 %  A description of each parameter follows:
2977 %
2978 %    o wand: the magick wand.
2979 %
2980 */
2981 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
2982 {
2983   Image
2984     *flip_image;
2985
2986   assert(wand != (MagickWand *) NULL);
2987   assert(wand->signature == WandSignature);
2988   if (wand->debug != MagickFalse)
2989     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2990   if (wand->images == (Image *) NULL)
2991     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2992   flip_image=FlipImage(wand->images,wand->exception);
2993   if (flip_image == (Image *) NULL)
2994     return(MagickFalse);
2995   ReplaceImageInList(&wand->images,flip_image);
2996   return(MagickTrue);
2997 }
2998 \f
2999 /*
3000 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3001 %                                                                             %
3002 %                                                                             %
3003 %                                                                             %
3004 %   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                         %
3005 %                                                                             %
3006 %                                                                             %
3007 %                                                                             %
3008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3009 %
3010 %  MagickFloodfillPaintImage() changes the color value of any pixel that matches
3011 %  target and is an immediate neighbor.  If the method FillToBorderMethod is
3012 %  specified, the color value is changed for any neighbor pixel that does not
3013 %  match the bordercolor member of image.
3014 %
3015 %  The format of the MagickFloodfillPaintImage method is:
3016 %
3017 %      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3018 %        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3019 %        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3020 %
3021 %  A description of each parameter follows:
3022 %
3023 %    o wand: the magick wand.
3024 %
3025 %    o fill: the floodfill color pixel wand.
3026 %
3027 %    o fuzz: By default target must match a particular pixel color
3028 %      exactly.  However, in many cases two colors may differ by a small amount.
3029 %      The fuzz member of image defines how much tolerance is acceptable to
3030 %      consider two colors as the same.  For example, set fuzz to 10 and the
3031 %      color red at intensities of 100 and 102 respectively are now interpreted
3032 %      as the same color for the purposes of the floodfill.
3033 %
3034 %    o bordercolor: the border color pixel wand.
3035 %
3036 %    o x,y: the starting location of the operation.
3037 %
3038 %    o invert: paint any pixel that does not match the target color.
3039 %
3040 */
3041 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3042   const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3043   const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3044 {
3045   DrawInfo
3046     *draw_info;
3047
3048   MagickBooleanType
3049     status;
3050
3051   PixelInfo
3052     target;
3053
3054   assert(wand != (MagickWand *) NULL);
3055   assert(wand->signature == WandSignature);
3056   if (wand->debug != MagickFalse)
3057     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3058   if (wand->images == (Image *) NULL)
3059     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3060   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3061   PixelGetQuantumPacket(fill,&draw_info->fill);
3062   (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
3063     y % wand->images->rows,&target,wand->exception);
3064   if (bordercolor != (PixelWand *) NULL)
3065     PixelGetMagickColor(bordercolor,&target);
3066   wand->images->fuzz=fuzz;
3067   status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3068     &wand->images->exception);
3069   draw_info=DestroyDrawInfo(draw_info);
3070   return(status);
3071 }
3072 \f
3073 /*
3074 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3075 %                                                                             %
3076 %                                                                             %
3077 %                                                                             %
3078 %   M a g i c k F l o p I m a g e                                             %
3079 %                                                                             %
3080 %                                                                             %
3081 %                                                                             %
3082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3083 %
3084 %  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3085 %  around the central y-axis.
3086 %
3087 %  The format of the MagickFlopImage method is:
3088 %
3089 %      MagickBooleanType MagickFlopImage(MagickWand *wand)
3090 %
3091 %  A description of each parameter follows:
3092 %
3093 %    o wand: the magick wand.
3094 %
3095 */
3096 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3097 {
3098   Image
3099     *flop_image;
3100
3101   assert(wand != (MagickWand *) NULL);
3102   assert(wand->signature == WandSignature);
3103   if (wand->debug != MagickFalse)
3104     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3105   if (wand->images == (Image *) NULL)
3106     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3107   flop_image=FlopImage(wand->images,wand->exception);
3108   if (flop_image == (Image *) NULL)
3109     return(MagickFalse);
3110   ReplaceImageInList(&wand->images,flop_image);
3111   return(MagickTrue);
3112 }
3113 \f
3114 /*
3115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3116 %                                                                             %
3117 %                                                                             %
3118 %                                                                             %
3119 %   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                     %
3120 %                                                                             %
3121 %                                                                             %
3122 %                                                                             %
3123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3124 %
3125 %  MagickForwardFourierTransformImage() implements the discrete Fourier
3126 %  transform (DFT) of the image either as a magnitude / phase or real /
3127 %  imaginary image pair.
3128 %
3129 %  The format of the MagickForwardFourierTransformImage method is:
3130 %
3131 %      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3132 %        const MagickBooleanType magnitude)
3133 %
3134 %  A description of each parameter follows:
3135 %
3136 %    o wand: the magick wand.
3137 %
3138 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3139 %      imaginary image pair.
3140 %
3141 */
3142 WandExport MagickBooleanType MagickForwardFourierTransformImage(
3143   MagickWand *wand,const MagickBooleanType magnitude)
3144 {
3145   Image
3146     *forward_image;
3147
3148   assert(wand != (MagickWand *) NULL);
3149   assert(wand->signature == WandSignature);
3150   if (wand->debug != MagickFalse)
3151     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3152   if (wand->images == (Image *) NULL)
3153     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3154   forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3155     wand->exception);
3156   if (forward_image == (Image *) NULL)
3157     return(MagickFalse);
3158   ReplaceImageInList(&wand->images,forward_image);
3159   return(MagickTrue);
3160 }
3161 \f
3162 /*
3163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3164 %                                                                             %
3165 %                                                                             %
3166 %                                                                             %
3167 %   M a g i c k F r a m e I m a g e                                           %
3168 %                                                                             %
3169 %                                                                             %
3170 %                                                                             %
3171 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3172 %
3173 %  MagickFrameImage() adds a simulated three-dimensional border around the
3174 %  image.  The width and height specify the border width of the vertical and
3175 %  horizontal sides of the frame.  The inner and outer bevels indicate the
3176 %  width of the inner and outer shadows of the frame.
3177 %
3178 %  The format of the MagickFrameImage method is:
3179 %
3180 %      MagickBooleanType MagickFrameImage(MagickWand *wand,
3181 %        const PixelWand *matte_color,const size_t width,
3182 %        const size_t height,const ssize_t inner_bevel,
3183 %        const ssize_t outer_bevel,const CompositeOperator compose)
3184 %
3185 %  A description of each parameter follows:
3186 %
3187 %    o wand: the magick wand.
3188 %
3189 %    o matte_color: the frame color pixel wand.
3190 %
3191 %    o width: the border width.
3192 %
3193 %    o height: the border height.
3194 %
3195 %    o inner_bevel: the inner bevel width.
3196 %
3197 %    o outer_bevel: the outer bevel width.
3198 %
3199 %    o compose: the composite operator.
3200 %
3201 */
3202 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3203   const PixelWand *matte_color,const size_t width,const size_t height,
3204   const ssize_t inner_bevel,const ssize_t outer_bevel,
3205   const CompositeOperator compose)
3206 {
3207   Image
3208     *frame_image;
3209
3210   FrameInfo
3211     frame_info;
3212
3213   assert(wand != (MagickWand *) NULL);
3214   assert(wand->signature == WandSignature);
3215   if (wand->debug != MagickFalse)
3216     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3217   if (wand->images == (Image *) NULL)
3218     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3219   (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3220   frame_info.width=wand->images->columns+2*width;
3221   frame_info.height=wand->images->rows+2*height;
3222   frame_info.x=(ssize_t) width;
3223   frame_info.y=(ssize_t) height;
3224   frame_info.inner_bevel=inner_bevel;
3225   frame_info.outer_bevel=outer_bevel;
3226   PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3227   frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3228   if (frame_image == (Image *) NULL)
3229     return(MagickFalse);
3230   ReplaceImageInList(&wand->images,frame_image);
3231   return(MagickTrue);
3232 }
3233 \f
3234 /*
3235 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3236 %                                                                             %
3237 %                                                                             %
3238 %                                                                             %
3239 %   M a g i c k F u n c t i o n I m a g e                                     %
3240 %                                                                             %
3241 %                                                                             %
3242 %                                                                             %
3243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3244 %
3245 %  MagickFunctionImage() applys an arithmetic, relational, or logical
3246 %  expression to an image.  Use these operators to lighten or darken an image,
3247 %  to increase or decrease contrast in an image, or to produce the "negative"
3248 %  of an image.
3249 %
3250 %  The format of the MagickFunctionImage method is:
3251 %
3252 %      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3253 %        const MagickFunction function,const size_t number_arguments,
3254 %        const double *arguments)
3255 %
3256 %  A description of each parameter follows:
3257 %
3258 %    o wand: the magick wand.
3259 %
3260 %    o function: the image function.
3261 %
3262 %    o number_arguments: the number of function arguments.
3263 %
3264 %    o arguments: the function arguments.
3265 %
3266 */
3267 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3268   const MagickFunction function,const size_t number_arguments,
3269   const double *arguments)
3270 {
3271   MagickBooleanType
3272     status;
3273
3274   assert(wand != (MagickWand *) NULL);
3275   assert(wand->signature == WandSignature);
3276   if (wand->debug != MagickFalse)
3277     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3278   if (wand->images == (Image *) NULL)
3279     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3280   status=FunctionImage(wand->images,function,number_arguments,arguments,
3281     &wand->images->exception);
3282   return(status);
3283 }
3284 \f
3285 /*
3286 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3287 %                                                                             %
3288 %                                                                             %
3289 %                                                                             %
3290 %   M a g i c k F x I m a g e                                                 %
3291 %                                                                             %
3292 %                                                                             %
3293 %                                                                             %
3294 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3295 %
3296 %  MagickFxImage() evaluate expression for each pixel in the image.
3297 %
3298 %  The format of the MagickFxImage method is:
3299 %
3300 %      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3301 %
3302 %  A description of each parameter follows:
3303 %
3304 %    o wand: the magick wand.
3305 %
3306 %    o expression: the expression.
3307 %
3308 */
3309 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3310 {
3311   Image
3312     *fx_image;
3313
3314   assert(wand != (MagickWand *) NULL);
3315   assert(wand->signature == WandSignature);
3316   if (wand->debug != MagickFalse)
3317     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3318   if (wand->images == (Image *) NULL)
3319     return((MagickWand *) NULL);
3320   fx_image=FxImage(wand->images,expression,wand->exception);
3321   if (fx_image == (Image *) NULL)
3322     return((MagickWand *) NULL);
3323   return(CloneMagickWandFromImages(wand,fx_image));
3324 }
3325 \f
3326 /*
3327 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3328 %                                                                             %
3329 %                                                                             %
3330 %                                                                             %
3331 %   M a g i c k G a m m a I m a g e                                           %
3332 %                                                                             %
3333 %                                                                             %
3334 %                                                                             %
3335 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3336 %
3337 %  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3338 %  different devices will have perceptual differences in the way the image's
3339 %  intensities are represented on the screen.  Specify individual gamma levels
3340 %  for the red, green, and blue channels, or adjust all three with the gamma
3341 %  parameter.  Values typically range from 0.8 to 2.3.
3342 %
3343 %  You can also reduce the influence of a particular channel with a gamma
3344 %  value of 0.
3345 %
3346 %  The format of the MagickGammaImage method is:
3347 %
3348 %      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3349 %
3350 %  A description of each parameter follows:
3351 %
3352 %    o wand: the magick wand.
3353 %
3354 %    o level: Define the level of gamma correction.
3355 %
3356 */
3357 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3358   const double gamma)
3359 {
3360   MagickBooleanType
3361     status;
3362
3363   assert(wand != (MagickWand *) NULL);
3364   assert(wand->signature == WandSignature);
3365   if (wand->debug != MagickFalse)
3366     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3367   if (wand->images == (Image *) NULL)
3368     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3369   status=GammaImage(wand->images,gamma,wand->exception);
3370   return(status);
3371 }
3372 \f
3373 /*
3374 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3375 %                                                                             %
3376 %                                                                             %
3377 %                                                                             %
3378 %   M a g i c k G a u s s i a n B l u r I m a g e                             %
3379 %                                                                             %
3380 %                                                                             %
3381 %                                                                             %
3382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3383 %
3384 %  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3385 %  Gaussian operator of the given radius and standard deviation (sigma).
3386 %  For reasonable results, the radius should be larger than sigma.  Use a
3387 %  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3388 %
3389 %  The format of the MagickGaussianBlurImage method is:
3390 %
3391 %      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3392 %        const double radius,const double sigma,const double bias)
3393 %
3394 %  A description of each parameter follows:
3395 %
3396 %    o wand: the magick wand.
3397 %
3398 %    o radius: the radius of the Gaussian, in pixels, not counting the center
3399 %      pixel.
3400 %
3401 %    o sigma: the standard deviation of the Gaussian, in pixels.
3402 %
3403 %    o bias: the bias.
3404 %
3405 */
3406 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3407   const double radius,const double sigma,const double bias)
3408 {
3409   Image
3410     *blur_image;
3411
3412   assert(wand != (MagickWand *) NULL);
3413   assert(wand->signature == WandSignature);
3414   if (wand->debug != MagickFalse)
3415     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3416   if (wand->images == (Image *) NULL)
3417     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3418   blur_image=GaussianBlurImage(wand->images,radius,sigma,bias,wand->exception);
3419   if (blur_image == (Image *) NULL)
3420     return(MagickFalse);
3421   ReplaceImageInList(&wand->images,blur_image);
3422   return(MagickTrue);
3423 }
3424 \f
3425 /*
3426 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3427 %                                                                             %
3428 %                                                                             %
3429 %                                                                             %
3430 %   M a g i c k G e t I m a g e                                               %
3431 %                                                                             %
3432 %                                                                             %
3433 %                                                                             %
3434 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3435 %
3436 %  MagickGetImage() gets the image at the current image index.
3437 %
3438 %  The format of the MagickGetImage method is:
3439 %
3440 %      MagickWand *MagickGetImage(MagickWand *wand)
3441 %
3442 %  A description of each parameter follows:
3443 %
3444 %    o wand: the magick wand.
3445 %
3446 */
3447 WandExport MagickWand *MagickGetImage(MagickWand *wand)
3448 {
3449   Image
3450     *image;
3451
3452   assert(wand != (MagickWand *) NULL);
3453   assert(wand->signature == WandSignature);
3454   if (wand->debug != MagickFalse)
3455     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3456   if (wand->images == (Image *) NULL)
3457     {
3458       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3459         "ContainsNoImages","`%s'",wand->name);
3460       return((MagickWand *) NULL);
3461     }
3462   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3463   if (image == (Image *) NULL)
3464     return((MagickWand *) NULL);
3465   return(CloneMagickWandFromImages(wand,image));
3466 }
3467 \f
3468 /*
3469 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3470 %                                                                             %
3471 %                                                                             %
3472 %                                                                             %
3473 %   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                       %
3474 %                                                                             %
3475 %                                                                             %
3476 %                                                                             %
3477 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3478 %
3479 %  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3480 %  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3481 %  than CMYKA.
3482 %
3483 %  The format of the MagickGetImageAlphaChannel method is:
3484 %
3485 %      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3486 %
3487 %  A description of each parameter follows:
3488 %
3489 %    o wand: the magick wand.
3490 %
3491 */
3492 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3493 {
3494   assert(wand != (MagickWand *) NULL);
3495   assert(wand->signature == WandSignature);
3496   if (wand->debug != MagickFalse)
3497     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3498   if (wand->images == (Image *) NULL)
3499     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3500   return(GetImageAlphaChannel(wand->images));
3501 }
3502 \f
3503 /*
3504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3505 %                                                                             %
3506 %                                                                             %
3507 %                                                                             %
3508 %   M a g i c k G e t I m a g e C l i p M a s k                               %
3509 %                                                                             %
3510 %                                                                             %
3511 %                                                                             %
3512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3513 %
3514 %  MagickGetImageClipMask() gets the image clip mask at the current image index.
3515 %
3516 %  The format of the MagickGetImageClipMask method is:
3517 %
3518 %      MagickWand *MagickGetImageClipMask(MagickWand *wand)
3519 %
3520 %  A description of each parameter follows:
3521 %
3522 %    o wand: the magick wand.
3523 %
3524 */
3525 WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
3526 {
3527   Image
3528     *image;
3529
3530   assert(wand != (MagickWand *) NULL);
3531   assert(wand->signature == WandSignature);
3532   if (wand->debug != MagickFalse)
3533     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3534   if (wand->images == (Image *) NULL)
3535     {
3536       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3537         "ContainsNoImages","`%s'",wand->name);
3538       return((MagickWand *) NULL);
3539     }
3540   image=GetImageClipMask(wand->images,wand->exception);
3541   if (image == (Image *) NULL)
3542     return((MagickWand *) NULL);
3543   return(CloneMagickWandFromImages(wand,image));
3544 }
3545 \f
3546 /*
3547 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3548 %                                                                             %
3549 %                                                                             %
3550 %                                                                             %
3551 %   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                 %
3552 %                                                                             %
3553 %                                                                             %
3554 %                                                                             %
3555 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3556 %
3557 %  MagickGetImageBackgroundColor() returns the image background color.
3558 %
3559 %  The format of the MagickGetImageBackgroundColor method is:
3560 %
3561 %      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3562 %        PixelWand *background_color)
3563 %
3564 %  A description of each parameter follows:
3565 %
3566 %    o wand: the magick wand.
3567 %
3568 %    o background_color: Return the background color.
3569 %
3570 */
3571 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3572   PixelWand *background_color)
3573 {
3574   assert(wand != (MagickWand *) NULL);
3575   assert(wand->signature == WandSignature);
3576   if (wand->debug != MagickFalse)
3577     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3578   if (wand->images == (Image *) NULL)
3579     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3580   PixelSetQuantumPacket(background_color,&wand->images->background_color);
3581   return(MagickTrue);
3582 }
3583 \f
3584 /*
3585 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3586 %                                                                             %
3587 %                                                                             %
3588 %                                                                             %
3589 %   M a g i c k G e t I m a g e B l o b                                       %
3590 %                                                                             %
3591 %                                                                             %
3592 %                                                                             %
3593 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3594 %
3595 %  MagickGetImageBlob() implements direct to memory image formats.  It returns
3596 %  the image as a blob (a formatted "file" in memory) and its length, starting
3597 %  from the current position in the image sequence.  Use MagickSetImageFormat()
3598 %  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3599 %
3600 %  Utilize MagickResetIterator() to ensure the write is from the beginning of
3601 %  the image sequence.
3602 %
3603 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
3604 %
3605 %  The format of the MagickGetImageBlob method is:
3606 %
3607 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3608 %
3609 %  A description of each parameter follows:
3610 %
3611 %    o wand: the magick wand.
3612 %
3613 %    o length: the length of the blob.
3614 %
3615 */
3616 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3617 {
3618   assert(wand != (MagickWand *) NULL);
3619   assert(wand->signature == WandSignature);
3620   if (wand->debug != MagickFalse)
3621     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3622   if (wand->images == (Image *) NULL)
3623     {
3624       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3625         "ContainsNoImages","`%s'",wand->name);
3626       return((unsigned char *) NULL);
3627     }
3628   return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3629 }
3630 \f
3631 /*
3632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3633 %                                                                             %
3634 %                                                                             %
3635 %                                                                             %
3636 %   M a g i c k G e t I m a g e s B l o b                                     %
3637 %                                                                             %
3638 %                                                                             %
3639 %                                                                             %
3640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3641 %
3642 %  MagickGetImageBlob() implements direct to memory image formats.  It
3643 %  returns the image sequence as a blob and its length.  The format of the image
3644 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3645 %  return a different image format, use MagickSetImageFormat().
3646 %
3647 %  Note, some image formats do not permit multiple images to the same image
3648 %  stream (e.g. JPEG).  in this instance, just the first image of the
3649 %  sequence is returned as a blob.
3650 %
3651 %  The format of the MagickGetImagesBlob method is:
3652 %
3653 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3654 %
3655 %  A description of each parameter follows:
3656 %
3657 %    o wand: the magick wand.
3658 %
3659 %    o length: the length of the blob.
3660 %
3661 */
3662 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3663 {
3664   unsigned char
3665     *blob;
3666
3667   assert(wand != (MagickWand *) NULL);
3668   assert(wand->signature == WandSignature);
3669   if (wand->debug != MagickFalse)
3670     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3671   if (wand->images == (Image *) NULL)
3672     {
3673       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3674         "ContainsNoImages","`%s'",wand->name);
3675       return((unsigned char *) NULL);
3676     }
3677   blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3678     wand->exception);
3679   return(blob);
3680 }
3681 \f
3682 /*
3683 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3684 %                                                                             %
3685 %                                                                             %
3686 %                                                                             %
3687 %   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                         %
3688 %                                                                             %
3689 %                                                                             %
3690 %                                                                             %
3691 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3692 %
3693 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3694 %  image.
3695 %
3696 %  The format of the MagickGetImageBluePrimary method is:
3697 %
3698 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3699 %        double *y)
3700 %
3701 %  A description of each parameter follows:
3702 %
3703 %    o wand: the magick wand.
3704 %
3705 %    o x: the chromaticity blue primary x-point.
3706 %
3707 %    o y: the chromaticity blue primary y-point.
3708 %
3709 */
3710 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3711   double *x,double *y)
3712 {
3713   assert(wand != (MagickWand *) NULL);
3714   assert(wand->signature == WandSignature);
3715   if (wand->debug != MagickFalse)
3716     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3717   if (wand->images == (Image *) NULL)
3718     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3719   *x=wand->images->chromaticity.blue_primary.x;
3720   *y=wand->images->chromaticity.blue_primary.y;
3721   return(MagickTrue);
3722 }
3723 \f
3724 /*
3725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3726 %                                                                             %
3727 %                                                                             %
3728 %                                                                             %
3729 %   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                         %
3730 %                                                                             %
3731 %                                                                             %
3732 %                                                                             %
3733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3734 %
3735 %  MagickGetImageBorderColor() returns the image border color.
3736 %
3737 %  The format of the MagickGetImageBorderColor method is:
3738 %
3739 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3740 %        PixelWand *border_color)
3741 %
3742 %  A description of each parameter follows:
3743 %
3744 %    o wand: the magick wand.
3745 %
3746 %    o border_color: Return the border color.
3747 %
3748 */
3749 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3750   PixelWand *border_color)
3751 {
3752   assert(wand != (MagickWand *) NULL);
3753   assert(wand->signature == WandSignature);
3754   if (wand->debug != MagickFalse)
3755     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3756   if (wand->images == (Image *) NULL)
3757     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3758   PixelSetQuantumPacket(border_color,&wand->images->border_color);
3759   return(MagickTrue);
3760 }
3761 \f
3762 /*
3763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3764 %                                                                             %
3765 %                                                                             %
3766 %                                                                             %
3767 %   M a g i c k G e t I m a g e F e a t u r e s                               %
3768 %                                                                             %
3769 %                                                                             %
3770 %                                                                             %
3771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3772 %
3773 %  MagickGetImageFeatures() returns features for each channel in the
3774 %  image in each of four directions (horizontal, vertical, left and right
3775 %  diagonals) for the specified distance.  The features include the angular
3776 %  second moment, contrast, correlation, sum of squares: variance, inverse
3777 %  difference moment, sum average, sum varience, sum entropy, entropy,
3778 %  difference variance, difference entropy, information measures of
3779 %  correlation 1, information measures of correlation 2, and maximum
3780 %  correlation coefficient.  You can access the red channel contrast, for
3781 %  example, like this:
3782 %
3783 %      channel_features=MagickGetImageFeatures(wand,1);
3784 %      contrast=channel_features[RedChannel].contrast[0];
3785 %
3786 %  Use MagickRelinquishMemory() to free the statistics buffer.
3787 %
3788 %  The format of the MagickGetImageFeatures method is:
3789 %
3790 %      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3791 %        const size_t distance)
3792 %
3793 %  A description of each parameter follows:
3794 %
3795 %    o wand: the magick wand.
3796 %
3797 %    o distance: the distance.
3798 %
3799 */
3800 WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3801   const size_t distance)
3802 {
3803   assert(wand != (MagickWand *) NULL);
3804   assert(wand->signature == WandSignature);
3805   if (wand->debug != MagickFalse)
3806     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3807   if (wand->images == (Image *) NULL)
3808     {
3809       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3810         "ContainsNoImages","`%s'",wand->name);
3811       return((ChannelFeatures *) NULL);
3812     }
3813   return(GetImageFeatures(wand->images,distance,wand->exception));
3814 }
3815 \f
3816 /*
3817 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3818 %                                                                             %
3819 %                                                                             %
3820 %                                                                             %
3821 %   M a g i c k G e t I m a g e K u r t o s i s                               %
3822 %                                                                             %
3823 %                                                                             %
3824 %                                                                             %
3825 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3826 %
3827 %  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
3828 %  more image channels.
3829 %
3830 %  The format of the MagickGetImageKurtosis method is:
3831 %
3832 %      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3833 %        double *kurtosis,double *skewness)
3834 %
3835 %  A description of each parameter follows:
3836 %
3837 %    o wand: the magick wand.
3838 %
3839 %    o kurtosis:  The kurtosis for the specified channel(s).
3840 %
3841 %    o skewness:  The skewness for the specified channel(s).
3842 %
3843 */
3844 WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3845   double *kurtosis,double *skewness)
3846 {
3847   MagickBooleanType
3848     status;
3849
3850   assert(wand != (MagickWand *) NULL);
3851   assert(wand->signature == WandSignature);
3852   if (wand->debug != MagickFalse)
3853     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3854   if (wand->images == (Image *) NULL)
3855     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3856   status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
3857   return(status);
3858 }
3859 \f
3860 /*
3861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3862 %                                                                             %
3863 %                                                                             %
3864 %                                                                             %
3865 %   M a g i c k G e t I m a g e M e a n                                       %
3866 %                                                                             %
3867 %                                                                             %
3868 %                                                                             %
3869 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3870 %
3871 %  MagickGetImageMean() gets the mean and standard deviation of one or more
3872 %  image channels.
3873 %
3874 %  The format of the MagickGetImageMean method is:
3875 %
3876 %      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3877 %        double *standard_deviation)
3878 %
3879 %  A description of each parameter follows:
3880 %
3881 %    o wand: the magick wand.
3882 %
3883 %    o channel: the image channel(s).
3884 %
3885 %    o mean:  The mean pixel value for the specified channel(s).
3886 %
3887 %    o standard_deviation:  The standard deviation for the specified channel(s).
3888 %
3889 */
3890 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3891   double *standard_deviation)
3892 {
3893   MagickBooleanType
3894     status;
3895
3896   assert(wand != (MagickWand *) NULL);
3897   assert(wand->signature == WandSignature);
3898   if (wand->debug != MagickFalse)
3899     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3900   if (wand->images == (Image *) NULL)
3901     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3902   status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
3903   return(status);
3904 }
3905 \f
3906 /*
3907 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3908 %                                                                             %
3909 %                                                                             %
3910 %                                                                             %
3911 %   M a g i c k G e t I m a g e R a n g e                                     %
3912 %                                                                             %
3913 %                                                                             %
3914 %                                                                             %
3915 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3916 %
3917 %  MagickGetImageRange() gets the range for one or more image channels.
3918 %
3919 %  The format of the MagickGetImageRange method is:
3920 %
3921 %      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
3922 %        double *maxima)
3923 %
3924 %  A description of each parameter follows:
3925 %
3926 %    o wand: the magick wand.
3927 %
3928 %    o minima:  The minimum pixel value for the specified channel(s).
3929 %
3930 %    o maxima:  The maximum pixel value for the specified channel(s).
3931 %
3932 */
3933 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
3934   double *minima,double *maxima)
3935 {
3936   MagickBooleanType
3937     status;
3938
3939   assert(wand != (MagickWand *) NULL);
3940   assert(wand->signature == WandSignature);
3941   if (wand->debug != MagickFalse)
3942     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3943   if (wand->images == (Image *) NULL)
3944     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3945   status=GetImageRange(wand->images,minima,maxima,wand->exception);
3946   return(status);
3947 }
3948 \f
3949 /*
3950 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3951 %                                                                             %
3952 %                                                                             %
3953 %                                                                             %
3954 %   M a g i c k G e t I m a g e S t a t i s t i c s                           %
3955 %                                                                             %
3956 %                                                                             %
3957 %                                                                             %
3958 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3959 %
3960 %  MagickGetImageStatistics() returns statistics for each channel in the
3961 %  image.  The statistics include the channel depth, its minima and
3962 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
3963 %  You can access the red channel mean, for example, like this:
3964 %
3965 %      channel_statistics=MagickGetImageStatistics(wand);
3966 %      red_mean=channel_statistics[RedChannel].mean;
3967 %
3968 %  Use MagickRelinquishMemory() to free the statistics buffer.
3969 %
3970 %  The format of the MagickGetImageStatistics method is:
3971 %
3972 %      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3973 %
3974 %  A description of each parameter follows:
3975 %
3976 %    o wand: the magick wand.
3977 %
3978 */
3979 WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3980 {
3981   assert(wand != (MagickWand *) NULL);
3982   assert(wand->signature == WandSignature);
3983   if (wand->debug != MagickFalse)
3984     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3985   if (wand->images == (Image *) NULL)
3986     {
3987       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3988         "ContainsNoImages","`%s'",wand->name);
3989       return((ChannelStatistics *) NULL);
3990     }
3991   return(GetImageStatistics(wand->images,wand->exception));
3992 }
3993 \f
3994 /*
3995 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3996 %                                                                             %
3997 %                                                                             %
3998 %                                                                             %
3999 %   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                     %
4000 %                                                                             %
4001 %                                                                             %
4002 %                                                                             %
4003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4004 %
4005 %  MagickGetImageColormapColor() returns the color of the specified colormap
4006 %  index.
4007 %
4008 %  The format of the MagickGetImageColormapColor method is:
4009 %
4010 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4011 %        const size_t index,PixelWand *color)
4012 %
4013 %  A description of each parameter follows:
4014 %
4015 %    o wand: the magick wand.
4016 %
4017 %    o index: the offset into the image colormap.
4018 %
4019 %    o color: Return the colormap color in this wand.
4020 %
4021 */
4022 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4023   const size_t index,PixelWand *color)
4024 {
4025   assert(wand != (MagickWand *) NULL);
4026   assert(wand->signature == WandSignature);
4027   if (wand->debug != MagickFalse)
4028     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4029   if (wand->images == (Image *) NULL)
4030     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4031   if ((wand->images->colormap == (PixelInfo *) NULL) ||
4032       (index >= wand->images->colors))
4033     {
4034       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4035         "InvalidColormapIndex","`%s'",wand->name);
4036       return(MagickFalse);
4037     }
4038   PixelSetQuantumPacket(color,wand->images->colormap+index);
4039   return(MagickTrue);
4040 }
4041 \f
4042 /*
4043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4044 %                                                                             %
4045 %                                                                             %
4046 %                                                                             %
4047 %   M a g i c k G e t I m a g e C o l o r s                                   %
4048 %                                                                             %
4049 %                                                                             %
4050 %                                                                             %
4051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4052 %
4053 %  MagickGetImageColors() gets the number of unique colors in the image.
4054 %
4055 %  The format of the MagickGetImageColors method is:
4056 %
4057 %      size_t MagickGetImageColors(MagickWand *wand)
4058 %
4059 %  A description of each parameter follows:
4060 %
4061 %    o wand: the magick wand.
4062 %
4063 */
4064 WandExport size_t MagickGetImageColors(MagickWand *wand)
4065 {
4066   assert(wand != (MagickWand *) NULL);
4067   assert(wand->signature == WandSignature);
4068   if (wand->debug != MagickFalse)
4069     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4070   if (wand->images == (Image *) NULL)
4071     {
4072       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4073         "ContainsNoImages","`%s'",wand->name);
4074       return(0);
4075     }
4076   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4077 }
4078 \f
4079 /*
4080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4081 %                                                                             %
4082 %                                                                             %
4083 %                                                                             %
4084 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4085 %                                                                             %
4086 %                                                                             %
4087 %                                                                             %
4088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4089 %
4090 %  MagickGetImageColorspace() gets the image colorspace.
4091 %
4092 %  The format of the MagickGetImageColorspace method is:
4093 %
4094 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4095 %
4096 %  A description of each parameter follows:
4097 %
4098 %    o wand: the magick wand.
4099 %
4100 */
4101 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4102 {
4103   assert(wand != (MagickWand *) NULL);
4104   assert(wand->signature == WandSignature);
4105   if (wand->debug != MagickFalse)
4106     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4107   if (wand->images == (Image *) NULL)
4108     {
4109       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4110         "ContainsNoImages","`%s'",wand->name);
4111       return(UndefinedColorspace);
4112     }
4113   return(wand->images->colorspace);
4114 }
4115 \f
4116 /*
4117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4118 %                                                                             %
4119 %                                                                             %
4120 %                                                                             %
4121 %   M a g i c k G e t I m a g e C o m p o s e                                 %
4122 %                                                                             %
4123 %                                                                             %
4124 %                                                                             %
4125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4126 %
4127 %  MagickGetImageCompose() returns the composite operator associated with the
4128 %  image.
4129 %
4130 %  The format of the MagickGetImageCompose method is:
4131 %
4132 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4133 %
4134 %  A description of each parameter follows:
4135 %
4136 %    o wand: the magick wand.
4137 %
4138 */
4139 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4140 {
4141   assert(wand != (MagickWand *) NULL);
4142   assert(wand->signature == WandSignature);
4143   if (wand->debug != MagickFalse)
4144     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4145   if (wand->images == (Image *) NULL)
4146     {
4147       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4148         "ContainsNoImages","`%s'",wand->name);
4149       return(UndefinedCompositeOp);
4150     }
4151   return(wand->images->compose);
4152 }
4153 \f
4154 /*
4155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4156 %                                                                             %
4157 %                                                                             %
4158 %                                                                             %
4159 %   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                         %
4160 %                                                                             %
4161 %                                                                             %
4162 %                                                                             %
4163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4164 %
4165 %  MagickGetImageCompression() gets the image compression.
4166 %
4167 %  The format of the MagickGetImageCompression method is:
4168 %
4169 %      CompressionType MagickGetImageCompression(MagickWand *wand)
4170 %
4171 %  A description of each parameter follows:
4172 %
4173 %    o wand: the magick wand.
4174 %
4175 */
4176 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4177 {
4178   assert(wand != (MagickWand *) NULL);
4179   assert(wand->signature == WandSignature);
4180   if (wand->debug != MagickFalse)
4181     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4182   if (wand->images == (Image *) NULL)
4183     {
4184       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4185         "ContainsNoImages","`%s'",wand->name);
4186       return(UndefinedCompression);
4187     }
4188   return(wand->images->compression);
4189 }
4190 \f
4191 /*
4192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4193 %                                                                             %
4194 %                                                                             %
4195 %                                                                             %
4196 %   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           %
4197 %                                                                             %
4198 %                                                                             %
4199 %                                                                             %
4200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4201 %
4202 %  MagickGetImageCompression() gets the image compression quality.
4203 %
4204 %  The format of the MagickGetImageCompression method is:
4205 %
4206 %      size_t MagickGetImageCompression(MagickWand *wand)
4207 %
4208 %  A description of each parameter follows:
4209 %
4210 %    o wand: the magick wand.
4211 %
4212 */
4213 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4214 {
4215   assert(wand != (MagickWand *) NULL);
4216   assert(wand->signature == WandSignature);
4217   if (wand->debug != MagickFalse)
4218     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4219   if (wand->images == (Image *) NULL)
4220     {
4221       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4222         "ContainsNoImages","`%s'",wand->name);
4223       return(0UL);
4224     }
4225   return(wand->images->quality);
4226 }
4227 \f
4228 /*
4229 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4230 %                                                                             %
4231 %                                                                             %
4232 %                                                                             %
4233 %   M a g i c k G e t I m a g e D e l a y                                     %
4234 %                                                                             %
4235 %                                                                             %
4236 %                                                                             %
4237 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4238 %
4239 %  MagickGetImageDelay() gets the image delay.
4240 %
4241 %  The format of the MagickGetImageDelay method is:
4242 %
4243 %      size_t MagickGetImageDelay(MagickWand *wand)
4244 %
4245 %  A description of each parameter follows:
4246 %
4247 %    o wand: the magick wand.
4248 %
4249 */
4250 WandExport size_t MagickGetImageDelay(MagickWand *wand)
4251 {
4252   assert(wand != (MagickWand *) NULL);
4253   assert(wand->signature == WandSignature);
4254   if (wand->debug != MagickFalse)
4255     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4256   if (wand->images == (Image *) NULL)
4257     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4258   return(wand->images->delay);
4259 }
4260 \f
4261 /*
4262 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4263 %                                                                             %
4264 %                                                                             %
4265 %                                                                             %
4266 %   M a g i c k G e t I m a g e D e p t h                                     %
4267 %                                                                             %
4268 %                                                                             %
4269 %                                                                             %
4270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4271 %
4272 %  MagickGetImageDepth() gets the image depth.
4273 %
4274 %  The format of the MagickGetImageDepth method is:
4275 %
4276 %      size_t MagickGetImageDepth(MagickWand *wand)
4277 %
4278 %  A description of each parameter follows:
4279 %
4280 %    o wand: the magick wand.
4281 %
4282 */
4283 WandExport size_t MagickGetImageDepth(MagickWand *wand)
4284 {
4285   assert(wand != (MagickWand *) NULL);
4286   assert(wand->signature == WandSignature);
4287   if (wand->debug != MagickFalse)
4288     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4289   if (wand->images == (Image *) NULL)
4290     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4291   return(GetImageDepth(wand->images,wand->exception));
4292 }
4293 \f
4294 /*
4295 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4296 %                                                                             %
4297 %                                                                             %
4298 %                                                                             %
4299 %   M a g i c k G e t I m a g e D i s p o s e                                 %
4300 %                                                                             %
4301 %                                                                             %
4302 %                                                                             %
4303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4304 %
4305 %  MagickGetImageDispose() gets the image disposal method.
4306 %
4307 %  The format of the MagickGetImageDispose method is:
4308 %
4309 %      DisposeType MagickGetImageDispose(MagickWand *wand)
4310 %
4311 %  A description of each parameter follows:
4312 %
4313 %    o wand: the magick wand.
4314 %
4315 */
4316 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4317 {
4318   assert(wand != (MagickWand *) NULL);
4319   assert(wand->signature == WandSignature);
4320   if (wand->debug != MagickFalse)
4321     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4322   if (wand->images == (Image *) NULL)
4323     {
4324       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4325         "ContainsNoImages","`%s'",wand->name);
4326       return(UndefinedDispose);
4327     }
4328   return((DisposeType) wand->images->dispose);
4329 }
4330 \f
4331 /*
4332 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4333 %                                                                             %
4334 %                                                                             %
4335 %                                                                             %
4336 %   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4337 %                                                                             %
4338 %                                                                             %
4339 %                                                                             %
4340 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4341 %
4342 %  MagickGetImageDistortion() compares an image to a reconstructed image and
4343 %  returns the specified distortion metric.
4344 %
4345 %  The format of the MagickGetImageDistortion method is:
4346 %
4347 %      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4348 %        const MagickWand *reference,const MetricType metric,
4349 %        double *distortion)
4350 %
4351 %  A description of each parameter follows:
4352 %
4353 %    o wand: the magick wand.
4354 %
4355 %    o reference: the reference wand.
4356 %
4357 %    o metric: the metric.
4358 %
4359 %    o distortion: the computed distortion between the images.
4360 %
4361 */
4362 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4363   const MagickWand *reference,const MetricType metric,double *distortion)
4364 {
4365   MagickBooleanType
4366     status;
4367
4368   assert(wand != (MagickWand *) NULL);
4369   assert(wand->signature == WandSignature);
4370   if (wand->debug != MagickFalse)
4371     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4372   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4373     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4374   status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4375     &wand->images->exception);
4376   return(status);
4377 }
4378 \f
4379 /*
4380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4381 %                                                                             %
4382 %                                                                             %
4383 %                                                                             %
4384 %   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                         %
4385 %                                                                             %
4386 %                                                                             %
4387 %                                                                             %
4388 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4389 %
4390 %  MagickGetImageDistortions() compares one or more pixel channels of an
4391 %  image to a reconstructed image and returns the specified distortion metrics.
4392 %
4393 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4394 %
4395 %  The format of the MagickGetImageDistortion method is:
4396 %
4397 %      double *MagickGetImageDistortion(MagickWand *wand,
4398 %        const MagickWand *reference,const MetricType metric)
4399 %
4400 %  A description of each parameter follows:
4401 %
4402 %    o wand: the magick wand.
4403 %
4404 %    o reference: the reference wand.
4405 %
4406 %    o metric: the metric.
4407 %
4408 */
4409 WandExport double *MagickGetImageDistortions(MagickWand *wand,
4410   const MagickWand *reference,const MetricType metric)
4411 {
4412   double
4413     *channel_distortion;
4414
4415   assert(wand != (MagickWand *) NULL);
4416   assert(wand->signature == WandSignature);
4417   if (wand->debug != MagickFalse)
4418     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4419   assert(reference != (MagickWand *) NULL);
4420   assert(reference->signature == WandSignature);
4421   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4422     {
4423       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4424         "ContainsNoImages","`%s'",wand->name);
4425       return((double *) NULL);
4426     }
4427   channel_distortion=GetImageDistortions(wand->images,reference->images,
4428     metric,&wand->images->exception);
4429   return(channel_distortion);
4430 }
4431 \f
4432 /*
4433 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4434 %                                                                             %
4435 %                                                                             %
4436 %                                                                             %
4437 %   M a g i c k G e t I m a g e F i l e n a m e                               %
4438 %                                                                             %
4439 %                                                                             %
4440 %                                                                             %
4441 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4442 %
4443 %  MagickGetImageFilename() returns the filename of a particular image in a
4444 %  sequence.
4445 %
4446 %  The format of the MagickGetImageFilename method is:
4447 %
4448 %      char *MagickGetImageFilename(MagickWand *wand)
4449 %
4450 %  A description of each parameter follows:
4451 %
4452 %    o wand: the magick wand.
4453 %
4454 */
4455 WandExport char *MagickGetImageFilename(MagickWand *wand)
4456 {
4457   assert(wand != (MagickWand *) NULL);
4458   assert(wand->signature == WandSignature);
4459   if (wand->debug != MagickFalse)
4460     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4461   if (wand->images == (Image *) NULL)
4462     {
4463       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4464         "ContainsNoImages","`%s'",wand->name);
4465       return((char *) NULL);
4466     }
4467   return(AcquireString(wand->images->filename));
4468 }
4469 \f
4470 /*
4471 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4472 %                                                                             %
4473 %                                                                             %
4474 %                                                                             %
4475 %   M a g i c k G e t I m a g e F o r m a t                                   %
4476 %                                                                             %
4477 %                                                                             %
4478 %                                                                             %
4479 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4480 %
4481 %  MagickGetImageFormat() returns the format of a particular image in a
4482 %  sequence.
4483 %
4484 %  The format of the MagickGetImageFormat method is:
4485 %
4486 %      const char *MagickGetImageFormat(MagickWand *wand)
4487 %
4488 %  A description of each parameter follows:
4489 %
4490 %    o wand: the magick wand.
4491 %
4492 */
4493 WandExport char *MagickGetImageFormat(MagickWand *wand)
4494 {
4495   assert(wand != (MagickWand *) NULL);
4496   assert(wand->signature == WandSignature);
4497   if (wand->debug != MagickFalse)
4498     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4499   if (wand->images == (Image *) NULL)
4500     {
4501       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4502         "ContainsNoImages","`%s'",wand->name);
4503       return((char *) NULL);
4504     }
4505   return(AcquireString(wand->images->magick));
4506 }
4507 \f
4508 /*
4509 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4510 %                                                                             %
4511 %                                                                             %
4512 %                                                                             %
4513 %   M a g i c k G e t I m a g e F u z z                                       %
4514 %                                                                             %
4515 %                                                                             %
4516 %                                                                             %
4517 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4518 %
4519 %  MagickGetImageFuzz() gets the image fuzz.
4520 %
4521 %  The format of the MagickGetImageFuzz method is:
4522 %
4523 %      double MagickGetImageFuzz(MagickWand *wand)
4524 %
4525 %  A description of each parameter follows:
4526 %
4527 %    o wand: the magick wand.
4528 %
4529 */
4530 WandExport double MagickGetImageFuzz(MagickWand *wand)
4531 {
4532   assert(wand != (MagickWand *) NULL);
4533   assert(wand->signature == WandSignature);
4534   if (wand->debug != MagickFalse)
4535     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4536   if (wand->images == (Image *) NULL)
4537     {
4538       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4539         "ContainsNoImages","`%s'",wand->name);
4540       return(0.0);
4541     }
4542   return(wand->images->fuzz);
4543 }
4544 \f
4545 /*
4546 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4547 %                                                                             %
4548 %                                                                             %
4549 %                                                                             %
4550 %   M a g i c k G e t I m a g e G a m m a                                     %
4551 %                                                                             %
4552 %                                                                             %
4553 %                                                                             %
4554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4555 %
4556 %  MagickGetImageGamma() gets the image gamma.
4557 %
4558 %  The format of the MagickGetImageGamma method is:
4559 %
4560 %      double MagickGetImageGamma(MagickWand *wand)
4561 %
4562 %  A description of each parameter follows:
4563 %
4564 %    o wand: the magick wand.
4565 %
4566 */
4567 WandExport double MagickGetImageGamma(MagickWand *wand)
4568 {
4569   assert(wand != (MagickWand *) NULL);
4570   assert(wand->signature == WandSignature);
4571   if (wand->debug != MagickFalse)
4572     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4573   if (wand->images == (Image *) NULL)
4574     {
4575       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4576         "ContainsNoImages","`%s'",wand->name);
4577       return(0.0);
4578     }
4579   return(wand->images->gamma);
4580 }
4581 \f
4582 /*
4583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4584 %                                                                             %
4585 %                                                                             %
4586 %                                                                             %
4587 %   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                 %
4588 %                                                                             %
4589 %                                                                             %
4590 %                                                                             %
4591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4592 %
4593 %  MagickGetImageGravity() gets the image gravity.
4594 %
4595 %  The format of the MagickGetImageGravity method is:
4596 %
4597 %      GravityType MagickGetImageGravity(MagickWand *wand)
4598 %
4599 %  A description of each parameter follows:
4600 %
4601 %    o wand: the magick wand.
4602 %
4603 */
4604 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4605 {
4606   assert(wand != (MagickWand *) NULL);
4607   assert(wand->signature == WandSignature);
4608   if (wand->debug != MagickFalse)
4609     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4610   if (wand->images == (Image *) NULL)
4611     {
4612       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4613         "ContainsNoImages","`%s'",wand->name);
4614       return(UndefinedGravity);
4615     }
4616   return(wand->images->gravity);
4617 }
4618 \f
4619 /*
4620 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4621 %                                                                             %
4622 %                                                                             %
4623 %                                                                             %
4624 %   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                       %
4625 %                                                                             %
4626 %                                                                             %
4627 %                                                                             %
4628 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4629 %
4630 %  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4631 %
4632 %  The format of the MagickGetImageGreenPrimary method is:
4633 %
4634 %      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4635 %        double *y)
4636 %
4637 %  A description of each parameter follows:
4638 %
4639 %    o wand: the magick wand.
4640 %
4641 %    o x: the chromaticity green primary x-point.
4642 %
4643 %    o y: the chromaticity green primary y-point.
4644 %
4645 */
4646 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4647   double *x,double *y)
4648 {
4649   assert(wand != (MagickWand *) NULL);
4650   assert(wand->signature == WandSignature);
4651   if (wand->debug != MagickFalse)
4652     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4653   if (wand->images == (Image *) NULL)
4654     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4655   *x=wand->images->chromaticity.green_primary.x;
4656   *y=wand->images->chromaticity.green_primary.y;
4657   return(MagickTrue);
4658 }
4659 \f
4660 /*
4661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4662 %                                                                             %
4663 %                                                                             %
4664 %                                                                             %
4665 %   M a g i c k G e t I m a g e H e i g h t                                   %
4666 %                                                                             %
4667 %                                                                             %
4668 %                                                                             %
4669 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4670 %
4671 %  MagickGetImageHeight() returns the image height.
4672 %
4673 %  The format of the MagickGetImageHeight method is:
4674 %
4675 %      size_t MagickGetImageHeight(MagickWand *wand)
4676 %
4677 %  A description of each parameter follows:
4678 %
4679 %    o wand: the magick wand.
4680 %
4681 */
4682 WandExport size_t MagickGetImageHeight(MagickWand *wand)
4683 {
4684   assert(wand != (MagickWand *) NULL);
4685   assert(wand->signature == WandSignature);
4686   if (wand->debug != MagickFalse)
4687     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4688   if (wand->images == (Image *) NULL)
4689     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4690   return(wand->images->rows);
4691 }
4692 \f
4693 /*
4694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4695 %                                                                             %
4696 %                                                                             %
4697 %                                                                             %
4698 %   M a g i c k G e t I m a g e H i s t o g r a m                             %
4699 %                                                                             %
4700 %                                                                             %
4701 %                                                                             %
4702 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4703 %
4704 %  MagickGetImageHistogram() returns the image histogram as an array of
4705 %  PixelWand wands.
4706 %
4707 %  The format of the MagickGetImageHistogram method is:
4708 %
4709 %      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4710 %        size_t *number_colors)
4711 %
4712 %  A description of each parameter follows:
4713 %
4714 %    o wand: the magick wand.
4715 %
4716 %    o number_colors: the number of unique colors in the image and the number
4717 %      of pixel wands returned.
4718 %
4719 */
4720 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4721   size_t *number_colors)
4722 {
4723   PixelInfo
4724     *histogram;
4725
4726   PixelWand
4727     **pixel_wands;
4728
4729   register ssize_t
4730     i;
4731
4732   assert(wand != (MagickWand *) NULL);
4733   assert(wand->signature == WandSignature);
4734   if (wand->debug != MagickFalse)
4735     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4736   if (wand->images == (Image *) NULL)
4737     {
4738       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4739         "ContainsNoImages","`%s'",wand->name);
4740       return((PixelWand **) NULL);
4741     }
4742   histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4743   if (histogram == (PixelInfo *) NULL)
4744     return((PixelWand **) NULL);
4745   pixel_wands=NewPixelWands(*number_colors);
4746   for (i=0; i < (ssize_t) *number_colors; i++)
4747   {
4748     PixelSetQuantumPacket(pixel_wands[i],&histogram[i]);
4749     PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4750   }
4751   histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
4752   return(pixel_wands);
4753 }
4754 \f
4755 /*
4756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4757 %                                                                             %
4758 %                                                                             %
4759 %                                                                             %
4760 %   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                 %
4761 %                                                                             %
4762 %                                                                             %
4763 %                                                                             %
4764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4765 %
4766 %  MagickGetImageInterlaceScheme() gets the image interlace scheme.
4767 %
4768 %  The format of the MagickGetImageInterlaceScheme method is:
4769 %
4770 %      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4771 %
4772 %  A description of each parameter follows:
4773 %
4774 %    o wand: the magick wand.
4775 %
4776 */
4777 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4778 {
4779   assert(wand != (MagickWand *) NULL);
4780   assert(wand->signature == WandSignature);
4781   if (wand->debug != MagickFalse)
4782     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4783   if (wand->images == (Image *) NULL)
4784     {
4785       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4786         "ContainsNoImages","`%s'",wand->name);
4787       return(UndefinedInterlace);
4788     }
4789   return(wand->images->interlace);
4790 }
4791 \f
4792 /*
4793 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4794 %                                                                             %
4795 %                                                                             %
4796 %                                                                             %
4797 %   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             %
4798 %                                                                             %
4799 %                                                                             %
4800 %                                                                             %
4801 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4802 %
4803 %  MagickGetImageInterpolateMethod() returns the interpolation method for the
4804 %  sepcified image.
4805 %
4806 %  The format of the MagickGetImageInterpolateMethod method is:
4807 %
4808 %      PixelInterpolateMethod MagickGetImagePixelInterpolateMethod(
4809 %        MagickWand *wand)
4810 %
4811 %  A description of each parameter follows:
4812 %
4813 %    o wand: the magick wand.
4814 %
4815 */
4816 WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
4817   MagickWand *wand)
4818 {
4819   assert(wand != (MagickWand *) NULL);
4820   assert(wand->signature == WandSignature);
4821   if (wand->debug != MagickFalse)
4822     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4823   if (wand->images == (Image *) NULL)
4824     {
4825       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4826         "ContainsNoImages","`%s'",wand->name);
4827       return(UndefinedInterpolatePixel);
4828     }
4829   return(wand->images->interpolate);
4830 }
4831 \f
4832 /*
4833 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4834 %                                                                             %
4835 %                                                                             %
4836 %                                                                             %
4837 %   M a g i c k G e t I m a g e I t e r a t i o n s                           %
4838 %                                                                             %
4839 %                                                                             %
4840 %                                                                             %
4841 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4842 %
4843 %  MagickGetImageIterations() gets the image iterations.
4844 %
4845 %  The format of the MagickGetImageIterations method is:
4846 %
4847 %      size_t MagickGetImageIterations(MagickWand *wand)
4848 %
4849 %  A description of each parameter follows:
4850 %
4851 %    o wand: the magick wand.
4852 %
4853 */
4854 WandExport size_t MagickGetImageIterations(MagickWand *wand)
4855 {
4856   assert(wand != (MagickWand *) NULL);
4857   assert(wand->signature == WandSignature);
4858   if (wand->debug != MagickFalse)
4859     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4860   if (wand->images == (Image *) NULL)
4861     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4862   return(wand->images->iterations);
4863 }
4864 \f
4865 /*
4866 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4867 %                                                                             %
4868 %                                                                             %
4869 %                                                                             %
4870 %   M a g i c k G e t I m a g e L e n g t h                                   %
4871 %                                                                             %
4872 %                                                                             %
4873 %                                                                             %
4874 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4875 %
4876 %  MagickGetImageLength() returns the image length in bytes.
4877 %
4878 %  The format of the MagickGetImageLength method is:
4879 %
4880 %      MagickBooleanType MagickGetImageLength(MagickWand *wand,
4881 %        MagickSizeType *length)
4882 %
4883 %  A description of each parameter follows:
4884 %
4885 %    o wand: the magick wand.
4886 %
4887 %    o length: the image length in bytes.
4888 %
4889 */
4890 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
4891   MagickSizeType *length)
4892 {
4893   assert(wand != (MagickWand *) NULL);
4894   assert(wand->signature == WandSignature);
4895   if (wand->debug != MagickFalse)
4896     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4897   if (wand->images == (Image *) NULL)
4898     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4899   *length=GetBlobSize(wand->images);
4900   return(MagickTrue);
4901 }
4902 \f
4903 /*
4904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4905 %                                                                             %
4906 %                                                                             %
4907 %                                                                             %
4908 %   M a g i c k G e t I m a g e M a t t e C o l o r                           %
4909 %                                                                             %
4910 %                                                                             %
4911 %                                                                             %
4912 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4913 %
4914 %  MagickGetImageMatteColor() returns the image matte color.
4915 %
4916 %  The format of the MagickGetImageMatteColor method is:
4917 %
4918 %      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
4919 %        PixelWand *matte_color)
4920 %
4921 %  A description of each parameter follows:
4922 %
4923 %    o wand: the magick wand.
4924 %
4925 %    o matte_color: Return the matte color.
4926 %
4927 */
4928 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
4929   PixelWand *matte_color)
4930 {
4931   assert(wand != (MagickWand *) NULL);
4932   assert(wand->signature == WandSignature);
4933   if (wand->debug != MagickFalse)
4934     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4935   if (wand->images == (Image *) NULL)
4936     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4937   PixelSetQuantumPacket(matte_color,&wand->images->matte_color);
4938   return(MagickTrue);
4939 }
4940 \f
4941 /*
4942 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4943 %                                                                             %
4944 %                                                                             %
4945 %                                                                             %
4946 %   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                         %
4947 %                                                                             %
4948 %                                                                             %
4949 %                                                                             %
4950 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4951 %
4952 %  MagickGetImageOrientation() returns the image orientation.
4953 %
4954 %  The format of the MagickGetImageOrientation method is:
4955 %
4956 %      OrientationType MagickGetImageOrientation(MagickWand *wand)
4957 %
4958 %  A description of each parameter follows:
4959 %
4960 %    o wand: the magick wand.
4961 %
4962 */
4963 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
4964 {
4965   assert(wand != (MagickWand *) NULL);
4966   assert(wand->signature == WandSignature);
4967   if (wand->debug != MagickFalse)
4968     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4969   if (wand->images == (Image *) NULL)
4970     {
4971       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4972         "ContainsNoImages","`%s'",wand->name);
4973       return(UndefinedOrientation);
4974     }
4975   return(wand->images->orientation);
4976 }
4977 \f
4978 /*
4979 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4980 %                                                                             %
4981 %                                                                             %
4982 %                                                                             %
4983 %   M a g i c k G e t I m a g e P a g e                                       %
4984 %                                                                             %
4985 %                                                                             %
4986 %                                                                             %
4987 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4988 %
4989 %  MagickGetImagePage() returns the page geometry associated with the image.
4990 %
4991 %  The format of the MagickGetImagePage method is:
4992 %
4993 %      MagickBooleanType MagickGetImagePage(MagickWand *wand,
4994 %        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4995 %
4996 %  A description of each parameter follows:
4997 %
4998 %    o wand: the magick wand.
4999 %
5000 %    o width: the page width.
5001 %
5002 %    o height: the page height.
5003 %
5004 %    o x: the page x-offset.
5005 %
5006 %    o y: the page y-offset.
5007 %
5008 */
5009 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5010   size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5011 {
5012   assert(wand != (const MagickWand *) NULL);
5013   assert(wand->signature == WandSignature);
5014   if (wand->debug != MagickFalse)
5015     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5016   if (wand->images == (Image *) NULL)
5017     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5018   *width=wand->images->page.width;
5019   *height=wand->images->page.height;
5020   *x=wand->images->page.x;
5021   *y=wand->images->page.y;
5022   return(MagickTrue);
5023 }
5024 \f
5025 /*
5026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5027 %                                                                             %
5028 %                                                                             %
5029 %                                                                             %
5030 %   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5031 %                                                                             %
5032 %                                                                             %
5033 %                                                                             %
5034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5035 %
5036 %  MagickGetImagePixelColor() returns the color of the specified pixel.
5037 %
5038 %  The format of the MagickGetImagePixelColor method is:
5039 %
5040 %      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5041 %        const ssize_t x,const ssize_t y,PixelWand *color)
5042 %
5043 %  A description of each parameter follows:
5044 %
5045 %    o wand: the magick wand.
5046 %
5047 %    o x,y: the pixel offset into the image.
5048 %
5049 %    o color: Return the colormap color in this wand.
5050 %
5051 */
5052 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5053   const ssize_t x,const ssize_t y,PixelWand *color)
5054 {
5055   register const Quantum
5056     *p;
5057
5058   CacheView
5059     *image_view;
5060
5061   assert(wand != (MagickWand *) NULL);
5062   assert(wand->signature == WandSignature);
5063   if (wand->debug != MagickFalse)
5064     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5065   if (wand->images == (Image *) NULL)
5066     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5067   image_view=AcquireCacheView(wand->images);
5068   p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5069   if (p == (const Quantum *) NULL)
5070     {
5071       image_view=DestroyCacheView(image_view);
5072       return(MagickFalse);
5073     }
5074   PixelSetQuantumPixel(wand->images,p,color);
5075   image_view=DestroyCacheView(image_view);
5076   return(MagickTrue);
5077 }
5078 \f
5079 /*
5080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5081 %                                                                             %
5082 %                                                                             %
5083 %                                                                             %
5084 %   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5085 %                                                                             %
5086 %                                                                             %
5087 %                                                                             %
5088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5089 %
5090 %  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5091 %
5092 %  The format of the MagickGetImageRedPrimary method is:
5093 %
5094 %      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5095 %        double *y)
5096 %
5097 %  A description of each parameter follows:
5098 %
5099 %    o wand: the magick wand.
5100 %
5101 %    o x: the chromaticity red primary x-point.
5102 %
5103 %    o y: the chromaticity red primary y-point.
5104 %
5105 */
5106 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5107   double *x,double *y)
5108 {
5109   assert(wand != (MagickWand *) NULL);
5110   assert(wand->signature == WandSignature);
5111   if (wand->debug != MagickFalse)
5112     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5113   if (wand->images == (Image *) NULL)
5114     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5115   *x=wand->images->chromaticity.red_primary.x;
5116   *y=wand->images->chromaticity.red_primary.y;
5117   return(MagickTrue);
5118 }
5119 \f
5120 /*
5121 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5122 %                                                                             %
5123 %                                                                             %
5124 %                                                                             %
5125 %   M a g i c k G e t I m a g e R e g i o n                                   %
5126 %                                                                             %
5127 %                                                                             %
5128 %                                                                             %
5129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5130 %
5131 %  MagickGetImageRegion() extracts a region of the image and returns it as a
5132 %  a new wand.
5133 %
5134 %  The format of the MagickGetImageRegion method is:
5135 %
5136 %      MagickWand *MagickGetImageRegion(MagickWand *wand,
5137 %        const size_t width,const size_t height,const ssize_t x,
5138 %        const ssize_t y)
5139 %
5140 %  A description of each parameter follows:
5141 %
5142 %    o wand: the magick wand.
5143 %
5144 %    o width: the region width.
5145 %
5146 %    o height: the region height.
5147 %
5148 %    o x: the region x offset.
5149 %
5150 %    o y: the region y offset.
5151 %
5152 */
5153 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5154   const size_t width,const size_t height,const ssize_t x,
5155   const ssize_t y)
5156 {
5157   Image
5158     *region_image;
5159
5160   RectangleInfo
5161     region;
5162
5163   assert(wand != (MagickWand *) NULL);
5164   assert(wand->signature == WandSignature);
5165   if (wand->debug != MagickFalse)
5166     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5167   if (wand->images == (Image *) NULL)
5168     return((MagickWand *) NULL);
5169   region.width=width;
5170   region.height=height;
5171   region.x=x;
5172   region.y=y;
5173   region_image=CropImage(wand->images,&region,wand->exception);
5174   if (region_image == (Image *) NULL)
5175     return((MagickWand *) NULL);
5176   return(CloneMagickWandFromImages(wand,region_image));
5177 }
5178 \f
5179 /*
5180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5181 %                                                                             %
5182 %                                                                             %
5183 %                                                                             %
5184 %   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                 %
5185 %                                                                             %
5186 %                                                                             %
5187 %                                                                             %
5188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5189 %
5190 %  MagickGetImageRenderingIntent() gets the image rendering intent.
5191 %
5192 %  The format of the MagickGetImageRenderingIntent method is:
5193 %
5194 %      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5195 %
5196 %  A description of each parameter follows:
5197 %
5198 %    o wand: the magick wand.
5199 %
5200 */
5201 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5202 {
5203   assert(wand != (MagickWand *) NULL);
5204   assert(wand->signature == WandSignature);
5205   if (wand->debug != MagickFalse)
5206     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5207   if (wand->images == (Image *) NULL)
5208     {
5209       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5210         "ContainsNoImages","`%s'",wand->name);
5211       return(UndefinedIntent);
5212     }
5213   return((RenderingIntent) wand->images->rendering_intent);
5214 }
5215 \f
5216 /*
5217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5218 %                                                                             %
5219 %                                                                             %
5220 %                                                                             %
5221 %   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5222 %                                                                             %
5223 %                                                                             %
5224 %                                                                             %
5225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5226 %
5227 %  MagickGetImageResolution() gets the image X and Y resolution.
5228 %
5229 %  The format of the MagickGetImageResolution method is:
5230 %
5231 %      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5232 %        double *y)
5233 %
5234 %  A description of each parameter follows:
5235 %
5236 %    o wand: the magick wand.
5237 %
5238 %    o x: the image x-resolution.
5239 %
5240 %    o y: the image y-resolution.
5241 %
5242 */
5243 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5244   double *x,double *y)
5245 {
5246   assert(wand != (MagickWand *) NULL);
5247   assert(wand->signature == WandSignature);
5248   if (wand->debug != MagickFalse)
5249     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5250   if (wand->images == (Image *) NULL)
5251     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5252   *x=wand->images->x_resolution;
5253   *y=wand->images->y_resolution;
5254   return(MagickTrue);
5255 }
5256 \f
5257 /*
5258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5259 %                                                                             %
5260 %                                                                             %
5261 %                                                                             %
5262 %   M a g i c k G e t I m a g e S c e n e                                     %
5263 %                                                                             %
5264 %                                                                             %
5265 %                                                                             %
5266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5267 %
5268 %  MagickGetImageScene() gets the image scene.
5269 %
5270 %  The format of the MagickGetImageScene method is:
5271 %
5272 %      size_t MagickGetImageScene(MagickWand *wand)
5273 %
5274 %  A description of each parameter follows:
5275 %
5276 %    o wand: the magick wand.
5277 %
5278 */
5279 WandExport size_t MagickGetImageScene(MagickWand *wand)
5280 {
5281   assert(wand != (MagickWand *) NULL);
5282   assert(wand->signature == WandSignature);
5283   if (wand->debug != MagickFalse)
5284     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5285   if (wand->images == (Image *) NULL)
5286     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5287   return(wand->images->scene);
5288 }
5289 \f
5290 /*
5291 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5292 %                                                                             %
5293 %                                                                             %
5294 %                                                                             %
5295 %   M a g i c k G e t I m a g e S i g n a t u r e                             %
5296 %                                                                             %
5297 %                                                                             %
5298 %                                                                             %
5299 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5300 %
5301 %  MagickGetImageSignature() generates an SHA-256 message digest for the image
5302 %  pixel stream.
5303 %
5304 %  The format of the MagickGetImageSignature method is:
5305 %
5306 %      const char MagickGetImageSignature(MagickWand *wand)
5307 %
5308 %  A description of each parameter follows:
5309 %
5310 %    o wand: the magick wand.
5311 %
5312 */
5313 WandExport char *MagickGetImageSignature(MagickWand *wand)
5314 {
5315   const char
5316     *value;
5317
5318   MagickBooleanType
5319     status;
5320
5321   assert(wand != (MagickWand *) NULL);
5322   assert(wand->signature == WandSignature);
5323   if (wand->debug != MagickFalse)
5324     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5325   if (wand->images == (Image *) NULL)
5326     {
5327       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5328         "ContainsNoImages","`%s'",wand->name);
5329       return((char *) NULL);
5330     }
5331   status=SignatureImage(wand->images,wand->exception);
5332   if (status == MagickFalse)
5333     return((char *) NULL);
5334   value=GetImageProperty(wand->images,"signature");
5335   if (value == (const char *) NULL)
5336     return((char *) NULL);
5337   return(AcquireString(value));
5338 }
5339 \f
5340 /*
5341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5342 %                                                                             %
5343 %                                                                             %
5344 %                                                                             %
5345 %   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                   %
5346 %                                                                             %
5347 %                                                                             %
5348 %                                                                             %
5349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5350 %
5351 %  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5352 %
5353 %  The format of the MagickGetImageTicksPerSecond method is:
5354 %
5355 %      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5356 %
5357 %  A description of each parameter follows:
5358 %
5359 %    o wand: the magick wand.
5360 %
5361 */
5362 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5363 {
5364   assert(wand != (MagickWand *) NULL);
5365   assert(wand->signature == WandSignature);
5366   if (wand->debug != MagickFalse)
5367     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5368   if (wand->images == (Image *) NULL)
5369     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5370   return((size_t) wand->images->ticks_per_second);
5371 }
5372 \f
5373 /*
5374 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5375 %                                                                             %
5376 %                                                                             %
5377 %                                                                             %
5378 %   M a g i c k G e t I m a g e T y p e                                       %
5379 %                                                                             %
5380 %                                                                             %
5381 %                                                                             %
5382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5383 %
5384 %  MagickGetImageType() gets the potential image type:
5385 %
5386 %        Bilevel        Grayscale       GrayscaleMatte
5387 %        Palette        PaletteMatte    TrueColor
5388 %        TrueColorMatte ColorSeparation ColorSeparationMatte
5389 %
5390 %  To ensure the image type matches its potential, use MagickSetImageType():
5391 %
5392 %    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5393 %
5394 %  The format of the MagickGetImageType method is:
5395 %
5396 %      ImageType MagickGetImageType(MagickWand *wand)
5397 %
5398 %  A description of each parameter follows:
5399 %
5400 %    o wand: the magick wand.
5401 %
5402 */
5403 WandExport ImageType MagickGetImageType(MagickWand *wand)
5404 {
5405   assert(wand != (MagickWand *) NULL);
5406   assert(wand->signature == WandSignature);
5407   if (wand->debug != MagickFalse)
5408     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5409   if (wand->images == (Image *) NULL)
5410     {
5411       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5412         "ContainsNoImages","`%s'",wand->name);
5413       return(UndefinedType);
5414     }
5415   return(GetImageType(wand->images,wand->exception));
5416 }
5417 \f
5418 /*
5419 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5420 %                                                                             %
5421 %                                                                             %
5422 %                                                                             %
5423 %   M a g i c k G e t I m a g e U n i t s                                     %
5424 %                                                                             %
5425 %                                                                             %
5426 %                                                                             %
5427 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5428 %
5429 %  MagickGetImageUnits() gets the image units of resolution.
5430 %
5431 %  The format of the MagickGetImageUnits method is:
5432 %
5433 %      ResolutionType MagickGetImageUnits(MagickWand *wand)
5434 %
5435 %  A description of each parameter follows:
5436 %
5437 %    o wand: the magick wand.
5438 %
5439 */
5440 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5441 {
5442   assert(wand != (MagickWand *) NULL);
5443   assert(wand->signature == WandSignature);
5444   if (wand->debug != MagickFalse)
5445     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5446   if (wand->images == (Image *) NULL)
5447     {
5448       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5449         "ContainsNoImages","`%s'",wand->name);
5450       return(UndefinedResolution);
5451     }
5452   return(wand->images->units);
5453 }
5454 \f
5455 /*
5456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5457 %                                                                             %
5458 %                                                                             %
5459 %                                                                             %
5460 %   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           %
5461 %                                                                             %
5462 %                                                                             %
5463 %                                                                             %
5464 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5465 %
5466 %  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5467 %  sepcified image.
5468 %
5469 %  The format of the MagickGetImageVirtualPixelMethod method is:
5470 %
5471 %      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5472 %
5473 %  A description of each parameter follows:
5474 %
5475 %    o wand: the magick wand.
5476 %
5477 */
5478 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5479 {
5480   assert(wand != (MagickWand *) NULL);
5481   assert(wand->signature == WandSignature);
5482   if (wand->debug != MagickFalse)
5483     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5484   if (wand->images == (Image *) NULL)
5485     {
5486       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5487         "ContainsNoImages","`%s'",wand->name);
5488       return(UndefinedVirtualPixelMethod);
5489     }
5490   return(GetImageVirtualPixelMethod(wand->images));
5491 }
5492 \f
5493 /*
5494 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5495 %                                                                             %
5496 %                                                                             %
5497 %                                                                             %
5498 %   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5499 %                                                                             %
5500 %                                                                             %
5501 %                                                                             %
5502 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5503 %
5504 %  MagickGetImageWhitePoint() returns the chromaticy white point.
5505 %
5506 %  The format of the MagickGetImageWhitePoint method is:
5507 %
5508 %      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5509 %        double *y)
5510 %
5511 %  A description of each parameter follows:
5512 %
5513 %    o wand: the magick wand.
5514 %
5515 %    o x: the chromaticity white x-point.
5516 %
5517 %    o y: the chromaticity white y-point.
5518 %
5519 */
5520 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5521   double *x,double *y)
5522 {
5523   assert(wand != (MagickWand *) NULL);
5524   assert(wand->signature == WandSignature);
5525   if (wand->debug != MagickFalse)
5526     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5527   if (wand->images == (Image *) NULL)
5528     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5529   *x=wand->images->chromaticity.white_point.x;
5530   *y=wand->images->chromaticity.white_point.y;
5531   return(MagickTrue);
5532 }
5533 \f
5534 /*
5535 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5536 %                                                                             %
5537 %                                                                             %
5538 %                                                                             %
5539 %   M a g i c k G e t I m a g e W i d t h                                     %
5540 %                                                                             %
5541 %                                                                             %
5542 %                                                                             %
5543 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5544 %
5545 %  MagickGetImageWidth() returns the image width.
5546 %
5547 %  The format of the MagickGetImageWidth method is:
5548 %
5549 %      size_t MagickGetImageWidth(MagickWand *wand)
5550 %
5551 %  A description of each parameter follows:
5552 %
5553 %    o wand: the magick wand.
5554 %
5555 */
5556 WandExport size_t MagickGetImageWidth(MagickWand *wand)
5557 {
5558   assert(wand != (MagickWand *) NULL);
5559   assert(wand->signature == WandSignature);
5560   if (wand->debug != MagickFalse)
5561     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5562   if (wand->images == (Image *) NULL)
5563     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5564   return(wand->images->columns);
5565 }
5566 \f
5567 /*
5568 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5569 %                                                                             %
5570 %                                                                             %
5571 %                                                                             %
5572 %   M a g i c k G e t N u m b e r I m a g e s                                 %
5573 %                                                                             %
5574 %                                                                             %
5575 %                                                                             %
5576 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5577 %
5578 %  MagickGetNumberImages() returns the number of images associated with a
5579 %  magick wand.
5580 %
5581 %  The format of the MagickGetNumberImages method is:
5582 %
5583 %      size_t MagickGetNumberImages(MagickWand *wand)
5584 %
5585 %  A description of each parameter follows:
5586 %
5587 %    o wand: the magick wand.
5588 %
5589 */
5590 WandExport size_t MagickGetNumberImages(MagickWand *wand)
5591 {
5592   assert(wand != (MagickWand *) NULL);
5593   assert(wand->signature == WandSignature);
5594   if (wand->debug != MagickFalse)
5595     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5596   return(GetImageListLength(wand->images));
5597 }
5598 \f
5599 /*
5600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5601 %                                                                             %
5602 %                                                                             %
5603 %                                                                             %
5604 %   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                 %
5605 %                                                                             %
5606 %                                                                             %
5607 %                                                                             %
5608 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5609 %
5610 %  MagickGetImageTotalInkDensity() gets the image total ink density.
5611 %
5612 %  The format of the MagickGetImageTotalInkDensity method is:
5613 %
5614 %      double MagickGetImageTotalInkDensity(MagickWand *wand)
5615 %
5616 %  A description of each parameter follows:
5617 %
5618 %    o wand: the magick wand.
5619 %
5620 */
5621 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5622 {
5623   assert(wand != (MagickWand *) NULL);
5624   assert(wand->signature == WandSignature);
5625   if (wand->debug != MagickFalse)
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(0.0);
5632     }
5633   return(GetImageTotalInkDensity(wand->images));
5634 }
5635 \f
5636 /*
5637 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5638 %                                                                             %
5639 %                                                                             %
5640 %                                                                             %
5641 %   M a g i c k H a l d C l u t I m a g e                                     %
5642 %                                                                             %
5643 %                                                                             %
5644 %                                                                             %
5645 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5646 %
5647 %  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5648 %  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5649 %  dimensions.  Create it with the HALD coder.  You can apply any color
5650 %  transformation to the Hald image and then use this method to apply the
5651 %  transform to the image.
5652 %
5653 %  The format of the MagickHaldClutImage method is:
5654 %
5655 %      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5656 %        const MagickWand *hald_wand)
5657 %
5658 %  A description of each parameter follows:
5659 %
5660 %    o wand: the magick wand.
5661 %
5662 %    o hald_image: the hald CLUT image.
5663 %
5664 */
5665 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5666   const MagickWand *hald_wand)
5667 {
5668   MagickBooleanType
5669     status;
5670
5671   assert(wand != (MagickWand *) NULL);
5672   assert(wand->signature == WandSignature);
5673   if (wand->debug != MagickFalse)
5674     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5675   if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5676     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5677   status=HaldClutImage(wand->images,hald_wand->images,&wand->images->exception);
5678   return(status);
5679 }
5680 \f
5681 /*
5682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5683 %                                                                             %
5684 %                                                                             %
5685 %                                                                             %
5686 %   M a g i c k H a s N e x t I m a g e                                       %
5687 %                                                                             %
5688 %                                                                             %
5689 %                                                                             %
5690 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5691 %
5692 %  MagickHasNextImage() returns MagickTrue if the wand has more images when
5693 %  traversing the list in the forward direction
5694 %
5695 %  The format of the MagickHasNextImage method is:
5696 %
5697 %      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5698 %
5699 %  A description of each parameter follows:
5700 %
5701 %    o wand: the magick wand.
5702 %
5703 */
5704 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5705 {
5706   assert(wand != (MagickWand *) NULL);
5707   assert(wand->signature == WandSignature);
5708   if (wand->debug != MagickFalse)
5709     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5710   if (wand->images == (Image *) NULL)
5711     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5712   if (GetNextImageInList(wand->images) == (Image *) NULL)
5713     return(MagickFalse);
5714   return(MagickTrue);
5715 }
5716 \f
5717 /*
5718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5719 %                                                                             %
5720 %                                                                             %
5721 %                                                                             %
5722 %   M a g i c k H a s P r e v i o u s I m a g e                               %
5723 %                                                                             %
5724 %                                                                             %
5725 %                                                                             %
5726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5727 %
5728 %  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5729 %  traversing the list in the reverse direction
5730 %
5731 %  The format of the MagickHasPreviousImage method is:
5732 %
5733 %      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5734 %
5735 %  A description of each parameter follows:
5736 %
5737 %    o wand: the magick wand.
5738 %
5739 */
5740 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5741 {
5742   assert(wand != (MagickWand *) NULL);
5743   assert(wand->signature == WandSignature);
5744   if (wand->debug != MagickFalse)
5745     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5746   if (wand->images == (Image *) NULL)
5747     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5748   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5749     return(MagickFalse);
5750   return(MagickTrue);
5751 }
5752 \f
5753 /*
5754 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5755 %                                                                             %
5756 %                                                                             %
5757 %                                                                             %
5758 %   M a g i c k I d e n t i f y I m a g e                                     %
5759 %                                                                             %
5760 %                                                                             %
5761 %                                                                             %
5762 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5763 %
5764 %  MagickIdentifyImage() identifies an image by printing its attributes to the
5765 %  file.  Attributes include the image width, height, size, and others.
5766 %
5767 %  The format of the MagickIdentifyImage method is:
5768 %
5769 %      const char *MagickIdentifyImage(MagickWand *wand)
5770 %
5771 %  A description of each parameter follows:
5772 %
5773 %    o wand: the magick wand.
5774 %
5775 */
5776 WandExport char *MagickIdentifyImage(MagickWand *wand)
5777 {
5778   char
5779     *description,
5780     filename[MaxTextExtent];
5781
5782   FILE
5783     *file;
5784
5785   int
5786     unique_file;
5787
5788   assert(wand != (MagickWand *) NULL);
5789   assert(wand->signature == WandSignature);
5790   if (wand->debug != MagickFalse)
5791     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5792   if (wand->images == (Image *) NULL)
5793     {
5794       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5795         "ContainsNoImages","`%s'",wand->name);
5796       return((char *) NULL);
5797     }
5798   description=(char *) NULL;
5799   unique_file=AcquireUniqueFileResource(filename);
5800   file=(FILE *) NULL;
5801   if (unique_file != -1)
5802     file=fdopen(unique_file,"wb");
5803   if ((unique_file == -1) || (file == (FILE *) NULL))
5804     {
5805       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5806         "UnableToCreateTemporaryFile","`%s'",wand->name);
5807       return((char *) NULL);
5808     }
5809   (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
5810   (void) fclose(file);
5811   description=FileToString(filename,~0,wand->exception);
5812   (void) RelinquishUniqueFileResource(filename);
5813   return(description);
5814 }
5815 \f
5816 /*
5817 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5818 %                                                                             %
5819 %                                                                             %
5820 %                                                                             %
5821 %   M a g i c k I m p l o d e I m a g e                                       %
5822 %                                                                             %
5823 %                                                                             %
5824 %                                                                             %
5825 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5826 %
5827 %  MagickImplodeImage() creates a new image that is a copy of an existing
5828 %  one with the image pixels "implode" by the specified percentage.  It
5829 %  allocates the memory necessary for the new Image structure and returns a
5830 %  pointer to the new image.
5831 %
5832 %  The format of the MagickImplodeImage method is:
5833 %
5834 %      MagickBooleanType MagickImplodeImage(MagickWand *wand,
5835 %        const double radius,const PixelInterpolateMethod method)
5836 %
5837 %  A description of each parameter follows:
5838 %
5839 %    o wand: the magick wand.
5840 %
5841 %    o amount: Define the extent of the implosion.
5842 %
5843 %    o method: the pixel interpolation method.
5844 %
5845 */
5846 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
5847   const double amount,const PixelInterpolateMethod method)
5848 {
5849   Image
5850     *implode_image;
5851
5852   assert(wand != (MagickWand *) NULL);
5853   assert(wand->signature == WandSignature);
5854   if (wand->debug != MagickFalse)
5855     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5856   if (wand->images == (Image *) NULL)
5857     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5858   implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
5859   if (implode_image == (Image *) NULL)
5860     return(MagickFalse);
5861   ReplaceImageInList(&wand->images,implode_image);
5862   return(MagickTrue);
5863 }
5864 \f
5865 /*
5866 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5867 %                                                                             %
5868 %                                                                             %
5869 %                                                                             %
5870 %   M a g i c k I m p o r t I m a g e P i x e l s                             %
5871 %                                                                             %
5872 %                                                                             %
5873 %                                                                             %
5874 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5875 %
5876 %  MagickImportImagePixels() accepts pixel datand stores it in the image at the
5877 %  location you specify.  The method returns MagickFalse on success otherwise
5878 %  MagickTrue if an error is encountered.  The pixel data can be either char,
5879 %  short int, int, ssize_t, float, or double in the order specified by map.
5880 %
5881 %  Suppose your want to upload the first scanline of a 640x480 image from
5882 %  character data in red-green-blue order:
5883 %
5884 %      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
5885 %
5886 %  The format of the MagickImportImagePixels method is:
5887 %
5888 %      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5889 %        const ssize_t x,const ssize_t y,const size_t columns,
5890 %        const size_t rows,const char *map,const StorageType storage,
5891 %        const void *pixels)
5892 %
5893 %  A description of each parameter follows:
5894 %
5895 %    o wand: the magick wand.
5896 %
5897 %    o x, y, columns, rows:  These values define the perimeter of a region
5898 %      of pixels you want to define.
5899 %
5900 %    o map:  This string reflects the expected ordering of the pixel array.
5901 %      It can be any combination or order of R = red, G = green, B = blue,
5902 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
5903 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
5904 %      P = pad.
5905 %
5906 %    o storage: Define the data type of the pixels.  Float and double types are
5907 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
5908 %      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
5909 %      or DoublePixel.
5910 %
5911 %    o pixels: This array of values contain the pixel components as defined by
5912 %      map and type.  You must preallocate this array where the expected
5913 %      length varies depending on the values of width, height, map, and type.
5914 %
5915 */
5916 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5917   const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
5918   const char *map,const StorageType storage,const void *pixels)
5919 {
5920   MagickBooleanType
5921     status;
5922
5923   assert(wand != (MagickWand *) NULL);
5924   assert(wand->signature == WandSignature);
5925   if (wand->debug != MagickFalse)
5926     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5927   if (wand->images == (Image *) NULL)
5928     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5929   status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
5930     wand->exception);
5931   return(status);
5932 }
5933 \f
5934 /*
5935 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5936 %                                                                             %
5937 %                                                                             %
5938 %                                                                             %
5939 %   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       %
5940 %                                                                             %
5941 %                                                                             %
5942 %                                                                             %
5943 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5944 %
5945 %  MagickInverseFourierTransformImage() implements the inverse discrete
5946 %  Fourier transform (DFT) of the image either as a magnitude / phase or real /
5947 %  imaginary image pair.
5948 %
5949 %  The format of the MagickInverseFourierTransformImage method is:
5950 %
5951 %      MagickBooleanType MagickInverseFourierTransformImage(
5952 %        MagickWand *magnitude_wand,MagickWand *phase_wand,
5953 %        const MagickBooleanType magnitude)
5954 %
5955 %  A description of each parameter follows:
5956 %
5957 %    o magnitude_wand: the magnitude or real wand.
5958 %
5959 %    o phase_wand: the phase or imaginary wand.
5960 %
5961 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
5962 %      imaginary image pair.
5963 %
5964 */
5965 WandExport MagickBooleanType MagickInverseFourierTransformImage(
5966   MagickWand *magnitude_wand,MagickWand *phase_wand,
5967   const MagickBooleanType magnitude)
5968 {
5969   Image
5970     *inverse_image;
5971
5972   MagickWand
5973     *wand;
5974
5975   assert(magnitude_wand != (MagickWand *) NULL);
5976   assert(magnitude_wand->signature == WandSignature);
5977   if (magnitude_wand->debug != MagickFalse)
5978     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
5979       magnitude_wand->name);
5980   wand=magnitude_wand;
5981   if (magnitude_wand->images == (Image *) NULL)
5982     ThrowWandException(WandError,"ContainsNoImages",
5983       magnitude_wand->name);
5984   assert(phase_wand != (MagickWand *) NULL);
5985   assert(phase_wand->signature == WandSignature);
5986   inverse_image=InverseFourierTransformImage(magnitude_wand->images,
5987     phase_wand->images,magnitude,wand->exception);
5988   if (inverse_image == (Image *) NULL)
5989     return(MagickFalse);
5990   ReplaceImageInList(&wand->images,inverse_image);
5991   return(MagickTrue);
5992 }
5993 \f
5994 /*
5995 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5996 %                                                                             %
5997 %                                                                             %
5998 %                                                                             %
5999 %   M a g i c k L a b e l I m a g e                                           %
6000 %                                                                             %
6001 %                                                                             %
6002 %                                                                             %
6003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6004 %
6005 %  MagickLabelImage() adds a label to your image.
6006 %
6007 %  The format of the MagickLabelImage method is:
6008 %
6009 %      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6010 %
6011 %  A description of each parameter follows:
6012 %
6013 %    o wand: the magick wand.
6014 %
6015 %    o label: the image label.
6016 %
6017 */
6018 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6019   const char *label)
6020 {
6021   MagickBooleanType
6022     status;
6023
6024   assert(wand != (MagickWand *) NULL);
6025   assert(wand->signature == WandSignature);
6026   if (wand->debug != MagickFalse)
6027     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6028   if (wand->images == (Image *) NULL)
6029     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6030   status=SetImageProperty(wand->images,"label",label);
6031   if (status == MagickFalse)
6032     InheritException(wand->exception,&wand->images->exception);
6033   return(status);
6034 }
6035 \f
6036 /*
6037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6038 %                                                                             %
6039 %                                                                             %
6040 %                                                                             %
6041 %   M a g i c k L e v e l I m a g e                                           %
6042 %                                                                             %
6043 %                                                                             %
6044 %                                                                             %
6045 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6046 %
6047 %  MagickLevelImage() adjusts the levels of an image by scaling the colors
6048 %  falling between specified white and black points to the full available
6049 %  quantum range. The parameters provided represent the black, mid, and white
6050 %  points. The black point specifies the darkest color in the image. Colors
6051 %  darker than the black point are set to zero. Mid point specifies a gamma
6052 %  correction to apply to the image.  White point specifies the lightest color
6053 %  in the image. Colors brighter than the white point are set to the maximum
6054 %  quantum value.
6055 %
6056 %  The format of the MagickLevelImage method is:
6057 %
6058 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6059 %        const double black_point,const double gamma,const double white_point)
6060 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6061 %        const ChannelType channel,const double black_point,const double gamma,
6062 %        const double white_point)
6063 %
6064 %  A description of each parameter follows:
6065 %
6066 %    o wand: the magick wand.
6067 %
6068 %    o channel: Identify which channel to level: RedChannel, GreenChannel,
6069 %
6070 %    o black_point: the black point.
6071 %
6072 %    o gamma: the gamma.
6073 %
6074 %    o white_point: the white point.
6075 %
6076 */
6077 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6078   const double black_point,const double gamma,const double white_point)
6079 {
6080   MagickBooleanType
6081     status;
6082
6083   assert(wand != (MagickWand *) NULL);
6084   assert(wand->signature == WandSignature);
6085   if (wand->debug != MagickFalse)
6086     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6087   if (wand->images == (Image *) NULL)
6088     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6089   status=LevelImage(wand->images,black_point,white_point,gamma,
6090     &wand->images->exception);
6091   return(status);
6092 }
6093 \f
6094 /*
6095 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6096 %                                                                             %
6097 %                                                                             %
6098 %                                                                             %
6099 %   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6100 %                                                                             %
6101 %                                                                             %
6102 %                                                                             %
6103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6104 %
6105 %  MagickLinearStretchImage() stretches with saturation the image intensity.
6106 %
6107 %  You can also reduce the influence of a particular channel with a gamma
6108 %  value of 0.
6109 %
6110 %  The format of the MagickLinearStretchImage method is:
6111 %
6112 %      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6113 %        const double black_point,const double white_point)
6114 %
6115 %  A description of each parameter follows:
6116 %
6117 %    o wand: the magick wand.
6118 %
6119 %    o black_point: the black point.
6120 %
6121 %    o white_point: the white point.
6122 %
6123 */
6124 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6125   const double black_point,const double white_point)
6126 {
6127   MagickBooleanType
6128     status;
6129
6130   assert(wand != (MagickWand *) NULL);
6131   assert(wand->signature == WandSignature);
6132   if (wand->debug != MagickFalse)
6133     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6134   if (wand->images == (Image *) NULL)
6135     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6136   status=LinearStretchImage(wand->images,black_point,white_point,
6137     &wand->images->exception);
6138   return(status);
6139 }
6140 \f
6141 /*
6142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6143 %                                                                             %
6144 %                                                                             %
6145 %                                                                             %
6146 %   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6147 %                                                                             %
6148 %                                                                             %
6149 %                                                                             %
6150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6151 %
6152 %  MagickLiquidRescaleImage() rescales image with seam carving.
6153 %
6154 %      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6155 %        const size_t columns,const size_t rows,
6156 %        const double delta_x,const double rigidity)
6157 %
6158 %  A description of each parameter follows:
6159 %
6160 %    o wand: the magick wand.
6161 %
6162 %    o columns: the number of columns in the scaled image.
6163 %
6164 %    o rows: the number of rows in the scaled image.
6165 %
6166 %    o delta_x: maximum seam transversal step (0 means straight seams).
6167 %
6168 %    o rigidity: introduce a bias for non-straight seams (typically 0).
6169 %
6170 */
6171 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6172   const size_t columns,const size_t rows,const double delta_x,
6173   const double rigidity)
6174 {
6175   Image
6176     *rescale_image;
6177
6178   assert(wand != (MagickWand *) NULL);
6179   assert(wand->signature == WandSignature);
6180   if (wand->debug != MagickFalse)
6181     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6182   if (wand->images == (Image *) NULL)
6183     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6184   rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6185     rigidity,wand->exception);
6186   if (rescale_image == (Image *) NULL)
6187     return(MagickFalse);
6188   ReplaceImageInList(&wand->images,rescale_image);
6189   return(MagickTrue);
6190 }
6191 \f
6192 /*
6193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6194 %                                                                             %
6195 %                                                                             %
6196 %                                                                             %
6197 %   M a g i c k M a g n i f y I m a g e                                       %
6198 %                                                                             %
6199 %                                                                             %
6200 %                                                                             %
6201 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6202 %
6203 %  MagickMagnifyImage() is a convenience method that scales an image
6204 %  proportionally to twice its original size.
6205 %
6206 %  The format of the MagickMagnifyImage method is:
6207 %
6208 %      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6209 %
6210 %  A description of each parameter follows:
6211 %
6212 %    o wand: the magick wand.
6213 %
6214 */
6215 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6216 {
6217   Image
6218     *magnify_image;
6219
6220   assert(wand != (MagickWand *) NULL);
6221   assert(wand->signature == WandSignature);
6222   if (wand->debug != MagickFalse)
6223     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6224   if (wand->images == (Image *) NULL)
6225     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6226   magnify_image=MagnifyImage(wand->images,wand->exception);
6227   if (magnify_image == (Image *) NULL)
6228     return(MagickFalse);
6229   ReplaceImageInList(&wand->images,magnify_image);
6230   return(MagickTrue);
6231 }
6232 \f
6233 /*
6234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6235 %                                                                             %
6236 %                                                                             %
6237 %                                                                             %
6238 %   M a g i c k M e r g e I m a g e L a y e r s                               %
6239 %                                                                             %
6240 %                                                                             %
6241 %                                                                             %
6242 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6243 %
6244 %  MagickMergeImageLayers() composes all the image layers from the current
6245 %  given image onward to produce a single image of the merged layers.
6246 %
6247 %  The inital canvas's size depends on the given ImageLayerMethod, and is
6248 %  initialized using the first images background color.  The images
6249 %  are then compositied onto that image in sequence using the given
6250 %  composition that has been assigned to each individual image.
6251 %
6252 %  The format of the MagickMergeImageLayers method is:
6253 %
6254 %      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6255 %        const ImageLayerMethod method)
6256 %
6257 %  A description of each parameter follows:
6258 %
6259 %    o wand: the magick wand.
6260 %
6261 %    o method: the method of selecting the size of the initial canvas.
6262 %
6263 %        MergeLayer: Merge all layers onto a canvas just large enough
6264 %           to hold all the actual images. The virtual canvas of the
6265 %           first image is preserved but otherwise ignored.
6266 %
6267 %        FlattenLayer: Use the virtual canvas size of first image.
6268 %           Images which fall outside this canvas is clipped.
6269 %           This can be used to 'fill out' a given virtual canvas.
6270 %
6271 %        MosaicLayer: Start with the virtual canvas of the first image,
6272 %           enlarging left and right edges to contain all images.
6273 %           Images with negative offsets will be clipped.
6274 %
6275 */
6276 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6277   const ImageLayerMethod method)
6278 {
6279   Image
6280     *mosaic_image;
6281
6282   assert(wand != (MagickWand *) NULL);
6283   assert(wand->signature == WandSignature);
6284   if (wand->debug != MagickFalse)
6285     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6286   if (wand->images == (Image *) NULL)
6287     return((MagickWand *) NULL);
6288   mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6289   if (mosaic_image == (Image *) NULL)
6290     return((MagickWand *) NULL);
6291   return(CloneMagickWandFromImages(wand,mosaic_image));
6292 }
6293 \f
6294 /*
6295 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6296 %                                                                             %
6297 %                                                                             %
6298 %                                                                             %
6299 %   M a g i c k M i n i f y I m a g e                                         %
6300 %                                                                             %
6301 %                                                                             %
6302 %                                                                             %
6303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6304 %
6305 %  MagickMinifyImage() is a convenience method that scales an image
6306 %  proportionally to one-half its original size
6307 %
6308 %  The format of the MagickMinifyImage method is:
6309 %
6310 %      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6311 %
6312 %  A description of each parameter follows:
6313 %
6314 %    o wand: the magick wand.
6315 %
6316 */
6317 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6318 {
6319   Image
6320     *minify_image;
6321
6322   assert(wand != (MagickWand *) NULL);
6323   assert(wand->signature == WandSignature);
6324   if (wand->debug != MagickFalse)
6325     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6326   if (wand->images == (Image *) NULL)
6327     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6328   minify_image=MinifyImage(wand->images,wand->exception);
6329   if (minify_image == (Image *) NULL)
6330     return(MagickFalse);
6331   ReplaceImageInList(&wand->images,minify_image);
6332   return(MagickTrue);
6333 }
6334 \f
6335 /*
6336 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6337 %                                                                             %
6338 %                                                                             %
6339 %                                                                             %
6340 %   M a g i c k M o d u l a t e I m a g e                                     %
6341 %                                                                             %
6342 %                                                                             %
6343 %                                                                             %
6344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6345 %
6346 %  MagickModulateImage() lets you control the brightness, saturation, and hue
6347 %  of an image.  Hue is the percentage of absolute rotation from the current
6348 %  position.  For example 50 results in a counter-clockwise rotation of 90
6349 %  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6350 %  both resulting in a rotation of 180 degrees.
6351 %
6352 %  To increase the color brightness by 20% and decrease the color saturation by
6353 %  10% and leave the hue unchanged, use: 120,90,100.
6354 %
6355 %  The format of the MagickModulateImage method is:
6356 %
6357 %      MagickBooleanType MagickModulateImage(MagickWand *wand,
6358 %        const double brightness,const double saturation,const double hue)
6359 %
6360 %  A description of each parameter follows:
6361 %
6362 %    o wand: the magick wand.
6363 %
6364 %    o brightness: the percent change in brighness.
6365 %
6366 %    o saturation: the percent change in saturation.
6367 %
6368 %    o hue: the percent change in hue.
6369 %
6370 */
6371 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6372   const double brightness,const double saturation,const double hue)
6373 {
6374   char
6375     modulate[MaxTextExtent];
6376
6377   MagickBooleanType
6378     status;
6379
6380   assert(wand != (MagickWand *) NULL);
6381   assert(wand->signature == WandSignature);
6382   if (wand->debug != MagickFalse)
6383     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6384   if (wand->images == (Image *) NULL)
6385     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6386   (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6387     brightness,saturation,hue);
6388   status=ModulateImage(wand->images,modulate,&wand->images->exception);
6389   return(status);
6390 }
6391 \f
6392 /*
6393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6394 %                                                                             %
6395 %                                                                             %
6396 %                                                                             %
6397 %   M a g i c k M o n t a g e I m a g e                                       %
6398 %                                                                             %
6399 %                                                                             %
6400 %                                                                             %
6401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6402 %
6403 %  MagickMontageImage() creates a composite image by combining several
6404 %  separate images. The images are tiled on the composite image with the name
6405 %  of the image optionally appearing just below the individual tile.
6406 %
6407 %  The format of the MagickMontageImage method is:
6408 %
6409 %      MagickWand *MagickMontageImage(MagickWand *wand,
6410 %        const DrawingWand drawing_wand,const char *tile_geometry,
6411 %        const char *thumbnail_geometry,const MontageMode mode,
6412 %        const char *frame)
6413 %
6414 %  A description of each parameter follows:
6415 %
6416 %    o wand: the magick wand.
6417 %
6418 %    o drawing_wand: the drawing wand.  The font name, size, and color are
6419 %      obtained from this wand.
6420 %
6421 %    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6422 %
6423 %    o thumbnail_geometry: Preferred image size and border size of each
6424 %      thumbnail (e.g. 120x120+4+3>).
6425 %
6426 %    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6427 %
6428 %    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6429 %      The frame color is that of the thumbnail's matte color.
6430 %
6431 */
6432 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6433   const DrawingWand *drawing_wand,const char *tile_geometry,
6434   const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6435 {
6436   char
6437     *font;
6438
6439   Image
6440     *montage_image;
6441
6442   MontageInfo
6443     *montage_info;
6444
6445   PixelWand
6446     *pixel_wand;
6447
6448   assert(wand != (MagickWand *) NULL);
6449   assert(wand->signature == WandSignature);
6450   if (wand->debug != MagickFalse)
6451     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6452   if (wand->images == (Image *) NULL)
6453     return((MagickWand *) NULL);
6454   montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6455   switch (mode)
6456   {
6457     case FrameMode:
6458     {
6459       (void) CloneString(&montage_info->frame,"15x15+3+3");
6460       montage_info->shadow=MagickTrue;
6461       break;
6462     }
6463     case UnframeMode:
6464     {
6465       montage_info->frame=(char *) NULL;
6466       montage_info->shadow=MagickFalse;
6467       montage_info->border_width=0;
6468       break;
6469     }
6470     case ConcatenateMode:
6471     {
6472       montage_info->frame=(char *) NULL;
6473       montage_info->shadow=MagickFalse;
6474       (void) CloneString(&montage_info->geometry,"+0+0");
6475       montage_info->border_width=0;
6476       break;
6477     }
6478     default:
6479       break;
6480   }
6481   font=DrawGetFont(drawing_wand);
6482   if (font != (char *) NULL)
6483     (void) CloneString(&montage_info->font,font);
6484   if (frame != (char *) NULL)
6485     (void) CloneString(&montage_info->frame,frame);
6486   montage_info->pointsize=DrawGetFontSize(drawing_wand);
6487   pixel_wand=NewPixelWand();
6488   DrawGetFillColor(drawing_wand,pixel_wand);
6489   PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6490   DrawGetStrokeColor(drawing_wand,pixel_wand);
6491   PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6492   pixel_wand=DestroyPixelWand(pixel_wand);
6493   if (thumbnail_geometry != (char *) NULL)
6494     (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6495   if (tile_geometry != (char *) NULL)
6496     (void) CloneString(&montage_info->tile,tile_geometry);
6497   montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6498     wand->exception);
6499   montage_info=DestroyMontageInfo(montage_info);
6500   if (montage_image == (Image *) NULL)
6501     return((MagickWand *) NULL);
6502   return(CloneMagickWandFromImages(wand,montage_image));
6503 }
6504 \f
6505 /*
6506 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6507 %                                                                             %
6508 %                                                                             %
6509 %                                                                             %
6510 %   M a g i c k M o r p h I m a g e s                                         %
6511 %                                                                             %
6512 %                                                                             %
6513 %                                                                             %
6514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6515 %
6516 %  MagickMorphImages() method morphs a set of images.  Both the image pixels
6517 %  and size are linearly interpolated to give the appearance of a
6518 %  meta-morphosis from one image to the next.
6519 %
6520 %  The format of the MagickMorphImages method is:
6521 %
6522 %      MagickWand *MagickMorphImages(MagickWand *wand,
6523 %        const size_t number_frames)
6524 %
6525 %  A description of each parameter follows:
6526 %
6527 %    o wand: the magick wand.
6528 %
6529 %    o number_frames: the number of in-between images to generate.
6530 %
6531 */
6532 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6533   const size_t number_frames)
6534 {
6535   Image
6536     *morph_image;
6537
6538   assert(wand != (MagickWand *) NULL);
6539   assert(wand->signature == WandSignature);
6540   if (wand->debug != MagickFalse)
6541     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6542   if (wand->images == (Image *) NULL)
6543     return((MagickWand *) NULL);
6544   morph_image=MorphImages(wand->images,number_frames,wand->exception);
6545   if (morph_image == (Image *) NULL)
6546     return((MagickWand *) NULL);
6547   return(CloneMagickWandFromImages(wand,morph_image));
6548 }
6549 \f
6550 /*
6551 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6552 %                                                                             %
6553 %                                                                             %
6554 %                                                                             %
6555 %   M a g i c k M o r p h o l o g y I m a g e                                 %
6556 %                                                                             %
6557 %                                                                             %
6558 %                                                                             %
6559 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6560 %
6561 %  MagickMorphologyImage() applies a user supplied kernel to the image
6562 %  according to the given mophology method.
6563 %
6564 %  The format of the MagickMorphologyImage method is:
6565 %
6566 %      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6567 %        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6568 %
6569 %  A description of each parameter follows:
6570 %
6571 %    o wand: the magick wand.
6572 %
6573 %    o method: the morphology method to be applied.
6574 %
6575 %    o iterations: apply the operation this many times (or no change).
6576 %      A value of -1 means loop until no change found.  How this is applied
6577 %      may depend on the morphology method.  Typically this is a value of 1.
6578 %
6579 %    o kernel: An array of doubles representing the morphology kernel.
6580 %
6581 */
6582 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6583   MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6584 {
6585   Image
6586     *morphology_image;
6587
6588   assert(wand != (MagickWand *) NULL);
6589   assert(wand->signature == WandSignature);
6590   if (wand->debug != MagickFalse)
6591     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6592   if (kernel == (const KernelInfo *) NULL)
6593     return(MagickFalse);
6594   if (wand->images == (Image *) NULL)
6595     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6596   morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6597     wand->exception);
6598   if (morphology_image == (Image *) NULL)
6599     return(MagickFalse);
6600   ReplaceImageInList(&wand->images,morphology_image);
6601   return(MagickTrue);
6602 }
6603 \f
6604 /*
6605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6606 %                                                                             %
6607 %                                                                             %
6608 %                                                                             %
6609 %   M a g i c k M o t i o n B l u r I m a g e                                 %
6610 %                                                                             %
6611 %                                                                             %
6612 %                                                                             %
6613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6614 %
6615 %  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6616 %  Gaussian operator of the given radius and standard deviation (sigma).
6617 %  For reasonable results, radius should be larger than sigma.  Use a
6618 %  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6619 %  Angle gives the angle of the blurring motion.
6620 %
6621 %  The format of the MagickMotionBlurImage method is:
6622 %
6623 %      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6624 %        const double radius,const double sigma,const double angle,
6625 %        const double bias)
6626 %
6627 %  A description of each parameter follows:
6628 %
6629 %    o wand: the magick wand.
6630 %
6631 %    o radius: the radius of the Gaussian, in pixels, not counting
6632 %      the center pixel.
6633 %
6634 %    o sigma: the standard deviation of the Gaussian, in pixels.
6635 %
6636 %    o angle: Apply the effect along this angle.
6637 %
6638 */
6639 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6640   const double radius,const double sigma,const double angle,const double bias)
6641 {
6642   Image
6643     *blur_image;
6644
6645   assert(wand != (MagickWand *) NULL);
6646   assert(wand->signature == WandSignature);
6647   if (wand->debug != MagickFalse)
6648     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6649   if (wand->images == (Image *) NULL)
6650     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6651   blur_image=MotionBlurImage(wand->images,radius,sigma,angle,bias,
6652     wand->exception);
6653   if (blur_image == (Image *) NULL)
6654     return(MagickFalse);
6655   ReplaceImageInList(&wand->images,blur_image);
6656   return(MagickTrue);
6657 }
6658 \f
6659 /*
6660 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6661 %                                                                             %
6662 %                                                                             %
6663 %                                                                             %
6664 %   M a g i c k N e g a t e I m a g e                                         %
6665 %                                                                             %
6666 %                                                                             %
6667 %                                                                             %
6668 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6669 %
6670 %  MagickNegateImage() negates the colors in the reference image.  The
6671 %  Grayscale option means that only grayscale values within the image are
6672 %  negated.
6673 %
6674 %  You can also reduce the influence of a particular channel with a gamma
6675 %  value of 0.
6676 %
6677 %  The format of the MagickNegateImage method is:
6678 %
6679 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
6680 %        const MagickBooleanType gray)
6681 %
6682 %  A description of each parameter follows:
6683 %
6684 %    o wand: the magick wand.
6685 %
6686 %    o gray: If MagickTrue, only negate grayscale pixels within the image.
6687 %
6688 */
6689 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6690   const MagickBooleanType gray)
6691 {
6692   MagickBooleanType
6693     status;
6694
6695   assert(wand != (MagickWand *) NULL);
6696   assert(wand->signature == WandSignature);
6697   if (wand->debug != MagickFalse)
6698     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6699   if (wand->images == (Image *) NULL)
6700     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6701   status=NegateImage(wand->images,gray,wand->exception);
6702   return(status);
6703 }
6704 \f
6705 /*
6706 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6707 %                                                                             %
6708 %                                                                             %
6709 %                                                                             %
6710 %   M a g i c k N e w I m a g e                                               %
6711 %                                                                             %
6712 %                                                                             %
6713 %                                                                             %
6714 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6715 %
6716 %  MagickNewImage() adds a blank image canvas of the specified size and
6717 %  background color to the wand.
6718 %
6719 %  The format of the MagickNewImage method is:
6720 %
6721 %      MagickBooleanType MagickNewImage(MagickWand *wand,
6722 %        const size_t columns,const size_t rows,
6723 %        const PixelWand *background)
6724 %
6725 %  A description of each parameter follows:
6726 %
6727 %    o wand: the magick wand.
6728 %
6729 %    o width: the image width.
6730 %
6731 %    o height: the image height.
6732 %
6733 %    o background: the image color.
6734 %
6735 */
6736 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
6737   const size_t height,const PixelWand *background)
6738 {
6739   Image
6740     *images;
6741
6742   PixelInfo
6743     pixel;
6744
6745   assert(wand != (MagickWand *) NULL);
6746   assert(wand->signature == WandSignature);
6747   if (wand->debug != MagickFalse)
6748     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6749   PixelGetMagickColor(background,&pixel);
6750   images=NewMagickImage(wand->image_info,width,height,&pixel,&wand->exception);
6751   if (images == (Image *) NULL)
6752     return(MagickFalse);
6753   return(InsertImageInWand(wand,images));
6754 }
6755 \f
6756 /*
6757 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6758 %                                                                             %
6759 %                                                                             %
6760 %                                                                             %
6761 %   M a g i c k N e x t I m a g e                                             %
6762 %                                                                             %
6763 %                                                                             %
6764 %                                                                             %
6765 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6766 %
6767 %  MagickNextImage() associates the next image in the image list with a magick
6768 %  wand.  It returns true if the it succeeds, meaning the current image is the
6769 %  next image to be iterated over.
6770 %
6771 %  The format of the MagickNextImage method is:
6772 %
6773 %      MagickBooleanType MagickNextImage(MagickWand *wand)
6774 %
6775 %  A description of each parameter follows:
6776 %
6777 %    o wand: the magick wand.
6778 %
6779 */
6780 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
6781 {
6782   assert(wand != (MagickWand *) NULL);
6783   assert(wand->signature == WandSignature);
6784   if (wand->debug != MagickFalse)
6785     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6786   if (wand->images == (Image *) NULL)
6787     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6788   /* If current image is 'pending' just return true.  */
6789   if (wand->image_pending != MagickFalse)
6790     {
6791       wand->image_pending=MagickFalse;
6792       return(MagickTrue);
6793     }
6794   /* If there is no next image, (Iterator is finished) */
6795   if (GetNextImageInList(wand->images) == (Image *) NULL)
6796       return(MagickFalse);
6797   /* just move to next image - current image is not 'pending' */
6798   wand->images=GetNextImageInList(wand->images);
6799   return(MagickTrue);
6800 }
6801 \f
6802 /*
6803 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6804 %                                                                             %
6805 %                                                                             %
6806 %                                                                             %
6807 %   M a g i c k N o r m a l i z e I m a g e                                   %
6808 %                                                                             %
6809 %                                                                             %
6810 %                                                                             %
6811 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6812 %
6813 %  MagickNormalizeImage() enhances the contrast of a color image by adjusting
6814 %  the pixels color to span the entire range of colors available
6815 %
6816 %  You can also reduce the influence of a particular channel with a gamma
6817 %  value of 0.
6818 %
6819 %  The format of the MagickNormalizeImage method is:
6820 %
6821 %      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6822 %
6823 %  A description of each parameter follows:
6824 %
6825 %    o wand: the magick wand.
6826 %
6827 */
6828 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6829 {
6830   MagickBooleanType
6831     status;
6832
6833   assert(wand != (MagickWand *) NULL);
6834   assert(wand->signature == WandSignature);
6835   if (wand->debug != MagickFalse)
6836     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6837   if (wand->images == (Image *) NULL)
6838     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6839   status=NormalizeImage(wand->images,&wand->images->exception);
6840   return(status);
6841 }
6842 \f
6843 /*
6844 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6845 %                                                                             %
6846 %                                                                             %
6847 %                                                                             %
6848 %   M a g i c k O i l P a i n t I m a g e                                     %
6849 %                                                                             %
6850 %                                                                             %
6851 %                                                                             %
6852 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6853 %
6854 %  MagickOilPaintImage() applies a special effect filter that simulates an oil
6855 %  painting.  Each pixel is replaced by the most frequent color occurring
6856 %  in a circular region defined by radius.
6857 %
6858 %  The format of the MagickOilPaintImage method is:
6859 %
6860 %      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6861 %        const double radius,const double sigma)
6862 %
6863 %  A description of each parameter follows:
6864 %
6865 %    o wand: the magick wand.
6866 %
6867 %    o radius: the radius of the circular neighborhood.
6868 %
6869 %    o sigma: the standard deviation of the Gaussian, in pixels.
6870 %
6871 */
6872 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6873   const double radius,const double sigma)
6874 {
6875   Image
6876     *paint_image;
6877
6878   assert(wand != (MagickWand *) NULL);
6879   assert(wand->signature == WandSignature);
6880   if (wand->debug != MagickFalse)
6881     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6882   if (wand->images == (Image *) NULL)
6883     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6884   paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
6885   if (paint_image == (Image *) NULL)
6886     return(MagickFalse);
6887   ReplaceImageInList(&wand->images,paint_image);
6888   return(MagickTrue);
6889 }
6890 \f
6891 /*
6892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6893 %                                                                             %
6894 %                                                                             %
6895 %                                                                             %
6896 %   M a g i c k O p a q u e P a i n t I m a g e                               %
6897 %                                                                             %
6898 %                                                                             %
6899 %                                                                             %
6900 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6901 %
6902 %  MagickOpaquePaintImage() changes any pixel that matches color with the color
6903 %  defined by fill.
6904 %
6905 %  The format of the MagickOpaquePaintImage method is:
6906 %
6907 %      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6908 %        const PixelWand *target,const PixelWand *fill,const double fuzz,
6909 %        const MagickBooleanType invert)
6910 %
6911 %  A description of each parameter follows:
6912 %
6913 %    o wand: the magick wand.
6914 %
6915 %    o target: Change this target color to the fill color within the image.
6916 %
6917 %    o fill: the fill pixel wand.
6918 %
6919 %    o fuzz: By default target must match a particular pixel color
6920 %      exactly.  However, in many cases two colors may differ by a small amount.
6921 %      The fuzz member of image defines how much tolerance is acceptable to
6922 %      consider two colors as the same.  For example, set fuzz to 10 and the
6923 %      color red at intensities of 100 and 102 respectively are now interpreted
6924 %      as the same color for the purposes of the floodfill.
6925 %
6926 %    o invert: paint any pixel that does not match the target color.
6927 %
6928 */
6929 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6930   const PixelWand *target,const PixelWand *fill,const double fuzz,
6931   const MagickBooleanType invert)
6932 {
6933   MagickBooleanType
6934     status;
6935
6936   PixelInfo
6937     fill_pixel,
6938     target_pixel;
6939
6940   assert(wand != (MagickWand *) NULL);
6941   assert(wand->signature == WandSignature);
6942   if (wand->debug != MagickFalse)
6943     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6944   if (wand->images == (Image *) NULL)
6945     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6946   PixelGetMagickColor(target,&target_pixel);
6947   PixelGetMagickColor(fill,&fill_pixel);
6948   wand->images->fuzz=fuzz;
6949   status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
6950     &wand->images->exception);
6951   return(status);
6952 }
6953 \f
6954 /*
6955 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6956 %                                                                             %
6957 %                                                                             %
6958 %                                                                             %
6959 %   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                         %
6960 %                                                                             %
6961 %                                                                             %
6962 %                                                                             %
6963 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6964 %
6965 %  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
6966 %  previous image in the sequence.  From this it attempts to select the
6967 %  smallest cropped image to replace each frame, while preserving the results
6968 %  of the animation.
6969 %
6970 %  The format of the MagickOptimizeImageLayers method is:
6971 %
6972 %      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6973 %
6974 %  A description of each parameter follows:
6975 %
6976 %    o wand: the magick wand.
6977 %
6978 */
6979 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6980 {
6981   Image
6982     *optimize_image;
6983
6984   assert(wand != (MagickWand *) NULL);
6985   assert(wand->signature == WandSignature);
6986   if (wand->debug != MagickFalse)
6987     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6988   if (wand->images == (Image *) NULL)
6989     return((MagickWand *) NULL);
6990   optimize_image=OptimizeImageLayers(wand->images,wand->exception);
6991   if (optimize_image == (Image *) NULL)
6992     return((MagickWand *) NULL);
6993   return(CloneMagickWandFromImages(wand,optimize_image));
6994 }
6995 \f
6996 /*
6997 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6998 %                                                                             %
6999 %                                                                             %
7000 %                                                                             %
7001 %     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                   %
7002 %                                                                             %
7003 %                                                                             %
7004 %                                                                             %
7005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7006 %
7007 %  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7008 %  of pre-defined dithering threshold maps, but over multiple intensity levels,
7009 %  which can be different for different channels, according to the input
7010 %  arguments.
7011 %
7012 %  The format of the MagickOrderedPosterizeImage method is:
7013 %
7014 %      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7015 %        const char *threshold_map)
7016 %
7017 %  A description of each parameter follows:
7018 %
7019 %    o image: the image.
7020 %
7021 %    o threshold_map: A string containing the name of the threshold dither
7022 %      map to use, followed by zero or more numbers representing the number of
7023 %      color levels tho dither between.
7024 %
7025 %      Any level number less than 2 is equivalent to 2, and means only binary
7026 %      dithering will be applied to each color channel.
7027 %
7028 %      No numbers also means a 2 level (bitmap) dither will be applied to all
7029 %      channels, while a single number is the number of levels applied to each
7030 %      channel in sequence.  More numbers will be applied in turn to each of
7031 %      the color channels.
7032 %
7033 %      For example: "o3x3,6" generates a 6 level posterization of the image
7034 %      with a ordered 3x3 diffused pixel dither being applied between each
7035 %      level. While checker,8,8,4 will produce a 332 colormaped image with
7036 %      only a single checkerboard hash pattern (50% grey) between each color
7037 %      level, to basically double the number of color levels with a bare
7038 %      minimim of dithering.
7039 %
7040 */
7041 WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7042   const char *threshold_map)
7043 {
7044   MagickBooleanType
7045     status;
7046
7047   assert(wand != (MagickWand *) NULL);
7048   assert(wand->signature == WandSignature);
7049   if (wand->debug != MagickFalse)
7050     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7051   if (wand->images == (Image *) NULL)
7052     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7053   status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7054   return(status);
7055 }
7056 \f
7057 /*
7058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7059 %                                                                             %
7060 %                                                                             %
7061 %                                                                             %
7062 %   M a g i c k P i n g I m a g e                                             %
7063 %                                                                             %
7064 %                                                                             %
7065 %                                                                             %
7066 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7067 %
7068 %  MagickPingImage() is the same as MagickReadImage() except the only valid
7069 %  information returned is the image width, height, size, and format.  It
7070 %  is designed to efficiently obtain this information from a file without
7071 %  reading the entire image sequence into memory.
7072 %
7073 %  The format of the MagickPingImage method is:
7074 %
7075 %      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7076 %
7077 %  A description of each parameter follows:
7078 %
7079 %    o wand: the magick wand.
7080 %
7081 %    o filename: the image filename.
7082 %
7083 */
7084 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7085   const char *filename)
7086 {
7087   Image
7088     *images;
7089
7090   ImageInfo
7091     *ping_info;
7092
7093   assert(wand != (MagickWand *) NULL);
7094   assert(wand->signature == WandSignature);
7095   if (wand->debug != MagickFalse)
7096     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7097   ping_info=CloneImageInfo(wand->image_info);
7098   if (filename != (const char *) NULL)
7099     (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7100   images=PingImage(ping_info,wand->exception);
7101   ping_info=DestroyImageInfo(ping_info);
7102   if (images == (Image *) NULL)
7103     return(MagickFalse);
7104   return(InsertImageInWand(wand,images));
7105 }
7106 \f
7107 /*
7108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7109 %                                                                             %
7110 %                                                                             %
7111 %                                                                             %
7112 %   M a g i c k P i n g I m a g e B l o b                                     %
7113 %                                                                             %
7114 %                                                                             %
7115 %                                                                             %
7116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7117 %
7118 %  MagickPingImageBlob() pings an image or image sequence from a blob.
7119 %
7120 %  The format of the MagickPingImageBlob method is:
7121 %
7122 %      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7123 %        const void *blob,const size_t length)
7124 %
7125 %  A description of each parameter follows:
7126 %
7127 %    o wand: the magick wand.
7128 %
7129 %    o blob: the blob.
7130 %
7131 %    o length: the blob length.
7132 %
7133 */
7134 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7135   const void *blob,const size_t length)
7136 {
7137   Image
7138     *images;
7139
7140   ImageInfo
7141     *read_info;
7142
7143   assert(wand != (MagickWand *) NULL);
7144   assert(wand->signature == WandSignature);
7145   if (wand->debug != MagickFalse)
7146     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7147   read_info=CloneImageInfo(wand->image_info);
7148   SetImageInfoBlob(read_info,blob,length);
7149   images=PingImage(read_info,wand->exception);
7150   read_info=DestroyImageInfo(read_info);
7151   if (images == (Image *) NULL)
7152     return(MagickFalse);
7153   return(InsertImageInWand(wand,images));
7154 }
7155 \f
7156 /*
7157 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7158 %                                                                             %
7159 %                                                                             %
7160 %                                                                             %
7161 %   M a g i c k P i n g I m a g e F i l e                                     %
7162 %                                                                             %
7163 %                                                                             %
7164 %                                                                             %
7165 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7166 %
7167 %  MagickPingImageFile() pings an image or image sequence from an open file
7168 %  descriptor.
7169 %
7170 %  The format of the MagickPingImageFile method is:
7171 %
7172 %      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7173 %
7174 %  A description of each parameter follows:
7175 %
7176 %    o wand: the magick wand.
7177 %
7178 %    o file: the file descriptor.
7179 %
7180 */
7181 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7182 {
7183   Image
7184     *images;
7185
7186   ImageInfo
7187     *read_info;
7188
7189   assert(wand != (MagickWand *) NULL);
7190   assert(wand->signature == WandSignature);
7191   assert(file != (FILE *) NULL);
7192   if (wand->debug != MagickFalse)
7193     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7194   read_info=CloneImageInfo(wand->image_info);
7195   SetImageInfoFile(read_info,file);
7196   images=PingImage(read_info,wand->exception);
7197   read_info=DestroyImageInfo(read_info);
7198   if (images == (Image *) NULL)
7199     return(MagickFalse);
7200   return(InsertImageInWand(wand,images));
7201 }
7202 \f
7203 /*
7204 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7205 %                                                                             %
7206 %                                                                             %
7207 %                                                                             %
7208 %   M a g i c k P o l a r o i d I m a g e                                     %
7209 %                                                                             %
7210 %                                                                             %
7211 %                                                                             %
7212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7213 %
7214 %  MagickPolaroidImage() simulates a Polaroid picture.
7215 %
7216 %  The format of the MagickPolaroidImage method is:
7217 %
7218 %      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7219 %        const DrawingWand *drawing_wand,const double angle,
7220 %        const PixelInterpolateMethod method)
7221 %
7222 %  A description of each parameter follows:
7223 %
7224 %    o wand: the magick wand.
7225 %
7226 %    o drawing_wand: the draw wand.
7227 %
7228 %    o angle: Apply the effect along this angle.
7229 %
7230 %    o method: the pixel interpolation method.
7231 %
7232 */
7233 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7234   const DrawingWand *drawing_wand,const double angle,
7235   const PixelInterpolateMethod method)
7236 {
7237   DrawInfo
7238     *draw_info;
7239
7240   Image
7241     *polaroid_image;
7242
7243   assert(wand != (MagickWand *) NULL);
7244   assert(wand->signature == WandSignature);
7245   if (wand->debug != MagickFalse)
7246     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7247   if (wand->images == (Image *) NULL)
7248     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7249   draw_info=PeekDrawingWand(drawing_wand);
7250   if (draw_info == (DrawInfo *) NULL)
7251     return(MagickFalse);
7252   polaroid_image=PolaroidImage(wand->images,draw_info,angle,method,
7253     wand->exception);
7254   if (polaroid_image == (Image *) NULL)
7255     return(MagickFalse);
7256   ReplaceImageInList(&wand->images,polaroid_image);
7257   return(MagickTrue);
7258 }
7259 \f
7260 /*
7261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7262 %                                                                             %
7263 %                                                                             %
7264 %                                                                             %
7265 %   M a g i c k P o s t e r i z e I m a g e                                   %
7266 %                                                                             %
7267 %                                                                             %
7268 %                                                                             %
7269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7270 %
7271 %  MagickPosterizeImage() reduces the image to a limited number of color level.
7272 %
7273 %  The format of the MagickPosterizeImage method is:
7274 %
7275 %      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7276 %        const unsigned levels,const MagickBooleanType dither)
7277 %
7278 %  A description of each parameter follows:
7279 %
7280 %    o wand: the magick wand.
7281 %
7282 %    o levels: Number of color levels allowed in each channel.  Very low values
7283 %      (2, 3, or 4) have the most visible effect.
7284 %
7285 %    o dither: Set this integer value to something other than zero to dither
7286 %      the mapped image.
7287 %
7288 */
7289 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7290   const size_t levels,const MagickBooleanType dither)
7291 {
7292   MagickBooleanType
7293     status;
7294
7295   assert(wand != (MagickWand *) NULL);
7296   assert(wand->signature == WandSignature);
7297   if (wand->debug != MagickFalse)
7298     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7299   if (wand->images == (Image *) NULL)
7300     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7301   status=PosterizeImage(wand->images,levels,dither,wand->exception);
7302   return(status);
7303 }
7304 \f
7305 /*
7306 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7307 %                                                                             %
7308 %                                                                             %
7309 %                                                                             %
7310 %   M a g i c k P r e v i e w I m a g e s                                     %
7311 %                                                                             %
7312 %                                                                             %
7313 %                                                                             %
7314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7315 %
7316 %  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7317 %  image processing operation applied at varying strengths.  This helpful
7318 %  to quickly pin-point an appropriate parameter for an image processing
7319 %  operation.
7320 %
7321 %  The format of the MagickPreviewImages method is:
7322 %
7323 %      MagickWand *MagickPreviewImages(MagickWand *wand,
7324 %        const PreviewType preview)
7325 %
7326 %  A description of each parameter follows:
7327 %
7328 %    o wand: the magick wand.
7329 %
7330 %    o preview: the preview type.
7331 %
7332 */
7333 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7334   const PreviewType preview)
7335 {
7336   Image
7337     *preview_image;
7338
7339   assert(wand != (MagickWand *) NULL);
7340   assert(wand->signature == WandSignature);
7341   if (wand->debug != MagickFalse)
7342     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7343   if (wand->images == (Image *) NULL)
7344     return((MagickWand *) NULL);
7345   preview_image=PreviewImage(wand->images,preview,wand->exception);
7346   if (preview_image == (Image *) NULL)
7347     return((MagickWand *) NULL);
7348   return(CloneMagickWandFromImages(wand,preview_image));
7349 }
7350 \f
7351 /*
7352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7353 %                                                                             %
7354 %                                                                             %
7355 %                                                                             %
7356 %   M a g i c k P r e v i o u s I m a g e                                     %
7357 %                                                                             %
7358 %                                                                             %
7359 %                                                                             %
7360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7361 %
7362 %  MagickPreviousImage() assocates the previous image in an image list with
7363 %  the magick wand.
7364 %
7365 %  The format of the MagickPreviousImage method is:
7366 %
7367 %      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7368 %
7369 %  A description of each parameter follows:
7370 %
7371 %    o wand: the magick wand.
7372 %
7373 */
7374 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7375 {
7376   assert(wand != (MagickWand *) NULL);
7377   assert(wand->signature == WandSignature);
7378   if (wand->debug != MagickFalse)
7379     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7380   if (wand->images == (Image *) NULL)
7381     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7382
7383   wand->image_pending=MagickFalse;  /* pending status has no meaning */
7384   /* If there is no prev image, return false (Iterator is finished) */
7385   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7386       return(MagickFalse);
7387   /* just do it - current image is not 'pending' */
7388   wand->images=GetPreviousImageInList(wand->images);
7389   return(MagickTrue);
7390 }
7391 \f
7392 /*
7393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7394 %                                                                             %
7395 %                                                                             %
7396 %                                                                             %
7397 %   M a g i c k Q u a n t i z e I m a g e                                     %
7398 %                                                                             %
7399 %                                                                             %
7400 %                                                                             %
7401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7402 %
7403 %  MagickQuantizeImage() analyzes the colors within a reference image and
7404 %  chooses a fixed number of colors to represent the image.  The goal of the
7405 %  algorithm is to minimize the color difference between the input and output
7406 %  image while minimizing the processing time.
7407 %
7408 %  The format of the MagickQuantizeImage method is:
7409 %
7410 %      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7411 %        const size_t number_colors,const ColorspaceType colorspace,
7412 %        const size_t treedepth,const MagickBooleanType dither,
7413 %        const MagickBooleanType measure_error)
7414 %
7415 %  A description of each parameter follows:
7416 %
7417 %    o wand: the magick wand.
7418 %
7419 %    o number_colors: the number of colors.
7420 %
7421 %    o colorspace: Perform color reduction in this colorspace, typically
7422 %      RGBColorspace.
7423 %
7424 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7425 %      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
7426 %      reference image with the least amount of memory and the fastest
7427 %      computational speed.  In some cases, such as an image with low color
7428 %      dispersion (a few number of colors), a value other than
7429 %      Log4(number_colors) is required.  To expand the color tree completely,
7430 %      use a value of 8.
7431 %
7432 %    o dither: A value other than zero distributes the difference between an
7433 %      original image and the corresponding color reduced image to
7434 %      neighboring pixels along a Hilbert curve.
7435 %
7436 %    o measure_error: A value other than zero measures the difference between
7437 %      the original and quantized images.  This difference is the total
7438 %      quantization error.  The error is computed by summing over all pixels
7439 %      in an image the distance squared in RGB space between each reference
7440 %      pixel value and its quantized value.
7441 %
7442 */
7443 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7444   const size_t number_colors,const ColorspaceType colorspace,
7445   const size_t treedepth,const MagickBooleanType dither,
7446   const MagickBooleanType measure_error)
7447 {
7448   MagickBooleanType
7449     status;
7450
7451   QuantizeInfo
7452     *quantize_info;
7453
7454   assert(wand != (MagickWand *) NULL);
7455   assert(wand->signature == WandSignature);
7456   if (wand->debug != MagickFalse)
7457     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7458   if (wand->images == (Image *) NULL)
7459     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7460   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7461   quantize_info->number_colors=number_colors;
7462   quantize_info->dither=dither;
7463   quantize_info->tree_depth=treedepth;
7464   quantize_info->colorspace=colorspace;
7465   quantize_info->measure_error=measure_error;
7466   status=QuantizeImage(quantize_info,wand->images,wand->exception);
7467   quantize_info=DestroyQuantizeInfo(quantize_info);
7468   return(status);
7469 }
7470 \f
7471 /*
7472 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7473 %                                                                             %
7474 %                                                                             %
7475 %                                                                             %
7476 %   M a g i c k Q u a n t i z e I m a g e s                                   %
7477 %                                                                             %
7478 %                                                                             %
7479 %                                                                             %
7480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7481 %
7482 %  MagickQuantizeImages() analyzes the colors within a sequence of images and
7483 %  chooses a fixed number of colors to represent the image.  The goal of the
7484 %  algorithm is to minimize the color difference between the input and output
7485 %  image while minimizing the processing time.
7486 %
7487 %  The format of the MagickQuantizeImages method is:
7488 %
7489 %      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7490 %        const size_t number_colors,const ColorspaceType colorspace,
7491 %        const size_t treedepth,const MagickBooleanType dither,
7492 %        const MagickBooleanType measure_error)
7493 %
7494 %  A description of each parameter follows:
7495 %
7496 %    o wand: the magick wand.
7497 %
7498 %    o number_colors: the number of colors.
7499 %
7500 %    o colorspace: Perform color reduction in this colorspace, typically
7501 %      RGBColorspace.
7502 %
7503 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7504 %      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
7505 %      reference image with the least amount of memory and the fastest
7506 %      computational speed.  In some cases, such as an image with low color
7507 %      dispersion (a few number of colors), a value other than
7508 %      Log4(number_colors) is required.  To expand the color tree completely,
7509 %      use a value of 8.
7510 %
7511 %    o dither: A value other than zero distributes the difference between an
7512 %      original image and the corresponding color reduced algorithm to
7513 %      neighboring pixels along a Hilbert curve.
7514 %
7515 %    o measure_error: A value other than zero measures the difference between
7516 %      the original and quantized images.  This difference is the total
7517 %      quantization error.  The error is computed by summing over all pixels
7518 %      in an image the distance squared in RGB space between each reference
7519 %      pixel value and its quantized value.
7520 %
7521 */
7522 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7523   const size_t number_colors,const ColorspaceType colorspace,
7524   const size_t treedepth,const MagickBooleanType dither,
7525   const MagickBooleanType measure_error)
7526 {
7527   MagickBooleanType
7528     status;
7529
7530   QuantizeInfo
7531     *quantize_info;
7532
7533   assert(wand != (MagickWand *) NULL);
7534   assert(wand->signature == WandSignature);
7535   if (wand->debug != MagickFalse)
7536     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7537   if (wand->images == (Image *) NULL)
7538     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7539   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7540   quantize_info->number_colors=number_colors;
7541   quantize_info->dither=dither;
7542   quantize_info->tree_depth=treedepth;
7543   quantize_info->colorspace=colorspace;
7544   quantize_info->measure_error=measure_error;
7545   status=QuantizeImages(quantize_info,wand->images,wand->exception);
7546   quantize_info=DestroyQuantizeInfo(quantize_info);
7547   return(status);
7548 }
7549 \f
7550 /*
7551 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7552 %                                                                             %
7553 %                                                                             %
7554 %                                                                             %
7555 %   M a g i c k R a d i a l B l u r I m a g e                                 %
7556 %                                                                             %
7557 %                                                                             %
7558 %                                                                             %
7559 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7560 %
7561 %  MagickRadialBlurImage() radial blurs an image.
7562 %
7563 %  The format of the MagickRadialBlurImage method is:
7564 %
7565 %      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7566 %        const double angle,const double bias)
7567 %
7568 %  A description of each parameter follows:
7569 %
7570 %    o wand: the magick wand.
7571 %
7572 %    o angle: the angle of the blur in degrees.
7573 %
7574 %    o bias: the bias.
7575 %
7576 */
7577 WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7578   const double angle,const double bias)
7579 {
7580   Image
7581     *blur_image;
7582
7583   assert(wand != (MagickWand *) NULL);
7584   assert(wand->signature == WandSignature);
7585   if (wand->debug != MagickFalse)
7586     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7587   if (wand->images == (Image *) NULL)
7588     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7589   blur_image=RadialBlurImage(wand->images,angle,bias,wand->exception);
7590   if (blur_image == (Image *) NULL)
7591     return(MagickFalse);
7592   ReplaceImageInList(&wand->images,blur_image);
7593   return(MagickTrue);
7594 }
7595 \f
7596 /*
7597 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7598 %                                                                             %
7599 %                                                                             %
7600 %                                                                             %
7601 %   M a g i c k R a i s e I m a g e                                           %
7602 %                                                                             %
7603 %                                                                             %
7604 %                                                                             %
7605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7606 %
7607 %  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7608 %  by lightening and darkening the edges of the image.  Members width and
7609 %  height of raise_info define the width of the vertical and horizontal
7610 %  edge of the effect.
7611 %
7612 %  The format of the MagickRaiseImage method is:
7613 %
7614 %      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7615 %        const size_t width,const size_t height,const ssize_t x,
7616 %        const ssize_t y,const MagickBooleanType raise)
7617 %
7618 %  A description of each parameter follows:
7619 %
7620 %    o wand: the magick wand.
7621 %
7622 %    o width,height,x,y:  Define the dimensions of the area to raise.
7623 %
7624 %    o raise: A value other than zero creates a 3-D raise effect,
7625 %      otherwise it has a lowered effect.
7626 %
7627 */
7628 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7629   const size_t width,const size_t height,const ssize_t x,
7630   const ssize_t y,const MagickBooleanType raise)
7631 {
7632   MagickBooleanType
7633     status;
7634
7635   RectangleInfo
7636     raise_info;
7637
7638   assert(wand != (MagickWand *) NULL);
7639   assert(wand->signature == WandSignature);
7640   if (wand->debug != MagickFalse)
7641     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7642   if (wand->images == (Image *) NULL)
7643     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7644   raise_info.width=width;
7645   raise_info.height=height;
7646   raise_info.x=x;
7647   raise_info.y=y;
7648   status=RaiseImage(wand->images,&raise_info,raise,&wand->images->exception);
7649   return(status);
7650 }
7651 \f
7652 /*
7653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7654 %                                                                             %
7655 %                                                                             %
7656 %                                                                             %
7657 %   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                       %
7658 %                                                                             %
7659 %                                                                             %
7660 %                                                                             %
7661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7662 %
7663 %  MagickRandomThresholdImage() changes the value of individual pixels based on
7664 %  the intensity of each pixel compared to threshold.  The result is a
7665 %  high-contrast, two color image.
7666 %
7667 %  The format of the MagickRandomThresholdImage method is:
7668 %
7669 %      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7670 %        const double low,const double high)
7671 %
7672 %  A description of each parameter follows:
7673 %
7674 %    o wand: the magick wand.
7675 %
7676 %    o low,high: Specify the high and low thresholds.  These values range from
7677 %      0 to QuantumRange.
7678 %
7679 */
7680 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7681   const double low,const double high)
7682 {
7683   char
7684     threshold[MaxTextExtent];
7685
7686   MagickBooleanType
7687     status;
7688
7689   assert(wand != (MagickWand *) NULL);
7690   assert(wand->signature == WandSignature);
7691   if (wand->debug != MagickFalse)
7692     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7693   if (wand->images == (Image *) NULL)
7694     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7695   (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
7696   status=RandomThresholdImage(wand->images,threshold,wand->exception);
7697   if (status == MagickFalse)
7698     InheritException(wand->exception,&wand->images->exception);
7699   return(status);
7700 }
7701 \f
7702 /*
7703 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7704 %                                                                             %
7705 %                                                                             %
7706 %                                                                             %
7707 %   M a g i c k R e a d I m a g e                                             %
7708 %                                                                             %
7709 %                                                                             %
7710 %                                                                             %
7711 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7712 %
7713 %  MagickReadImage() reads an image or image sequence.  The images are inserted
7714 %  at the current image pointer position.
7715 %
7716 %  Use MagickSetFirstIterator(), to insert new images before all the current
7717 %  images in the wand, MagickSetLastIterator() to append add to the end,
7718 %  MagickSetImageIndex() to place images just after the given index.
7719 %
7720 %  The format of the MagickReadImage method is:
7721 %
7722 %      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
7723 %
7724 %  A description of each parameter follows:
7725 %
7726 %    o wand: the magick wand.
7727 %
7728 %    o filename: the image filename.
7729 %
7730 */
7731 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
7732   const char *filename)
7733 {
7734   Image
7735     *images;
7736
7737   ImageInfo
7738     *read_info;
7739
7740   assert(wand != (MagickWand *) NULL);
7741   assert(wand->signature == WandSignature);
7742   if (wand->debug != MagickFalse)
7743     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7744   read_info=CloneImageInfo(wand->image_info);
7745   if (filename != (const char *) NULL)
7746     (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
7747   images=ReadImage(read_info,wand->exception);
7748   read_info=DestroyImageInfo(read_info);
7749   if (images == (Image *) NULL)
7750     return(MagickFalse);
7751   return(InsertImageInWand(wand,images));
7752 }
7753 \f
7754 /*
7755 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7756 %                                                                             %
7757 %                                                                             %
7758 %                                                                             %
7759 %   M a g i c k R e a d I m a g e B l o b                                     %
7760 %                                                                             %
7761 %                                                                             %
7762 %                                                                             %
7763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7764 %
7765 %  MagickReadImageBlob() reads an image or image sequence from a blob.
7766 %  In all other respects it is like MagickReadImage().
7767 %
7768 %  The format of the MagickReadImageBlob method is:
7769 %
7770 %      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7771 %        const void *blob,const size_t length)
7772 %
7773 %  A description of each parameter follows:
7774 %
7775 %    o wand: the magick wand.
7776 %
7777 %    o blob: the blob.
7778 %
7779 %    o length: the blob length.
7780 %
7781 */
7782 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7783   const void *blob,const size_t length)
7784 {
7785   Image
7786     *images;
7787
7788   assert(wand != (MagickWand *) NULL);
7789   assert(wand->signature == WandSignature);
7790   if (wand->debug != MagickFalse)
7791     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7792   images=BlobToImage(wand->image_info,blob,length,wand->exception);
7793   if (images == (Image *) NULL)
7794     return(MagickFalse);
7795   return(InsertImageInWand(wand,images));
7796 }
7797 \f
7798 /*
7799 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7800 %                                                                             %
7801 %                                                                             %
7802 %                                                                             %
7803 %   M a g i c k R e a d I m a g e F i l e                                     %
7804 %                                                                             %
7805 %                                                                             %
7806 %                                                                             %
7807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7808 %
7809 %  MagickReadImageFile() reads an image or image sequence from an already
7810 %  opened file descriptor.  Otherwise it is like MagickReadImage().
7811 %
7812 %  The format of the MagickReadImageFile method is:
7813 %
7814 %      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7815 %
7816 %  A description of each parameter follows:
7817 %
7818 %    o wand: the magick wand.
7819 %
7820 %    o file: the file descriptor.
7821 %
7822 */
7823 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7824 {
7825   Image
7826     *images;
7827
7828   ImageInfo
7829     *read_info;
7830
7831   assert(wand != (MagickWand *) NULL);
7832   assert(wand->signature == WandSignature);
7833   assert(file != (FILE *) NULL);
7834   if (wand->debug != MagickFalse)
7835     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7836   read_info=CloneImageInfo(wand->image_info);
7837   SetImageInfoFile(read_info,file);
7838   images=ReadImage(read_info,wand->exception);
7839   read_info=DestroyImageInfo(read_info);
7840   if (images == (Image *) NULL)
7841     return(MagickFalse);
7842   return(InsertImageInWand(wand,images));
7843 }
7844 \f
7845 /*
7846 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7847 %                                                                             %
7848 %                                                                             %
7849 %                                                                             %
7850 %   M a g i c k R e m a p I m a g e                                           %
7851 %                                                                             %
7852 %                                                                             %
7853 %                                                                             %
7854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7855 %
7856 %  MagickRemapImage() replaces the colors of an image with the closest color
7857 %  from a reference image.
7858 %
7859 %  The format of the MagickRemapImage method is:
7860 %
7861 %      MagickBooleanType MagickRemapImage(MagickWand *wand,
7862 %        const MagickWand *remap_wand,const DitherMethod method)
7863 %
7864 %  A description of each parameter follows:
7865 %
7866 %    o wand: the magick wand.
7867 %
7868 %    o affinity: the affinity wand.
7869 %
7870 %    o method: choose from these dither methods: NoDitherMethod,
7871 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7872 %
7873 */
7874 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
7875   const MagickWand *remap_wand,const DitherMethod method)
7876 {
7877   MagickBooleanType
7878     status;
7879
7880   QuantizeInfo
7881     *quantize_info;
7882
7883   assert(wand != (MagickWand *) NULL);
7884   assert(wand->signature == WandSignature);
7885   if (wand->debug != MagickFalse)
7886     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7887   if ((wand->images == (Image *) NULL) ||
7888       (remap_wand->images == (Image *) NULL))
7889     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7890   quantize_info=AcquireQuantizeInfo(wand->image_info);
7891   quantize_info->dither_method=method;
7892   if (method == NoDitherMethod)
7893     quantize_info->dither=MagickFalse;
7894   status=RemapImage(quantize_info,wand->images,remap_wand->images,
7895     wand->exception);
7896   quantize_info=DestroyQuantizeInfo(quantize_info);
7897   return(status);
7898 }
7899 \f
7900 /*
7901 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7902 %                                                                             %
7903 %                                                                             %
7904 %                                                                             %
7905 %   M a g i c k R e m o v e I m a g e                                         %
7906 %                                                                             %
7907 %                                                                             %
7908 %                                                                             %
7909 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7910 %
7911 %  MagickRemoveImage() removes an image from the image list.
7912 %
7913 %  The format of the MagickRemoveImage method is:
7914 %
7915 %      MagickBooleanType MagickRemoveImage(MagickWand *wand)
7916 %
7917 %  A description of each parameter follows:
7918 %
7919 %    o wand: the magick wand.
7920 %
7921 %    o insert: the splice wand.
7922 %
7923 */
7924 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
7925 {
7926   assert(wand != (MagickWand *) NULL);
7927   assert(wand->signature == WandSignature);
7928   if (wand->debug != MagickFalse)
7929     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7930   if (wand->images == (Image *) NULL)
7931     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7932   DeleteImageFromList(&wand->images);
7933   return(MagickTrue);
7934 }
7935 \f
7936 /*
7937 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7938 %                                                                             %
7939 %                                                                             %
7940 %                                                                             %
7941 %   M a g i c k R e s a m p l e I m a g e                                     %
7942 %                                                                             %
7943 %                                                                             %
7944 %                                                                             %
7945 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7946 %
7947 %  MagickResampleImage() resample image to desired resolution.
7948 %
7949 %    Bessel   Blackman   Box
7950 %    Catrom   Cubic      Gaussian
7951 %    Hanning  Hermite    Lanczos
7952 %    Mitchell Point      Quandratic
7953 %    Sinc     Triangle
7954 %
7955 %  Most of the filters are FIR (finite impulse response), however, Bessel,
7956 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
7957 %  are windowed (brought down to zero) with the Blackman filter.
7958 %
7959 %  The format of the MagickResampleImage method is:
7960 %
7961 %      MagickBooleanType MagickResampleImage(MagickWand *wand,
7962 %        const double x_resolution,const double y_resolution,
7963 %        const FilterTypes filter,const double blur)
7964 %
7965 %  A description of each parameter follows:
7966 %
7967 %    o wand: the magick wand.
7968 %
7969 %    o x_resolution: the new image x resolution.
7970 %
7971 %    o y_resolution: the new image y resolution.
7972 %
7973 %    o filter: Image filter to use.
7974 %
7975 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
7976 %
7977 */
7978 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
7979   const double x_resolution,const double y_resolution,const FilterTypes filter,
7980   const double blur)
7981 {
7982   Image
7983     *resample_image;
7984
7985   assert(wand != (MagickWand *) NULL);
7986   assert(wand->signature == WandSignature);
7987   if (wand->debug != MagickFalse)
7988     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7989   if (wand->images == (Image *) NULL)
7990     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7991   resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
7992     blur,wand->exception);
7993   if (resample_image == (Image *) NULL)
7994     return(MagickFalse);
7995   ReplaceImageInList(&wand->images,resample_image);
7996   return(MagickTrue);
7997 }
7998 \f
7999 /*
8000 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8001 %                                                                             %
8002 %                                                                             %
8003 %                                                                             %
8004 %   M a g i c k R e s e t I m a g e P a g e                                   %
8005 %                                                                             %
8006 %                                                                             %
8007 %                                                                             %
8008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8009 %
8010 %  MagickResetImagePage() resets the Wand page canvas and position.
8011 %
8012 %  The format of the MagickResetImagePage method is:
8013 %
8014 %      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8015 %        const char *page)
8016 %
8017 %  A description of each parameter follows:
8018 %
8019 %    o wand: the magick wand.
8020 %
8021 %    o page: the relative page specification.
8022 %
8023 */
8024 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8025   const char *page)
8026 {
8027   assert(wand != (MagickWand *) NULL);
8028   assert(wand->signature == WandSignature);
8029   if (wand->debug != MagickFalse)
8030     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8031   if (wand->images == (Image *) NULL)
8032     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8033   if ((page == (char *) NULL) || (*page == '\0'))
8034     {
8035       (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8036       return(MagickTrue);
8037     }
8038   return(ResetImagePage(wand->images,page));
8039 }
8040 \f
8041 /*
8042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8043 %                                                                             %
8044 %                                                                             %
8045 %                                                                             %
8046 %   M a g i c k R e s i z e I m a g e                                         %
8047 %                                                                             %
8048 %                                                                             %
8049 %                                                                             %
8050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8051 %
8052 %  MagickResizeImage() scales an image to the desired dimensions with one of
8053 %  these filters:
8054 %
8055 %    Bessel   Blackman   Box
8056 %    Catrom   Cubic      Gaussian
8057 %    Hanning  Hermite    Lanczos
8058 %    Mitchell Point      Quandratic
8059 %    Sinc     Triangle
8060 %
8061 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8062 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8063 %  are windowed (brought down to zero) with the Blackman filter.
8064 %
8065 %  The format of the MagickResizeImage method is:
8066 %
8067 %      MagickBooleanType MagickResizeImage(MagickWand *wand,
8068 %        const size_t columns,const size_t rows,
8069 %        const FilterTypes filter,const double blur)
8070 %
8071 %  A description of each parameter follows:
8072 %
8073 %    o wand: the magick wand.
8074 %
8075 %    o columns: the number of columns in the scaled image.
8076 %
8077 %    o rows: the number of rows in the scaled image.
8078 %
8079 %    o filter: Image filter to use.
8080 %
8081 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8082 %
8083 */
8084 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8085   const size_t columns,const size_t rows,const FilterTypes filter,
8086   const double blur)
8087 {
8088   Image
8089     *resize_image;
8090
8091   assert(wand != (MagickWand *) NULL);
8092   assert(wand->signature == WandSignature);
8093   if (wand->debug != MagickFalse)
8094     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8095   if (wand->images == (Image *) NULL)
8096     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8097   resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8098     wand->exception);
8099   if (resize_image == (Image *) NULL)
8100     return(MagickFalse);
8101   ReplaceImageInList(&wand->images,resize_image);
8102   return(MagickTrue);
8103 }
8104 \f
8105 /*
8106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8107 %                                                                             %
8108 %                                                                             %
8109 %                                                                             %
8110 %   M a g i c k R o l l I m a g e                                             %
8111 %                                                                             %
8112 %                                                                             %
8113 %                                                                             %
8114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8115 %
8116 %  MagickRollImage() offsets an image as defined by x and y.
8117 %
8118 %  The format of the MagickRollImage method is:
8119 %
8120 %      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8121 %        const size_t y)
8122 %
8123 %  A description of each parameter follows:
8124 %
8125 %    o wand: the magick wand.
8126 %
8127 %    o x: the x offset.
8128 %
8129 %    o y: the y offset.
8130 %
8131 %
8132 */
8133 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8134   const ssize_t x,const ssize_t y)
8135 {
8136   Image
8137     *roll_image;
8138
8139   assert(wand != (MagickWand *) NULL);
8140   assert(wand->signature == WandSignature);
8141   if (wand->debug != MagickFalse)
8142     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8143   if (wand->images == (Image *) NULL)
8144     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8145   roll_image=RollImage(wand->images,x,y,wand->exception);
8146   if (roll_image == (Image *) NULL)
8147     return(MagickFalse);
8148   ReplaceImageInList(&wand->images,roll_image);
8149   return(MagickTrue);
8150 }
8151 \f
8152 /*
8153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8154 %                                                                             %
8155 %                                                                             %
8156 %                                                                             %
8157 %   M a g i c k R o t a t e I m a g e                                         %
8158 %                                                                             %
8159 %                                                                             %
8160 %                                                                             %
8161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8162 %
8163 %  MagickRotateImage() rotates an image the specified number of degrees. Empty
8164 %  triangles left over from rotating the image are filled with the
8165 %  background color.
8166 %
8167 %  The format of the MagickRotateImage method is:
8168 %
8169 %      MagickBooleanType MagickRotateImage(MagickWand *wand,
8170 %        const PixelWand *background,const double degrees)
8171 %
8172 %  A description of each parameter follows:
8173 %
8174 %    o wand: the magick wand.
8175 %
8176 %    o background: the background pixel wand.
8177 %
8178 %    o degrees: the number of degrees to rotate the image.
8179 %
8180 %
8181 */
8182 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8183   const PixelWand *background,const double degrees)
8184 {
8185   Image
8186     *rotate_image;
8187
8188   assert(wand != (MagickWand *) NULL);
8189   assert(wand->signature == WandSignature);
8190   if (wand->debug != MagickFalse)
8191     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8192   if (wand->images == (Image *) NULL)
8193     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8194   PixelGetQuantumPacket(background,&wand->images->background_color);
8195   rotate_image=RotateImage(wand->images,degrees,wand->exception);
8196   if (rotate_image == (Image *) NULL)
8197     return(MagickFalse);
8198   ReplaceImageInList(&wand->images,rotate_image);
8199   return(MagickTrue);
8200 }
8201 \f
8202 /*
8203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8204 %                                                                             %
8205 %                                                                             %
8206 %                                                                             %
8207 %   M a g i c k S a m p l e I m a g e                                         %
8208 %                                                                             %
8209 %                                                                             %
8210 %                                                                             %
8211 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8212 %
8213 %  MagickSampleImage() scales an image to the desired dimensions with pixel
8214 %  sampling.  Unlike other scaling methods, this method does not introduce
8215 %  any additional color into the scaled image.
8216 %
8217 %  The format of the MagickSampleImage method is:
8218 %
8219 %      MagickBooleanType MagickSampleImage(MagickWand *wand,
8220 %        const size_t columns,const size_t rows)
8221 %
8222 %  A description of each parameter follows:
8223 %
8224 %    o wand: the magick wand.
8225 %
8226 %    o columns: the number of columns in the scaled image.
8227 %
8228 %    o rows: the number of rows in the scaled image.
8229 %
8230 %
8231 */
8232 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8233   const size_t columns,const size_t rows)
8234 {
8235   Image
8236     *sample_image;
8237
8238   assert(wand != (MagickWand *) NULL);
8239   assert(wand->signature == WandSignature);
8240   if (wand->debug != MagickFalse)
8241     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8242   if (wand->images == (Image *) NULL)
8243     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8244   sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8245   if (sample_image == (Image *) NULL)
8246     return(MagickFalse);
8247   ReplaceImageInList(&wand->images,sample_image);
8248   return(MagickTrue);
8249 }
8250 \f
8251 /*
8252 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8253 %                                                                             %
8254 %                                                                             %
8255 %                                                                             %
8256 %   M a g i c k S c a l e I m a g e                                           %
8257 %                                                                             %
8258 %                                                                             %
8259 %                                                                             %
8260 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8261 %
8262 %  MagickScaleImage() scales the size of an image to the given dimensions.
8263 %
8264 %  The format of the MagickScaleImage method is:
8265 %
8266 %      MagickBooleanType MagickScaleImage(MagickWand *wand,
8267 %        const size_t columns,const size_t rows)
8268 %
8269 %  A description of each parameter follows:
8270 %
8271 %    o wand: the magick wand.
8272 %
8273 %    o columns: the number of columns in the scaled image.
8274 %
8275 %    o rows: the number of rows in the scaled image.
8276 %
8277 %
8278 */
8279 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8280   const size_t columns,const size_t rows)
8281 {
8282   Image
8283     *scale_image;
8284
8285   assert(wand != (MagickWand *) NULL);
8286   assert(wand->signature == WandSignature);
8287   if (wand->debug != MagickFalse)
8288     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8289   if (wand->images == (Image *) NULL)
8290     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8291   scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8292   if (scale_image == (Image *) NULL)
8293     return(MagickFalse);
8294   ReplaceImageInList(&wand->images,scale_image);
8295   return(MagickTrue);
8296 }
8297 \f
8298 /*
8299 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8300 %                                                                             %
8301 %                                                                             %
8302 %                                                                             %
8303 %   M a g i c k S e g m e n t I m a g e                                       %
8304 %                                                                             %
8305 %                                                                             %
8306 %                                                                             %
8307 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8308 %
8309 %  MagickSegmentImage() segments an image by analyzing the histograms of the
8310 %  color components and identifying units that are homogeneous with the fuzzy
8311 %  C-means technique.
8312 %
8313 %  The format of the SegmentImage method is:
8314 %
8315 %      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8316 %        const ColorspaceType colorspace,const MagickBooleanType verbose,
8317 %        const double cluster_threshold,const double smooth_threshold)
8318 %
8319 %  A description of each parameter follows.
8320 %
8321 %    o wand: the wand.
8322 %
8323 %    o colorspace: the image colorspace.
8324 %
8325 %    o verbose:  Set to MagickTrue to print detailed information about the
8326 %      identified classes.
8327 %
8328 %    o cluster_threshold:  This represents the minimum number of pixels
8329 %      contained in a hexahedra before it can be considered valid (expressed as
8330 %      a percentage).
8331 %
8332 %    o smooth_threshold: the smoothing threshold eliminates noise in the second
8333 %      derivative of the histogram.  As the value is increased, you can expect a
8334 %      smoother second derivative.
8335 %
8336 */
8337 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8338   const ColorspaceType colorspace,const MagickBooleanType verbose,
8339   const double cluster_threshold,const double smooth_threshold)
8340 {
8341   MagickBooleanType
8342     status;
8343
8344   assert(wand != (MagickWand *) NULL);
8345   assert(wand->signature == WandSignature);
8346   if (wand->debug != MagickFalse)
8347     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8348   if (wand->images == (Image *) NULL)
8349     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8350   status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8351     smooth_threshold,wand->exception);
8352   return(status);
8353 }
8354 \f
8355 /*
8356 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8357 %                                                                             %
8358 %                                                                             %
8359 %                                                                             %
8360 %   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8361 %                                                                             %
8362 %                                                                             %
8363 %                                                                             %
8364 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8365 %
8366 %  MagickSelectiveBlurImage() selectively blur an image within a contrast
8367 %  threshold. It is similar to the unsharpen mask that sharpens everything with
8368 %  contrast above a certain threshold.
8369 %
8370 %  The format of the MagickSelectiveBlurImage method is:
8371 %
8372 %      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8373 %        const double radius,const double sigma,const double threshold,
8374 %        const double bias)
8375 %
8376 %  A description of each parameter follows:
8377 %
8378 %    o wand: the magick wand.
8379 %
8380 %    o radius: the radius of the gaussian, in pixels, not counting the center
8381 %      pixel.
8382 %
8383 %    o sigma: the standard deviation of the gaussian, in pixels.
8384 %
8385 %    o threshold: only pixels within this contrast threshold are included
8386 %      in the blur operation.
8387 %
8388 %    o bias: the bias.
8389 %
8390 */
8391 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8392   const double radius,const double sigma,const double threshold,
8393   const double bias)
8394 {
8395   Image
8396     *blur_image;
8397
8398   assert(wand != (MagickWand *) NULL);
8399   assert(wand->signature == WandSignature);
8400   if (wand->debug != MagickFalse)
8401     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8402   if (wand->images == (Image *) NULL)
8403     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8404   blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,bias,
8405     wand->exception);
8406   if (blur_image == (Image *) NULL)
8407     return(MagickFalse);
8408   ReplaceImageInList(&wand->images,blur_image);
8409   return(MagickTrue);
8410 }
8411 \f
8412 /*
8413 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8414 %                                                                             %
8415 %                                                                             %
8416 %                                                                             %
8417 %   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                       %
8418 %                                                                             %
8419 %                                                                             %
8420 %                                                                             %
8421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8422 %
8423 %  MagickSeparateImage() separates a channel from the image and returns a
8424 %  grayscale image.  A channel is a particular color component of each pixel
8425 %  in the image.
8426 %
8427 %  The format of the MagickSeparateImage method is:
8428 %
8429 %      MagickBooleanType MagickSeparateImage(MagickWand *wand)
8430 %
8431 %  A description of each parameter follows:
8432 %
8433 %    o wand: the magick wand.
8434 %
8435 */
8436 WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand)
8437 {
8438   MagickBooleanType
8439     status;
8440
8441   assert(wand != (MagickWand *) NULL);
8442   assert(wand->signature == WandSignature);
8443   if (wand->debug != MagickFalse)
8444     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8445   if (wand->images == (Image *) NULL)
8446     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8447   status=SeparateImage(wand->images);
8448   if (status == MagickFalse)
8449     InheritException(wand->exception,&wand->images->exception);
8450   return(status);
8451 }
8452 \f
8453 /*
8454 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8455 %                                                                             %
8456 %                                                                             %
8457 %                                                                             %
8458 %     M a g i c k S e p i a T o n e I m a g e                                 %
8459 %                                                                             %
8460 %                                                                             %
8461 %                                                                             %
8462 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8463 %
8464 %  MagickSepiaToneImage() applies a special effect to the image, similar to the
8465 %  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8466 %  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8467 %  threshold of 80% is a good starting point for a reasonable tone.
8468 %
8469 %  The format of the MagickSepiaToneImage method is:
8470 %
8471 %      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8472 %        const double threshold)
8473 %
8474 %  A description of each parameter follows:
8475 %
8476 %    o wand: the magick wand.
8477 %
8478 %    o threshold:  Define the extent of the sepia toning.
8479 %
8480 */
8481 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8482   const double threshold)
8483 {
8484   Image
8485     *sepia_image;
8486
8487   assert(wand != (MagickWand *) NULL);
8488   assert(wand->signature == WandSignature);
8489   if (wand->debug != MagickFalse)
8490     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8491   if (wand->images == (Image *) NULL)
8492     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8493   sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8494   if (sepia_image == (Image *) NULL)
8495     return(MagickFalse);
8496   ReplaceImageInList(&wand->images,sepia_image);
8497   return(MagickTrue);
8498 }
8499 \f
8500 /*
8501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8502 %                                                                             %
8503 %                                                                             %
8504 %                                                                             %
8505 %   M a g i c k S e t I m a g e                                               %
8506 %                                                                             %
8507 %                                                                             %
8508 %                                                                             %
8509 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8510 %
8511 %  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8512 %  MagickNextImage(), MagickPreviousImage() with the images from the specified
8513 %  wand.
8514 %
8515 %  The format of the MagickSetImage method is:
8516 %
8517 %      MagickBooleanType MagickSetImage(MagickWand *wand,
8518 %        const MagickWand *set_wand)
8519 %
8520 %  A description of each parameter follows:
8521 %
8522 %    o wand: the magick wand.
8523 %
8524 %    o set_wand: the set_wand wand.
8525 %
8526 */
8527 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8528   const MagickWand *set_wand)
8529 {
8530   Image
8531     *images;
8532
8533   assert(wand != (MagickWand *) NULL);
8534   assert(wand->signature == WandSignature);
8535   if (wand->debug != MagickFalse)
8536     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8537   assert(set_wand != (MagickWand *) NULL);
8538   assert(set_wand->signature == WandSignature);
8539   if (wand->debug != MagickFalse)
8540     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8541   if (set_wand->images == (Image *) NULL)
8542     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8543   images=CloneImageList(set_wand->images,wand->exception);
8544   if (images == (Image *) NULL)
8545     return(MagickFalse);
8546   ReplaceImageInList(&wand->images,images);
8547   return(MagickTrue);
8548 }
8549 \f
8550 /*
8551 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8552 %                                                                             %
8553 %                                                                             %
8554 %                                                                             %
8555 %   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                       %
8556 %                                                                             %
8557 %                                                                             %
8558 %                                                                             %
8559 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8560 %
8561 %  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8562 %  alpha channel.
8563 %
8564 %  The format of the MagickSetImageAlphaChannel method is:
8565 %
8566 %      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8567 %        const AlphaChannelType alpha_type)
8568 %
8569 %  A description of each parameter follows:
8570 %
8571 %    o wand: the magick wand.
8572 %
8573 %    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8574 %      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8575 %
8576 */
8577 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8578   const AlphaChannelType alpha_type)
8579 {
8580   assert(wand != (MagickWand *) NULL);
8581   assert(wand->signature == WandSignature);
8582   if (wand->debug != MagickFalse)
8583     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8584   if (wand->images == (Image *) NULL)
8585     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8586   return(SetImageAlphaChannel(wand->images,alpha_type,&wand->images->exception));
8587 }
8588 \f
8589 /*
8590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8591 %                                                                             %
8592 %                                                                             %
8593 %                                                                             %
8594 %   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                 %
8595 %                                                                             %
8596 %                                                                             %
8597 %                                                                             %
8598 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8599 %
8600 %  MagickSetImageBackgroundColor() sets the image background color.
8601 %
8602 %  The format of the MagickSetImageBackgroundColor method is:
8603 %
8604 %      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8605 %        const PixelWand *background)
8606 %
8607 %  A description of each parameter follows:
8608 %
8609 %    o wand: the magick wand.
8610 %
8611 %    o background: the background pixel wand.
8612 %
8613 */
8614 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8615   const PixelWand *background)
8616 {
8617   assert(wand != (MagickWand *) NULL);
8618   assert(wand->signature == WandSignature);
8619   if (wand->debug != MagickFalse)
8620     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8621   if (wand->images == (Image *) NULL)
8622     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8623   PixelGetQuantumPacket(background,&wand->images->background_color);
8624   return(MagickTrue);
8625 }
8626 \f
8627 /*
8628 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8629 %                                                                             %
8630 %                                                                             %
8631 %                                                                             %
8632 %   M a g i c k S e t I m a g e B i a s                                       %
8633 %                                                                             %
8634 %                                                                             %
8635 %                                                                             %
8636 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8637 %
8638 %  MagickSetImageBias() sets the image bias for any method that convolves an
8639 %  image (e.g. MagickConvolveImage()).
8640 %
8641 %  The format of the MagickSetImageBias method is:
8642 %
8643 %      MagickBooleanType MagickSetImageBias(MagickWand *wand,
8644 %        const double bias)
8645 %
8646 %  A description of each parameter follows:
8647 %
8648 %    o wand: the magick wand.
8649 %
8650 %    o bias: the image bias.
8651 %
8652 */
8653 WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
8654   const double bias)
8655 {
8656   assert(wand != (MagickWand *) NULL);
8657   assert(wand->signature == WandSignature);
8658   if (wand->debug != MagickFalse)
8659     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8660   if (wand->images == (Image *) NULL)
8661     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8662   wand->images->bias=bias;
8663   return(MagickTrue);
8664 }
8665 \f
8666 /*
8667 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8668 %                                                                             %
8669 %                                                                             %
8670 %                                                                             %
8671 %   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                         %
8672 %                                                                             %
8673 %                                                                             %
8674 %                                                                             %
8675 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8676 %
8677 %  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8678 %
8679 %  The format of the MagickSetImageBluePrimary method is:
8680 %
8681 %      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8682 %        const double x,const double y)
8683 %
8684 %  A description of each parameter follows:
8685 %
8686 %    o wand: the magick wand.
8687 %
8688 %    o x: the blue primary x-point.
8689 %
8690 %    o y: the blue primary y-point.
8691 %
8692 */
8693 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8694   const double x,const double y)
8695 {
8696   assert(wand != (MagickWand *) NULL);
8697   assert(wand->signature == WandSignature);
8698   if (wand->debug != MagickFalse)
8699     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8700   if (wand->images == (Image *) NULL)
8701     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8702   wand->images->chromaticity.blue_primary.x=x;
8703   wand->images->chromaticity.blue_primary.y=y;
8704   return(MagickTrue);
8705 }
8706 \f
8707 /*
8708 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8709 %                                                                             %
8710 %                                                                             %
8711 %                                                                             %
8712 %   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                         %
8713 %                                                                             %
8714 %                                                                             %
8715 %                                                                             %
8716 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8717 %
8718 %  MagickSetImageBorderColor() sets the image border color.
8719 %
8720 %  The format of the MagickSetImageBorderColor method is:
8721 %
8722 %      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8723 %        const PixelWand *border)
8724 %
8725 %  A description of each parameter follows:
8726 %
8727 %    o wand: the magick wand.
8728 %
8729 %    o border: the border pixel wand.
8730 %
8731 */
8732 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8733   const PixelWand *border)
8734 {
8735   assert(wand != (MagickWand *) NULL);
8736   assert(wand->signature == WandSignature);
8737   if (wand->debug != MagickFalse)
8738     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8739   if (wand->images == (Image *) NULL)
8740     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8741   PixelGetQuantumPacket(border,&wand->images->border_color);
8742   return(MagickTrue);
8743 }
8744 \f
8745 /*
8746 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8747 %                                                                             %
8748 %                                                                             %
8749 %                                                                             %
8750 %   M a g i c k S e t I m a g e C l i p M a s k                               %
8751 %                                                                             %
8752 %                                                                             %
8753 %                                                                             %
8754 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8755 %
8756 %  MagickSetImageClipMask() sets image clip mask.
8757 %
8758 %  The format of the MagickSetImageClipMask method is:
8759 %
8760 %      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8761 %        const MagickWand *clip_mask)
8762 %
8763 %  A description of each parameter follows:
8764 %
8765 %    o wand: the magick wand.
8766 %
8767 %    o clip_mask: the clip_mask wand.
8768 %
8769 */
8770 WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8771   const MagickWand *clip_mask)
8772 {
8773   assert(wand != (MagickWand *) NULL);
8774   assert(wand->signature == WandSignature);
8775   if (wand->debug != MagickFalse)
8776     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8777   assert(clip_mask != (MagickWand *) NULL);
8778   assert(clip_mask->signature == WandSignature);
8779   if (wand->debug != MagickFalse)
8780     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
8781   if (clip_mask->images == (Image *) NULL)
8782     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8783   return(SetImageClipMask(wand->images,clip_mask->images,wand->exception));
8784 }
8785 \f
8786 /*
8787 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8788 %                                                                             %
8789 %                                                                             %
8790 %                                                                             %
8791 %   M a g i c k S e t I m a g e C o l o r                                     %
8792 %                                                                             %
8793 %                                                                             %
8794 %                                                                             %
8795 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8796 %
8797 %  MagickSetImageColor() set the entire wand canvas to the specified color.
8798 %
8799 %  The format of the MagickSetImageColor method is:
8800 %
8801 %      MagickBooleanType MagickSetImageColor(MagickWand *wand,
8802 %        const PixelWand *color)
8803 %
8804 %  A description of each parameter follows:
8805 %
8806 %    o wand: the magick wand.
8807 %
8808 %    o background: the image color.
8809 %
8810 */
8811 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
8812   const PixelWand *color)
8813 {
8814   MagickBooleanType
8815     status;
8816
8817   PixelInfo
8818     pixel;
8819
8820   assert(wand != (MagickWand *) NULL);
8821   assert(wand->signature == WandSignature);
8822   if (wand->debug != MagickFalse)
8823     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8824   PixelGetMagickColor(color,&pixel);
8825   status=SetImageColor(wand->images,&pixel);
8826   if (status == MagickFalse)
8827     InheritException(wand->exception,&wand->images->exception);
8828   return(status);
8829 }
8830 \f
8831 /*
8832 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8833 %                                                                             %
8834 %                                                                             %
8835 %                                                                             %
8836 %   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                     %
8837 %                                                                             %
8838 %                                                                             %
8839 %                                                                             %
8840 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8841 %
8842 %  MagickSetImageColormapColor() sets the color of the specified colormap
8843 %  index.
8844 %
8845 %  The format of the MagickSetImageColormapColor method is:
8846 %
8847 %      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8848 %        const size_t index,const PixelWand *color)
8849 %
8850 %  A description of each parameter follows:
8851 %
8852 %    o wand: the magick wand.
8853 %
8854 %    o index: the offset into the image colormap.
8855 %
8856 %    o color: Return the colormap color in this wand.
8857 %
8858 */
8859 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8860   const size_t index,const PixelWand *color)
8861 {
8862   assert(wand != (MagickWand *) NULL);
8863   assert(wand->signature == WandSignature);
8864   if (wand->debug != MagickFalse)
8865     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8866   if (wand->images == (Image *) NULL)
8867     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8868   if ((wand->images->colormap == (PixelInfo *) NULL) ||
8869       (index >= wand->images->colors))
8870     ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
8871   PixelGetQuantumPacket(color,wand->images->colormap+index);
8872   return(SyncImage(wand->images));
8873 }
8874 \f
8875 /*
8876 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8877 %                                                                             %
8878 %                                                                             %
8879 %                                                                             %
8880 %   M a g i c k S e t I m a g e C o l o r s p a c e                           %
8881 %                                                                             %
8882 %                                                                             %
8883 %                                                                             %
8884 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8885 %
8886 %  MagickSetImageColorspace() sets the image colorspace.
8887 %
8888 %  The format of the MagickSetImageColorspace method is:
8889 %
8890 %      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8891 %        const ColorspaceType colorspace)
8892 %
8893 %  A description of each parameter follows:
8894 %
8895 %    o wand: the magick wand.
8896 %
8897 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
8898 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
8899 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
8900 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
8901 %      HSLColorspace, or HWBColorspace.
8902 %
8903 */
8904 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8905   const ColorspaceType colorspace)
8906 {
8907   assert(wand != (MagickWand *) NULL);
8908   assert(wand->signature == WandSignature);
8909   if (wand->debug != MagickFalse)
8910     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8911   if (wand->images == (Image *) NULL)
8912     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8913   return(SetImageColorspace(wand->images,colorspace,&wand->images->exception));
8914 }
8915 \f
8916 /*
8917 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8918 %                                                                             %
8919 %                                                                             %
8920 %                                                                             %
8921 %   M a g i c k S e t I m a g e C o m p o s e                                 %
8922 %                                                                             %
8923 %                                                                             %
8924 %                                                                             %
8925 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8926 %
8927 %  MagickSetImageCompose() sets the image composite operator, useful for
8928 %  specifying how to composite the image thumbnail when using the
8929 %  MagickMontageImage() method.
8930 %
8931 %  The format of the MagickSetImageCompose method is:
8932 %
8933 %      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8934 %        const CompositeOperator compose)
8935 %
8936 %  A description of each parameter follows:
8937 %
8938 %    o wand: the magick wand.
8939 %
8940 %    o compose: the image composite operator.
8941 %
8942 */
8943 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8944   const CompositeOperator compose)
8945 {
8946   assert(wand != (MagickWand *) NULL);
8947   assert(wand->signature == WandSignature);
8948   if (wand->debug != MagickFalse)
8949     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8950   if (wand->images == (Image *) NULL)
8951     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8952   wand->images->compose=compose;
8953   return(MagickTrue);
8954 }
8955 \f
8956 /*
8957 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8958 %                                                                             %
8959 %                                                                             %
8960 %                                                                             %
8961 %   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                         %
8962 %                                                                             %
8963 %                                                                             %
8964 %                                                                             %
8965 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8966 %
8967 %  MagickSetImageCompression() sets the image compression.
8968 %
8969 %  The format of the MagickSetImageCompression method is:
8970 %
8971 %      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8972 %        const CompressionType compression)
8973 %
8974 %  A description of each parameter follows:
8975 %
8976 %    o wand: the magick wand.
8977 %
8978 %    o compression: the image compression type.
8979 %
8980 */
8981 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8982   const CompressionType compression)
8983 {
8984   assert(wand != (MagickWand *) NULL);
8985   assert(wand->signature == WandSignature);
8986   if (wand->debug != MagickFalse)
8987     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8988   if (wand->images == (Image *) NULL)
8989     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8990   wand->images->compression=compression;
8991   return(MagickTrue);
8992 }
8993 \f
8994 /*
8995 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8996 %                                                                             %
8997 %                                                                             %
8998 %                                                                             %
8999 %   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           %
9000 %                                                                             %
9001 %                                                                             %
9002 %                                                                             %
9003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9004 %
9005 %  MagickSetImageCompressionQuality() sets the image compression quality.
9006 %
9007 %  The format of the MagickSetImageCompressionQuality method is:
9008 %
9009 %      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9010 %        const size_t quality)
9011 %
9012 %  A description of each parameter follows:
9013 %
9014 %    o wand: the magick wand.
9015 %
9016 %    o quality: the image compression tlityype.
9017 %
9018 */
9019 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9020   const size_t quality)
9021 {
9022   assert(wand != (MagickWand *) NULL);
9023   assert(wand->signature == WandSignature);
9024   if (wand->debug != MagickFalse)
9025     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9026   if (wand->images == (Image *) NULL)
9027     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9028   wand->images->quality=quality;
9029   return(MagickTrue);
9030 }
9031 \f
9032 /*
9033 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9034 %                                                                             %
9035 %                                                                             %
9036 %                                                                             %
9037 %   M a g i c k S e t I m a g e D e l a y                                     %
9038 %                                                                             %
9039 %                                                                             %
9040 %                                                                             %
9041 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9042 %
9043 %  MagickSetImageDelay() sets the image delay.
9044 %
9045 %  The format of the MagickSetImageDelay method is:
9046 %
9047 %      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9048 %        const size_t delay)
9049 %
9050 %  A description of each parameter follows:
9051 %
9052 %    o wand: the magick wand.
9053 %
9054 %    o delay: the image delay in ticks-per-second units.
9055 %
9056 */
9057 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9058   const size_t delay)
9059 {
9060   assert(wand != (MagickWand *) NULL);
9061   assert(wand->signature == WandSignature);
9062   if (wand->debug != MagickFalse)
9063     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9064   if (wand->images == (Image *) NULL)
9065     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9066   wand->images->delay=delay;
9067   return(MagickTrue);
9068 }
9069 \f
9070 /*
9071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9072 %                                                                             %
9073 %                                                                             %
9074 %                                                                             %
9075 %   M a g i c k S e t I m a g e D e p t h                                     %
9076 %                                                                             %
9077 %                                                                             %
9078 %                                                                             %
9079 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9080 %
9081 %  MagickSetImageDepth() sets the image depth.
9082 %
9083 %  The format of the MagickSetImageDepth method is:
9084 %
9085 %      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9086 %        const size_t depth)
9087 %
9088 %  A description of each parameter follows:
9089 %
9090 %    o wand: the magick wand.
9091 %
9092 %    o depth: the image depth in bits: 8, 16, or 32.
9093 %
9094 */
9095 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9096   const size_t depth)
9097 {
9098   assert(wand != (MagickWand *) NULL);
9099   assert(wand->signature == WandSignature);
9100   if (wand->debug != MagickFalse)
9101     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9102   if (wand->images == (Image *) NULL)
9103     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9104   return(SetImageDepth(wand->images,depth));
9105 }
9106 \f
9107 /*
9108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9109 %                                                                             %
9110 %                                                                             %
9111 %                                                                             %
9112 %   M a g i c k S e t I m a g e D i s p o s e                                 %
9113 %                                                                             %
9114 %                                                                             %
9115 %                                                                             %
9116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9117 %
9118 %  MagickSetImageDispose() sets the image disposal method.
9119 %
9120 %  The format of the MagickSetImageDispose method is:
9121 %
9122 %      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9123 %        const DisposeType dispose)
9124 %
9125 %  A description of each parameter follows:
9126 %
9127 %    o wand: the magick wand.
9128 %
9129 %    o dispose: the image disposeal type.
9130 %
9131 */
9132 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9133   const DisposeType dispose)
9134 {
9135   assert(wand != (MagickWand *) NULL);
9136   assert(wand->signature == WandSignature);
9137   if (wand->debug != MagickFalse)
9138     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9139   if (wand->images == (Image *) NULL)
9140     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9141   wand->images->dispose=dispose;
9142   return(MagickTrue);
9143 }
9144 \f
9145 /*
9146 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9147 %                                                                             %
9148 %                                                                             %
9149 %                                                                             %
9150 %   M a g i c k S e t I m a g e E x t e n t                                   %
9151 %                                                                             %
9152 %                                                                             %
9153 %                                                                             %
9154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9155 %
9156 %  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9157 %
9158 %  The format of the MagickSetImageExtent method is:
9159 %
9160 %      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9161 %        const size_t columns,const unsigned rows)
9162 %
9163 %  A description of each parameter follows:
9164 %
9165 %    o wand: the magick wand.
9166 %
9167 %    o columns:  The image width in pixels.
9168 %
9169 %    o rows:  The image height in pixels.
9170 %
9171 */
9172 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9173   const size_t columns,const size_t rows)
9174 {
9175   assert(wand != (MagickWand *) NULL);
9176   assert(wand->signature == WandSignature);
9177   if (wand->debug != MagickFalse)
9178     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9179   if (wand->images == (Image *) NULL)
9180     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9181   return(SetImageExtent(wand->images,columns,rows,&wand->images->exception));
9182 }
9183 \f
9184 /*
9185 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9186 %                                                                             %
9187 %                                                                             %
9188 %                                                                             %
9189 %   M a g i c k S e t I m a g e F i l e n a m e                               %
9190 %                                                                             %
9191 %                                                                             %
9192 %                                                                             %
9193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9194 %
9195 %  MagickSetImageFilename() sets the filename of a particular image in a
9196 %  sequence.
9197 %
9198 %  The format of the MagickSetImageFilename method is:
9199 %
9200 %      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9201 %        const char *filename)
9202 %
9203 %  A description of each parameter follows:
9204 %
9205 %    o wand: the magick wand.
9206 %
9207 %    o filename: the image filename.
9208 %
9209 */
9210 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9211   const char *filename)
9212 {
9213   assert(wand != (MagickWand *) NULL);
9214   assert(wand->signature == WandSignature);
9215   if (wand->debug != MagickFalse)
9216     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9217   if (wand->images == (Image *) NULL)
9218     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9219   if (filename != (const char *) NULL)
9220     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9221   return(MagickTrue);
9222 }
9223 \f
9224 /*
9225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9226 %                                                                             %
9227 %                                                                             %
9228 %                                                                             %
9229 %   M a g i c k S e t I m a g e F o r m a t                                   %
9230 %                                                                             %
9231 %                                                                             %
9232 %                                                                             %
9233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9234 %
9235 %  MagickSetImageFormat() sets the format of a particular image in a
9236 %  sequence.
9237 %
9238 %  The format of the MagickSetImageFormat method is:
9239 %
9240 %      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9241 %        const char *format)
9242 %
9243 %  A description of each parameter follows:
9244 %
9245 %    o wand: the magick wand.
9246 %
9247 %    o format: the image format.
9248 %
9249 */
9250 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9251   const char *format)
9252 {
9253   const MagickInfo
9254     *magick_info;
9255
9256   assert(wand != (MagickWand *) NULL);
9257   assert(wand->signature == WandSignature);
9258   if (wand->debug != MagickFalse)
9259     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9260   if (wand->images == (Image *) NULL)
9261     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9262   if ((format == (char *) NULL) || (*format == '\0'))
9263     {
9264       *wand->images->magick='\0';
9265       return(MagickTrue);
9266     }
9267   magick_info=GetMagickInfo(format,wand->exception);
9268   if (magick_info == (const MagickInfo *) NULL)
9269     return(MagickFalse);
9270   ClearMagickException(wand->exception);
9271   (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9272   return(MagickTrue);
9273 }
9274 \f
9275 /*
9276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9277 %                                                                             %
9278 %                                                                             %
9279 %                                                                             %
9280 %   M a g i c k S e t I m a g e F u z z                                       %
9281 %                                                                             %
9282 %                                                                             %
9283 %                                                                             %
9284 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9285 %
9286 %  MagickSetImageFuzz() sets the image fuzz.
9287 %
9288 %  The format of the MagickSetImageFuzz method is:
9289 %
9290 %      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9291 %        const double fuzz)
9292 %
9293 %  A description of each parameter follows:
9294 %
9295 %    o wand: the magick wand.
9296 %
9297 %    o fuzz: the image fuzz.
9298 %
9299 */
9300 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9301   const double fuzz)
9302 {
9303   assert(wand != (MagickWand *) NULL);
9304   assert(wand->signature == WandSignature);
9305   if (wand->debug != MagickFalse)
9306     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9307   if (wand->images == (Image *) NULL)
9308     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9309   wand->images->fuzz=fuzz;
9310   return(MagickTrue);
9311 }
9312 \f
9313 /*
9314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9315 %                                                                             %
9316 %                                                                             %
9317 %                                                                             %
9318 %   M a g i c k S e t I m a g e G a m m a                                     %
9319 %                                                                             %
9320 %                                                                             %
9321 %                                                                             %
9322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9323 %
9324 %  MagickSetImageGamma() sets the image gamma.
9325 %
9326 %  The format of the MagickSetImageGamma method is:
9327 %
9328 %      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9329 %        const double gamma)
9330 %
9331 %  A description of each parameter follows:
9332 %
9333 %    o wand: the magick wand.
9334 %
9335 %    o gamma: the image gamma.
9336 %
9337 */
9338 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9339   const double gamma)
9340 {
9341   assert(wand != (MagickWand *) NULL);
9342   assert(wand->signature == WandSignature);
9343   if (wand->debug != MagickFalse)
9344     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9345   if (wand->images == (Image *) NULL)
9346     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9347   wand->images->gamma=gamma;
9348   return(MagickTrue);
9349 }
9350 \f
9351 /*
9352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9353 %                                                                             %
9354 %                                                                             %
9355 %                                                                             %
9356 %   M a g i c k S e t I m a g e G r a v i t y                                 %
9357 %                                                                             %
9358 %                                                                             %
9359 %                                                                             %
9360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9361 %
9362 %  MagickSetImageGravity() sets the image gravity type.
9363 %
9364 %  The format of the MagickSetImageGravity method is:
9365 %
9366 %      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9367 %        const GravityType gravity)
9368 %
9369 %  A description of each parameter follows:
9370 %
9371 %    o wand: the magick wand.
9372 %
9373 %    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9374 %      PlaneInterlace, PartitionInterlace.
9375 %
9376 */
9377 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9378   const GravityType gravity)
9379 {
9380   assert(wand != (MagickWand *) NULL);
9381   assert(wand->signature == WandSignature);
9382   if (wand->debug != MagickFalse)
9383     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9384   if (wand->images == (Image *) NULL)
9385     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9386   wand->images->gravity=gravity;
9387   return(MagickTrue);
9388 }
9389 \f
9390 /*
9391 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9392 %                                                                             %
9393 %                                                                             %
9394 %                                                                             %
9395 %   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                       %
9396 %                                                                             %
9397 %                                                                             %
9398 %                                                                             %
9399 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9400 %
9401 %  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9402 %  point.
9403 %
9404 %  The format of the MagickSetImageGreenPrimary method is:
9405 %
9406 %      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9407 %        const double x,const double y)
9408 %
9409 %  A description of each parameter follows:
9410 %
9411 %    o wand: the magick wand.
9412 %
9413 %    o x: the green primary x-point.
9414 %
9415 %    o y: the green primary y-point.
9416 %
9417 %
9418 */
9419 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9420   const double x,const double y)
9421 {
9422   assert(wand != (MagickWand *) NULL);
9423   assert(wand->signature == WandSignature);
9424   if (wand->debug != MagickFalse)
9425     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9426   if (wand->images == (Image *) NULL)
9427     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9428   wand->images->chromaticity.green_primary.x=x;
9429   wand->images->chromaticity.green_primary.y=y;
9430   return(MagickTrue);
9431 }
9432 \f
9433 /*
9434 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9435 %                                                                             %
9436 %                                                                             %
9437 %                                                                             %
9438 %   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                 %
9439 %                                                                             %
9440 %                                                                             %
9441 %                                                                             %
9442 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9443 %
9444 %  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9445 %
9446 %  The format of the MagickSetImageInterlaceScheme method is:
9447 %
9448 %      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9449 %        const InterlaceType interlace)
9450 %
9451 %  A description of each parameter follows:
9452 %
9453 %    o wand: the magick wand.
9454 %
9455 %    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9456 %      PlaneInterlace, PartitionInterlace.
9457 %
9458 */
9459 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9460   const InterlaceType interlace)
9461 {
9462   assert(wand != (MagickWand *) NULL);
9463   assert(wand->signature == WandSignature);
9464   if (wand->debug != MagickFalse)
9465     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9466   if (wand->images == (Image *) NULL)
9467     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9468   wand->images->interlace=interlace;
9469   return(MagickTrue);
9470 }
9471 \f
9472 /*
9473 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9474 %                                                                             %
9475 %                                                                             %
9476 %                                                                             %
9477 %   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             %
9478 %                                                                             %
9479 %                                                                             %
9480 %                                                                             %
9481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9482 %
9483 %  MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel method.
9484 %
9485 %  The format of the MagickSetImagePixelInterpolateMethod method is:
9486 %
9487 %      MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9488 %        const PixelInterpolateMethod method)
9489 %
9490 %  A description of each parameter follows:
9491 %
9492 %    o wand: the magick wand.
9493 %
9494 %    o method: the image interpole pixel methods: choose from Undefined,
9495 %      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9496 %
9497 */
9498 WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9499   const PixelInterpolateMethod method)
9500 {
9501   assert(wand != (MagickWand *) NULL);
9502   assert(wand->signature == WandSignature);
9503   if (wand->debug != MagickFalse)
9504     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9505   if (wand->images == (Image *) NULL)
9506     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9507   wand->images->interpolate=method;
9508   return(MagickTrue);
9509 }
9510 \f
9511 /*
9512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9513 %                                                                             %
9514 %                                                                             %
9515 %                                                                             %
9516 %   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9517 %                                                                             %
9518 %                                                                             %
9519 %                                                                             %
9520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9521 %
9522 %  MagickSetImageIterations() sets the image iterations.
9523 %
9524 %  The format of the MagickSetImageIterations method is:
9525 %
9526 %      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9527 %        const size_t iterations)
9528 %
9529 %  A description of each parameter follows:
9530 %
9531 %    o wand: the magick wand.
9532 %
9533 %    o delay: the image delay in 1/100th of a second.
9534 %
9535 */
9536 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9537   const size_t iterations)
9538 {
9539   assert(wand != (MagickWand *) NULL);
9540   assert(wand->signature == WandSignature);
9541   if (wand->debug != MagickFalse)
9542     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9543   if (wand->images == (Image *) NULL)
9544     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9545   wand->images->iterations=iterations;
9546   return(MagickTrue);
9547 }
9548 \f
9549 /*
9550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9551 %                                                                             %
9552 %                                                                             %
9553 %                                                                             %
9554 %   M a g i c k S e t I m a g e M a t t e                                     %
9555 %                                                                             %
9556 %                                                                             %
9557 %                                                                             %
9558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9559 %
9560 %  MagickSetImageMatte() sets the image matte channel.
9561 %
9562 %  The format of the MagickSetImageMatteColor method is:
9563 %
9564 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9565 %        const MagickBooleanType *matte)
9566 %
9567 %  A description of each parameter follows:
9568 %
9569 %    o wand: the magick wand.
9570 %
9571 %    o matte: Set to MagickTrue to enable the image matte channel otherwise
9572 %      MagickFalse.
9573 %
9574 */
9575 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9576   const MagickBooleanType matte)
9577 {
9578   assert(wand != (MagickWand *) NULL);
9579   assert(wand->signature == WandSignature);
9580   if (wand->debug != MagickFalse)
9581     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9582   if (wand->images == (Image *) NULL)
9583     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9584   if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
9585     (void) SetImageAlpha(wand->images,OpaqueAlpha);
9586   wand->images->matte=matte;
9587   return(MagickTrue);
9588 }
9589 \f
9590 /*
9591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9592 %                                                                             %
9593 %                                                                             %
9594 %                                                                             %
9595 %   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9596 %                                                                             %
9597 %                                                                             %
9598 %                                                                             %
9599 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9600 %
9601 %  MagickSetImageMatteColor() sets the image matte color.
9602 %
9603 %  The format of the MagickSetImageMatteColor method is:
9604 %
9605 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9606 %        const PixelWand *matte)
9607 %
9608 %  A description of each parameter follows:
9609 %
9610 %    o wand: the magick wand.
9611 %
9612 %    o matte: the matte pixel wand.
9613 %
9614 */
9615 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9616   const PixelWand *matte)
9617 {
9618   assert(wand != (MagickWand *) NULL);
9619   assert(wand->signature == WandSignature);
9620   if (wand->debug != MagickFalse)
9621     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9622   if (wand->images == (Image *) NULL)
9623     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9624   PixelGetQuantumPacket(matte,&wand->images->matte_color);
9625   return(MagickTrue);
9626 }
9627 \f
9628 /*
9629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9630 %                                                                             %
9631 %                                                                             %
9632 %                                                                             %
9633 %   M a g i c k S e t I m a g e O p a c i t y                                 %
9634 %                                                                             %
9635 %                                                                             %
9636 %                                                                             %
9637 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9638 %
9639 %  MagickSetImageAlpha() sets the image to the specified alpha level.
9640 %
9641 %  The format of the MagickSetImageAlpha method is:
9642 %
9643 %      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9644 %        const double alpha)
9645 %
9646 %  A description of each parameter follows:
9647 %
9648 %    o wand: the magick wand.
9649 %
9650 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9651 %      transparent.
9652 %
9653 */
9654 WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9655   const double alpha)
9656 {
9657   MagickBooleanType
9658     status;
9659
9660   assert(wand != (MagickWand *) NULL);
9661   assert(wand->signature == WandSignature);
9662   if (wand->debug != MagickFalse)
9663     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9664   if (wand->images == (Image *) NULL)
9665     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9666   status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha));
9667   if (status == MagickFalse)
9668     InheritException(wand->exception,&wand->images->exception);
9669   return(status);
9670 }
9671 \f
9672 /*
9673 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9674 %                                                                             %
9675 %                                                                             %
9676 %                                                                             %
9677 %   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                         %
9678 %                                                                             %
9679 %                                                                             %
9680 %                                                                             %
9681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9682 %
9683 %  MagickSetImageOrientation() sets the image orientation.
9684 %
9685 %  The format of the MagickSetImageOrientation method is:
9686 %
9687 %      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9688 %        const OrientationType orientation)
9689 %
9690 %  A description of each parameter follows:
9691 %
9692 %    o wand: the magick wand.
9693 %
9694 %    o orientation: the image orientation type.
9695 %
9696 */
9697 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9698   const OrientationType orientation)
9699 {
9700   assert(wand != (MagickWand *) NULL);
9701   assert(wand->signature == WandSignature);
9702   if (wand->debug != MagickFalse)
9703     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9704   if (wand->images == (Image *) NULL)
9705     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9706   wand->images->orientation=orientation;
9707   return(MagickTrue);
9708 }
9709 \f
9710 /*
9711 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9712 %                                                                             %
9713 %                                                                             %
9714 %                                                                             %
9715 %   M a g i c k S e t I m a g e P a g e                                       %
9716 %                                                                             %
9717 %                                                                             %
9718 %                                                                             %
9719 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9720 %
9721 %  MagickSetImagePage() sets the page geometry of the image.
9722 %
9723 %  The format of the MagickSetImagePage method is:
9724 %
9725 %      MagickBooleanType MagickSetImagePage(MagickWand *wand,
9726 %        const size_t width,const size_t height,const ssize_t x,
9727 %        const ssize_t y)
9728 %
9729 %  A description of each parameter follows:
9730 %
9731 %    o wand: the magick wand.
9732 %
9733 %    o width: the page width.
9734 %
9735 %    o height: the page height.
9736 %
9737 %    o x: the page x-offset.
9738 %
9739 %    o y: the page y-offset.
9740 %
9741 */
9742 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
9743   const size_t width,const size_t height,const ssize_t x,
9744   const ssize_t y)
9745 {
9746   assert(wand != (MagickWand *) NULL);
9747   assert(wand->signature == WandSignature);
9748   if (wand->debug != MagickFalse)
9749     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9750   if (wand->images == (Image *) NULL)
9751     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9752   wand->images->page.width=width;
9753   wand->images->page.height=height;
9754   wand->images->page.x=x;
9755   wand->images->page.y=y;
9756   return(MagickTrue);
9757 }
9758 \f
9759 /*
9760 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9761 %                                                                             %
9762 %                                                                             %
9763 %                                                                             %
9764 %   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                 %
9765 %                                                                             %
9766 %                                                                             %
9767 %                                                                             %
9768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9769 %
9770 %  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
9771 %  specified method and returns the previous progress monitor if any.  The
9772 %  progress monitor method looks like this:
9773 %
9774 %    MagickBooleanType MagickProgressMonitor(const char *text,
9775 %      const MagickOffsetType offset,const MagickSizeType span,
9776 %      void *client_data)
9777 %
9778 %  If the progress monitor returns MagickFalse, the current operation is
9779 %  interrupted.
9780 %
9781 %  The format of the MagickSetImageProgressMonitor method is:
9782 %
9783 %      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
9784 %        const MagickProgressMonitor progress_monitor,void *client_data)
9785 %
9786 %  A description of each parameter follows:
9787 %
9788 %    o wand: the magick wand.
9789 %
9790 %    o progress_monitor: Specifies a pointer to a method to monitor progress
9791 %      of an image operation.
9792 %
9793 %    o client_data: Specifies a pointer to any client data.
9794 %
9795 */
9796 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
9797   const MagickProgressMonitor progress_monitor,void *client_data)
9798 {
9799   MagickProgressMonitor
9800     previous_monitor;
9801
9802   assert(wand != (MagickWand *) NULL);
9803   assert(wand->signature == WandSignature);
9804   if (wand->debug != MagickFalse)
9805     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9806   if (wand->images == (Image *) NULL)
9807     {
9808       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
9809         "ContainsNoImages","`%s'",wand->name);
9810       return((MagickProgressMonitor) NULL);
9811     }
9812   previous_monitor=SetImageProgressMonitor(wand->images,
9813     progress_monitor,client_data);
9814   return(previous_monitor);
9815 }
9816 \f
9817 /*
9818 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9819 %                                                                             %
9820 %                                                                             %
9821 %                                                                             %
9822 %   M a g i c k S e t I m a g e R e d P r i m a r y                           %
9823 %                                                                             %
9824 %                                                                             %
9825 %                                                                             %
9826 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9827 %
9828 %  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
9829 %
9830 %  The format of the MagickSetImageRedPrimary method is:
9831 %
9832 %      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9833 %        const double x,const double y)
9834 %
9835 %  A description of each parameter follows:
9836 %
9837 %    o wand: the magick wand.
9838 %
9839 %    o x: the red primary x-point.
9840 %
9841 %    o y: the red primary y-point.
9842 %
9843 */
9844 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9845   const double x,const double y)
9846 {
9847   assert(wand != (MagickWand *) NULL);
9848   assert(wand->signature == WandSignature);
9849   if (wand->debug != MagickFalse)
9850     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9851   if (wand->images == (Image *) NULL)
9852     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9853   wand->images->chromaticity.red_primary.x=x;
9854   wand->images->chromaticity.red_primary.y=y;
9855   return(MagickTrue);
9856 }
9857 \f
9858 /*
9859 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9860 %                                                                             %
9861 %                                                                             %
9862 %                                                                             %
9863 %   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                 %
9864 %                                                                             %
9865 %                                                                             %
9866 %                                                                             %
9867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9868 %
9869 %  MagickSetImageRenderingIntent() sets the image rendering intent.
9870 %
9871 %  The format of the MagickSetImageRenderingIntent method is:
9872 %
9873 %      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9874 %        const RenderingIntent rendering_intent)
9875 %
9876 %  A description of each parameter follows:
9877 %
9878 %    o wand: the magick wand.
9879 %
9880 %    o rendering_intent: the image rendering intent: UndefinedIntent,
9881 %      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
9882 %
9883 */
9884 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9885   const RenderingIntent rendering_intent)
9886 {
9887   assert(wand != (MagickWand *) NULL);
9888   assert(wand->signature == WandSignature);
9889   if (wand->debug != MagickFalse)
9890     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9891   if (wand->images == (Image *) NULL)
9892     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9893   wand->images->rendering_intent=rendering_intent;
9894   return(MagickTrue);
9895 }
9896 \f
9897 /*
9898 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9899 %                                                                             %
9900 %                                                                             %
9901 %                                                                             %
9902 %   M a g i c k S e t I m a g e R e s o l u t i o n                           %
9903 %                                                                             %
9904 %                                                                             %
9905 %                                                                             %
9906 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9907 %
9908 %  MagickSetImageResolution() sets the image resolution.
9909 %
9910 %  The format of the MagickSetImageResolution method is:
9911 %
9912 %      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9913 %        const double x_resolution,const doubtl y_resolution)
9914 %
9915 %  A description of each parameter follows:
9916 %
9917 %    o wand: the magick wand.
9918 %
9919 %    o x_resolution: the image x resolution.
9920 %
9921 %    o y_resolution: the image y resolution.
9922 %
9923 */
9924 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9925   const double x_resolution,const double y_resolution)
9926 {
9927   assert(wand != (MagickWand *) NULL);
9928   assert(wand->signature == WandSignature);
9929   if (wand->debug != MagickFalse)
9930     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9931   if (wand->images == (Image *) NULL)
9932     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9933   wand->images->x_resolution=x_resolution;
9934   wand->images->y_resolution=y_resolution;
9935   return(MagickTrue);
9936 }
9937 \f
9938 /*
9939 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9940 %                                                                             %
9941 %                                                                             %
9942 %                                                                             %
9943 %   M a g i c k S e t I m a g e S c e n e                                     %
9944 %                                                                             %
9945 %                                                                             %
9946 %                                                                             %
9947 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9948 %
9949 %  MagickSetImageScene() sets the image scene.
9950 %
9951 %  The format of the MagickSetImageScene method is:
9952 %
9953 %      MagickBooleanType MagickSetImageScene(MagickWand *wand,
9954 %        const size_t scene)
9955 %
9956 %  A description of each parameter follows:
9957 %
9958 %    o wand: the magick wand.
9959 %
9960 %    o delay: the image scene number.
9961 %
9962 */
9963 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
9964   const size_t scene)
9965 {
9966   assert(wand != (MagickWand *) NULL);
9967   assert(wand->signature == WandSignature);
9968   if (wand->debug != MagickFalse)
9969     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9970   if (wand->images == (Image *) NULL)
9971     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9972   wand->images->scene=scene;
9973   return(MagickTrue);
9974 }
9975 \f
9976 /*
9977 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9978 %                                                                             %
9979 %                                                                             %
9980 %                                                                             %
9981 %   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                   %
9982 %                                                                             %
9983 %                                                                             %
9984 %                                                                             %
9985 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9986 %
9987 %  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
9988 %
9989 %  The format of the MagickSetImageTicksPerSecond method is:
9990 %
9991 %      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9992 %        const ssize_t ticks_per-second)
9993 %
9994 %  A description of each parameter follows:
9995 %
9996 %    o wand: the magick wand.
9997 %
9998 %    o ticks_per_second: the units to use for the image delay.
9999 %
10000 */
10001 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10002   const ssize_t ticks_per_second)
10003 {
10004   assert(wand != (MagickWand *) NULL);
10005   assert(wand->signature == WandSignature);
10006   if (wand->debug != MagickFalse)
10007     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10008   if (wand->images == (Image *) NULL)
10009     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10010   wand->images->ticks_per_second=ticks_per_second;
10011   return(MagickTrue);
10012 }
10013 \f
10014 /*
10015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10016 %                                                                             %
10017 %                                                                             %
10018 %                                                                             %
10019 %   M a g i c k S e t I m a g e T y p e                                       %
10020 %                                                                             %
10021 %                                                                             %
10022 %                                                                             %
10023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10024 %
10025 %  MagickSetImageType() sets the image type.
10026 %
10027 %  The format of the MagickSetImageType method is:
10028 %
10029 %      MagickBooleanType MagickSetImageType(MagickWand *wand,
10030 %        const ImageType image_type)
10031 %
10032 %  A description of each parameter follows:
10033 %
10034 %    o wand: the magick wand.
10035 %
10036 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10037 %      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10038 %      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10039 %      or OptimizeType.
10040 %
10041 */
10042 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10043   const ImageType image_type)
10044 {
10045   assert(wand != (MagickWand *) NULL);
10046   assert(wand->signature == WandSignature);
10047   if (wand->debug != MagickFalse)
10048     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10049   if (wand->images == (Image *) NULL)
10050     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10051   return(SetImageType(wand->images,image_type,wand->exception));
10052 }
10053 \f
10054 /*
10055 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10056 %                                                                             %
10057 %                                                                             %
10058 %                                                                             %
10059 %   M a g i c k S e t I m a g e U n i t s                                     %
10060 %                                                                             %
10061 %                                                                             %
10062 %                                                                             %
10063 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10064 %
10065 %  MagickSetImageUnits() sets the image units of resolution.
10066 %
10067 %  The format of the MagickSetImageUnits method is:
10068 %
10069 %      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10070 %        const ResolutionType units)
10071 %
10072 %  A description of each parameter follows:
10073 %
10074 %    o wand: the magick wand.
10075 %
10076 %    o units: the image units of resolution : UndefinedResolution,
10077 %      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10078 %
10079 */
10080 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10081   const ResolutionType units)
10082 {
10083   assert(wand != (MagickWand *) NULL);
10084   assert(wand->signature == WandSignature);
10085   if (wand->debug != MagickFalse)
10086     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10087   if (wand->images == (Image *) NULL)
10088     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10089   wand->images->units=units;
10090   return(MagickTrue);
10091 }
10092 \f
10093 /*
10094 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10095 %                                                                             %
10096 %                                                                             %
10097 %                                                                             %
10098 %   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           %
10099 %                                                                             %
10100 %                                                                             %
10101 %                                                                             %
10102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10103 %
10104 %  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10105 %
10106 %  The format of the MagickSetImageVirtualPixelMethod method is:
10107 %
10108 %      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10109 %        const VirtualPixelMethod method)
10110 %
10111 %  A description of each parameter follows:
10112 %
10113 %    o wand: the magick wand.
10114 %
10115 %    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10116 %      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10117 %      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10118 %
10119 */
10120 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10121   const VirtualPixelMethod method)
10122 {
10123   assert(wand != (MagickWand *) NULL);
10124   assert(wand->signature == WandSignature);
10125   if (wand->debug != MagickFalse)
10126     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10127   if (wand->images == (Image *) NULL)
10128     return(UndefinedVirtualPixelMethod);
10129   return(SetImageVirtualPixelMethod(wand->images,method));
10130 }
10131 \f
10132 /*
10133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10134 %                                                                             %
10135 %                                                                             %
10136 %                                                                             %
10137 %   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10138 %                                                                             %
10139 %                                                                             %
10140 %                                                                             %
10141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10142 %
10143 %  MagickSetImageWhitePoint() sets the image chromaticity white point.
10144 %
10145 %  The format of the MagickSetImageWhitePoint method is:
10146 %
10147 %      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10148 %        const double x,const double y)
10149 %
10150 %  A description of each parameter follows:
10151 %
10152 %    o wand: the magick wand.
10153 %
10154 %    o x: the white x-point.
10155 %
10156 %    o y: the white y-point.
10157 %
10158 */
10159 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10160   const double x,const double y)
10161 {
10162   assert(wand != (MagickWand *) NULL);
10163   assert(wand->signature == WandSignature);
10164   if (wand->debug != MagickFalse)
10165     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10166   if (wand->images == (Image *) NULL)
10167     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10168   wand->images->chromaticity.white_point.x=x;
10169   wand->images->chromaticity.white_point.y=y;
10170   return(MagickTrue);
10171 }
10172 \f
10173 /*
10174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10175 %                                                                             %
10176 %                                                                             %
10177 %                                                                             %
10178 %   M a g i c k S h a d e I m a g e C h a n n e l                             %
10179 %                                                                             %
10180 %                                                                             %
10181 %                                                                             %
10182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10183 %
10184 %  MagickShadeImage() shines a distant light on an image to create a
10185 %  three-dimensional effect. You control the positioning of the light with
10186 %  azimuth and elevation; azimuth is measured in degrees off the x axis
10187 %  and elevation is measured in pixels above the Z axis.
10188 %
10189 %  The format of the MagickShadeImage method is:
10190 %
10191 %      MagickBooleanType MagickShadeImage(MagickWand *wand,
10192 %        const MagickBooleanType gray,const double azimuth,
10193 %        const double elevation)
10194 %
10195 %  A description of each parameter follows:
10196 %
10197 %    o wand: the magick wand.
10198 %
10199 %    o gray: A value other than zero shades the intensity of each pixel.
10200 %
10201 %    o azimuth, elevation:  Define the light source direction.
10202 %
10203 */
10204 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10205   const MagickBooleanType gray,const double asimuth,const double elevation)
10206 {
10207   Image
10208     *shade_image;
10209
10210   assert(wand != (MagickWand *) NULL);
10211   assert(wand->signature == WandSignature);
10212   if (wand->debug != MagickFalse)
10213     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10214   if (wand->images == (Image *) NULL)
10215     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10216   shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10217   if (shade_image == (Image *) NULL)
10218     return(MagickFalse);
10219   ReplaceImageInList(&wand->images,shade_image);
10220   return(MagickTrue);
10221 }
10222 \f
10223 /*
10224 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10225 %                                                                             %
10226 %                                                                             %
10227 %                                                                             %
10228 %   M a g i c k S h a d o w I m a g e                                         %
10229 %                                                                             %
10230 %                                                                             %
10231 %                                                                             %
10232 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10233 %
10234 %  MagickShadowImage() simulates an image shadow.
10235 %
10236 %  The format of the MagickShadowImage method is:
10237 %
10238 %      MagickBooleanType MagickShadowImage(MagickWand *wand,
10239 %        const double alpha,const double sigma,const ssize_t x,const ssize_t y)
10240 %
10241 %  A description of each parameter follows:
10242 %
10243 %    o wand: the magick wand.
10244 %
10245 %    o alpha: percentage transparency.
10246 %
10247 %    o sigma: the standard deviation of the Gaussian, in pixels.
10248 %
10249 %    o x: the shadow x-offset.
10250 %
10251 %    o y: the shadow y-offset.
10252 %
10253 */
10254 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10255   const double alpha,const double sigma,const ssize_t x,const ssize_t y)
10256 {
10257   Image
10258     *shadow_image;
10259
10260   assert(wand != (MagickWand *) NULL);
10261   assert(wand->signature == WandSignature);
10262   if (wand->debug != MagickFalse)
10263     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10264   if (wand->images == (Image *) NULL)
10265     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10266   shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
10267   if (shadow_image == (Image *) NULL)
10268     return(MagickFalse);
10269   ReplaceImageInList(&wand->images,shadow_image);
10270   return(MagickTrue);
10271 }
10272 \f
10273 /*
10274 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10275 %                                                                             %
10276 %                                                                             %
10277 %                                                                             %
10278 %   M a g i c k S h a r p e n I m a g e                                       %
10279 %                                                                             %
10280 %                                                                             %
10281 %                                                                             %
10282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10283 %
10284 %  MagickSharpenImage() sharpens an image.  We convolve the image with a
10285 %  Gaussian operator of the given radius and standard deviation (sigma).
10286 %  For reasonable results, the radius should be larger than sigma.  Use a
10287 %  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10288 %
10289 %  The format of the MagickSharpenImage method is:
10290 %
10291 %      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10292 %        const double radius,const double sigma,const double bias)
10293 %
10294 %  A description of each parameter follows:
10295 %
10296 %    o wand: the magick wand.
10297 %
10298 %    o radius: the radius of the Gaussian, in pixels, not counting the center
10299 %      pixel.
10300 %
10301 %    o sigma: the standard deviation of the Gaussian, in pixels.
10302 %
10303 %    o bias: the bias.
10304 %
10305 */
10306 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10307   const double radius,const double sigma,const double bias)
10308 {
10309   Image
10310     *sharp_image;
10311
10312   assert(wand != (MagickWand *) NULL);
10313   assert(wand->signature == WandSignature);
10314   if (wand->debug != MagickFalse)
10315     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10316   if (wand->images == (Image *) NULL)
10317     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10318   sharp_image=SharpenImage(wand->images,radius,sigma,bias,wand->exception);
10319   if (sharp_image == (Image *) NULL)
10320     return(MagickFalse);
10321   ReplaceImageInList(&wand->images,sharp_image);
10322   return(MagickTrue);
10323 }
10324 \f
10325 /*
10326 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10327 %                                                                             %
10328 %                                                                             %
10329 %                                                                             %
10330 %   M a g i c k S h a v e I m a g e                                           %
10331 %                                                                             %
10332 %                                                                             %
10333 %                                                                             %
10334 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10335 %
10336 %  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10337 %  memory necessary for the new Image structure and returns a pointer to the
10338 %  new image.
10339 %
10340 %  The format of the MagickShaveImage method is:
10341 %
10342 %      MagickBooleanType MagickShaveImage(MagickWand *wand,
10343 %        const size_t columns,const size_t rows)
10344 %
10345 %  A description of each parameter follows:
10346 %
10347 %    o wand: the magick wand.
10348 %
10349 %    o columns: the number of columns in the scaled image.
10350 %
10351 %    o rows: the number of rows in the scaled image.
10352 %
10353 %
10354 */
10355 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10356   const size_t columns,const size_t rows)
10357 {
10358   Image
10359     *shave_image;
10360
10361   RectangleInfo
10362     shave_info;
10363
10364   assert(wand != (MagickWand *) NULL);
10365   assert(wand->signature == WandSignature);
10366   if (wand->debug != MagickFalse)
10367     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10368   if (wand->images == (Image *) NULL)
10369     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10370   shave_info.width=columns;
10371   shave_info.height=rows;
10372   shave_info.x=0;
10373   shave_info.y=0;
10374   shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10375   if (shave_image == (Image *) NULL)
10376     return(MagickFalse);
10377   ReplaceImageInList(&wand->images,shave_image);
10378   return(MagickTrue);
10379 }
10380 \f
10381 /*
10382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10383 %                                                                             %
10384 %                                                                             %
10385 %                                                                             %
10386 %   M a g i c k S h e a r I m a g e                                           %
10387 %                                                                             %
10388 %                                                                             %
10389 %                                                                             %
10390 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10391 %
10392 %  MagickShearImage() slides one edge of an image along the X or Y axis,
10393 %  creating a parallelogram.  An X direction shear slides an edge along the X
10394 %  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10395 %  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10396 %  is measured relative to the Y axis, and similarly, for Y direction shears
10397 %  y_shear is measured relative to the X axis.  Empty triangles left over from
10398 %  shearing the image are filled with the background color.
10399 %
10400 %  The format of the MagickShearImage method is:
10401 %
10402 %      MagickBooleanType MagickShearImage(MagickWand *wand,
10403 %        const PixelWand *background,const double x_shear,onst double y_shear)
10404 %
10405 %  A description of each parameter follows:
10406 %
10407 %    o wand: the magick wand.
10408 %
10409 %    o background: the background pixel wand.
10410 %
10411 %    o x_shear: the number of degrees to shear the image.
10412 %
10413 %    o y_shear: the number of degrees to shear the image.
10414 %
10415 */
10416 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10417   const PixelWand *background,const double x_shear,const double y_shear)
10418 {
10419   Image
10420     *shear_image;
10421
10422   assert(wand != (MagickWand *) NULL);
10423   assert(wand->signature == WandSignature);
10424   if (wand->debug != MagickFalse)
10425     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10426   if (wand->images == (Image *) NULL)
10427     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10428   PixelGetQuantumPacket(background,&wand->images->background_color);
10429   shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10430   if (shear_image == (Image *) NULL)
10431     return(MagickFalse);
10432   ReplaceImageInList(&wand->images,shear_image);
10433   return(MagickTrue);
10434 }
10435 \f
10436 /*
10437 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10438 %                                                                             %
10439 %                                                                             %
10440 %                                                                             %
10441 %   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                   %
10442 %                                                                             %
10443 %                                                                             %
10444 %                                                                             %
10445 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10446 %
10447 %  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10448 %  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10449 %  image using a sigmoidal transfer function without saturating highlights or
10450 %  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10451 %  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10452 %  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10453 %  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10454 %  is reduced.
10455 %
10456 %  The format of the MagickSigmoidalContrastImage method is:
10457 %
10458 %      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10459 %        const MagickBooleanType sharpen,const double alpha,const double beta)
10460 %
10461 %  A description of each parameter follows:
10462 %
10463 %    o wand: the magick wand.
10464 %
10465 %    o sharpen: Increase or decrease image contrast.
10466 %
10467 %    o alpha: strength of the contrast, the larger the number the more
10468 %      'threshold-like' it becomes.
10469 %
10470 %    o beta: midpoint of the function as a color value 0 to QuantumRange.
10471 %
10472 */
10473 WandExport MagickBooleanType MagickSigmoidalContrastImage(
10474   MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10475   const double beta)
10476 {
10477   MagickBooleanType
10478     status;
10479
10480   assert(wand != (MagickWand *) NULL);
10481   assert(wand->signature == WandSignature);
10482   if (wand->debug != MagickFalse)
10483     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10484   if (wand->images == (Image *) NULL)
10485     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10486   status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10487     &wand->images->exception);
10488   return(status);
10489 }
10490 \f
10491 /*
10492 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10493 %                                                                             %
10494 %                                                                             %
10495 %                                                                             %
10496 %   M a g i c k S i m i l a r i t y I m a g e                                 %
10497 %                                                                             %
10498 %                                                                             %
10499 %                                                                             %
10500 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10501 %
10502 %  MagickSimilarityImage() compares the reference image of the image and
10503 %  returns the best match offset.  In addition, it returns a similarity image
10504 %  such that an exact match location is completely white and if none of the
10505 %  pixels match, black, otherwise some gray level in-between.
10506 %
10507 %  The format of the MagickSimilarityImage method is:
10508 %
10509 %      MagickWand *MagickSimilarityImage(MagickWand *wand,
10510 %        const MagickWand *reference,RectangeInfo *offset,double *similarity)
10511 %
10512 %  A description of each parameter follows:
10513 %
10514 %    o wand: the magick wand.
10515 %
10516 %    o reference: the reference wand.
10517 %
10518 %    o offset: the best match offset of the reference image within the image.
10519 %
10520 %    o similarity: the computed similarity between the images.
10521 %
10522 */
10523 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10524   const MagickWand *reference,RectangleInfo *offset,double *similarity)
10525 {
10526   Image
10527     *similarity_image;
10528
10529   assert(wand != (MagickWand *) NULL);
10530   assert(wand->signature == WandSignature);
10531   if (wand->debug != MagickFalse)
10532     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10533   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10534     {
10535       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10536         "ContainsNoImages","`%s'",wand->name);
10537       return((MagickWand *) NULL);
10538     }
10539   similarity_image=SimilarityImage(wand->images,reference->images,offset,
10540     similarity,&wand->images->exception);
10541   if (similarity_image == (Image *) NULL)
10542     return((MagickWand *) NULL);
10543   return(CloneMagickWandFromImages(wand,similarity_image));
10544 }
10545 \f
10546 /*
10547 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10548 %                                                                             %
10549 %                                                                             %
10550 %                                                                             %
10551 %   M a g i c k S k e t c h I m a g e                                         %
10552 %                                                                             %
10553 %                                                                             %
10554 %                                                                             %
10555 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10556 %
10557 %  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10558 %  a Gaussian operator of the given radius and standard deviation (sigma).
10559 %  For reasonable results, radius should be larger than sigma.  Use a
10560 %  radius of 0 and SketchImage() selects a suitable radius for you.
10561 %  Angle gives the angle of the blurring motion.
10562 %
10563 %  The format of the MagickSketchImage method is:
10564 %
10565 %      MagickBooleanType MagickSketchImage(MagickWand *wand,
10566 %        const double radius,const double sigma,const double angle,
10567 %        const double bias)
10568 %
10569 %  A description of each parameter follows:
10570 %
10571 %    o wand: the magick wand.
10572 %
10573 %    o radius: the radius of the Gaussian, in pixels, not counting
10574 %      the center pixel.
10575 %
10576 %    o sigma: the standard deviation of the Gaussian, in pixels.
10577 %
10578 %    o angle: apply the effect along this angle.
10579 %
10580 %    o bias: the bias.
10581 %
10582 */
10583 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10584   const double radius,const double sigma,const double angle,const double bias)
10585 {
10586   Image
10587     *sketch_image;
10588
10589   assert(wand != (MagickWand *) NULL);
10590   assert(wand->signature == WandSignature);
10591   if (wand->debug != MagickFalse)
10592     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10593   if (wand->images == (Image *) NULL)
10594     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10595   sketch_image=SketchImage(wand->images,radius,sigma,angle,bias,
10596     wand->exception);
10597   if (sketch_image == (Image *) NULL)
10598     return(MagickFalse);
10599   ReplaceImageInList(&wand->images,sketch_image);
10600   return(MagickTrue);
10601 }
10602 \f
10603 /*
10604 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10605 %                                                                             %
10606 %                                                                             %
10607 %                                                                             %
10608 %   M a g i c k S m u s h I m a g e s                                         %
10609 %                                                                             %
10610 %                                                                             %
10611 %                                                                             %
10612 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10613 %
10614 %  MagickSmushImages() takes all images from the current image pointer to the
10615 %  end of the image list and smushs them to each other top-to-bottom if the
10616 %  stack parameter is true, otherwise left-to-right.
10617 %
10618 %  The format of the MagickSmushImages method is:
10619 %
10620 %      MagickWand *MagickSmushImages(MagickWand *wand,
10621 %        const MagickBooleanType stack,const ssize_t offset)
10622 %
10623 %  A description of each parameter follows:
10624 %
10625 %    o wand: the magick wand.
10626 %
10627 %    o stack: By default, images are stacked left-to-right. Set stack to
10628 %      MagickTrue to stack them top-to-bottom.
10629 %
10630 %    o offset: minimum distance in pixels between images.
10631 %
10632 */
10633 WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10634   const MagickBooleanType stack,const ssize_t offset)
10635 {
10636   Image
10637     *smush_image;
10638
10639   assert(wand != (MagickWand *) NULL);
10640   assert(wand->signature == WandSignature);
10641   if (wand->debug != MagickFalse)
10642     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10643   if (wand->images == (Image *) NULL)
10644     return((MagickWand *) NULL);
10645   smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10646   if (smush_image == (Image *) NULL)
10647     return((MagickWand *) NULL);
10648   return(CloneMagickWandFromImages(wand,smush_image));
10649 }
10650 \f
10651 /*
10652 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10653 %                                                                             %
10654 %                                                                             %
10655 %                                                                             %
10656 %     M a g i c k S o l a r i z e I m a g e                                   %
10657 %                                                                             %
10658 %                                                                             %
10659 %                                                                             %
10660 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10661 %
10662 %  MagickSolarizeImage() applies a special effect to the image, similar to the
10663 %  effect achieved in a photo darkroom by selectively exposing areas of photo
10664 %  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
10665 %  measure of the extent of the solarization.
10666 %
10667 %  The format of the MagickSolarizeImage method is:
10668 %
10669 %      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10670 %        const double threshold)
10671 %
10672 %  A description of each parameter follows:
10673 %
10674 %    o wand: the magick wand.
10675 %
10676 %    o threshold:  Define the extent of the solarization.
10677 %
10678 */
10679 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10680   const double threshold)
10681 {
10682   MagickBooleanType
10683     status;
10684
10685   assert(wand != (MagickWand *) NULL);
10686   assert(wand->signature == WandSignature);
10687   if (wand->debug != MagickFalse)
10688     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10689   if (wand->images == (Image *) NULL)
10690     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10691   status=SolarizeImage(wand->images,threshold,&wand->images->exception);
10692   return(status);
10693 }
10694 \f
10695 /*
10696 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10697 %                                                                             %
10698 %                                                                             %
10699 %                                                                             %
10700 %   M a g i c k S p a r s e C o l o r I m a g e                               %
10701 %                                                                             %
10702 %                                                                             %
10703 %                                                                             %
10704 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10705 %
10706 %  MagickSparseColorImage(), given a set of coordinates, interpolates the
10707 %  colors found at those coordinates, across the whole image, using various
10708 %  methods.
10709 %
10710 %  The format of the MagickSparseColorImage method is:
10711 %
10712 %      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10713 %        const SparseColorMethod method,const size_t number_arguments,
10714 %        const double *arguments)
10715 %
10716 %  A description of each parameter follows:
10717 %
10718 %    o image: the image to be sparseed.
10719 %
10720 %    o method: the method of image sparseion.
10721 %
10722 %        ArcSparseColorion will always ignore source image offset, and always
10723 %        'bestfit' the destination image with the top left corner offset
10724 %        relative to the polar mapping center.
10725 %
10726 %        Bilinear has no simple inverse mapping so will not allow 'bestfit'
10727 %        style of image sparseion.
10728 %
10729 %        Affine, Perspective, and Bilinear, will do least squares fitting of
10730 %        the distrotion when more than the minimum number of control point
10731 %        pairs are provided.
10732 %
10733 %        Perspective, and Bilinear, will fall back to a Affine sparseion when
10734 %        less than 4 control point pairs are provided. While Affine sparseions
10735 %        will let you use any number of control point pairs, that is Zero pairs
10736 %        is a No-Op (viewport only) distrotion, one pair is a translation and
10737 %        two pairs of control points will do a scale-rotate-translate, without
10738 %        any shearing.
10739 %
10740 %    o number_arguments: the number of arguments given for this sparseion
10741 %      method.
10742 %
10743 %    o arguments: the arguments for this sparseion method.
10744 %
10745 */
10746 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10747   const SparseColorMethod method,const size_t number_arguments,
10748   const double *arguments)
10749 {
10750   Image
10751     *sparse_image;
10752
10753   assert(wand != (MagickWand *) NULL);
10754   assert(wand->signature == WandSignature);
10755   if (wand->debug != MagickFalse)
10756     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10757   if (wand->images == (Image *) NULL)
10758     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10759   sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
10760     wand->exception);
10761   if (sparse_image == (Image *) NULL)
10762     return(MagickFalse);
10763   ReplaceImageInList(&wand->images,sparse_image);
10764   return(MagickTrue);
10765 }
10766 \f
10767 /*
10768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10769 %                                                                             %
10770 %                                                                             %
10771 %                                                                             %
10772 %   M a g i c k S p l i c e I m a g e                                         %
10773 %                                                                             %
10774 %                                                                             %
10775 %                                                                             %
10776 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10777 %
10778 %  MagickSpliceImage() splices a solid color into the image.
10779 %
10780 %  The format of the MagickSpliceImage method is:
10781 %
10782 %      MagickBooleanType MagickSpliceImage(MagickWand *wand,
10783 %        const size_t width,const size_t height,const ssize_t x,
10784 %        const ssize_t y)
10785 %
10786 %  A description of each parameter follows:
10787 %
10788 %    o wand: the magick wand.
10789 %
10790 %    o width: the region width.
10791 %
10792 %    o height: the region height.
10793 %
10794 %    o x: the region x offset.
10795 %
10796 %    o y: the region y offset.
10797 %
10798 */
10799 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
10800   const size_t width,const size_t height,const ssize_t x,
10801   const ssize_t y)
10802 {
10803   Image
10804     *splice_image;
10805
10806   RectangleInfo
10807     splice;
10808
10809   assert(wand != (MagickWand *) NULL);
10810   assert(wand->signature == WandSignature);
10811   if (wand->debug != MagickFalse)
10812     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10813   if (wand->images == (Image *) NULL)
10814     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10815   splice.width=width;
10816   splice.height=height;
10817   splice.x=x;
10818   splice.y=y;
10819   splice_image=SpliceImage(wand->images,&splice,wand->exception);
10820   if (splice_image == (Image *) NULL)
10821     return(MagickFalse);
10822   ReplaceImageInList(&wand->images,splice_image);
10823   return(MagickTrue);
10824 }
10825 \f
10826 /*
10827 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10828 %                                                                             %
10829 %                                                                             %
10830 %                                                                             %
10831 %   M a g i c k S p r e a d I m a g e                                         %
10832 %                                                                             %
10833 %                                                                             %
10834 %                                                                             %
10835 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10836 %
10837 %  MagickSpreadImage() is a special effects method that randomly displaces each
10838 %  pixel in a block defined by the radius parameter.
10839 %
10840 %  The format of the MagickSpreadImage method is:
10841 %
10842 %      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius,
10843 %        const PixelInterpolateMethod method)
10844 %
10845 %  A description of each parameter follows:
10846 %
10847 %    o wand: the magick wand.
10848 %
10849 %    o radius:  Choose a random pixel in a neighborhood of this extent.
10850 %
10851 %    o method: the pixel interpolation method.
10852 %
10853 */
10854 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
10855   const double radius,const PixelInterpolateMethod method)
10856 {
10857   Image
10858     *spread_image;
10859
10860   assert(wand != (MagickWand *) NULL);
10861   assert(wand->signature == WandSignature);
10862   if (wand->debug != MagickFalse)
10863     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10864   if (wand->images == (Image *) NULL)
10865     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10866   spread_image=SpreadImage(wand->images,radius,method,wand->exception);
10867   if (spread_image == (Image *) NULL)
10868     return(MagickFalse);
10869   ReplaceImageInList(&wand->images,spread_image);
10870   return(MagickTrue);
10871 }
10872 \f
10873 /*
10874 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10875 %                                                                             %
10876 %                                                                             %
10877 %                                                                             %
10878 %   M a g i c k S t a t i s t i c I m a g e                                   %
10879 %                                                                             %
10880 %                                                                             %
10881 %                                                                             %
10882 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10883 %
10884 %  MagickStatisticImage() replace each pixel with corresponding statistic from
10885 %  the neighborhood of the specified width and height.
10886 %
10887 %  The format of the MagickStatisticImage method is:
10888 %
10889 %      MagickBooleanType MagickStatisticImage(MagickWand *wand,
10890 %        const StatisticType type,const double width,const size_t height)
10891 %
10892 %  A description of each parameter follows:
10893 %
10894 %    o wand: the magick wand.
10895 %
10896 %    o type: the statistic type (e.g. median, mode, etc.).
10897 %
10898 %    o width: the width of the pixel neighborhood.
10899 %
10900 %    o height: the height of the pixel neighborhood.
10901 %
10902 */
10903 WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
10904   const StatisticType type,const size_t width,const size_t height)
10905 {
10906   Image
10907     *statistic_image;
10908
10909   assert(wand != (MagickWand *) NULL);
10910   assert(wand->signature == WandSignature);
10911   if (wand->debug != MagickFalse)
10912     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10913   if (wand->images == (Image *) NULL)
10914     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10915   statistic_image=StatisticImage(wand->images,type,width,height,
10916     wand->exception);
10917   if (statistic_image == (Image *) NULL)
10918     return(MagickFalse);
10919   ReplaceImageInList(&wand->images,statistic_image);
10920   return(MagickTrue);
10921 }
10922 \f
10923 /*
10924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10925 %                                                                             %
10926 %                                                                             %
10927 %                                                                             %
10928 %   M a g i c k S t e g a n o I m a g e                                       %
10929 %                                                                             %
10930 %                                                                             %
10931 %                                                                             %
10932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10933 %
10934 %  MagickSteganoImage() hides a digital watermark within the image.
10935 %  Recover the hidden watermark later to prove that the authenticity of
10936 %  an image.  Offset defines the start position within the image to hide
10937 %  the watermark.
10938 %
10939 %  The format of the MagickSteganoImage method is:
10940 %
10941 %      MagickWand *MagickSteganoImage(MagickWand *wand,
10942 %        const MagickWand *watermark_wand,const ssize_t offset)
10943 %
10944 %  A description of each parameter follows:
10945 %
10946 %    o wand: the magick wand.
10947 %
10948 %    o watermark_wand: the watermark wand.
10949 %
10950 %    o offset: Start hiding at this offset into the image.
10951 %
10952 */
10953 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
10954   const MagickWand *watermark_wand,const ssize_t offset)
10955 {
10956   Image
10957     *stegano_image;
10958
10959   assert(wand != (MagickWand *) NULL);
10960   assert(wand->signature == WandSignature);
10961   if (wand->debug != MagickFalse)
10962     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10963   if ((wand->images == (Image *) NULL) ||
10964       (watermark_wand->images == (Image *) NULL))
10965     {
10966       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10967         "ContainsNoImages","`%s'",wand->name);
10968       return((MagickWand *) NULL);
10969     }
10970   wand->images->offset=offset;
10971   stegano_image=SteganoImage(wand->images,watermark_wand->images,
10972     wand->exception);
10973   if (stegano_image == (Image *) NULL)
10974     return((MagickWand *) NULL);
10975   return(CloneMagickWandFromImages(wand,stegano_image));
10976 }
10977 \f
10978 /*
10979 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10980 %                                                                             %
10981 %                                                                             %
10982 %                                                                             %
10983 %   M a g i c k S t e r e o I m a g e                                         %
10984 %                                                                             %
10985 %                                                                             %
10986 %                                                                             %
10987 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10988 %
10989 %  MagickStereoImage() composites two images and produces a single image that
10990 %  is the composite of a left and right image of a stereo pair
10991 %
10992 %  The format of the MagickStereoImage method is:
10993 %
10994 %      MagickWand *MagickStereoImage(MagickWand *wand,
10995 %        const MagickWand *offset_wand)
10996 %
10997 %  A description of each parameter follows:
10998 %
10999 %    o wand: the magick wand.
11000 %
11001 %    o offset_wand: Another image wand.
11002 %
11003 */
11004 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11005   const MagickWand *offset_wand)
11006 {
11007   Image
11008     *stereo_image;
11009
11010   assert(wand != (MagickWand *) NULL);
11011   assert(wand->signature == WandSignature);
11012   if (wand->debug != MagickFalse)
11013     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11014   if ((wand->images == (Image *) NULL) ||
11015       (offset_wand->images == (Image *) NULL))
11016     {
11017       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11018         "ContainsNoImages","`%s'",wand->name);
11019       return((MagickWand *) NULL);
11020     }
11021   stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11022   if (stereo_image == (Image *) NULL)
11023     return((MagickWand *) NULL);
11024   return(CloneMagickWandFromImages(wand,stereo_image));
11025 }
11026 \f
11027 /*
11028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11029 %                                                                             %
11030 %                                                                             %
11031 %                                                                             %
11032 %   M a g i c k S t r i p I m a g e                                           %
11033 %                                                                             %
11034 %                                                                             %
11035 %                                                                             %
11036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11037 %
11038 %  MagickStripImage() strips an image of all profiles and comments.
11039 %
11040 %  The format of the MagickStripImage method is:
11041 %
11042 %      MagickBooleanType MagickStripImage(MagickWand *wand)
11043 %
11044 %  A description of each parameter follows:
11045 %
11046 %    o wand: the magick wand.
11047 %
11048 */
11049 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11050 {
11051   MagickBooleanType
11052     status;
11053
11054   assert(wand != (MagickWand *) NULL);
11055   assert(wand->signature == WandSignature);
11056   if (wand->debug != MagickFalse)
11057     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11058   if (wand->images == (Image *) NULL)
11059     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11060   status=StripImage(wand->images);
11061   if (status == MagickFalse)
11062     InheritException(wand->exception,&wand->images->exception);
11063   return(status);
11064 }
11065 \f
11066 /*
11067 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11068 %                                                                             %
11069 %                                                                             %
11070 %                                                                             %
11071 %   M a g i c k S w i r l I m a g e                                           %
11072 %                                                                             %
11073 %                                                                             %
11074 %                                                                             %
11075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11076 %
11077 %  MagickSwirlImage() swirls the pixels about the center of the image, where
11078 %  degrees indicates the sweep of the arc through which each pixel is moved.
11079 %  You get a more dramatic effect as the degrees move from 1 to 360.
11080 %
11081 %  The format of the MagickSwirlImage method is:
11082 %
11083 %      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11084 %        const PixelInterpolateMethod method)
11085 %
11086 %  A description of each parameter follows:
11087 %
11088 %    o wand: the magick wand.
11089 %
11090 %    o degrees: Define the tightness of the swirling effect.
11091 %
11092 %    o method: the pixel interpolation method.
11093 %
11094 */
11095 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11096   const double degrees,const PixelInterpolateMethod method)
11097 {
11098   Image
11099     *swirl_image;
11100
11101   assert(wand != (MagickWand *) NULL);
11102   assert(wand->signature == WandSignature);
11103   if (wand->debug != MagickFalse)
11104     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11105   if (wand->images == (Image *) NULL)
11106     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11107   swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
11108   if (swirl_image == (Image *) NULL)
11109     return(MagickFalse);
11110   ReplaceImageInList(&wand->images,swirl_image);
11111   return(MagickTrue);
11112 }
11113 \f
11114 /*
11115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11116 %                                                                             %
11117 %                                                                             %
11118 %                                                                             %
11119 %   M a g i c k T e x t u r e I m a g e                                       %
11120 %                                                                             %
11121 %                                                                             %
11122 %                                                                             %
11123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11124 %
11125 %  MagickTextureImage() repeatedly tiles the texture image across and down the
11126 %  image canvas.
11127 %
11128 %  The format of the MagickTextureImage method is:
11129 %
11130 %      MagickWand *MagickTextureImage(MagickWand *wand,
11131 %        const MagickWand *texture_wand)
11132 %
11133 %  A description of each parameter follows:
11134 %
11135 %    o wand: the magick wand.
11136 %
11137 %    o texture_wand: the texture wand
11138 %
11139 */
11140 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11141   const MagickWand *texture_wand)
11142 {
11143   Image
11144     *texture_image;
11145
11146   MagickBooleanType
11147     status;
11148
11149   assert(wand != (MagickWand *) NULL);
11150   assert(wand->signature == WandSignature);
11151   if (wand->debug != MagickFalse)
11152     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11153   if ((wand->images == (Image *) NULL) ||
11154       (texture_wand->images == (Image *) NULL))
11155     {
11156       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11157         "ContainsNoImages","`%s'",wand->name);
11158       return((MagickWand *) NULL);
11159     }
11160   texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11161   if (texture_image == (Image *) NULL)
11162     return((MagickWand *) NULL);
11163   status=TextureImage(texture_image,texture_wand->images);
11164   if (status == MagickFalse)
11165     {
11166       InheritException(wand->exception,&texture_image->exception);
11167       texture_image=DestroyImage(texture_image);
11168       return((MagickWand *) NULL);
11169     }
11170   return(CloneMagickWandFromImages(wand,texture_image));
11171 }
11172 \f
11173 /*
11174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11175 %                                                                             %
11176 %                                                                             %
11177 %                                                                             %
11178 %   M a g i c k T h r e s h o l d I m a g e                                   %
11179 %                                                                             %
11180 %                                                                             %
11181 %                                                                             %
11182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11183 %
11184 %  MagickThresholdImage() changes the value of individual pixels based on
11185 %  the intensity of each pixel compared to threshold.  The result is a
11186 %  high-contrast, two color image.
11187 %
11188 %  The format of the MagickThresholdImage method is:
11189 %
11190 %      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11191 %        const double threshold)
11192 %      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11193 %        const ChannelType channel,const double threshold)
11194 %
11195 %  A description of each parameter follows:
11196 %
11197 %    o wand: the magick wand.
11198 %
11199 %    o channel: the image channel(s).
11200 %
11201 %    o threshold: Define the threshold value.
11202 %
11203 */
11204 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11205   const double threshold)
11206 {
11207   MagickBooleanType
11208     status;
11209
11210   status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11211   return(status);
11212 }
11213
11214 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11215   const ChannelType channel,const double threshold)
11216 {
11217   MagickBooleanType
11218     status;
11219
11220   assert(wand != (MagickWand *) NULL);
11221   assert(wand->signature == WandSignature);
11222   if (wand->debug != MagickFalse)
11223     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11224   if (wand->images == (Image *) NULL)
11225     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11226   status=BilevelImage(wand->images,threshold);
11227   if (status == MagickFalse)
11228     InheritException(wand->exception,&wand->images->exception);
11229   return(status);
11230 }
11231 \f
11232 /*
11233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11234 %                                                                             %
11235 %                                                                             %
11236 %                                                                             %
11237 %   M a g i c k T h u m b n a i l I m a g e                                   %
11238 %                                                                             %
11239 %                                                                             %
11240 %                                                                             %
11241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11242 %
11243 %  MagickThumbnailImage()  changes the size of an image to the given dimensions
11244 %  and removes any associated profiles.  The goal is to produce small low cost
11245 %  thumbnail images suited for display on the Web.
11246 %
11247 %  The format of the MagickThumbnailImage method is:
11248 %
11249 %      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11250 %        const size_t columns,const size_t rows)
11251 %
11252 %  A description of each parameter follows:
11253 %
11254 %    o wand: the magick wand.
11255 %
11256 %    o columns: the number of columns in the scaled image.
11257 %
11258 %    o rows: the number of rows in the scaled image.
11259 %
11260 */
11261 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11262   const size_t columns,const size_t rows)
11263 {
11264   Image
11265     *thumbnail_image;
11266
11267   assert(wand != (MagickWand *) NULL);
11268   assert(wand->signature == WandSignature);
11269   if (wand->debug != MagickFalse)
11270     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11271   if (wand->images == (Image *) NULL)
11272     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11273   thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11274   if (thumbnail_image == (Image *) NULL)
11275     return(MagickFalse);
11276   ReplaceImageInList(&wand->images,thumbnail_image);
11277   return(MagickTrue);
11278 }
11279 \f
11280 /*
11281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11282 %                                                                             %
11283 %                                                                             %
11284 %                                                                             %
11285 %   M a g i c k T i n t I m a g e                                             %
11286 %                                                                             %
11287 %                                                                             %
11288 %                                                                             %
11289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11290 %
11291 %  MagickTintImage() applies a color vector to each pixel in the image.  The
11292 %  length of the vector is 0 for black and white and at its maximum for the
11293 %  midtones.  The vector weighting function is
11294 %  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11295 %
11296 %  The format of the MagickTintImage method is:
11297 %
11298 %      MagickBooleanType MagickTintImage(MagickWand *wand,
11299 %        const PixelWand *tint,const PixelWand *blend)
11300 %
11301 %  A description of each parameter follows:
11302 %
11303 %    o wand: the magick wand.
11304 %
11305 %    o tint: the tint pixel wand.
11306 %
11307 %    o alpha: the alpha pixel wand.
11308 %
11309 */
11310 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11311   const PixelWand *tint,const PixelWand *blend)
11312 {
11313   char
11314     percent_blend[MaxTextExtent];
11315
11316   Image
11317     *tint_image;
11318
11319   PixelInfo
11320     target;
11321
11322   assert(wand != (MagickWand *) NULL);
11323   assert(wand->signature == WandSignature);
11324   if (wand->debug != MagickFalse)
11325     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11326   if (wand->images == (Image *) NULL)
11327     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11328   if (wand->images->colorspace != CMYKColorspace)
11329     (void) FormatLocaleString(percent_blend,MaxTextExtent,
11330       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11331       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11332       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11333       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11334       PixelGetAlphaQuantum(blend)));
11335   else
11336     (void) FormatLocaleString(percent_blend,MaxTextExtent,
11337       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
11338       PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11339       PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11340       PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11341       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11342       PixelGetAlphaQuantum(blend)));
11343   target=PixelGetPixel(tint);
11344   tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
11345   if (tint_image == (Image *) NULL)
11346     return(MagickFalse);
11347   ReplaceImageInList(&wand->images,tint_image);
11348   return(MagickTrue);
11349 }
11350 \f
11351 /*
11352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11353 %                                                                             %
11354 %                                                                             %
11355 %                                                                             %
11356 %   M a g i c k T r a n s f o r m I m a g e                                   %
11357 %                                                                             %
11358 %                                                                             %
11359 %                                                                             %
11360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11361 %
11362 %  MagickTransformImage() is a convenience method that behaves like
11363 %  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11364 %  information as a region geometry specification.  If the operation fails,
11365 %  a NULL image handle is returned.
11366 %
11367 %  The format of the MagickTransformImage method is:
11368 %
11369 %      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11370 %        const char *geometry)
11371 %
11372 %  A description of each parameter follows:
11373 %
11374 %    o wand: the magick wand.
11375 %
11376 %    o crop: A crop geometry string.  This geometry defines a subregion of the
11377 %      image to crop.
11378 %
11379 %    o geometry: An image geometry string.  This geometry defines the final
11380 %      size of the image.
11381 %
11382 */
11383 WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11384   const char *crop,const char *geometry)
11385 {
11386   Image
11387     *transform_image;
11388
11389   MagickBooleanType
11390     status;
11391
11392   assert(wand != (MagickWand *) NULL);
11393   assert(wand->signature == WandSignature);
11394   if (wand->debug != MagickFalse)
11395     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11396   if (wand->images == (Image *) NULL)
11397     return((MagickWand *) NULL);
11398   transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11399   if (transform_image == (Image *) NULL)
11400     return((MagickWand *) NULL);
11401   status=TransformImage(&transform_image,crop,geometry);
11402   if (status == MagickFalse)
11403     {
11404       InheritException(wand->exception,&transform_image->exception);
11405       transform_image=DestroyImage(transform_image);
11406       return((MagickWand *) NULL);
11407     }
11408   return(CloneMagickWandFromImages(wand,transform_image));
11409 }
11410 \f
11411 /*
11412 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11413 %                                                                             %
11414 %                                                                             %
11415 %                                                                             %
11416 %   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               %
11417 %                                                                             %
11418 %                                                                             %
11419 %                                                                             %
11420 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11421 %
11422 %  MagickTransformImageColorspace() transform the image colorspace.
11423 %
11424 %  The format of the MagickTransformImageColorspace method is:
11425 %
11426 %      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11427 %        const ColorspaceType colorspace)
11428 %
11429 %  A description of each parameter follows:
11430 %
11431 %    o wand: the magick wand.
11432 %
11433 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
11434 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
11435 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
11436 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
11437 %      HSLColorspace, or HWBColorspace.
11438 %
11439 */
11440 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11441   const ColorspaceType colorspace)
11442 {
11443   assert(wand != (MagickWand *) NULL);
11444   assert(wand->signature == WandSignature);
11445   if (wand->debug != MagickFalse)
11446     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11447   if (wand->images == (Image *) NULL)
11448     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11449   return(TransformImageColorspace(wand->images,colorspace));
11450 }
11451 \f
11452 /*
11453 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11454 %                                                                             %
11455 %                                                                             %
11456 %                                                                             %
11457 %   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                     %
11458 %                                                                             %
11459 %                                                                             %
11460 %                                                                             %
11461 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11462 %
11463 %  MagickTransparentPaintImage() changes any pixel that matches color with the
11464 %  color defined by fill.
11465 %
11466 %  The format of the MagickTransparentPaintImage method is:
11467 %
11468 %      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11469 %        const PixelWand *target,const double alpha,const double fuzz,
11470 %        const MagickBooleanType invert)
11471 %
11472 %  A description of each parameter follows:
11473 %
11474 %    o wand: the magick wand.
11475 %
11476 %    o target: Change this target color to specified alpha value within
11477 %      the image.
11478 %
11479 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11480 %      transparent.
11481 %
11482 %    o fuzz: By default target must match a particular pixel color
11483 %      exactly.  However, in many cases two colors may differ by a small amount.
11484 %      The fuzz member of image defines how much tolerance is acceptable to
11485 %      consider two colors as the same.  For example, set fuzz to 10 and the
11486 %      color red at intensities of 100 and 102 respectively are now interpreted
11487 %      as the same color for the purposes of the floodfill.
11488 %
11489 %    o invert: paint any pixel that does not match the target color.
11490 %
11491 */
11492 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11493   const PixelWand *target,const double alpha,const double fuzz,
11494   const MagickBooleanType invert)
11495 {
11496   MagickBooleanType
11497     status;
11498
11499   PixelInfo
11500     target_pixel;
11501
11502   assert(wand != (MagickWand *) NULL);
11503   assert(wand->signature == WandSignature);
11504   if (wand->debug != MagickFalse)
11505     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11506   if (wand->images == (Image *) NULL)
11507     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11508   PixelGetMagickColor(target,&target_pixel);
11509   wand->images->fuzz=fuzz;
11510   status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11511     QuantumRange*alpha),invert,&wand->images->exception);
11512   return(status);
11513 }
11514 \f
11515 /*
11516 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11517 %                                                                             %
11518 %                                                                             %
11519 %                                                                             %
11520 %   M a g i c k T r a n s p o s e I m a g e                                   %
11521 %                                                                             %
11522 %                                                                             %
11523 %                                                                             %
11524 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11525 %
11526 %  MagickTransposeImage() creates a vertical mirror image by reflecting the
11527 %  pixels around the central x-axis while rotating them 90-degrees.
11528 %
11529 %  The format of the MagickTransposeImage method is:
11530 %
11531 %      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11532 %
11533 %  A description of each parameter follows:
11534 %
11535 %    o wand: the magick wand.
11536 %
11537 */
11538 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11539 {
11540   Image
11541     *transpose_image;
11542
11543   assert(wand != (MagickWand *) NULL);
11544   assert(wand->signature == WandSignature);
11545   if (wand->debug != MagickFalse)
11546     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11547   if (wand->images == (Image *) NULL)
11548     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11549   transpose_image=TransposeImage(wand->images,wand->exception);
11550   if (transpose_image == (Image *) NULL)
11551     return(MagickFalse);
11552   ReplaceImageInList(&wand->images,transpose_image);
11553   return(MagickTrue);
11554 }
11555 \f
11556 /*
11557 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11558 %                                                                             %
11559 %                                                                             %
11560 %                                                                             %
11561 %   M a g i c k T r a n s v e r s e I m a g e                                 %
11562 %                                                                             %
11563 %                                                                             %
11564 %                                                                             %
11565 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11566 %
11567 %  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11568 %  pixels around the central y-axis while rotating them 270-degrees.
11569 %
11570 %  The format of the MagickTransverseImage method is:
11571 %
11572 %      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11573 %
11574 %  A description of each parameter follows:
11575 %
11576 %    o wand: the magick wand.
11577 %
11578 */
11579 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11580 {
11581   Image
11582     *transverse_image;
11583
11584   assert(wand != (MagickWand *) NULL);
11585   assert(wand->signature == WandSignature);
11586   if (wand->debug != MagickFalse)
11587     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11588   if (wand->images == (Image *) NULL)
11589     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11590   transverse_image=TransverseImage(wand->images,wand->exception);
11591   if (transverse_image == (Image *) NULL)
11592     return(MagickFalse);
11593   ReplaceImageInList(&wand->images,transverse_image);
11594   return(MagickTrue);
11595 }
11596 \f
11597 /*
11598 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11599 %                                                                             %
11600 %                                                                             %
11601 %                                                                             %
11602 %   M a g i c k T r i m I m a g e                                             %
11603 %                                                                             %
11604 %                                                                             %
11605 %                                                                             %
11606 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11607 %
11608 %  MagickTrimImage() remove edges that are the background color from the image.
11609 %
11610 %  The format of the MagickTrimImage method is:
11611 %
11612 %      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11613 %
11614 %  A description of each parameter follows:
11615 %
11616 %    o wand: the magick wand.
11617 %
11618 %    o fuzz: By default target must match a particular pixel color
11619 %      exactly.  However, in many cases two colors may differ by a small amount.
11620 %      The fuzz member of image defines how much tolerance is acceptable to
11621 %      consider two colors as the same.  For example, set fuzz to 10 and the
11622 %      color red at intensities of 100 and 102 respectively are now interpreted
11623 %      as the same color for the purposes of the floodfill.
11624 %
11625 */
11626 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11627 {
11628   Image
11629     *trim_image;
11630
11631   assert(wand != (MagickWand *) NULL);
11632   assert(wand->signature == WandSignature);
11633   if (wand->debug != MagickFalse)
11634     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11635   if (wand->images == (Image *) NULL)
11636     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11637   wand->images->fuzz=fuzz;
11638   trim_image=TrimImage(wand->images,wand->exception);
11639   if (trim_image == (Image *) NULL)
11640     return(MagickFalse);
11641   ReplaceImageInList(&wand->images,trim_image);
11642   return(MagickTrue);
11643 }
11644 \f
11645 /*
11646 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11647 %                                                                             %
11648 %                                                                             %
11649 %                                                                             %
11650 %   M a g i c k U n i q u e I m a g e C o l o r s                             %
11651 %                                                                             %
11652 %                                                                             %
11653 %                                                                             %
11654 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11655 %
11656 %  MagickUniqueImageColors() discards all but one of any pixel color.
11657 %
11658 %  The format of the MagickUniqueImageColors method is:
11659 %
11660 %      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11661 %
11662 %  A description of each parameter follows:
11663 %
11664 %    o wand: the magick wand.
11665 %
11666 */
11667 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11668 {
11669   Image
11670     *unique_image;
11671
11672   assert(wand != (MagickWand *) NULL);
11673   assert(wand->signature == WandSignature);
11674   if (wand->debug != MagickFalse)
11675     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11676   if (wand->images == (Image *) NULL)
11677     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11678   unique_image=UniqueImageColors(wand->images,wand->exception);
11679   if (unique_image == (Image *) NULL)
11680     return(MagickFalse);
11681   ReplaceImageInList(&wand->images,unique_image);
11682   return(MagickTrue);
11683 }
11684 \f
11685 /*
11686 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11687 %                                                                             %
11688 %                                                                             %
11689 %                                                                             %
11690 %   M a g i c k U n s h a r p M a s k I m a g e                               %
11691 %                                                                             %
11692 %                                                                             %
11693 %                                                                             %
11694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11695 %
11696 %  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
11697 %  Gaussian operator of the given radius and standard deviation (sigma).
11698 %  For reasonable results, radius should be larger than sigma.  Use a radius
11699 %  of 0 and UnsharpMaskImage() selects a suitable radius for you.
11700 %
11701 %  The format of the MagickUnsharpMaskImage method is:
11702 %
11703 %      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11704 %        const double radius,const double sigma,const double amount,
11705 %        const double threshold)
11706 %
11707 %  A description of each parameter follows:
11708 %
11709 %    o wand: the magick wand.
11710 %
11711 %    o radius: the radius of the Gaussian, in pixels, not counting the center
11712 %      pixel.
11713 %
11714 %    o sigma: the standard deviation of the Gaussian, in pixels.
11715 %
11716 %    o amount: the percentage of the difference between the original and the
11717 %      blur image that is added back into the original.
11718 %
11719 %    o threshold: the threshold in pixels needed to apply the diffence amount.
11720 %
11721 */
11722 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11723   const double radius,const double sigma,const double amount,
11724   const double threshold)
11725 {
11726   Image
11727     *unsharp_image;
11728
11729   assert(wand != (MagickWand *) NULL);
11730   assert(wand->signature == WandSignature);
11731   if (wand->debug != MagickFalse)
11732     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11733   if (wand->images == (Image *) NULL)
11734     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11735   unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
11736     wand->exception);
11737   if (unsharp_image == (Image *) NULL)
11738     return(MagickFalse);
11739   ReplaceImageInList(&wand->images,unsharp_image);
11740   return(MagickTrue);
11741 }
11742 \f
11743 /*
11744 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11745 %                                                                             %
11746 %                                                                             %
11747 %                                                                             %
11748 %   M a g i c k V i g n e t t e I m a g e                                     %
11749 %                                                                             %
11750 %                                                                             %
11751 %                                                                             %
11752 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11753 %
11754 %  MagickVignetteImage() softens the edges of the image in vignette style.
11755 %
11756 %  The format of the MagickVignetteImage method is:
11757 %
11758 %      MagickBooleanType MagickVignetteImage(MagickWand *wand,
11759 %        const double black_point,const double white_point,const ssize_t x,
11760 %        const ssize_t y)
11761 %
11762 %  A description of each parameter follows:
11763 %
11764 %    o wand: the magick wand.
11765 %
11766 %    o black_point: the black point.
11767 %
11768 %    o white_point: the white point.
11769 %
11770 %    o x, y:  Define the x and y ellipse offset.
11771 %
11772 */
11773 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
11774   const double black_point,const double white_point,const ssize_t x,const ssize_t y)
11775 {
11776   Image
11777     *vignette_image;
11778
11779   assert(wand != (MagickWand *) NULL);
11780   assert(wand->signature == WandSignature);
11781   if (wand->debug != MagickFalse)
11782     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11783   if (wand->images == (Image *) NULL)
11784     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11785   vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
11786     wand->exception);
11787   if (vignette_image == (Image *) NULL)
11788     return(MagickFalse);
11789   ReplaceImageInList(&wand->images,vignette_image);
11790   return(MagickTrue);
11791 }
11792 \f
11793 /*
11794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11795 %                                                                             %
11796 %                                                                             %
11797 %                                                                             %
11798 %   M a g i c k W a v e I m a g e                                             %
11799 %                                                                             %
11800 %                                                                             %
11801 %                                                                             %
11802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11803 %
11804 %  MagickWaveImage()  creates a "ripple" effect in the image by shifting
11805 %  the pixels vertically along a sine wave whose amplitude and wavelength
11806 %  is specified by the given parameters.
11807 %
11808 %  The format of the MagickWaveImage method is:
11809 %
11810 %      MagickBooleanType MagickWaveImage(MagickWand *wand,
11811 %        const double amplitude,const double wave_length,
11812 %        const PixelInterpolateMethod method)
11813 %
11814 %  A description of each parameter follows:
11815 %
11816 %    o wand: the magick wand.
11817 %
11818 %    o amplitude, wave_length:  Define the amplitude and wave length of the
11819 %      sine wave.
11820 %
11821 %    o method: the pixel interpolation method.
11822 %
11823 */
11824 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
11825   const double amplitude,const double wave_length,
11826   const PixelInterpolateMethod method)
11827 {
11828   Image
11829     *wave_image;
11830
11831   assert(wand != (MagickWand *) NULL);
11832   assert(wand->signature == WandSignature);
11833   if (wand->debug != MagickFalse)
11834     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11835   if (wand->images == (Image *) NULL)
11836     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11837   wave_image=WaveImage(wand->images,amplitude,wave_length,method,
11838     wand->exception);
11839   if (wave_image == (Image *) NULL)
11840     return(MagickFalse);
11841   ReplaceImageInList(&wand->images,wave_image);
11842   return(MagickTrue);
11843 }
11844 \f
11845 /*
11846 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11847 %                                                                             %
11848 %                                                                             %
11849 %                                                                             %
11850 %   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                         %
11851 %                                                                             %
11852 %                                                                             %
11853 %                                                                             %
11854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11855 %
11856 %  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
11857 %  above the threshold into white while leaving all pixels below the threshold
11858 %  unchanged.
11859 %
11860 %  The format of the MagickWhiteThresholdImage method is:
11861 %
11862 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11863 %        const PixelWand *threshold)
11864 %
11865 %  A description of each parameter follows:
11866 %
11867 %    o wand: the magick wand.
11868 %
11869 %    o threshold: the pixel wand.
11870 %
11871 */
11872 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11873   const PixelWand *threshold)
11874 {
11875   char
11876     thresholds[MaxTextExtent];
11877
11878   MagickBooleanType
11879     status;
11880
11881   assert(wand != (MagickWand *) NULL);
11882   assert(wand->signature == WandSignature);
11883   if (wand->debug != MagickFalse)
11884     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11885   if (wand->images == (Image *) NULL)
11886     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11887   (void) FormatLocaleString(thresholds,MaxTextExtent,
11888     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
11889     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
11890     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
11891   status=WhiteThresholdImage(wand->images,thresholds,&wand->images->exception);
11892   if (status == MagickFalse)
11893     InheritException(wand->exception,&wand->images->exception);
11894   return(status);
11895 }
11896 \f
11897 /*
11898 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11899 %                                                                             %
11900 %                                                                             %
11901 %                                                                             %
11902 %   M a g i c k W r i t e I m a g e                                           %
11903 %                                                                             %
11904 %                                                                             %
11905 %                                                                             %
11906 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11907 %
11908 %  MagickWriteImage() writes an image to the specified filename.  If the
11909 %  filename parameter is NULL, the image is written to the filename set
11910 %  by MagickReadImage() or MagickSetImageFilename().
11911 %
11912 %  The format of the MagickWriteImage method is:
11913 %
11914 %      MagickBooleanType MagickWriteImage(MagickWand *wand,
11915 %        const char *filename)
11916 %
11917 %  A description of each parameter follows:
11918 %
11919 %    o wand: the magick wand.
11920 %
11921 %    o filename: the image filename.
11922 %
11923 %
11924 */
11925 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
11926   const char *filename)
11927 {
11928   Image
11929     *image;
11930
11931   ImageInfo
11932     *write_info;
11933
11934   MagickBooleanType
11935     status;
11936
11937   assert(wand != (MagickWand *) NULL);
11938   assert(wand->signature == WandSignature);
11939   if (wand->debug != MagickFalse)
11940     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11941   if (wand->images == (Image *) NULL)
11942     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11943   if (filename != (const char *) NULL)
11944     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
11945   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11946   if (image == (Image *) NULL)
11947     return(MagickFalse);
11948   write_info=CloneImageInfo(wand->image_info);
11949   write_info->adjoin=MagickTrue;
11950   status=WriteImage(write_info,image,&image->exception);
11951   image=DestroyImage(image);
11952   write_info=DestroyImageInfo(write_info);
11953   return(status);
11954 }
11955 \f
11956 /*
11957 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11958 %                                                                             %
11959 %                                                                             %
11960 %                                                                             %
11961 %   M a g i c k W r i t e I m a g e F i l e                                   %
11962 %                                                                             %
11963 %                                                                             %
11964 %                                                                             %
11965 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11966 %
11967 %  MagickWriteImageFile() writes an image to an open file descriptor.
11968 %
11969 %  The format of the MagickWriteImageFile method is:
11970 %
11971 %      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11972 %
11973 %  A description of each parameter follows:
11974 %
11975 %    o wand: the magick wand.
11976 %
11977 %    o file: the file descriptor.
11978 %
11979 */
11980 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11981 {
11982   Image
11983     *image;
11984
11985   ImageInfo
11986     *write_info;
11987
11988   MagickBooleanType
11989     status;
11990
11991   assert(wand != (MagickWand *) NULL);
11992   assert(wand->signature == WandSignature);
11993   assert(file != (FILE *) NULL);
11994   if (wand->debug != MagickFalse)
11995     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11996   if (wand->images == (Image *) NULL)
11997     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11998   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11999   if (image == (Image *) NULL)
12000     return(MagickFalse);
12001   write_info=CloneImageInfo(wand->image_info);
12002   SetImageInfoFile(write_info,file);
12003   write_info->adjoin=MagickTrue;
12004   status=WriteImage(write_info,image,&image->exception);
12005   write_info=DestroyImageInfo(write_info);
12006   image=DestroyImage(image);
12007   return(status);
12008 }
12009 \f
12010 /*
12011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12012 %                                                                             %
12013 %                                                                             %
12014 %                                                                             %
12015 %   M a g i c k W r i t e I m a g e s                                         %
12016 %                                                                             %
12017 %                                                                             %
12018 %                                                                             %
12019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12020 %
12021 %  MagickWriteImages() writes an image or image sequence.
12022 %
12023 %  The format of the MagickWriteImages method is:
12024 %
12025 %      MagickBooleanType MagickWriteImages(MagickWand *wand,
12026 %        const char *filename,const MagickBooleanType adjoin)
12027 %
12028 %  A description of each parameter follows:
12029 %
12030 %    o wand: the magick wand.
12031 %
12032 %    o filename: the image filename.
12033 %
12034 %    o adjoin: join images into a single multi-image file.
12035 %
12036 */
12037 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12038   const char *filename,const MagickBooleanType adjoin)
12039 {
12040   ImageInfo
12041     *write_info;
12042
12043   MagickBooleanType
12044     status;
12045
12046   assert(wand != (MagickWand *) NULL);
12047   assert(wand->signature == WandSignature);
12048   if (wand->debug != MagickFalse)
12049     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12050   if (wand->images == (Image *) NULL)
12051     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12052   write_info=CloneImageInfo(wand->image_info);
12053   write_info->adjoin=adjoin;
12054   status=WriteImages(write_info,wand->images,filename,wand->exception);
12055   if (status == MagickFalse)
12056     InheritException(wand->exception,&wand->images->exception);
12057   write_info=DestroyImageInfo(write_info);
12058   return(status);
12059 }
12060 \f
12061 /*
12062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12063 %                                                                             %
12064 %                                                                             %
12065 %                                                                             %
12066 %   M a g i c k W r i t e I m a g e s F i l e                                 %
12067 %                                                                             %
12068 %                                                                             %
12069 %                                                                             %
12070 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12071 %
12072 %  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12073 %
12074 %  The format of the MagickWriteImagesFile method is:
12075 %
12076 %      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12077 %
12078 %  A description of each parameter follows:
12079 %
12080 %    o wand: the magick wand.
12081 %
12082 %    o file: the file descriptor.
12083 %
12084 */
12085 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12086 {
12087   ImageInfo
12088     *write_info;
12089
12090   MagickBooleanType
12091     status;
12092
12093   assert(wand != (MagickWand *) NULL);
12094   assert(wand->signature == WandSignature);
12095   if (wand->debug != MagickFalse)
12096     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12097   if (wand->images == (Image *) NULL)
12098     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12099   write_info=CloneImageInfo(wand->image_info);
12100   SetImageInfoFile(write_info,file);
12101   write_info->adjoin=MagickTrue;
12102   status=WriteImages(write_info,wand->images,(const char *) NULL,
12103     wand->exception);
12104   write_info=DestroyImageInfo(write_info);
12105   if (status == MagickFalse)
12106     InheritException(wand->exception,&wand->images->exception);
12107   return(status);
12108 }