]> 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->exception);
854   return(status);
855 }
856 \f
857 /*
858 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
859 %                                                                             %
860 %                                                                             %
861 %                                                                             %
862 %   M a g i c k B l u e S h i f t I m a g e                                   %
863 %                                                                             %
864 %                                                                             %
865 %                                                                             %
866 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
867 %
868 %  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
869 %  nighttime in the moonlight.
870 %
871 %  The format of the MagickBlueShiftImage method is:
872 %
873 %      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
874 %        const double factor)
875 %
876 %  A description of each parameter follows:
877 %
878 %    o wand: the magick wand.
879 %
880 %    o factor: the blue shift factor (default 1.5)
881 %
882 */
883 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
884   const double factor)
885 {
886   Image
887     *shift_image;
888
889   assert(wand != (MagickWand *) NULL);
890   assert(wand->signature == WandSignature);
891   if (wand->debug != MagickFalse)
892     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
893   if (wand->images == (Image *) NULL)
894     ThrowWandException(WandError,"ContainsNoImages",wand->name);
895   shift_image=BlueShiftImage(wand->images,factor,wand->exception);
896   if (shift_image == (Image *) NULL)
897     return(MagickFalse);
898   ReplaceImageInList(&wand->images,shift_image);
899   return(MagickTrue);
900 }
901 \f
902 /*
903 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
904 %                                                                             %
905 %                                                                             %
906 %                                                                             %
907 %   M a g i c k B l u r I m a g e                                             %
908 %                                                                             %
909 %                                                                             %
910 %                                                                             %
911 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
912 %
913 %  MagickBlurImage() blurs an image.  We convolve the image with a
914 %  gaussian operator of the given radius and standard deviation (sigma).
915 %  For reasonable results, the radius should be larger than sigma.  Use a
916 %  radius of 0 and BlurImage() selects a suitable radius for you.
917 %
918 %  The format of the MagickBlurImage method is:
919 %
920 %      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
921 %        const double sigmaconst double bias)
922 %
923 %  A description of each parameter follows:
924 %
925 %    o wand: the magick wand.
926 %
927 %    o radius: the radius of the , in pixels, not counting the center
928 %      pixel.
929 %
930 %    o sigma: the standard deviation of the , in pixels.
931 %
932 %    o bias: the bias.
933 %
934 */
935 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
936   const double radius,const double sigma,const double bias)
937 {
938   Image
939     *blur_image;
940
941   assert(wand != (MagickWand *) NULL);
942   assert(wand->signature == WandSignature);
943   if (wand->debug != MagickFalse)
944     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
945   if (wand->images == (Image *) NULL)
946     ThrowWandException(WandError,"ContainsNoImages",wand->name);
947   blur_image=BlurImage(wand->images,radius,sigma,bias,wand->exception);
948   if (blur_image == (Image *) NULL)
949     return(MagickFalse);
950   ReplaceImageInList(&wand->images,blur_image);
951   return(MagickTrue);
952 }
953 \f
954 /*
955 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
956 %                                                                             %
957 %                                                                             %
958 %                                                                             %
959 %   M a g i c k B o r d e r I m a g e                                         %
960 %                                                                             %
961 %                                                                             %
962 %                                                                             %
963 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
964 %
965 %  MagickBorderImage() surrounds the image with a border of the color defined
966 %  by the bordercolor pixel wand.
967 %
968 %  The format of the MagickBorderImage method is:
969 %
970 %      MagickBooleanType MagickBorderImage(MagickWand *wand,
971 %        const PixelWand *bordercolor,const size_t width,
972 %        const size_t height,const CompositeOperator compose)
973 %
974 %  A description of each parameter follows:
975 %
976 %    o wand: the magick wand.
977 %
978 %    o bordercolor: the border color pixel wand.
979 %
980 %    o width: the border width.
981 %
982 %    o height: the border height.
983 %
984 %    o compose: the composite operator.
985 %
986 */
987 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
988   const PixelWand *bordercolor,const size_t width,const size_t height,
989   const CompositeOperator compose)
990 {
991   Image
992     *border_image;
993
994   RectangleInfo
995     border_info;
996
997   assert(wand != (MagickWand *) NULL);
998   assert(wand->signature == WandSignature);
999   if (wand->debug != MagickFalse)
1000     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1001   if (wand->images == (Image *) NULL)
1002     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1003   border_info.width=width;
1004   border_info.height=height;
1005   border_info.x=0;
1006   border_info.y=0;
1007   PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
1008   border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
1009   if (border_image == (Image *) NULL)
1010     return(MagickFalse);
1011   ReplaceImageInList(&wand->images,border_image);
1012   return(MagickTrue);
1013 }
1014 \f
1015 /*
1016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1017 %                                                                             %
1018 %                                                                             %
1019 %                                                                             %
1020 %   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   %
1021 %                                                                             %
1022 %                                                                             %
1023 %                                                                             %
1024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1025 %
1026 %  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1027 %  of an image.  It converts the brightness and contrast parameters into slope
1028 %  and intercept and calls a polynomical function to apply to the image.
1029
1030 %
1031 %  The format of the MagickBrightnessContrastImage method is:
1032 %
1033 %      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1034 %        const double brightness,const double contrast)
1035 %
1036 %  A description of each parameter follows:
1037 %
1038 %    o wand: the magick wand.
1039 %
1040 %    o brightness: the brightness percent (-100 .. 100).
1041 %
1042 %    o contrast: the contrast percent (-100 .. 100).
1043 %
1044 */
1045 WandExport MagickBooleanType MagickBrightnessContrastImage(
1046   MagickWand *wand,const double brightness,const double contrast)
1047 {
1048   MagickBooleanType
1049     status;
1050
1051   assert(wand != (MagickWand *) NULL);
1052   assert(wand->signature == WandSignature);
1053   if (wand->debug != MagickFalse)
1054     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1055   if (wand->images == (Image *) NULL)
1056     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1057   status=BrightnessContrastImage(wand->images,brightness,contrast,
1058     &wand->images->exception);
1059   return(status);
1060 }
1061 \f
1062 /*
1063 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1064 %                                                                             %
1065 %                                                                             %
1066 %                                                                             %
1067 %   M a g i c k C h a r c o a l I m a g e                                     %
1068 %                                                                             %
1069 %                                                                             %
1070 %                                                                             %
1071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1072 %
1073 %  MagickCharcoalImage() simulates a charcoal drawing.
1074 %
1075 %  The format of the MagickCharcoalImage method is:
1076 %
1077 %      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1078 %        const double radius,const double sigma,const double bias)
1079 %
1080 %  A description of each parameter follows:
1081 %
1082 %    o wand: the magick wand.
1083 %
1084 %    o radius: the radius of the Gaussian, in pixels, not counting the center
1085 %      pixel.
1086 %
1087 %    o sigma: the standard deviation of the Gaussian, in pixels.
1088 %
1089 %    o bias: the bias.
1090 %
1091 */
1092 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1093   const double radius,const double sigma,const double bias)
1094 {
1095   Image
1096     *charcoal_image;
1097
1098   assert(wand != (MagickWand *) NULL);
1099   assert(wand->signature == WandSignature);
1100   if (wand->debug != MagickFalse)
1101     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1102   if (wand->images == (Image *) NULL)
1103     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1104   charcoal_image=CharcoalImage(wand->images,radius,sigma,bias,wand->exception);
1105   if (charcoal_image == (Image *) NULL)
1106     return(MagickFalse);
1107   ReplaceImageInList(&wand->images,charcoal_image);
1108   return(MagickTrue);
1109 }
1110 \f
1111 /*
1112 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1113 %                                                                             %
1114 %                                                                             %
1115 %                                                                             %
1116 %   M a g i c k C h o p I m a g e                                             %
1117 %                                                                             %
1118 %                                                                             %
1119 %                                                                             %
1120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1121 %
1122 %  MagickChopImage() removes a region of an image and collapses the image to
1123 %  occupy the removed portion
1124 %
1125 %  The format of the MagickChopImage method is:
1126 %
1127 %      MagickBooleanType MagickChopImage(MagickWand *wand,
1128 %        const size_t width,const size_t height,const ssize_t x,
1129 %        const ssize_t y)
1130 %
1131 %  A description of each parameter follows:
1132 %
1133 %    o wand: the magick wand.
1134 %
1135 %    o width: the region width.
1136 %
1137 %    o height: the region height.
1138 %
1139 %    o x: the region x offset.
1140 %
1141 %    o y: the region y offset.
1142 %
1143 %
1144 */
1145 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1146   const size_t width,const size_t height,const ssize_t x,
1147   const ssize_t y)
1148 {
1149   Image
1150     *chop_image;
1151
1152   RectangleInfo
1153     chop;
1154
1155   assert(wand != (MagickWand *) NULL);
1156   assert(wand->signature == WandSignature);
1157   if (wand->debug != MagickFalse)
1158     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1159   if (wand->images == (Image *) NULL)
1160     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1161   chop.width=width;
1162   chop.height=height;
1163   chop.x=x;
1164   chop.y=y;
1165   chop_image=ChopImage(wand->images,&chop,wand->exception);
1166   if (chop_image == (Image *) NULL)
1167     return(MagickFalse);
1168   ReplaceImageInList(&wand->images,chop_image);
1169   return(MagickTrue);
1170 }
1171 \f
1172 /*
1173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1174 %                                                                             %
1175 %                                                                             %
1176 %                                                                             %
1177 %   M a g i c k C l a m p I m a g e                                           %
1178 %                                                                             %
1179 %                                                                             %
1180 %                                                                             %
1181 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1182 %
1183 %  MagickClampImage() restricts the color range from 0 to the quantum depth.
1184 %
1185 %  The format of the MagickClampImage method is:
1186 %
1187 %      MagickBooleanType MagickClampImage(MagickWand *wand)
1188 %
1189 %  A description of each parameter follows:
1190 %
1191 %    o wand: the magick wand.
1192 %
1193 %    o channel: the channel.
1194 %
1195 */
1196 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1197 {
1198   assert(wand != (MagickWand *) NULL);
1199   assert(wand->signature == WandSignature);
1200   if (wand->debug != MagickFalse)
1201     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1202   if (wand->images == (Image *) NULL)
1203     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1204   return(ClampImage(wand->images,wand->exception));
1205 }
1206 \f
1207 /*
1208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1209 %                                                                             %
1210 %                                                                             %
1211 %                                                                             %
1212 %   M a g i c k C l i p I m a g e                                             %
1213 %                                                                             %
1214 %                                                                             %
1215 %                                                                             %
1216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1217 %
1218 %  MagickClipImage() clips along the first path from the 8BIM profile, if
1219 %  present.
1220 %
1221 %  The format of the MagickClipImage method is:
1222 %
1223 %      MagickBooleanType MagickClipImage(MagickWand *wand)
1224 %
1225 %  A description of each parameter follows:
1226 %
1227 %    o wand: the magick wand.
1228 %
1229 */
1230 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1231 {
1232   MagickBooleanType
1233     status;
1234
1235   assert(wand != (MagickWand *) NULL);
1236   assert(wand->signature == WandSignature);
1237   if (wand->debug != MagickFalse)
1238     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1239   if (wand->images == (Image *) NULL)
1240     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1241   status=ClipImage(wand->images,wand->exception);
1242   return(status);
1243 }
1244 \f
1245 /*
1246 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1247 %                                                                             %
1248 %                                                                             %
1249 %                                                                             %
1250 %   M a g i c k C l i p I m a g e P a t h                                     %
1251 %                                                                             %
1252 %                                                                             %
1253 %                                                                             %
1254 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1255 %
1256 %  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1257 %  present. Later operations take effect inside the path.  Id may be a number
1258 %  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1259 %  path.
1260 %
1261 %  The format of the MagickClipImagePath method is:
1262 %
1263 %      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1264 %        const char *pathname,const MagickBooleanType inside)
1265 %
1266 %  A description of each parameter follows:
1267 %
1268 %    o wand: the magick wand.
1269 %
1270 %    o pathname: name of clipping path resource. If name is preceded by #, use
1271 %      clipping path numbered by name.
1272 %
1273 %    o inside: if non-zero, later operations take effect inside clipping path.
1274 %      Otherwise later operations take effect outside clipping path.
1275 %
1276 */
1277 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1278   const char *pathname,const MagickBooleanType inside)
1279 {
1280   MagickBooleanType
1281     status;
1282
1283   assert(wand != (MagickWand *) NULL);
1284   assert(wand->signature == WandSignature);
1285   if (wand->debug != MagickFalse)
1286     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1287   if (wand->images == (Image *) NULL)
1288     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1289   status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1290   return(status);
1291 }
1292 \f
1293 /*
1294 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1295 %                                                                             %
1296 %                                                                             %
1297 %                                                                             %
1298 %   M a g i c k C l u t I m a g e                                             %
1299 %                                                                             %
1300 %                                                                             %
1301 %                                                                             %
1302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1303 %
1304 %  MagickClutImage() replaces colors in the image from a color lookup table.
1305 %
1306 %  The format of the MagickClutImage method is:
1307 %
1308 %      MagickBooleanType MagickClutImage(MagickWand *wand,
1309 %        const MagickWand *clut_wand,const PixelInterpolateMethod method)
1310 %
1311 %  A description of each parameter follows:
1312 %
1313 %    o wand: the magick wand.
1314 %
1315 %    o clut_image: the clut image.
1316 %
1317 %    o method: the pixel interpolation method.
1318 %
1319 */
1320 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1321   const MagickWand *clut_wand,const PixelInterpolateMethod method)
1322 {
1323   MagickBooleanType
1324     status;
1325
1326   assert(wand != (MagickWand *) NULL);
1327   assert(wand->signature == WandSignature);
1328   if (wand->debug != MagickFalse)
1329     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1330   if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1331     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1332   status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1333   return(status);
1334 }
1335 \f
1336 /*
1337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1338 %                                                                             %
1339 %                                                                             %
1340 %                                                                             %
1341 %   M a g i c k C o a l e s c e I m a g e s                                   %
1342 %                                                                             %
1343 %                                                                             %
1344 %                                                                             %
1345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1346 %
1347 %  MagickCoalesceImages() composites a set of images while respecting any page
1348 %  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1349 %  typically start with an image background and each subsequent image
1350 %  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1351 %  where each image in the sequence is the same size as the first and
1352 %  composited with the next image in the sequence.
1353 %
1354 %  The format of the MagickCoalesceImages method is:
1355 %
1356 %      MagickWand *MagickCoalesceImages(MagickWand *wand)
1357 %
1358 %  A description of each parameter follows:
1359 %
1360 %    o wand: the magick wand.
1361 %
1362 */
1363 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1364 {
1365   Image
1366     *coalesce_image;
1367
1368   assert(wand != (MagickWand *) NULL);
1369   assert(wand->signature == WandSignature);
1370   if (wand->debug != MagickFalse)
1371     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1372   if (wand->images == (Image *) NULL)
1373     return((MagickWand *) NULL);
1374   coalesce_image=CoalesceImages(wand->images,wand->exception);
1375   if (coalesce_image == (Image *) NULL)
1376     return((MagickWand *) NULL);
1377   return(CloneMagickWandFromImages(wand,coalesce_image));
1378 }
1379 \f
1380 /*
1381 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1382 %                                                                             %
1383 %                                                                             %
1384 %                                                                             %
1385 %   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1386 %                                                                             %
1387 %                                                                             %
1388 %                                                                             %
1389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1390 %
1391 %  MagickColorDecisionListImage() accepts a lightweight Color Correction
1392 %  Collection (CCC) file which solely contains one or more color corrections
1393 %  and applies the color correction to the image.  Here is a sample CCC file:
1394 %
1395 %    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1396 %          <ColorCorrection id="cc03345">
1397 %                <SOPNode>
1398 %                     <Slope> 0.9 1.2 0.5 </Slope>
1399 %                     <Offset> 0.4 -0.5 0.6 </Offset>
1400 %                     <Power> 1.0 0.8 1.5 </Power>
1401 %                </SOPNode>
1402 %                <SATNode>
1403 %                     <Saturation> 0.85 </Saturation>
1404 %                </SATNode>
1405 %          </ColorCorrection>
1406 %    </ColorCorrectionCollection>
1407 %
1408 %  which includes the offset, slope, and power for each of the RGB channels
1409 %  as well as the saturation.
1410 %
1411 %  The format of the MagickColorDecisionListImage method is:
1412 %
1413 %      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1414 %        const double gamma)
1415 %
1416 %  A description of each parameter follows:
1417 %
1418 %    o wand: the magick wand.
1419 %
1420 %    o color_correction_collection: the color correction collection in XML.
1421 %
1422 */
1423 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1424   const char *color_correction_collection)
1425 {
1426   MagickBooleanType
1427     status;
1428
1429   assert(wand != (MagickWand *) NULL);
1430   assert(wand->signature == WandSignature);
1431   if (wand->debug != MagickFalse)
1432     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1433   if (wand->images == (Image *) NULL)
1434     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1435   status=ColorDecisionListImage(wand->images,color_correction_collection,
1436     &wand->images->exception);
1437   return(status);
1438 }
1439 \f
1440 /*
1441 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1442 %                                                                             %
1443 %                                                                             %
1444 %                                                                             %
1445 %   M a g i c k C o l o r i z e I m a g e                                     %
1446 %                                                                             %
1447 %                                                                             %
1448 %                                                                             %
1449 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1450 %
1451 %  MagickColorizeImage() blends the fill color with each pixel in the image.
1452 %
1453 %  The format of the MagickColorizeImage method is:
1454 %
1455 %      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1456 %        const PixelWand *colorize,const PixelWand *blend)
1457 %
1458 %  A description of each parameter follows:
1459 %
1460 %    o wand: the magick wand.
1461 %
1462 %    o colorize: the colorize pixel wand.
1463 %
1464 %    o alpha: the alpha pixel wand.
1465 %
1466 */
1467 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1468   const PixelWand *colorize,const PixelWand *blend)
1469 {
1470   char
1471     percent_blend[MaxTextExtent];
1472
1473   Image
1474     *colorize_image;
1475
1476   PixelInfo
1477     target;
1478
1479   assert(wand != (MagickWand *) NULL);
1480   assert(wand->signature == WandSignature);
1481   if (wand->debug != MagickFalse)
1482     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1483   if (wand->images == (Image *) NULL)
1484     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1485   GetPixelInfo(wand->images,&target);
1486   if (target.colorspace != CMYKColorspace)
1487     (void) FormatLocaleString(percent_blend,MaxTextExtent,
1488       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1489       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1490       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1491       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1492       PixelGetAlphaQuantum(blend)));
1493   else
1494     (void) FormatLocaleString(percent_blend,MaxTextExtent,
1495       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1496       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1497       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1498       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1499       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1500       PixelGetAlphaQuantum(blend)));
1501   target=PixelGetPixel(colorize);
1502   colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1503     wand->exception);
1504   if (colorize_image == (Image *) NULL)
1505     return(MagickFalse);
1506   ReplaceImageInList(&wand->images,colorize_image);
1507   return(MagickTrue);
1508 }
1509 \f
1510 /*
1511 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1512 %                                                                             %
1513 %                                                                             %
1514 %                                                                             %
1515 %   M a g i c k C o l o r M a t r i x I m a g e                               %
1516 %                                                                             %
1517 %                                                                             %
1518 %                                                                             %
1519 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1520 %
1521 %  MagickColorMatrixImage() apply color transformation to an image. The method
1522 %  permits saturation changes, hue rotation, luminance to alpha, and various
1523 %  other effects.  Although variable-sized transformation matrices can be used,
1524 %  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1525 %  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1526 %  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1527 %  and offsets are normalized (divide Flash offset by 255).
1528 %
1529 %  The format of the MagickColorMatrixImage method is:
1530 %
1531 %      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1532 %        const KernelInfo *color_matrix)
1533 %
1534 %  A description of each parameter follows:
1535 %
1536 %    o wand: the magick wand.
1537 %
1538 %    o color_matrix:  the color matrix.
1539 %
1540 */
1541 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1542   const KernelInfo *color_matrix)
1543 {
1544   Image
1545     *color_image;
1546
1547   assert(wand != (MagickWand *) NULL);
1548   assert(wand->signature == WandSignature);
1549   if (wand->debug != MagickFalse)
1550     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1551   if (color_matrix == (const KernelInfo *) NULL)
1552     return(MagickFalse);
1553   if (wand->images == (Image *) NULL)
1554     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1555   color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1556   if (color_image == (Image *) NULL)
1557     return(MagickFalse);
1558   ReplaceImageInList(&wand->images,color_image);
1559   return(MagickTrue);
1560 }
1561 \f
1562 /*
1563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1564 %                                                                             %
1565 %                                                                             %
1566 %                                                                             %
1567 %   M a g i c k C o m b i n e I m a g e s                                     %
1568 %                                                                             %
1569 %                                                                             %
1570 %                                                                             %
1571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1572 %
1573 %  MagickCombineImages() combines one or more images into a single image.  The
1574 %  grayscale value of the pixels of each image in the sequence is assigned in
1575 %  order to the specified  hannels of the combined image.   The typical
1576 %  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1577 %
1578 %  The format of the MagickCombineImages method is:
1579 %
1580 %      MagickWand *MagickCombineImages(MagickWand *wand)
1581 %
1582 %  A description of each parameter follows:
1583 %
1584 %    o wand: the magick wand.
1585 %
1586 */
1587 WandExport MagickWand *MagickCombineImages(MagickWand *wand)
1588 {
1589   Image
1590     *combine_image;
1591
1592   assert(wand != (MagickWand *) NULL);
1593   assert(wand->signature == WandSignature);
1594   if (wand->debug != MagickFalse)
1595     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1596   if (wand->images == (Image *) NULL)
1597     return((MagickWand *) NULL);
1598   combine_image=CombineImages(wand->images,wand->exception);
1599   if (combine_image == (Image *) NULL)
1600     return((MagickWand *) NULL);
1601   return(CloneMagickWandFromImages(wand,combine_image));
1602 }
1603 \f
1604 /*
1605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1606 %                                                                             %
1607 %                                                                             %
1608 %                                                                             %
1609 %   M a g i c k C o m m e n t I m a g e                                       %
1610 %                                                                             %
1611 %                                                                             %
1612 %                                                                             %
1613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1614 %
1615 %  MagickCommentImage() adds a comment to your image.
1616 %
1617 %  The format of the MagickCommentImage method is:
1618 %
1619 %      MagickBooleanType MagickCommentImage(MagickWand *wand,
1620 %        const char *comment)
1621 %
1622 %  A description of each parameter follows:
1623 %
1624 %    o wand: the magick wand.
1625 %
1626 %    o comment: the image comment.
1627 %
1628 */
1629 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1630   const char *comment)
1631 {
1632   MagickBooleanType
1633     status;
1634
1635   assert(wand != (MagickWand *) NULL);
1636   assert(wand->signature == WandSignature);
1637   if (wand->debug != MagickFalse)
1638     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1639   if (wand->images == (Image *) NULL)
1640     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1641   status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1642   return(status);
1643 }
1644 \f
1645 /*
1646 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1647 %                                                                             %
1648 %                                                                             %
1649 %                                                                             %
1650 %   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1651 %                                                                             %
1652 %                                                                             %
1653 %                                                                             %
1654 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1655 %
1656 %  MagickCompareImagesLayers() compares each image with the next in a sequence
1657 %  and returns the maximum bounding region of any pixel differences it
1658 %  discovers.
1659 %
1660 %  The format of the MagickCompareImagesLayers method is:
1661 %
1662 %      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1663 %        const ImageLayerMethod method)
1664 %
1665 %  A description of each parameter follows:
1666 %
1667 %    o wand: the magick wand.
1668 %
1669 %    o method: the compare method.
1670 %
1671 */
1672 WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1673   const ImageLayerMethod method)
1674 {
1675   Image
1676     *layers_image;
1677
1678   assert(wand != (MagickWand *) NULL);
1679   assert(wand->signature == WandSignature);
1680   if (wand->debug != MagickFalse)
1681     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1682   if (wand->images == (Image *) NULL)
1683     return((MagickWand *) NULL);
1684   layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1685   if (layers_image == (Image *) NULL)
1686     return((MagickWand *) NULL);
1687   return(CloneMagickWandFromImages(wand,layers_image));
1688 }
1689 \f
1690 /*
1691 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1692 %                                                                             %
1693 %                                                                             %
1694 %                                                                             %
1695 %   M a g i c k C o m p a r e I m a g e s                                     %
1696 %                                                                             %
1697 %                                                                             %
1698 %                                                                             %
1699 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1700 %
1701 %  MagickCompareImages() compares an image to a reconstructed image and returns
1702 %  the specified difference image.
1703 %
1704 %  The format of the MagickCompareImages method is:
1705 %
1706 %      MagickWand *MagickCompareImages(MagickWand *wand,
1707 %        const MagickWand *reference,const MetricType metric,
1708 %        double *distortion)
1709 %
1710 %  A description of each parameter follows:
1711 %
1712 %    o wand: the magick wand.
1713 %
1714 %    o reference: the reference wand.
1715 %
1716 %    o metric: the metric.
1717 %
1718 %    o distortion: the computed distortion between the images.
1719 %
1720 */
1721 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1722   const MagickWand *reference,const MetricType metric,double *distortion)
1723 {
1724   Image
1725     *compare_image;
1726
1727
1728   assert(wand != (MagickWand *) NULL);
1729   assert(wand->signature == WandSignature);
1730   if (wand->debug != MagickFalse)
1731     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1732   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1733     {
1734       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1735         "ContainsNoImages","`%s'",wand->name);
1736       return((MagickWand *) NULL);
1737     }
1738   compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1739     &wand->images->exception);
1740   if (compare_image == (Image *) NULL)
1741     return((MagickWand *) NULL);
1742   return(CloneMagickWandFromImages(wand,compare_image));
1743 }
1744 \f
1745 /*
1746 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1747 %                                                                             %
1748 %                                                                             %
1749 %                                                                             %
1750 %   M a g i c k C o m p o s i t e I m a g e                                   %
1751 %                                                                             %
1752 %                                                                             %
1753 %                                                                             %
1754 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1755 %
1756 %  MagickCompositeImage() composite one image onto another at the specified
1757 %  offset.
1758 %
1759 %  The format of the MagickCompositeImage method is:
1760 %
1761 %      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1762 %        const MagickWand *composite_wand,const CompositeOperator compose,
1763 %        const ssize_t x,const ssize_t y)
1764 %
1765 %  A description of each parameter follows:
1766 %
1767 %    o wand: the magick wand.
1768 %
1769 %    o composite_image: the composite image.
1770 %
1771 %    o compose: This operator affects how the composite is applied to the
1772 %      image.  The default is Over.  Choose from these operators:
1773 %
1774 %        OverCompositeOp       InCompositeOp         OutCompositeOp
1775 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1776 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1777 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1778 %        DisplaceCompositeOp
1779 %
1780 %    o x: the column offset of the composited image.
1781 %
1782 %    o y: the row offset of the composited image.
1783 %
1784 */
1785 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1786   const MagickWand *composite_wand,const CompositeOperator compose,
1787   const ssize_t x,const ssize_t y)
1788 {
1789   MagickBooleanType
1790     status;
1791
1792   assert(wand != (MagickWand *) NULL);
1793   assert(wand->signature == WandSignature);
1794   if (wand->debug != MagickFalse)
1795     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1796   if ((wand->images == (Image *) NULL) ||
1797       (composite_wand->images == (Image *) NULL))
1798     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1799   status=CompositeImage(wand->images,compose,composite_wand->images,x,y,
1800     wand->exception);
1801   return(status);
1802 }
1803 \f
1804 /*
1805 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1806 %                                                                             %
1807 %                                                                             %
1808 %                                                                             %
1809 %   M a g i c k C o n t r a s t I m a g e                                     %
1810 %                                                                             %
1811 %                                                                             %
1812 %                                                                             %
1813 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1814 %
1815 %  MagickContrastImage() enhances the intensity differences between the lighter
1816 %  and darker elements of the image.  Set sharpen to a value other than 0 to
1817 %  increase the image contrast otherwise the contrast is reduced.
1818 %
1819 %  The format of the MagickContrastImage method is:
1820 %
1821 %      MagickBooleanType MagickContrastImage(MagickWand *wand,
1822 %        const MagickBooleanType sharpen)
1823 %
1824 %  A description of each parameter follows:
1825 %
1826 %    o wand: the magick wand.
1827 %
1828 %    o sharpen: Increase or decrease image contrast.
1829 %
1830 %
1831 */
1832 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1833   const MagickBooleanType sharpen)
1834 {
1835   MagickBooleanType
1836     status;
1837
1838   assert(wand != (MagickWand *) NULL);
1839   assert(wand->signature == WandSignature);
1840   if (wand->debug != MagickFalse)
1841     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1842   if (wand->images == (Image *) NULL)
1843     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1844   status=ContrastImage(wand->images,sharpen,&wand->images->exception);
1845   return(status);
1846 }
1847 \f
1848 /*
1849 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1850 %                                                                             %
1851 %                                                                             %
1852 %                                                                             %
1853 %   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                       %
1854 %                                                                             %
1855 %                                                                             %
1856 %                                                                             %
1857 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1858 %
1859 %  MagickContrastStretchImage() enhances the contrast of a color image by
1860 %  adjusting the pixels color to span the entire range of colors available.
1861 %  You can also reduce the influence of a particular channel with a gamma
1862 %  value of 0.
1863 %
1864 %  The format of the MagickContrastStretchImage method is:
1865 %
1866 %      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1867 %        const double black_point,const double white_point)
1868 %
1869 %  A description of each parameter follows:
1870 %
1871 %    o wand: the magick wand.
1872 %
1873 %    o black_point: the black point.
1874 %
1875 %    o white_point: the white point.
1876 %
1877 */
1878 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1879   const double black_point,const double white_point)
1880 {
1881   MagickBooleanType
1882     status;
1883
1884   assert(wand != (MagickWand *) NULL);
1885   assert(wand->signature == WandSignature);
1886   if (wand->debug != MagickFalse)
1887     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1888   if (wand->images == (Image *) NULL)
1889     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1890   status=ContrastStretchImage(wand->images,black_point,white_point,
1891     &wand->images->exception);
1892   return(status);
1893 }
1894 \f
1895 /*
1896 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1897 %                                                                             %
1898 %                                                                             %
1899 %                                                                             %
1900 %   M a g i c k C o n v o l v e I m a g e                                     %
1901 %                                                                             %
1902 %                                                                             %
1903 %                                                                             %
1904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1905 %
1906 %  MagickConvolveImage() applies a custom convolution kernel to the image.
1907 %
1908 %  The format of the MagickConvolveImage method is:
1909 %
1910 %      MagickBooleanType MagickConvolveImage(MagickWand *wand,
1911 %        const KernelInfo *kernel)
1912 %
1913 %  A description of each parameter follows:
1914 %
1915 %    o wand: the magick wand.
1916 %
1917 %    o kernel: An array of doubles representing the convolution kernel.
1918 %
1919 */
1920 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
1921   const KernelInfo *kernel)
1922 {
1923   Image
1924     *filter_image;
1925
1926   assert(wand != (MagickWand *) NULL);
1927   assert(wand->signature == WandSignature);
1928   if (wand->debug != MagickFalse)
1929     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1930   if (kernel == (const KernelInfo *) NULL)
1931     return(MagickFalse);
1932   if (wand->images == (Image *) NULL)
1933     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1934   filter_image=ConvolveImage(wand->images,kernel,wand->exception);
1935   if (filter_image == (Image *) NULL)
1936     return(MagickFalse);
1937   ReplaceImageInList(&wand->images,filter_image);
1938   return(MagickTrue);
1939 }
1940 \f
1941 /*
1942 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1943 %                                                                             %
1944 %                                                                             %
1945 %                                                                             %
1946 %   M a g i c k C r o p I m a g e                                             %
1947 %                                                                             %
1948 %                                                                             %
1949 %                                                                             %
1950 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1951 %
1952 %  MagickCropImage() extracts a region of the image.
1953 %
1954 %  The format of the MagickCropImage method is:
1955 %
1956 %      MagickBooleanType MagickCropImage(MagickWand *wand,
1957 %        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1958 %
1959 %  A description of each parameter follows:
1960 %
1961 %    o wand: the magick wand.
1962 %
1963 %    o width: the region width.
1964 %
1965 %    o height: the region height.
1966 %
1967 %    o x: the region x-offset.
1968 %
1969 %    o y: the region y-offset.
1970 %
1971 */
1972 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
1973   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1974 {
1975   Image
1976     *crop_image;
1977
1978   RectangleInfo
1979     crop;
1980
1981   assert(wand != (MagickWand *) NULL);
1982   assert(wand->signature == WandSignature);
1983   if (wand->debug != MagickFalse)
1984     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1985   if (wand->images == (Image *) NULL)
1986     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1987   crop.width=width;
1988   crop.height=height;
1989   crop.x=x;
1990   crop.y=y;
1991   crop_image=CropImage(wand->images,&crop,wand->exception);
1992   if (crop_image == (Image *) NULL)
1993     return(MagickFalse);
1994   ReplaceImageInList(&wand->images,crop_image);
1995   return(MagickTrue);
1996 }
1997 \f
1998 /*
1999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2000 %                                                                             %
2001 %                                                                             %
2002 %                                                                             %
2003 %   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2004 %                                                                             %
2005 %                                                                             %
2006 %                                                                             %
2007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2008 %
2009 %  MagickCycleColormapImage() displaces an image's colormap by a given number
2010 %  of positions.  If you cycle the colormap a number of times you can produce
2011 %  a psychodelic effect.
2012 %
2013 %  The format of the MagickCycleColormapImage method is:
2014 %
2015 %      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2016 %        const ssize_t displace)
2017 %
2018 %  A description of each parameter follows:
2019 %
2020 %    o wand: the magick wand.
2021 %
2022 %    o pixel_wand: the pixel wand.
2023 %
2024 */
2025 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2026   const ssize_t displace)
2027 {
2028   MagickBooleanType
2029     status;
2030
2031   assert(wand != (MagickWand *) NULL);
2032   assert(wand->signature == WandSignature);
2033   if (wand->debug != MagickFalse)
2034     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2035   if (wand->images == (Image *) NULL)
2036     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2037   status=CycleColormapImage(wand->images,displace,wand->exception);
2038   return(status);
2039 }
2040 \f
2041 /*
2042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2043 %                                                                             %
2044 %                                                                             %
2045 %                                                                             %
2046 %   M a g i c k C o n s t i t u t e I m a g e                                 %
2047 %                                                                             %
2048 %                                                                             %
2049 %                                                                             %
2050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2051 %
2052 %  MagickConstituteImage() adds an image to the wand comprised of the pixel
2053 %  data you supply.  The pixel data must be in scanline order top-to-bottom.
2054 %  The data can be char, short int, int, float, or double.  Float and double
2055 %  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2056 %  is the maximum value the type can accomodate (e.g. 255 for char).  For
2057 %  example, to create a 640x480 image from unsigned red-green-blue character
2058 %  data, use
2059 %
2060 %      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2061 %
2062 %  The format of the MagickConstituteImage method is:
2063 %
2064 %      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2065 %        const size_t columns,const size_t rows,const char *map,
2066 %        const StorageType storage,void *pixels)
2067 %
2068 %  A description of each parameter follows:
2069 %
2070 %    o wand: the magick wand.
2071 %
2072 %    o columns: width in pixels of the image.
2073 %
2074 %    o rows: height in pixels of the image.
2075 %
2076 %    o map:  This string reflects the expected ordering of the pixel array.
2077 %      It can be any combination or order of R = red, G = green, B = blue,
2078 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2079 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2080 %      P = pad.
2081 %
2082 %    o storage: Define the data type of the pixels.  Float and double types are
2083 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2084 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2085 %      LongPixel, QuantumPixel, or ShortPixel.
2086 %
2087 %    o pixels: This array of values contain the pixel components as defined by
2088 %      map and type.  You must preallocate this array where the expected
2089 %      length varies depending on the values of width, height, map, and type.
2090 %
2091 %
2092 */
2093 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2094   const size_t columns,const size_t rows,const char *map,
2095   const StorageType storage,const void *pixels)
2096 {
2097   Image
2098     *images;
2099
2100   assert(wand != (MagickWand *) NULL);
2101   assert(wand->signature == WandSignature);
2102   if (wand->debug != MagickFalse)
2103     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2104   images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2105   if (images == (Image *) NULL)
2106     return(MagickFalse);
2107   return(InsertImageInWand(wand,images));
2108 }
2109 \f
2110 /*
2111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2112 %                                                                             %
2113 %                                                                             %
2114 %                                                                             %
2115 %   M a g i c k D e c i p h e r I m a g e                                     %
2116 %                                                                             %
2117 %                                                                             %
2118 %                                                                             %
2119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2120 %
2121 %  MagickDecipherImage() converts cipher pixels to plain pixels.
2122 %
2123 %  The format of the MagickDecipherImage method is:
2124 %
2125 %      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2126 %        const char *passphrase)
2127 %
2128 %  A description of each parameter follows:
2129 %
2130 %    o wand: the magick wand.
2131 %
2132 %    o passphrase: the passphrase.
2133 %
2134 */
2135 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2136   const char *passphrase)
2137 {
2138   assert(wand != (MagickWand *) NULL);
2139   assert(wand->signature == WandSignature);
2140   if (wand->debug != MagickFalse)
2141     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2142   if (wand->images == (Image *) NULL)
2143     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2144   return(DecipherImage(wand->images,passphrase,&wand->images->exception));
2145 }
2146 \f
2147 /*
2148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2149 %                                                                             %
2150 %                                                                             %
2151 %                                                                             %
2152 %   M a g i c k D e c o n s t r u c t I m a g e s                             %
2153 %                                                                             %
2154 %                                                                             %
2155 %                                                                             %
2156 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2157 %
2158 %  MagickDeconstructImages() compares each image with the next in a sequence
2159 %  and returns the maximum bounding region of any pixel differences it
2160 %  discovers.
2161 %
2162 %  The format of the MagickDeconstructImages method is:
2163 %
2164 %      MagickWand *MagickDeconstructImages(MagickWand *wand)
2165 %
2166 %  A description of each parameter follows:
2167 %
2168 %    o wand: the magick wand.
2169 %
2170 */
2171 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2172 {
2173   Image
2174     *deconstruct_image;
2175
2176   assert(wand != (MagickWand *) NULL);
2177   assert(wand->signature == WandSignature);
2178   if (wand->debug != MagickFalse)
2179     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2180   if (wand->images == (Image *) NULL)
2181     return((MagickWand *) NULL);
2182   deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2183     wand->exception);
2184   if (deconstruct_image == (Image *) NULL)
2185     return((MagickWand *) NULL);
2186   return(CloneMagickWandFromImages(wand,deconstruct_image));
2187 }
2188 \f
2189 /*
2190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2191 %                                                                             %
2192 %                                                                             %
2193 %                                                                             %
2194 %     M a g i c k D e s k e w I m a g e                                       %
2195 %                                                                             %
2196 %                                                                             %
2197 %                                                                             %
2198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2199 %
2200 %  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2201 %  occurs in scanned images because of the camera being misaligned,
2202 %  imperfections in the scanning or surface, or simply because the paper was
2203 %  not placed completely flat when scanned.
2204 %
2205 %  The format of the MagickDeskewImage method is:
2206 %
2207 %      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2208 %        const double threshold)
2209 %
2210 %  A description of each parameter follows:
2211 %
2212 %    o wand: the magick wand.
2213 %
2214 %    o threshold: separate background from foreground.
2215 %
2216 */
2217 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2218   const double threshold)
2219 {
2220   Image
2221     *sepia_image;
2222
2223   assert(wand != (MagickWand *) NULL);
2224   assert(wand->signature == WandSignature);
2225   if (wand->debug != MagickFalse)
2226     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2227   if (wand->images == (Image *) NULL)
2228     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2229   sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2230   if (sepia_image == (Image *) NULL)
2231     return(MagickFalse);
2232   ReplaceImageInList(&wand->images,sepia_image);
2233   return(MagickTrue);
2234 }
2235 \f
2236 /*
2237 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2238 %                                                                             %
2239 %                                                                             %
2240 %                                                                             %
2241 %     M a g i c k D e s p e c k l e I m a g e                                 %
2242 %                                                                             %
2243 %                                                                             %
2244 %                                                                             %
2245 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2246 %
2247 %  MagickDespeckleImage() reduces the speckle noise in an image while
2248 %  perserving the edges of the original image.
2249 %
2250 %  The format of the MagickDespeckleImage method is:
2251 %
2252 %      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2253 %
2254 %  A description of each parameter follows:
2255 %
2256 %    o wand: the magick wand.
2257 %
2258 */
2259 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2260 {
2261   Image
2262     *despeckle_image;
2263
2264   assert(wand != (MagickWand *) NULL);
2265   assert(wand->signature == WandSignature);
2266   if (wand->debug != MagickFalse)
2267     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2268   if (wand->images == (Image *) NULL)
2269     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2270   despeckle_image=DespeckleImage(wand->images,wand->exception);
2271   if (despeckle_image == (Image *) NULL)
2272     return(MagickFalse);
2273   ReplaceImageInList(&wand->images,despeckle_image);
2274   return(MagickTrue);
2275 }
2276 \f
2277 /*
2278 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2279 %                                                                             %
2280 %                                                                             %
2281 %                                                                             %
2282 %   M a g i c k D e s t r o y I m a g e                                       %
2283 %                                                                             %
2284 %                                                                             %
2285 %                                                                             %
2286 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2287 %
2288 %  MagickDestroyImage() dereferences an image, deallocating memory associated
2289 %  with the image if the reference count becomes zero.
2290 %
2291 %  The format of the MagickDestroyImage method is:
2292 %
2293 %      Image *MagickDestroyImage(Image *image)
2294 %
2295 %  A description of each parameter follows:
2296 %
2297 %    o image: the image.
2298 %
2299 */
2300 WandExport Image *MagickDestroyImage(Image *image)
2301 {
2302   return(DestroyImage(image));
2303 }
2304 \f
2305 /*
2306 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2307 %                                                                             %
2308 %                                                                             %
2309 %                                                                             %
2310 %   M a g i c k D i s p l a y I m a g e                                       %
2311 %                                                                             %
2312 %                                                                             %
2313 %                                                                             %
2314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2315 %
2316 %  MagickDisplayImage() displays an image.
2317 %
2318 %  The format of the MagickDisplayImage method is:
2319 %
2320 %      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2321 %        const char *server_name)
2322 %
2323 %  A description of each parameter follows:
2324 %
2325 %    o wand: the magick wand.
2326 %
2327 %    o server_name: the X server name.
2328 %
2329 */
2330 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2331   const char *server_name)
2332 {
2333   Image
2334     *image;
2335
2336   MagickBooleanType
2337     status;
2338
2339   assert(wand != (MagickWand *) NULL);
2340   assert(wand->signature == WandSignature);
2341   if (wand->debug != MagickFalse)
2342     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2343   if (wand->images == (Image *) NULL)
2344     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2345   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2346   if (image == (Image *) NULL)
2347     return(MagickFalse);
2348   (void) CloneString(&wand->image_info->server_name,server_name);
2349   status=DisplayImages(wand->image_info,image,&image->exception);
2350   image=DestroyImage(image);
2351   return(status);
2352 }
2353 \f
2354 /*
2355 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2356 %                                                                             %
2357 %                                                                             %
2358 %                                                                             %
2359 %   M a g i c k D i s p l a y I m a g e s                                     %
2360 %                                                                             %
2361 %                                                                             %
2362 %                                                                             %
2363 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2364 %
2365 %  MagickDisplayImages() displays an image or image sequence.
2366 %
2367 %  The format of the MagickDisplayImages method is:
2368 %
2369 %      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2370 %        const char *server_name)
2371 %
2372 %  A description of each parameter follows:
2373 %
2374 %    o wand: the magick wand.
2375 %
2376 %    o server_name: the X server name.
2377 %
2378 */
2379 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2380   const char *server_name)
2381 {
2382   MagickBooleanType
2383     status;
2384
2385   assert(wand != (MagickWand *) NULL);
2386   assert(wand->signature == WandSignature);
2387   if (wand->debug != MagickFalse)
2388     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2389   (void) CloneString(&wand->image_info->server_name,server_name);
2390   status=DisplayImages(wand->image_info,wand->images,&wand->images->exception);
2391   return(status);
2392 }
2393 \f
2394 /*
2395 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2396 %                                                                             %
2397 %                                                                             %
2398 %                                                                             %
2399 %   M a g i c k D i s t o r t I m a g e                                       %
2400 %                                                                             %
2401 %                                                                             %
2402 %                                                                             %
2403 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2404 %
2405 %  MagickDistortImage() distorts an image using various distortion methods, by
2406 %  mapping color lookups of the source image to a new destination image
2407 %  usally of the same size as the source image, unless 'bestfit' is set to
2408 %  true.
2409 %
2410 %  If 'bestfit' is enabled, and distortion allows it, the destination image is
2411 %  adjusted to ensure the whole source 'image' will just fit within the final
2412 %  destination image, which will be sized and offset accordingly.  Also in
2413 %  many cases the virtual offset of the source image will be taken into
2414 %  account in the mapping.
2415 %
2416 %  The format of the MagickDistortImage method is:
2417 %
2418 %      MagickBooleanType MagickDistortImage(MagickWand *wand,
2419 %        const DistortImageMethod method,const size_t number_arguments,
2420 %        const double *arguments,const MagickBooleanType bestfit)
2421 %
2422 %  A description of each parameter follows:
2423 %
2424 %    o image: the image to be distorted.
2425 %
2426 %    o method: the method of image distortion.
2427 %
2428 %        ArcDistortion always ignores the source image offset, and always
2429 %        'bestfit' the destination image with the top left corner offset
2430 %        relative to the polar mapping center.
2431 %
2432 %        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2433 %        style of image distortion.
2434 %
2435 %        Affine, Perspective, and Bilinear, do least squares fitting of the
2436 %        distortion when more than the minimum number of control point pairs
2437 %        are provided.
2438 %
2439 %        Perspective, and Bilinear, falls back to a Affine distortion when less
2440 %        that 4 control point pairs are provided. While Affine distortions let
2441 %        you use any number of control point pairs, that is Zero pairs is a
2442 %        no-Op (viewport only) distrotion, one pair is a translation and two
2443 %        pairs of control points do a scale-rotate-translate, without any
2444 %        shearing.
2445 %
2446 %    o number_arguments: the number of arguments given for this distortion
2447 %      method.
2448 %
2449 %    o arguments: the arguments for this distortion method.
2450 %
2451 %    o bestfit: Attempt to resize destination to fit distorted source.
2452 %
2453 */
2454 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2455   const DistortImageMethod method,const size_t number_arguments,
2456   const double *arguments,const MagickBooleanType bestfit)
2457 {
2458   Image
2459     *distort_image;
2460
2461   assert(wand != (MagickWand *) NULL);
2462   assert(wand->signature == WandSignature);
2463   if (wand->debug != MagickFalse)
2464     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2465   if (wand->images == (Image *) NULL)
2466     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2467   distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2468     bestfit,wand->exception);
2469   if (distort_image == (Image *) NULL)
2470     return(MagickFalse);
2471   ReplaceImageInList(&wand->images,distort_image);
2472   return(MagickTrue);
2473 }
2474 \f
2475 /*
2476 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2477 %                                                                             %
2478 %                                                                             %
2479 %                                                                             %
2480 %   M a g i c k D r a w I m a g e                                             %
2481 %                                                                             %
2482 %                                                                             %
2483 %                                                                             %
2484 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2485 %
2486 %  MagickDrawImage() renders the drawing wand on the current image.
2487 %
2488 %  The format of the MagickDrawImage method is:
2489 %
2490 %      MagickBooleanType MagickDrawImage(MagickWand *wand,
2491 %        const DrawingWand *drawing_wand)
2492 %
2493 %  A description of each parameter follows:
2494 %
2495 %    o wand: the magick wand.
2496 %
2497 %    o drawing_wand: the draw wand.
2498 %
2499 */
2500 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2501   const DrawingWand *drawing_wand)
2502 {
2503   char
2504     *primitive;
2505
2506   DrawInfo
2507     *draw_info;
2508
2509   MagickBooleanType
2510     status;
2511
2512   assert(wand != (MagickWand *) NULL);
2513   assert(wand->signature == WandSignature);
2514   if (wand->debug != MagickFalse)
2515     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2516   if (wand->images == (Image *) NULL)
2517     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2518   draw_info=PeekDrawingWand(drawing_wand);
2519   if ((draw_info == (DrawInfo *) NULL) ||
2520       (draw_info->primitive == (char *) NULL))
2521     return(MagickFalse);
2522   primitive=AcquireString(draw_info->primitive);
2523   draw_info=DestroyDrawInfo(draw_info);
2524   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2525   draw_info->primitive=primitive;
2526   status=DrawImage(wand->images,draw_info,wand->exception);
2527   draw_info=DestroyDrawInfo(draw_info);
2528   return(status);
2529 }
2530 \f
2531 /*
2532 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2533 %                                                                             %
2534 %                                                                             %
2535 %                                                                             %
2536 %   M a g i c k E d g e I m a g e                                             %
2537 %                                                                             %
2538 %                                                                             %
2539 %                                                                             %
2540 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2541 %
2542 %  MagickEdgeImage() enhance edges within the image with a convolution filter
2543 %  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2544 %  radius for you.
2545 %
2546 %  The format of the MagickEdgeImage method is:
2547 %
2548 %      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius,
2549 %        const double sigma)
2550 %
2551 %  A description of each parameter follows:
2552 %
2553 %    o wand: the magick wand.
2554 %
2555 %    o radius: the radius of the pixel neighborhood.
2556 %
2557 %    o sigma: the standard deviation of the Gaussian, in pixels.
2558 %
2559 */
2560 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2561   const double radius,const double sigma)
2562 {
2563   Image
2564     *edge_image;
2565
2566   assert(wand != (MagickWand *) NULL);
2567   assert(wand->signature == WandSignature);
2568   if (wand->debug != MagickFalse)
2569     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2570   if (wand->images == (Image *) NULL)
2571     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2572   edge_image=EdgeImage(wand->images,radius,sigma,wand->exception);
2573   if (edge_image == (Image *) NULL)
2574     return(MagickFalse);
2575   ReplaceImageInList(&wand->images,edge_image);
2576   return(MagickTrue);
2577 }
2578 \f
2579 /*
2580 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2581 %                                                                             %
2582 %                                                                             %
2583 %                                                                             %
2584 %   M a g i c k E m b o s s I m a g e                                         %
2585 %                                                                             %
2586 %                                                                             %
2587 %                                                                             %
2588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2589 %
2590 %  MagickEmbossImage() returns a grayscale image with a three-dimensional
2591 %  effect.  We convolve the image with a Gaussian operator of the given radius
2592 %  and standard deviation (sigma).  For reasonable results, radius should be
2593 %  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2594 %  radius for you.
2595 %
2596 %  The format of the MagickEmbossImage method is:
2597 %
2598 %      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2599 %        const double sigma)
2600 %
2601 %  A description of each parameter follows:
2602 %
2603 %    o wand: the magick wand.
2604 %
2605 %    o radius: the radius of the Gaussian, in pixels, not counting the center
2606 %      pixel.
2607 %
2608 %    o sigma: the standard deviation of the Gaussian, in pixels.
2609 %
2610 */
2611 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2612   const double radius,const double sigma)
2613 {
2614   Image
2615     *emboss_image;
2616
2617   assert(wand != (MagickWand *) NULL);
2618   assert(wand->signature == WandSignature);
2619   if (wand->debug != MagickFalse)
2620     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2621   if (wand->images == (Image *) NULL)
2622     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2623   emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2624   if (emboss_image == (Image *) NULL)
2625     return(MagickFalse);
2626   ReplaceImageInList(&wand->images,emboss_image);
2627   return(MagickTrue);
2628 }
2629 \f
2630 /*
2631 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2632 %                                                                             %
2633 %                                                                             %
2634 %                                                                             %
2635 %   M a g i c k E n c i p h e r I m a g e                                     %
2636 %                                                                             %
2637 %                                                                             %
2638 %                                                                             %
2639 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2640 %
2641 %  MagickEncipherImage() converts plaint pixels to cipher pixels.
2642 %
2643 %  The format of the MagickEncipherImage method is:
2644 %
2645 %      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2646 %        const char *passphrase)
2647 %
2648 %  A description of each parameter follows:
2649 %
2650 %    o wand: the magick wand.
2651 %
2652 %    o passphrase: the passphrase.
2653 %
2654 */
2655 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2656   const char *passphrase)
2657 {
2658   assert(wand != (MagickWand *) NULL);
2659   assert(wand->signature == WandSignature);
2660   if (wand->debug != MagickFalse)
2661     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2662   if (wand->images == (Image *) NULL)
2663     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2664   return(EncipherImage(wand->images,passphrase,&wand->images->exception));
2665 }
2666 \f
2667 /*
2668 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2669 %                                                                             %
2670 %                                                                             %
2671 %                                                                             %
2672 %   M a g i c k E n h a n c e I m a g e                                       %
2673 %                                                                             %
2674 %                                                                             %
2675 %                                                                             %
2676 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2677 %
2678 %  MagickEnhanceImage() applies a digital filter that improves the quality of a
2679 %  noisy image.
2680 %
2681 %  The format of the MagickEnhanceImage method is:
2682 %
2683 %      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2684 %
2685 %  A description of each parameter follows:
2686 %
2687 %    o wand: the magick wand.
2688 %
2689 */
2690 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2691 {
2692   Image
2693     *enhance_image;
2694
2695   assert(wand != (MagickWand *) NULL);
2696   assert(wand->signature == WandSignature);
2697   if (wand->debug != MagickFalse)
2698     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2699   if (wand->images == (Image *) NULL)
2700     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2701   enhance_image=EnhanceImage(wand->images,wand->exception);
2702   if (enhance_image == (Image *) NULL)
2703     return(MagickFalse);
2704   ReplaceImageInList(&wand->images,enhance_image);
2705   return(MagickTrue);
2706 }
2707 \f
2708 /*
2709 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2710 %                                                                             %
2711 %                                                                             %
2712 %                                                                             %
2713 %   M a g i c k E q u a l i z e I m a g e                                     %
2714 %                                                                             %
2715 %                                                                             %
2716 %                                                                             %
2717 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2718 %
2719 %  MagickEqualizeImage() equalizes the image histogram.
2720 %
2721 %  The format of the MagickEqualizeImage method is:
2722 %
2723 %      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2724 %
2725 %  A description of each parameter follows:
2726 %
2727 %    o wand: the magick wand.
2728 %
2729 %    o channel: the image channel(s).
2730 %
2731 */
2732 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2733 {
2734   MagickBooleanType
2735     status;
2736
2737   assert(wand != (MagickWand *) NULL);
2738   assert(wand->signature == WandSignature);
2739   if (wand->debug != MagickFalse)
2740     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2741   if (wand->images == (Image *) NULL)
2742     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2743   status=EqualizeImage(wand->images,&wand->images->exception);
2744   return(status);
2745 }
2746 \f
2747 /*
2748 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2749 %                                                                             %
2750 %                                                                             %
2751 %                                                                             %
2752 %   M a g i c k E v a l u a t e I m a g e                                     %
2753 %                                                                             %
2754 %                                                                             %
2755 %                                                                             %
2756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2757 %
2758 %  MagickEvaluateImage() applys an arithmetic, relational, or logical
2759 %  expression to an image.  Use these operators to lighten or darken an image,
2760 %  to increase or decrease contrast in an image, or to produce the "negative"
2761 %  of an image.
2762 %
2763 %  The format of the MagickEvaluateImage method is:
2764 %
2765 %      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2766 %        const MagickEvaluateOperator operator,const double value)
2767 %      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2768 %        const MagickEvaluateOperator operator)
2769 %
2770 %  A description of each parameter follows:
2771 %
2772 %    o wand: the magick wand.
2773 %
2774 %    o op: A channel operator.
2775 %
2776 %    o value: A value value.
2777 %
2778 */
2779
2780 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2781   const MagickEvaluateOperator op)
2782 {
2783   Image
2784     *evaluate_image;
2785
2786   assert(wand != (MagickWand *) NULL);
2787   assert(wand->signature == WandSignature);
2788   if (wand->debug != MagickFalse)
2789     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2790   if (wand->images == (Image *) NULL)
2791     return((MagickWand *) NULL);
2792   evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2793   if (evaluate_image == (Image *) NULL)
2794     return((MagickWand *) NULL);
2795   return(CloneMagickWandFromImages(wand,evaluate_image));
2796 }
2797
2798 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2799   const MagickEvaluateOperator op,const double value)
2800 {
2801   MagickBooleanType
2802     status;
2803
2804   assert(wand != (MagickWand *) NULL);
2805   assert(wand->signature == WandSignature);
2806   if (wand->debug != MagickFalse)
2807     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2808   if (wand->images == (Image *) NULL)
2809     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2810   status=EvaluateImage(wand->images,op,value,&wand->images->exception);
2811   return(status);
2812 }
2813 \f
2814 /*
2815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2816 %                                                                             %
2817 %                                                                             %
2818 %                                                                             %
2819 %   M a g i c k E x p o r t I m a g e P i x e l s                             %
2820 %                                                                             %
2821 %                                                                             %
2822 %                                                                             %
2823 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2824 %
2825 %  MagickExportImagePixels() extracts pixel data from an image and returns it
2826 %  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2827 %  an error is encountered.  The data is returned as char, short int, int,
2828 %  ssize_t, float, or double in the order specified by map.
2829 %
2830 %  Suppose you want to extract the first scanline of a 640x480 image as
2831 %  character data in red-green-blue order:
2832 %
2833 %      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
2834 %
2835 %  The format of the MagickExportImagePixels method is:
2836 %
2837 %      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2838 %        const ssize_t x,const ssize_t y,const size_t columns,
2839 %        const size_t rows,const char *map,const StorageType storage,
2840 %        void *pixels)
2841 %
2842 %  A description of each parameter follows:
2843 %
2844 %    o wand: the magick wand.
2845 %
2846 %    o x, y, columns, rows:  These values define the perimeter
2847 %      of a region of pixels you want to extract.
2848 %
2849 %    o map:  This string reflects the expected ordering of the pixel array.
2850 %      It can be any combination or order of R = red, G = green, B = blue,
2851 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2852 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2853 %      P = pad.
2854 %
2855 %    o storage: Define the data type of the pixels.  Float and double types are
2856 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2857 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2858 %      LongPixel, QuantumPixel, or ShortPixel.
2859 %
2860 %    o pixels: This array of values contain the pixel components as defined by
2861 %      map and type.  You must preallocate this array where the expected
2862 %      length varies depending on the values of width, height, map, and type.
2863 %
2864 */
2865 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2866   const ssize_t x,const ssize_t y,const size_t columns,
2867   const size_t rows,const char *map,const StorageType storage,
2868   void *pixels)
2869 {
2870   MagickBooleanType
2871     status;
2872
2873   assert(wand != (MagickWand *) NULL);
2874   assert(wand->signature == WandSignature);
2875   if (wand->debug != MagickFalse)
2876     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2877   if (wand->images == (Image *) NULL)
2878     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2879   status=ExportImagePixels(wand->images,x,y,columns,rows,map,
2880     storage,pixels,wand->exception);
2881   return(status);
2882 }
2883 \f
2884 /*
2885 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2886 %                                                                             %
2887 %                                                                             %
2888 %                                                                             %
2889 %   M a g i c k E x t e n t I m a g e                                         %
2890 %                                                                             %
2891 %                                                                             %
2892 %                                                                             %
2893 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2894 %
2895 %  MagickExtentImage() extends the image as defined by the geometry, gravity,
2896 %  and wand background color.  Set the (x,y) offset of the geometry to move
2897 %  the original wand relative to the extended wand.
2898 %
2899 %  The format of the MagickExtentImage method is:
2900 %
2901 %      MagickBooleanType MagickExtentImage(MagickWand *wand,
2902 %        const size_t width,const size_t height,const ssize_t x,
2903 %        const ssize_t y)
2904 %
2905 %  A description of each parameter follows:
2906 %
2907 %    o wand: the magick wand.
2908 %
2909 %    o width: the region width.
2910 %
2911 %    o height: the region height.
2912 %
2913 %    o x: the region x offset.
2914 %
2915 %    o y: the region y offset.
2916 %
2917 */
2918 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
2919   const size_t width,const size_t height,const ssize_t x,
2920   const ssize_t y)
2921 {
2922   Image
2923     *extent_image;
2924
2925   RectangleInfo
2926     extent;
2927
2928   assert(wand != (MagickWand *) NULL);
2929   assert(wand->signature == WandSignature);
2930   if (wand->debug != MagickFalse)
2931     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2932   if (wand->images == (Image *) NULL)
2933     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2934   extent.width=width;
2935   extent.height=height;
2936   extent.x=x;
2937   extent.y=y;
2938   extent_image=ExtentImage(wand->images,&extent,wand->exception);
2939   if (extent_image == (Image *) NULL)
2940     return(MagickFalse);
2941   ReplaceImageInList(&wand->images,extent_image);
2942   return(MagickTrue);
2943 }
2944 \f
2945 /*
2946 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2947 %                                                                             %
2948 %                                                                             %
2949 %                                                                             %
2950 %   M a g i c k F l i p I m a g e                                             %
2951 %                                                                             %
2952 %                                                                             %
2953 %                                                                             %
2954 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2955 %
2956 %  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
2957 %  around the central x-axis.
2958 %
2959 %  The format of the MagickFlipImage method is:
2960 %
2961 %      MagickBooleanType MagickFlipImage(MagickWand *wand)
2962 %
2963 %  A description of each parameter follows:
2964 %
2965 %    o wand: the magick wand.
2966 %
2967 */
2968 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
2969 {
2970   Image
2971     *flip_image;
2972
2973   assert(wand != (MagickWand *) NULL);
2974   assert(wand->signature == WandSignature);
2975   if (wand->debug != MagickFalse)
2976     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2977   if (wand->images == (Image *) NULL)
2978     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2979   flip_image=FlipImage(wand->images,wand->exception);
2980   if (flip_image == (Image *) NULL)
2981     return(MagickFalse);
2982   ReplaceImageInList(&wand->images,flip_image);
2983   return(MagickTrue);
2984 }
2985 \f
2986 /*
2987 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2988 %                                                                             %
2989 %                                                                             %
2990 %                                                                             %
2991 %   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                         %
2992 %                                                                             %
2993 %                                                                             %
2994 %                                                                             %
2995 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2996 %
2997 %  MagickFloodfillPaintImage() changes the color value of any pixel that matches
2998 %  target and is an immediate neighbor.  If the method FillToBorderMethod is
2999 %  specified, the color value is changed for any neighbor pixel that does not
3000 %  match the bordercolor member of image.
3001 %
3002 %  The format of the MagickFloodfillPaintImage method is:
3003 %
3004 %      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3005 %        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3006 %        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3007 %
3008 %  A description of each parameter follows:
3009 %
3010 %    o wand: the magick wand.
3011 %
3012 %    o fill: the floodfill color pixel wand.
3013 %
3014 %    o fuzz: By default target must match a particular pixel color
3015 %      exactly.  However, in many cases two colors may differ by a small amount.
3016 %      The fuzz member of image defines how much tolerance is acceptable to
3017 %      consider two colors as the same.  For example, set fuzz to 10 and the
3018 %      color red at intensities of 100 and 102 respectively are now interpreted
3019 %      as the same color for the purposes of the floodfill.
3020 %
3021 %    o bordercolor: the border color pixel wand.
3022 %
3023 %    o x,y: the starting location of the operation.
3024 %
3025 %    o invert: paint any pixel that does not match the target color.
3026 %
3027 */
3028 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3029   const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3030   const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3031 {
3032   DrawInfo
3033     *draw_info;
3034
3035   MagickBooleanType
3036     status;
3037
3038   PixelInfo
3039     target;
3040
3041   assert(wand != (MagickWand *) NULL);
3042   assert(wand->signature == WandSignature);
3043   if (wand->debug != MagickFalse)
3044     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3045   if (wand->images == (Image *) NULL)
3046     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3047   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3048   PixelGetQuantumPacket(fill,&draw_info->fill);
3049   (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
3050     y % wand->images->rows,&target,wand->exception);
3051   if (bordercolor != (PixelWand *) NULL)
3052     PixelGetMagickColor(bordercolor,&target);
3053   wand->images->fuzz=fuzz;
3054   status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3055     &wand->images->exception);
3056   draw_info=DestroyDrawInfo(draw_info);
3057   return(status);
3058 }
3059 \f
3060 /*
3061 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3062 %                                                                             %
3063 %                                                                             %
3064 %                                                                             %
3065 %   M a g i c k F l o p I m a g e                                             %
3066 %                                                                             %
3067 %                                                                             %
3068 %                                                                             %
3069 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3070 %
3071 %  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3072 %  around the central y-axis.
3073 %
3074 %  The format of the MagickFlopImage method is:
3075 %
3076 %      MagickBooleanType MagickFlopImage(MagickWand *wand)
3077 %
3078 %  A description of each parameter follows:
3079 %
3080 %    o wand: the magick wand.
3081 %
3082 */
3083 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3084 {
3085   Image
3086     *flop_image;
3087
3088   assert(wand != (MagickWand *) NULL);
3089   assert(wand->signature == WandSignature);
3090   if (wand->debug != MagickFalse)
3091     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3092   if (wand->images == (Image *) NULL)
3093     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3094   flop_image=FlopImage(wand->images,wand->exception);
3095   if (flop_image == (Image *) NULL)
3096     return(MagickFalse);
3097   ReplaceImageInList(&wand->images,flop_image);
3098   return(MagickTrue);
3099 }
3100 \f
3101 /*
3102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3103 %                                                                             %
3104 %                                                                             %
3105 %                                                                             %
3106 %   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                     %
3107 %                                                                             %
3108 %                                                                             %
3109 %                                                                             %
3110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3111 %
3112 %  MagickForwardFourierTransformImage() implements the discrete Fourier
3113 %  transform (DFT) of the image either as a magnitude / phase or real /
3114 %  imaginary image pair.
3115 %
3116 %  The format of the MagickForwardFourierTransformImage method is:
3117 %
3118 %      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3119 %        const MagickBooleanType magnitude)
3120 %
3121 %  A description of each parameter follows:
3122 %
3123 %    o wand: the magick wand.
3124 %
3125 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3126 %      imaginary image pair.
3127 %
3128 */
3129 WandExport MagickBooleanType MagickForwardFourierTransformImage(
3130   MagickWand *wand,const MagickBooleanType magnitude)
3131 {
3132   Image
3133     *forward_image;
3134
3135   assert(wand != (MagickWand *) NULL);
3136   assert(wand->signature == WandSignature);
3137   if (wand->debug != MagickFalse)
3138     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3139   if (wand->images == (Image *) NULL)
3140     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3141   forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3142     wand->exception);
3143   if (forward_image == (Image *) NULL)
3144     return(MagickFalse);
3145   ReplaceImageInList(&wand->images,forward_image);
3146   return(MagickTrue);
3147 }
3148 \f
3149 /*
3150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3151 %                                                                             %
3152 %                                                                             %
3153 %                                                                             %
3154 %   M a g i c k F r a m e I m a g e                                           %
3155 %                                                                             %
3156 %                                                                             %
3157 %                                                                             %
3158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3159 %
3160 %  MagickFrameImage() adds a simulated three-dimensional border around the
3161 %  image.  The width and height specify the border width of the vertical and
3162 %  horizontal sides of the frame.  The inner and outer bevels indicate the
3163 %  width of the inner and outer shadows of the frame.
3164 %
3165 %  The format of the MagickFrameImage method is:
3166 %
3167 %      MagickBooleanType MagickFrameImage(MagickWand *wand,
3168 %        const PixelWand *matte_color,const size_t width,
3169 %        const size_t height,const ssize_t inner_bevel,
3170 %        const ssize_t outer_bevel,const CompositeOperator compose)
3171 %
3172 %  A description of each parameter follows:
3173 %
3174 %    o wand: the magick wand.
3175 %
3176 %    o matte_color: the frame color pixel wand.
3177 %
3178 %    o width: the border width.
3179 %
3180 %    o height: the border height.
3181 %
3182 %    o inner_bevel: the inner bevel width.
3183 %
3184 %    o outer_bevel: the outer bevel width.
3185 %
3186 %    o compose: the composite operator.
3187 %
3188 */
3189 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3190   const PixelWand *matte_color,const size_t width,const size_t height,
3191   const ssize_t inner_bevel,const ssize_t outer_bevel,
3192   const CompositeOperator compose)
3193 {
3194   Image
3195     *frame_image;
3196
3197   FrameInfo
3198     frame_info;
3199
3200   assert(wand != (MagickWand *) NULL);
3201   assert(wand->signature == WandSignature);
3202   if (wand->debug != MagickFalse)
3203     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3204   if (wand->images == (Image *) NULL)
3205     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3206   (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3207   frame_info.width=wand->images->columns+2*width;
3208   frame_info.height=wand->images->rows+2*height;
3209   frame_info.x=(ssize_t) width;
3210   frame_info.y=(ssize_t) height;
3211   frame_info.inner_bevel=inner_bevel;
3212   frame_info.outer_bevel=outer_bevel;
3213   PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3214   frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3215   if (frame_image == (Image *) NULL)
3216     return(MagickFalse);
3217   ReplaceImageInList(&wand->images,frame_image);
3218   return(MagickTrue);
3219 }
3220 \f
3221 /*
3222 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3223 %                                                                             %
3224 %                                                                             %
3225 %                                                                             %
3226 %   M a g i c k F u n c t i o n I m a g e                                     %
3227 %                                                                             %
3228 %                                                                             %
3229 %                                                                             %
3230 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3231 %
3232 %  MagickFunctionImage() applys an arithmetic, relational, or logical
3233 %  expression to an image.  Use these operators to lighten or darken an image,
3234 %  to increase or decrease contrast in an image, or to produce the "negative"
3235 %  of an image.
3236 %
3237 %  The format of the MagickFunctionImage method is:
3238 %
3239 %      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3240 %        const MagickFunction function,const size_t number_arguments,
3241 %        const double *arguments)
3242 %
3243 %  A description of each parameter follows:
3244 %
3245 %    o wand: the magick wand.
3246 %
3247 %    o function: the image function.
3248 %
3249 %    o number_arguments: the number of function arguments.
3250 %
3251 %    o arguments: the function arguments.
3252 %
3253 */
3254 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3255   const MagickFunction function,const size_t number_arguments,
3256   const double *arguments)
3257 {
3258   MagickBooleanType
3259     status;
3260
3261   assert(wand != (MagickWand *) NULL);
3262   assert(wand->signature == WandSignature);
3263   if (wand->debug != MagickFalse)
3264     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3265   if (wand->images == (Image *) NULL)
3266     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3267   status=FunctionImage(wand->images,function,number_arguments,arguments,
3268     &wand->images->exception);
3269   return(status);
3270 }
3271 \f
3272 /*
3273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3274 %                                                                             %
3275 %                                                                             %
3276 %                                                                             %
3277 %   M a g i c k F x I m a g e                                                 %
3278 %                                                                             %
3279 %                                                                             %
3280 %                                                                             %
3281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3282 %
3283 %  MagickFxImage() evaluate expression for each pixel in the image.
3284 %
3285 %  The format of the MagickFxImage method is:
3286 %
3287 %      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3288 %
3289 %  A description of each parameter follows:
3290 %
3291 %    o wand: the magick wand.
3292 %
3293 %    o expression: the expression.
3294 %
3295 */
3296 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3297 {
3298   Image
3299     *fx_image;
3300
3301   assert(wand != (MagickWand *) NULL);
3302   assert(wand->signature == WandSignature);
3303   if (wand->debug != MagickFalse)
3304     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3305   if (wand->images == (Image *) NULL)
3306     return((MagickWand *) NULL);
3307   fx_image=FxImage(wand->images,expression,wand->exception);
3308   if (fx_image == (Image *) NULL)
3309     return((MagickWand *) NULL);
3310   return(CloneMagickWandFromImages(wand,fx_image));
3311 }
3312 \f
3313 /*
3314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3315 %                                                                             %
3316 %                                                                             %
3317 %                                                                             %
3318 %   M a g i c k G a m m a I m a g e                                           %
3319 %                                                                             %
3320 %                                                                             %
3321 %                                                                             %
3322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3323 %
3324 %  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3325 %  different devices will have perceptual differences in the way the image's
3326 %  intensities are represented on the screen.  Specify individual gamma levels
3327 %  for the red, green, and blue channels, or adjust all three with the gamma
3328 %  parameter.  Values typically range from 0.8 to 2.3.
3329 %
3330 %  You can also reduce the influence of a particular channel with a gamma
3331 %  value of 0.
3332 %
3333 %  The format of the MagickGammaImage method is:
3334 %
3335 %      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3336 %
3337 %  A description of each parameter follows:
3338 %
3339 %    o wand: the magick wand.
3340 %
3341 %    o level: Define the level of gamma correction.
3342 %
3343 */
3344 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3345   const double gamma)
3346 {
3347   MagickBooleanType
3348     status;
3349
3350   assert(wand != (MagickWand *) NULL);
3351   assert(wand->signature == WandSignature);
3352   if (wand->debug != MagickFalse)
3353     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3354   if (wand->images == (Image *) NULL)
3355     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3356   status=GammaImage(wand->images,gamma,wand->exception);
3357   return(status);
3358 }
3359 \f
3360 /*
3361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3362 %                                                                             %
3363 %                                                                             %
3364 %                                                                             %
3365 %   M a g i c k G a u s s i a n B l u r I m a g e                             %
3366 %                                                                             %
3367 %                                                                             %
3368 %                                                                             %
3369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3370 %
3371 %  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3372 %  Gaussian operator of the given radius and standard deviation (sigma).
3373 %  For reasonable results, the radius should be larger than sigma.  Use a
3374 %  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3375 %
3376 %  The format of the MagickGaussianBlurImage method is:
3377 %
3378 %      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3379 %        const double radius,const double sigma,const double bias)
3380 %
3381 %  A description of each parameter follows:
3382 %
3383 %    o wand: the magick wand.
3384 %
3385 %    o radius: the radius of the Gaussian, in pixels, not counting the center
3386 %      pixel.
3387 %
3388 %    o sigma: the standard deviation of the Gaussian, in pixels.
3389 %
3390 %    o bias: the bias.
3391 %
3392 */
3393 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3394   const double radius,const double sigma,const double bias)
3395 {
3396   Image
3397     *blur_image;
3398
3399   assert(wand != (MagickWand *) NULL);
3400   assert(wand->signature == WandSignature);
3401   if (wand->debug != MagickFalse)
3402     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3403   if (wand->images == (Image *) NULL)
3404     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3405   blur_image=GaussianBlurImage(wand->images,radius,sigma,bias,wand->exception);
3406   if (blur_image == (Image *) NULL)
3407     return(MagickFalse);
3408   ReplaceImageInList(&wand->images,blur_image);
3409   return(MagickTrue);
3410 }
3411 \f
3412 /*
3413 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3414 %                                                                             %
3415 %                                                                             %
3416 %                                                                             %
3417 %   M a g i c k G e t I m a g e                                               %
3418 %                                                                             %
3419 %                                                                             %
3420 %                                                                             %
3421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3422 %
3423 %  MagickGetImage() gets the image at the current image index.
3424 %
3425 %  The format of the MagickGetImage method is:
3426 %
3427 %      MagickWand *MagickGetImage(MagickWand *wand)
3428 %
3429 %  A description of each parameter follows:
3430 %
3431 %    o wand: the magick wand.
3432 %
3433 */
3434 WandExport MagickWand *MagickGetImage(MagickWand *wand)
3435 {
3436   Image
3437     *image;
3438
3439   assert(wand != (MagickWand *) NULL);
3440   assert(wand->signature == WandSignature);
3441   if (wand->debug != MagickFalse)
3442     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3443   if (wand->images == (Image *) NULL)
3444     {
3445       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3446         "ContainsNoImages","`%s'",wand->name);
3447       return((MagickWand *) NULL);
3448     }
3449   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3450   if (image == (Image *) NULL)
3451     return((MagickWand *) NULL);
3452   return(CloneMagickWandFromImages(wand,image));
3453 }
3454 \f
3455 /*
3456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3457 %                                                                             %
3458 %                                                                             %
3459 %                                                                             %
3460 %   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                       %
3461 %                                                                             %
3462 %                                                                             %
3463 %                                                                             %
3464 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3465 %
3466 %  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3467 %  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3468 %  than CMYKA.
3469 %
3470 %  The format of the MagickGetImageAlphaChannel method is:
3471 %
3472 %      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3473 %
3474 %  A description of each parameter follows:
3475 %
3476 %    o wand: the magick wand.
3477 %
3478 */
3479 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3480 {
3481   assert(wand != (MagickWand *) NULL);
3482   assert(wand->signature == WandSignature);
3483   if (wand->debug != MagickFalse)
3484     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3485   if (wand->images == (Image *) NULL)
3486     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3487   return(GetImageAlphaChannel(wand->images));
3488 }
3489 \f
3490 /*
3491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3492 %                                                                             %
3493 %                                                                             %
3494 %                                                                             %
3495 %   M a g i c k G e t I m a g e C l i p M a s k                               %
3496 %                                                                             %
3497 %                                                                             %
3498 %                                                                             %
3499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3500 %
3501 %  MagickGetImageClipMask() gets the image clip mask at the current image index.
3502 %
3503 %  The format of the MagickGetImageClipMask method is:
3504 %
3505 %      MagickWand *MagickGetImageClipMask(MagickWand *wand)
3506 %
3507 %  A description of each parameter follows:
3508 %
3509 %    o wand: the magick wand.
3510 %
3511 */
3512 WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
3513 {
3514   Image
3515     *image;
3516
3517   assert(wand != (MagickWand *) NULL);
3518   assert(wand->signature == WandSignature);
3519   if (wand->debug != MagickFalse)
3520     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3521   if (wand->images == (Image *) NULL)
3522     {
3523       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3524         "ContainsNoImages","`%s'",wand->name);
3525       return((MagickWand *) NULL);
3526     }
3527   image=GetImageClipMask(wand->images,wand->exception);
3528   if (image == (Image *) NULL)
3529     return((MagickWand *) NULL);
3530   return(CloneMagickWandFromImages(wand,image));
3531 }
3532 \f
3533 /*
3534 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3535 %                                                                             %
3536 %                                                                             %
3537 %                                                                             %
3538 %   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                 %
3539 %                                                                             %
3540 %                                                                             %
3541 %                                                                             %
3542 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3543 %
3544 %  MagickGetImageBackgroundColor() returns the image background color.
3545 %
3546 %  The format of the MagickGetImageBackgroundColor method is:
3547 %
3548 %      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3549 %        PixelWand *background_color)
3550 %
3551 %  A description of each parameter follows:
3552 %
3553 %    o wand: the magick wand.
3554 %
3555 %    o background_color: Return the background color.
3556 %
3557 */
3558 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3559   PixelWand *background_color)
3560 {
3561   assert(wand != (MagickWand *) NULL);
3562   assert(wand->signature == WandSignature);
3563   if (wand->debug != MagickFalse)
3564     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3565   if (wand->images == (Image *) NULL)
3566     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3567   PixelSetQuantumPacket(background_color,&wand->images->background_color);
3568   return(MagickTrue);
3569 }
3570 \f
3571 /*
3572 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3573 %                                                                             %
3574 %                                                                             %
3575 %                                                                             %
3576 %   M a g i c k G e t I m a g e B l o b                                       %
3577 %                                                                             %
3578 %                                                                             %
3579 %                                                                             %
3580 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3581 %
3582 %  MagickGetImageBlob() implements direct to memory image formats.  It returns
3583 %  the image as a blob (a formatted "file" in memory) and its length, starting
3584 %  from the current position in the image sequence.  Use MagickSetImageFormat()
3585 %  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3586 %
3587 %  Utilize MagickResetIterator() to ensure the write is from the beginning of
3588 %  the image sequence.
3589 %
3590 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
3591 %
3592 %  The format of the MagickGetImageBlob method is:
3593 %
3594 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3595 %
3596 %  A description of each parameter follows:
3597 %
3598 %    o wand: the magick wand.
3599 %
3600 %    o length: the length of the blob.
3601 %
3602 */
3603 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3604 {
3605   assert(wand != (MagickWand *) NULL);
3606   assert(wand->signature == WandSignature);
3607   if (wand->debug != MagickFalse)
3608     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3609   if (wand->images == (Image *) NULL)
3610     {
3611       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3612         "ContainsNoImages","`%s'",wand->name);
3613       return((unsigned char *) NULL);
3614     }
3615   return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3616 }
3617 \f
3618 /*
3619 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3620 %                                                                             %
3621 %                                                                             %
3622 %                                                                             %
3623 %   M a g i c k G e t I m a g e s B l o b                                     %
3624 %                                                                             %
3625 %                                                                             %
3626 %                                                                             %
3627 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3628 %
3629 %  MagickGetImageBlob() implements direct to memory image formats.  It
3630 %  returns the image sequence as a blob and its length.  The format of the image
3631 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3632 %  return a different image format, use MagickSetImageFormat().
3633 %
3634 %  Note, some image formats do not permit multiple images to the same image
3635 %  stream (e.g. JPEG).  in this instance, just the first image of the
3636 %  sequence is returned as a blob.
3637 %
3638 %  The format of the MagickGetImagesBlob method is:
3639 %
3640 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3641 %
3642 %  A description of each parameter follows:
3643 %
3644 %    o wand: the magick wand.
3645 %
3646 %    o length: the length of the blob.
3647 %
3648 */
3649 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3650 {
3651   unsigned char
3652     *blob;
3653
3654   assert(wand != (MagickWand *) NULL);
3655   assert(wand->signature == WandSignature);
3656   if (wand->debug != MagickFalse)
3657     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3658   if (wand->images == (Image *) NULL)
3659     {
3660       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3661         "ContainsNoImages","`%s'",wand->name);
3662       return((unsigned char *) NULL);
3663     }
3664   blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3665     wand->exception);
3666   return(blob);
3667 }
3668 \f
3669 /*
3670 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3671 %                                                                             %
3672 %                                                                             %
3673 %                                                                             %
3674 %   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                         %
3675 %                                                                             %
3676 %                                                                             %
3677 %                                                                             %
3678 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3679 %
3680 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3681 %  image.
3682 %
3683 %  The format of the MagickGetImageBluePrimary method is:
3684 %
3685 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3686 %        double *y)
3687 %
3688 %  A description of each parameter follows:
3689 %
3690 %    o wand: the magick wand.
3691 %
3692 %    o x: the chromaticity blue primary x-point.
3693 %
3694 %    o y: the chromaticity blue primary y-point.
3695 %
3696 */
3697 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3698   double *x,double *y)
3699 {
3700   assert(wand != (MagickWand *) NULL);
3701   assert(wand->signature == WandSignature);
3702   if (wand->debug != MagickFalse)
3703     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3704   if (wand->images == (Image *) NULL)
3705     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3706   *x=wand->images->chromaticity.blue_primary.x;
3707   *y=wand->images->chromaticity.blue_primary.y;
3708   return(MagickTrue);
3709 }
3710 \f
3711 /*
3712 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3713 %                                                                             %
3714 %                                                                             %
3715 %                                                                             %
3716 %   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                         %
3717 %                                                                             %
3718 %                                                                             %
3719 %                                                                             %
3720 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3721 %
3722 %  MagickGetImageBorderColor() returns the image border color.
3723 %
3724 %  The format of the MagickGetImageBorderColor method is:
3725 %
3726 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3727 %        PixelWand *border_color)
3728 %
3729 %  A description of each parameter follows:
3730 %
3731 %    o wand: the magick wand.
3732 %
3733 %    o border_color: Return the border color.
3734 %
3735 */
3736 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3737   PixelWand *border_color)
3738 {
3739   assert(wand != (MagickWand *) NULL);
3740   assert(wand->signature == WandSignature);
3741   if (wand->debug != MagickFalse)
3742     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3743   if (wand->images == (Image *) NULL)
3744     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3745   PixelSetQuantumPacket(border_color,&wand->images->border_color);
3746   return(MagickTrue);
3747 }
3748 \f
3749 /*
3750 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3751 %                                                                             %
3752 %                                                                             %
3753 %                                                                             %
3754 %   M a g i c k G e t I m a g e F e a t u r e s                               %
3755 %                                                                             %
3756 %                                                                             %
3757 %                                                                             %
3758 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3759 %
3760 %  MagickGetImageFeatures() returns features for each channel in the
3761 %  image in each of four directions (horizontal, vertical, left and right
3762 %  diagonals) for the specified distance.  The features include the angular
3763 %  second moment, contrast, correlation, sum of squares: variance, inverse
3764 %  difference moment, sum average, sum varience, sum entropy, entropy,
3765 %  difference variance, difference entropy, information measures of
3766 %  correlation 1, information measures of correlation 2, and maximum
3767 %  correlation coefficient.  You can access the red channel contrast, for
3768 %  example, like this:
3769 %
3770 %      channel_features=MagickGetImageFeatures(wand,1);
3771 %      contrast=channel_features[RedChannel].contrast[0];
3772 %
3773 %  Use MagickRelinquishMemory() to free the statistics buffer.
3774 %
3775 %  The format of the MagickGetImageFeatures method is:
3776 %
3777 %      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3778 %        const size_t distance)
3779 %
3780 %  A description of each parameter follows:
3781 %
3782 %    o wand: the magick wand.
3783 %
3784 %    o distance: the distance.
3785 %
3786 */
3787 WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3788   const size_t distance)
3789 {
3790   assert(wand != (MagickWand *) NULL);
3791   assert(wand->signature == WandSignature);
3792   if (wand->debug != MagickFalse)
3793     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3794   if (wand->images == (Image *) NULL)
3795     {
3796       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3797         "ContainsNoImages","`%s'",wand->name);
3798       return((ChannelFeatures *) NULL);
3799     }
3800   return(GetImageFeatures(wand->images,distance,wand->exception));
3801 }
3802 \f
3803 /*
3804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3805 %                                                                             %
3806 %                                                                             %
3807 %                                                                             %
3808 %   M a g i c k G e t I m a g e K u r t o s i s                               %
3809 %                                                                             %
3810 %                                                                             %
3811 %                                                                             %
3812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3813 %
3814 %  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
3815 %  more image channels.
3816 %
3817 %  The format of the MagickGetImageKurtosis method is:
3818 %
3819 %      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3820 %        double *kurtosis,double *skewness)
3821 %
3822 %  A description of each parameter follows:
3823 %
3824 %    o wand: the magick wand.
3825 %
3826 %    o kurtosis:  The kurtosis for the specified channel(s).
3827 %
3828 %    o skewness:  The skewness for the specified channel(s).
3829 %
3830 */
3831 WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3832   double *kurtosis,double *skewness)
3833 {
3834   MagickBooleanType
3835     status;
3836
3837   assert(wand != (MagickWand *) NULL);
3838   assert(wand->signature == WandSignature);
3839   if (wand->debug != MagickFalse)
3840     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3841   if (wand->images == (Image *) NULL)
3842     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3843   status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
3844   return(status);
3845 }
3846 \f
3847 /*
3848 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3849 %                                                                             %
3850 %                                                                             %
3851 %                                                                             %
3852 %   M a g i c k G e t I m a g e M e a n                                       %
3853 %                                                                             %
3854 %                                                                             %
3855 %                                                                             %
3856 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3857 %
3858 %  MagickGetImageMean() gets the mean and standard deviation of one or more
3859 %  image channels.
3860 %
3861 %  The format of the MagickGetImageMean method is:
3862 %
3863 %      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3864 %        double *standard_deviation)
3865 %
3866 %  A description of each parameter follows:
3867 %
3868 %    o wand: the magick wand.
3869 %
3870 %    o channel: the image channel(s).
3871 %
3872 %    o mean:  The mean pixel value for the specified channel(s).
3873 %
3874 %    o standard_deviation:  The standard deviation for the specified channel(s).
3875 %
3876 */
3877 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3878   double *standard_deviation)
3879 {
3880   MagickBooleanType
3881     status;
3882
3883   assert(wand != (MagickWand *) NULL);
3884   assert(wand->signature == WandSignature);
3885   if (wand->debug != MagickFalse)
3886     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3887   if (wand->images == (Image *) NULL)
3888     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3889   status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
3890   return(status);
3891 }
3892 \f
3893 /*
3894 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3895 %                                                                             %
3896 %                                                                             %
3897 %                                                                             %
3898 %   M a g i c k G e t I m a g e R a n g e                                     %
3899 %                                                                             %
3900 %                                                                             %
3901 %                                                                             %
3902 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3903 %
3904 %  MagickGetImageRange() gets the range for one or more image channels.
3905 %
3906 %  The format of the MagickGetImageRange method is:
3907 %
3908 %      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
3909 %        double *maxima)
3910 %
3911 %  A description of each parameter follows:
3912 %
3913 %    o wand: the magick wand.
3914 %
3915 %    o minima:  The minimum pixel value for the specified channel(s).
3916 %
3917 %    o maxima:  The maximum pixel value for the specified channel(s).
3918 %
3919 */
3920 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
3921   double *minima,double *maxima)
3922 {
3923   MagickBooleanType
3924     status;
3925
3926   assert(wand != (MagickWand *) NULL);
3927   assert(wand->signature == WandSignature);
3928   if (wand->debug != MagickFalse)
3929     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3930   if (wand->images == (Image *) NULL)
3931     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3932   status=GetImageRange(wand->images,minima,maxima,wand->exception);
3933   return(status);
3934 }
3935 \f
3936 /*
3937 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3938 %                                                                             %
3939 %                                                                             %
3940 %                                                                             %
3941 %   M a g i c k G e t I m a g e S t a t i s t i c s                           %
3942 %                                                                             %
3943 %                                                                             %
3944 %                                                                             %
3945 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3946 %
3947 %  MagickGetImageStatistics() returns statistics for each channel in the
3948 %  image.  The statistics include the channel depth, its minima and
3949 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
3950 %  You can access the red channel mean, for example, like this:
3951 %
3952 %      channel_statistics=MagickGetImageStatistics(wand);
3953 %      red_mean=channel_statistics[RedChannel].mean;
3954 %
3955 %  Use MagickRelinquishMemory() to free the statistics buffer.
3956 %
3957 %  The format of the MagickGetImageStatistics method is:
3958 %
3959 %      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3960 %
3961 %  A description of each parameter follows:
3962 %
3963 %    o wand: the magick wand.
3964 %
3965 */
3966 WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3967 {
3968   assert(wand != (MagickWand *) NULL);
3969   assert(wand->signature == WandSignature);
3970   if (wand->debug != MagickFalse)
3971     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3972   if (wand->images == (Image *) NULL)
3973     {
3974       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3975         "ContainsNoImages","`%s'",wand->name);
3976       return((ChannelStatistics *) NULL);
3977     }
3978   return(GetImageStatistics(wand->images,wand->exception));
3979 }
3980 \f
3981 /*
3982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3983 %                                                                             %
3984 %                                                                             %
3985 %                                                                             %
3986 %   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                     %
3987 %                                                                             %
3988 %                                                                             %
3989 %                                                                             %
3990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3991 %
3992 %  MagickGetImageColormapColor() returns the color of the specified colormap
3993 %  index.
3994 %
3995 %  The format of the MagickGetImageColormapColor method is:
3996 %
3997 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
3998 %        const size_t index,PixelWand *color)
3999 %
4000 %  A description of each parameter follows:
4001 %
4002 %    o wand: the magick wand.
4003 %
4004 %    o index: the offset into the image colormap.
4005 %
4006 %    o color: Return the colormap color in this wand.
4007 %
4008 */
4009 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4010   const size_t index,PixelWand *color)
4011 {
4012   assert(wand != (MagickWand *) NULL);
4013   assert(wand->signature == WandSignature);
4014   if (wand->debug != MagickFalse)
4015     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4016   if (wand->images == (Image *) NULL)
4017     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4018   if ((wand->images->colormap == (PixelInfo *) NULL) ||
4019       (index >= wand->images->colors))
4020     {
4021       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4022         "InvalidColormapIndex","`%s'",wand->name);
4023       return(MagickFalse);
4024     }
4025   PixelSetQuantumPacket(color,wand->images->colormap+index);
4026   return(MagickTrue);
4027 }
4028 \f
4029 /*
4030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4031 %                                                                             %
4032 %                                                                             %
4033 %                                                                             %
4034 %   M a g i c k G e t I m a g e C o l o r s                                   %
4035 %                                                                             %
4036 %                                                                             %
4037 %                                                                             %
4038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4039 %
4040 %  MagickGetImageColors() gets the number of unique colors in the image.
4041 %
4042 %  The format of the MagickGetImageColors method is:
4043 %
4044 %      size_t MagickGetImageColors(MagickWand *wand)
4045 %
4046 %  A description of each parameter follows:
4047 %
4048 %    o wand: the magick wand.
4049 %
4050 */
4051 WandExport size_t MagickGetImageColors(MagickWand *wand)
4052 {
4053   assert(wand != (MagickWand *) NULL);
4054   assert(wand->signature == WandSignature);
4055   if (wand->debug != MagickFalse)
4056     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4057   if (wand->images == (Image *) NULL)
4058     {
4059       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4060         "ContainsNoImages","`%s'",wand->name);
4061       return(0);
4062     }
4063   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4064 }
4065 \f
4066 /*
4067 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4068 %                                                                             %
4069 %                                                                             %
4070 %                                                                             %
4071 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4072 %                                                                             %
4073 %                                                                             %
4074 %                                                                             %
4075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4076 %
4077 %  MagickGetImageColorspace() gets the image colorspace.
4078 %
4079 %  The format of the MagickGetImageColorspace method is:
4080 %
4081 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4082 %
4083 %  A description of each parameter follows:
4084 %
4085 %    o wand: the magick wand.
4086 %
4087 */
4088 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4089 {
4090   assert(wand != (MagickWand *) NULL);
4091   assert(wand->signature == WandSignature);
4092   if (wand->debug != MagickFalse)
4093     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4094   if (wand->images == (Image *) NULL)
4095     {
4096       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4097         "ContainsNoImages","`%s'",wand->name);
4098       return(UndefinedColorspace);
4099     }
4100   return(wand->images->colorspace);
4101 }
4102 \f
4103 /*
4104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4105 %                                                                             %
4106 %                                                                             %
4107 %                                                                             %
4108 %   M a g i c k G e t I m a g e C o m p o s e                                 %
4109 %                                                                             %
4110 %                                                                             %
4111 %                                                                             %
4112 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4113 %
4114 %  MagickGetImageCompose() returns the composite operator associated with the
4115 %  image.
4116 %
4117 %  The format of the MagickGetImageCompose method is:
4118 %
4119 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4120 %
4121 %  A description of each parameter follows:
4122 %
4123 %    o wand: the magick wand.
4124 %
4125 */
4126 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4127 {
4128   assert(wand != (MagickWand *) NULL);
4129   assert(wand->signature == WandSignature);
4130   if (wand->debug != MagickFalse)
4131     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4132   if (wand->images == (Image *) NULL)
4133     {
4134       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4135         "ContainsNoImages","`%s'",wand->name);
4136       return(UndefinedCompositeOp);
4137     }
4138   return(wand->images->compose);
4139 }
4140 \f
4141 /*
4142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4143 %                                                                             %
4144 %                                                                             %
4145 %                                                                             %
4146 %   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                         %
4147 %                                                                             %
4148 %                                                                             %
4149 %                                                                             %
4150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4151 %
4152 %  MagickGetImageCompression() gets the image compression.
4153 %
4154 %  The format of the MagickGetImageCompression method is:
4155 %
4156 %      CompressionType MagickGetImageCompression(MagickWand *wand)
4157 %
4158 %  A description of each parameter follows:
4159 %
4160 %    o wand: the magick wand.
4161 %
4162 */
4163 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4164 {
4165   assert(wand != (MagickWand *) NULL);
4166   assert(wand->signature == WandSignature);
4167   if (wand->debug != MagickFalse)
4168     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4169   if (wand->images == (Image *) NULL)
4170     {
4171       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4172         "ContainsNoImages","`%s'",wand->name);
4173       return(UndefinedCompression);
4174     }
4175   return(wand->images->compression);
4176 }
4177 \f
4178 /*
4179 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4180 %                                                                             %
4181 %                                                                             %
4182 %                                                                             %
4183 %   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           %
4184 %                                                                             %
4185 %                                                                             %
4186 %                                                                             %
4187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4188 %
4189 %  MagickGetImageCompression() gets the image compression quality.
4190 %
4191 %  The format of the MagickGetImageCompression method is:
4192 %
4193 %      size_t MagickGetImageCompression(MagickWand *wand)
4194 %
4195 %  A description of each parameter follows:
4196 %
4197 %    o wand: the magick wand.
4198 %
4199 */
4200 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4201 {
4202   assert(wand != (MagickWand *) NULL);
4203   assert(wand->signature == WandSignature);
4204   if (wand->debug != MagickFalse)
4205     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4206   if (wand->images == (Image *) NULL)
4207     {
4208       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4209         "ContainsNoImages","`%s'",wand->name);
4210       return(0UL);
4211     }
4212   return(wand->images->quality);
4213 }
4214 \f
4215 /*
4216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4217 %                                                                             %
4218 %                                                                             %
4219 %                                                                             %
4220 %   M a g i c k G e t I m a g e D e l a y                                     %
4221 %                                                                             %
4222 %                                                                             %
4223 %                                                                             %
4224 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4225 %
4226 %  MagickGetImageDelay() gets the image delay.
4227 %
4228 %  The format of the MagickGetImageDelay method is:
4229 %
4230 %      size_t MagickGetImageDelay(MagickWand *wand)
4231 %
4232 %  A description of each parameter follows:
4233 %
4234 %    o wand: the magick wand.
4235 %
4236 */
4237 WandExport size_t MagickGetImageDelay(MagickWand *wand)
4238 {
4239   assert(wand != (MagickWand *) NULL);
4240   assert(wand->signature == WandSignature);
4241   if (wand->debug != MagickFalse)
4242     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4243   if (wand->images == (Image *) NULL)
4244     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4245   return(wand->images->delay);
4246 }
4247 \f
4248 /*
4249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4250 %                                                                             %
4251 %                                                                             %
4252 %                                                                             %
4253 %   M a g i c k G e t I m a g e D e p t h                                     %
4254 %                                                                             %
4255 %                                                                             %
4256 %                                                                             %
4257 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4258 %
4259 %  MagickGetImageDepth() gets the image depth.
4260 %
4261 %  The format of the MagickGetImageDepth method is:
4262 %
4263 %      size_t MagickGetImageDepth(MagickWand *wand)
4264 %
4265 %  A description of each parameter follows:
4266 %
4267 %    o wand: the magick wand.
4268 %
4269 */
4270 WandExport size_t MagickGetImageDepth(MagickWand *wand)
4271 {
4272   assert(wand != (MagickWand *) NULL);
4273   assert(wand->signature == WandSignature);
4274   if (wand->debug != MagickFalse)
4275     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4276   if (wand->images == (Image *) NULL)
4277     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4278   return(GetImageDepth(wand->images,wand->exception));
4279 }
4280 \f
4281 /*
4282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4283 %                                                                             %
4284 %                                                                             %
4285 %                                                                             %
4286 %   M a g i c k G e t I m a g e D i s p o s e                                 %
4287 %                                                                             %
4288 %                                                                             %
4289 %                                                                             %
4290 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4291 %
4292 %  MagickGetImageDispose() gets the image disposal method.
4293 %
4294 %  The format of the MagickGetImageDispose method is:
4295 %
4296 %      DisposeType MagickGetImageDispose(MagickWand *wand)
4297 %
4298 %  A description of each parameter follows:
4299 %
4300 %    o wand: the magick wand.
4301 %
4302 */
4303 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4304 {
4305   assert(wand != (MagickWand *) NULL);
4306   assert(wand->signature == WandSignature);
4307   if (wand->debug != MagickFalse)
4308     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4309   if (wand->images == (Image *) NULL)
4310     {
4311       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4312         "ContainsNoImages","`%s'",wand->name);
4313       return(UndefinedDispose);
4314     }
4315   return((DisposeType) wand->images->dispose);
4316 }
4317 \f
4318 /*
4319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4320 %                                                                             %
4321 %                                                                             %
4322 %                                                                             %
4323 %   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4324 %                                                                             %
4325 %                                                                             %
4326 %                                                                             %
4327 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4328 %
4329 %  MagickGetImageDistortion() compares an image to a reconstructed image and
4330 %  returns the specified distortion metric.
4331 %
4332 %  The format of the MagickGetImageDistortion method is:
4333 %
4334 %      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4335 %        const MagickWand *reference,const MetricType metric,
4336 %        double *distortion)
4337 %
4338 %  A description of each parameter follows:
4339 %
4340 %    o wand: the magick wand.
4341 %
4342 %    o reference: the reference wand.
4343 %
4344 %    o metric: the metric.
4345 %
4346 %    o distortion: the computed distortion between the images.
4347 %
4348 */
4349 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4350   const MagickWand *reference,const MetricType metric,double *distortion)
4351 {
4352   MagickBooleanType
4353     status;
4354
4355   assert(wand != (MagickWand *) NULL);
4356   assert(wand->signature == WandSignature);
4357   if (wand->debug != MagickFalse)
4358     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4359   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4360     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4361   status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4362     &wand->images->exception);
4363   return(status);
4364 }
4365 \f
4366 /*
4367 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4368 %                                                                             %
4369 %                                                                             %
4370 %                                                                             %
4371 %   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                         %
4372 %                                                                             %
4373 %                                                                             %
4374 %                                                                             %
4375 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4376 %
4377 %  MagickGetImageDistortions() compares one or more pixel channels of an
4378 %  image to a reconstructed image and returns the specified distortion metrics.
4379 %
4380 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4381 %
4382 %  The format of the MagickGetImageDistortion method is:
4383 %
4384 %      double *MagickGetImageDistortion(MagickWand *wand,
4385 %        const MagickWand *reference,const MetricType metric)
4386 %
4387 %  A description of each parameter follows:
4388 %
4389 %    o wand: the magick wand.
4390 %
4391 %    o reference: the reference wand.
4392 %
4393 %    o metric: the metric.
4394 %
4395 */
4396 WandExport double *MagickGetImageDistortions(MagickWand *wand,
4397   const MagickWand *reference,const MetricType metric)
4398 {
4399   double
4400     *channel_distortion;
4401
4402   assert(wand != (MagickWand *) NULL);
4403   assert(wand->signature == WandSignature);
4404   if (wand->debug != MagickFalse)
4405     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4406   assert(reference != (MagickWand *) NULL);
4407   assert(reference->signature == WandSignature);
4408   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4409     {
4410       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4411         "ContainsNoImages","`%s'",wand->name);
4412       return((double *) NULL);
4413     }
4414   channel_distortion=GetImageDistortions(wand->images,reference->images,
4415     metric,&wand->images->exception);
4416   return(channel_distortion);
4417 }
4418 \f
4419 /*
4420 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4421 %                                                                             %
4422 %                                                                             %
4423 %                                                                             %
4424 %   M a g i c k G e t I m a g e F i l e n a m e                               %
4425 %                                                                             %
4426 %                                                                             %
4427 %                                                                             %
4428 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4429 %
4430 %  MagickGetImageFilename() returns the filename of a particular image in a
4431 %  sequence.
4432 %
4433 %  The format of the MagickGetImageFilename method is:
4434 %
4435 %      char *MagickGetImageFilename(MagickWand *wand)
4436 %
4437 %  A description of each parameter follows:
4438 %
4439 %    o wand: the magick wand.
4440 %
4441 */
4442 WandExport char *MagickGetImageFilename(MagickWand *wand)
4443 {
4444   assert(wand != (MagickWand *) NULL);
4445   assert(wand->signature == WandSignature);
4446   if (wand->debug != MagickFalse)
4447     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4448   if (wand->images == (Image *) NULL)
4449     {
4450       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4451         "ContainsNoImages","`%s'",wand->name);
4452       return((char *) NULL);
4453     }
4454   return(AcquireString(wand->images->filename));
4455 }
4456 \f
4457 /*
4458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4459 %                                                                             %
4460 %                                                                             %
4461 %                                                                             %
4462 %   M a g i c k G e t I m a g e F o r m a t                                   %
4463 %                                                                             %
4464 %                                                                             %
4465 %                                                                             %
4466 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4467 %
4468 %  MagickGetImageFormat() returns the format of a particular image in a
4469 %  sequence.
4470 %
4471 %  The format of the MagickGetImageFormat method is:
4472 %
4473 %      const char *MagickGetImageFormat(MagickWand *wand)
4474 %
4475 %  A description of each parameter follows:
4476 %
4477 %    o wand: the magick wand.
4478 %
4479 */
4480 WandExport char *MagickGetImageFormat(MagickWand *wand)
4481 {
4482   assert(wand != (MagickWand *) NULL);
4483   assert(wand->signature == WandSignature);
4484   if (wand->debug != MagickFalse)
4485     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4486   if (wand->images == (Image *) NULL)
4487     {
4488       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4489         "ContainsNoImages","`%s'",wand->name);
4490       return((char *) NULL);
4491     }
4492   return(AcquireString(wand->images->magick));
4493 }
4494 \f
4495 /*
4496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4497 %                                                                             %
4498 %                                                                             %
4499 %                                                                             %
4500 %   M a g i c k G e t I m a g e F u z z                                       %
4501 %                                                                             %
4502 %                                                                             %
4503 %                                                                             %
4504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4505 %
4506 %  MagickGetImageFuzz() gets the image fuzz.
4507 %
4508 %  The format of the MagickGetImageFuzz method is:
4509 %
4510 %      double MagickGetImageFuzz(MagickWand *wand)
4511 %
4512 %  A description of each parameter follows:
4513 %
4514 %    o wand: the magick wand.
4515 %
4516 */
4517 WandExport double MagickGetImageFuzz(MagickWand *wand)
4518 {
4519   assert(wand != (MagickWand *) NULL);
4520   assert(wand->signature == WandSignature);
4521   if (wand->debug != MagickFalse)
4522     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4523   if (wand->images == (Image *) NULL)
4524     {
4525       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4526         "ContainsNoImages","`%s'",wand->name);
4527       return(0.0);
4528     }
4529   return(wand->images->fuzz);
4530 }
4531 \f
4532 /*
4533 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4534 %                                                                             %
4535 %                                                                             %
4536 %                                                                             %
4537 %   M a g i c k G e t I m a g e G a m m a                                     %
4538 %                                                                             %
4539 %                                                                             %
4540 %                                                                             %
4541 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4542 %
4543 %  MagickGetImageGamma() gets the image gamma.
4544 %
4545 %  The format of the MagickGetImageGamma method is:
4546 %
4547 %      double MagickGetImageGamma(MagickWand *wand)
4548 %
4549 %  A description of each parameter follows:
4550 %
4551 %    o wand: the magick wand.
4552 %
4553 */
4554 WandExport double MagickGetImageGamma(MagickWand *wand)
4555 {
4556   assert(wand != (MagickWand *) NULL);
4557   assert(wand->signature == WandSignature);
4558   if (wand->debug != MagickFalse)
4559     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4560   if (wand->images == (Image *) NULL)
4561     {
4562       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4563         "ContainsNoImages","`%s'",wand->name);
4564       return(0.0);
4565     }
4566   return(wand->images->gamma);
4567 }
4568 \f
4569 /*
4570 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4571 %                                                                             %
4572 %                                                                             %
4573 %                                                                             %
4574 %   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                 %
4575 %                                                                             %
4576 %                                                                             %
4577 %                                                                             %
4578 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4579 %
4580 %  MagickGetImageGravity() gets the image gravity.
4581 %
4582 %  The format of the MagickGetImageGravity method is:
4583 %
4584 %      GravityType MagickGetImageGravity(MagickWand *wand)
4585 %
4586 %  A description of each parameter follows:
4587 %
4588 %    o wand: the magick wand.
4589 %
4590 */
4591 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4592 {
4593   assert(wand != (MagickWand *) NULL);
4594   assert(wand->signature == WandSignature);
4595   if (wand->debug != MagickFalse)
4596     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4597   if (wand->images == (Image *) NULL)
4598     {
4599       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4600         "ContainsNoImages","`%s'",wand->name);
4601       return(UndefinedGravity);
4602     }
4603   return(wand->images->gravity);
4604 }
4605 \f
4606 /*
4607 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4608 %                                                                             %
4609 %                                                                             %
4610 %                                                                             %
4611 %   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                       %
4612 %                                                                             %
4613 %                                                                             %
4614 %                                                                             %
4615 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4616 %
4617 %  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4618 %
4619 %  The format of the MagickGetImageGreenPrimary method is:
4620 %
4621 %      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4622 %        double *y)
4623 %
4624 %  A description of each parameter follows:
4625 %
4626 %    o wand: the magick wand.
4627 %
4628 %    o x: the chromaticity green primary x-point.
4629 %
4630 %    o y: the chromaticity green primary y-point.
4631 %
4632 */
4633 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4634   double *x,double *y)
4635 {
4636   assert(wand != (MagickWand *) NULL);
4637   assert(wand->signature == WandSignature);
4638   if (wand->debug != MagickFalse)
4639     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4640   if (wand->images == (Image *) NULL)
4641     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4642   *x=wand->images->chromaticity.green_primary.x;
4643   *y=wand->images->chromaticity.green_primary.y;
4644   return(MagickTrue);
4645 }
4646 \f
4647 /*
4648 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4649 %                                                                             %
4650 %                                                                             %
4651 %                                                                             %
4652 %   M a g i c k G e t I m a g e H e i g h t                                   %
4653 %                                                                             %
4654 %                                                                             %
4655 %                                                                             %
4656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4657 %
4658 %  MagickGetImageHeight() returns the image height.
4659 %
4660 %  The format of the MagickGetImageHeight method is:
4661 %
4662 %      size_t MagickGetImageHeight(MagickWand *wand)
4663 %
4664 %  A description of each parameter follows:
4665 %
4666 %    o wand: the magick wand.
4667 %
4668 */
4669 WandExport size_t MagickGetImageHeight(MagickWand *wand)
4670 {
4671   assert(wand != (MagickWand *) NULL);
4672   assert(wand->signature == WandSignature);
4673   if (wand->debug != MagickFalse)
4674     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4675   if (wand->images == (Image *) NULL)
4676     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4677   return(wand->images->rows);
4678 }
4679 \f
4680 /*
4681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4682 %                                                                             %
4683 %                                                                             %
4684 %                                                                             %
4685 %   M a g i c k G e t I m a g e H i s t o g r a m                             %
4686 %                                                                             %
4687 %                                                                             %
4688 %                                                                             %
4689 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4690 %
4691 %  MagickGetImageHistogram() returns the image histogram as an array of
4692 %  PixelWand wands.
4693 %
4694 %  The format of the MagickGetImageHistogram method is:
4695 %
4696 %      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4697 %        size_t *number_colors)
4698 %
4699 %  A description of each parameter follows:
4700 %
4701 %    o wand: the magick wand.
4702 %
4703 %    o number_colors: the number of unique colors in the image and the number
4704 %      of pixel wands returned.
4705 %
4706 */
4707 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4708   size_t *number_colors)
4709 {
4710   PixelInfo
4711     *histogram;
4712
4713   PixelWand
4714     **pixel_wands;
4715
4716   register ssize_t
4717     i;
4718
4719   assert(wand != (MagickWand *) NULL);
4720   assert(wand->signature == WandSignature);
4721   if (wand->debug != MagickFalse)
4722     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4723   if (wand->images == (Image *) NULL)
4724     {
4725       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4726         "ContainsNoImages","`%s'",wand->name);
4727       return((PixelWand **) NULL);
4728     }
4729   histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4730   if (histogram == (PixelInfo *) NULL)
4731     return((PixelWand **) NULL);
4732   pixel_wands=NewPixelWands(*number_colors);
4733   for (i=0; i < (ssize_t) *number_colors; i++)
4734   {
4735     PixelSetQuantumPacket(pixel_wands[i],&histogram[i]);
4736     PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4737   }
4738   histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
4739   return(pixel_wands);
4740 }
4741 \f
4742 /*
4743 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4744 %                                                                             %
4745 %                                                                             %
4746 %                                                                             %
4747 %   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                 %
4748 %                                                                             %
4749 %                                                                             %
4750 %                                                                             %
4751 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4752 %
4753 %  MagickGetImageInterlaceScheme() gets the image interlace scheme.
4754 %
4755 %  The format of the MagickGetImageInterlaceScheme method is:
4756 %
4757 %      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4758 %
4759 %  A description of each parameter follows:
4760 %
4761 %    o wand: the magick wand.
4762 %
4763 */
4764 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4765 {
4766   assert(wand != (MagickWand *) NULL);
4767   assert(wand->signature == WandSignature);
4768   if (wand->debug != MagickFalse)
4769     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4770   if (wand->images == (Image *) NULL)
4771     {
4772       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4773         "ContainsNoImages","`%s'",wand->name);
4774       return(UndefinedInterlace);
4775     }
4776   return(wand->images->interlace);
4777 }
4778 \f
4779 /*
4780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4781 %                                                                             %
4782 %                                                                             %
4783 %                                                                             %
4784 %   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             %
4785 %                                                                             %
4786 %                                                                             %
4787 %                                                                             %
4788 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4789 %
4790 %  MagickGetImageInterpolateMethod() returns the interpolation method for the
4791 %  sepcified image.
4792 %
4793 %  The format of the MagickGetImageInterpolateMethod method is:
4794 %
4795 %      PixelInterpolateMethod MagickGetImagePixelInterpolateMethod(
4796 %        MagickWand *wand)
4797 %
4798 %  A description of each parameter follows:
4799 %
4800 %    o wand: the magick wand.
4801 %
4802 */
4803 WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
4804   MagickWand *wand)
4805 {
4806   assert(wand != (MagickWand *) NULL);
4807   assert(wand->signature == WandSignature);
4808   if (wand->debug != MagickFalse)
4809     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4810   if (wand->images == (Image *) NULL)
4811     {
4812       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4813         "ContainsNoImages","`%s'",wand->name);
4814       return(UndefinedInterpolatePixel);
4815     }
4816   return(wand->images->interpolate);
4817 }
4818 \f
4819 /*
4820 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4821 %                                                                             %
4822 %                                                                             %
4823 %                                                                             %
4824 %   M a g i c k G e t I m a g e I t e r a t i o n s                           %
4825 %                                                                             %
4826 %                                                                             %
4827 %                                                                             %
4828 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4829 %
4830 %  MagickGetImageIterations() gets the image iterations.
4831 %
4832 %  The format of the MagickGetImageIterations method is:
4833 %
4834 %      size_t MagickGetImageIterations(MagickWand *wand)
4835 %
4836 %  A description of each parameter follows:
4837 %
4838 %    o wand: the magick wand.
4839 %
4840 */
4841 WandExport size_t MagickGetImageIterations(MagickWand *wand)
4842 {
4843   assert(wand != (MagickWand *) NULL);
4844   assert(wand->signature == WandSignature);
4845   if (wand->debug != MagickFalse)
4846     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4847   if (wand->images == (Image *) NULL)
4848     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4849   return(wand->images->iterations);
4850 }
4851 \f
4852 /*
4853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4854 %                                                                             %
4855 %                                                                             %
4856 %                                                                             %
4857 %   M a g i c k G e t I m a g e L e n g t h                                   %
4858 %                                                                             %
4859 %                                                                             %
4860 %                                                                             %
4861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4862 %
4863 %  MagickGetImageLength() returns the image length in bytes.
4864 %
4865 %  The format of the MagickGetImageLength method is:
4866 %
4867 %      MagickBooleanType MagickGetImageLength(MagickWand *wand,
4868 %        MagickSizeType *length)
4869 %
4870 %  A description of each parameter follows:
4871 %
4872 %    o wand: the magick wand.
4873 %
4874 %    o length: the image length in bytes.
4875 %
4876 */
4877 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
4878   MagickSizeType *length)
4879 {
4880   assert(wand != (MagickWand *) NULL);
4881   assert(wand->signature == WandSignature);
4882   if (wand->debug != MagickFalse)
4883     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4884   if (wand->images == (Image *) NULL)
4885     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4886   *length=GetBlobSize(wand->images);
4887   return(MagickTrue);
4888 }
4889 \f
4890 /*
4891 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4892 %                                                                             %
4893 %                                                                             %
4894 %                                                                             %
4895 %   M a g i c k G e t I m a g e M a t t e C o l o r                           %
4896 %                                                                             %
4897 %                                                                             %
4898 %                                                                             %
4899 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4900 %
4901 %  MagickGetImageMatteColor() returns the image matte color.
4902 %
4903 %  The format of the MagickGetImageMatteColor method is:
4904 %
4905 %      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
4906 %        PixelWand *matte_color)
4907 %
4908 %  A description of each parameter follows:
4909 %
4910 %    o wand: the magick wand.
4911 %
4912 %    o matte_color: Return the matte color.
4913 %
4914 */
4915 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
4916   PixelWand *matte_color)
4917 {
4918   assert(wand != (MagickWand *) NULL);
4919   assert(wand->signature == WandSignature);
4920   if (wand->debug != MagickFalse)
4921     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4922   if (wand->images == (Image *) NULL)
4923     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4924   PixelSetQuantumPacket(matte_color,&wand->images->matte_color);
4925   return(MagickTrue);
4926 }
4927 \f
4928 /*
4929 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4930 %                                                                             %
4931 %                                                                             %
4932 %                                                                             %
4933 %   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                         %
4934 %                                                                             %
4935 %                                                                             %
4936 %                                                                             %
4937 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4938 %
4939 %  MagickGetImageOrientation() returns the image orientation.
4940 %
4941 %  The format of the MagickGetImageOrientation method is:
4942 %
4943 %      OrientationType MagickGetImageOrientation(MagickWand *wand)
4944 %
4945 %  A description of each parameter follows:
4946 %
4947 %    o wand: the magick wand.
4948 %
4949 */
4950 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
4951 {
4952   assert(wand != (MagickWand *) NULL);
4953   assert(wand->signature == WandSignature);
4954   if (wand->debug != MagickFalse)
4955     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4956   if (wand->images == (Image *) NULL)
4957     {
4958       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4959         "ContainsNoImages","`%s'",wand->name);
4960       return(UndefinedOrientation);
4961     }
4962   return(wand->images->orientation);
4963 }
4964 \f
4965 /*
4966 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4967 %                                                                             %
4968 %                                                                             %
4969 %                                                                             %
4970 %   M a g i c k G e t I m a g e P a g e                                       %
4971 %                                                                             %
4972 %                                                                             %
4973 %                                                                             %
4974 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4975 %
4976 %  MagickGetImagePage() returns the page geometry associated with the image.
4977 %
4978 %  The format of the MagickGetImagePage method is:
4979 %
4980 %      MagickBooleanType MagickGetImagePage(MagickWand *wand,
4981 %        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4982 %
4983 %  A description of each parameter follows:
4984 %
4985 %    o wand: the magick wand.
4986 %
4987 %    o width: the page width.
4988 %
4989 %    o height: the page height.
4990 %
4991 %    o x: the page x-offset.
4992 %
4993 %    o y: the page y-offset.
4994 %
4995 */
4996 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
4997   size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4998 {
4999   assert(wand != (const MagickWand *) NULL);
5000   assert(wand->signature == WandSignature);
5001   if (wand->debug != MagickFalse)
5002     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5003   if (wand->images == (Image *) NULL)
5004     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5005   *width=wand->images->page.width;
5006   *height=wand->images->page.height;
5007   *x=wand->images->page.x;
5008   *y=wand->images->page.y;
5009   return(MagickTrue);
5010 }
5011 \f
5012 /*
5013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5014 %                                                                             %
5015 %                                                                             %
5016 %                                                                             %
5017 %   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5018 %                                                                             %
5019 %                                                                             %
5020 %                                                                             %
5021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5022 %
5023 %  MagickGetImagePixelColor() returns the color of the specified pixel.
5024 %
5025 %  The format of the MagickGetImagePixelColor method is:
5026 %
5027 %      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5028 %        const ssize_t x,const ssize_t y,PixelWand *color)
5029 %
5030 %  A description of each parameter follows:
5031 %
5032 %    o wand: the magick wand.
5033 %
5034 %    o x,y: the pixel offset into the image.
5035 %
5036 %    o color: Return the colormap color in this wand.
5037 %
5038 */
5039 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5040   const ssize_t x,const ssize_t y,PixelWand *color)
5041 {
5042   register const Quantum
5043     *p;
5044
5045   CacheView
5046     *image_view;
5047
5048   assert(wand != (MagickWand *) NULL);
5049   assert(wand->signature == WandSignature);
5050   if (wand->debug != MagickFalse)
5051     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5052   if (wand->images == (Image *) NULL)
5053     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5054   image_view=AcquireCacheView(wand->images);
5055   p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5056   if (p == (const Quantum *) NULL)
5057     {
5058       image_view=DestroyCacheView(image_view);
5059       return(MagickFalse);
5060     }
5061   PixelSetQuantumPixel(wand->images,p,color);
5062   image_view=DestroyCacheView(image_view);
5063   return(MagickTrue);
5064 }
5065 \f
5066 /*
5067 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5068 %                                                                             %
5069 %                                                                             %
5070 %                                                                             %
5071 %   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5072 %                                                                             %
5073 %                                                                             %
5074 %                                                                             %
5075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5076 %
5077 %  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5078 %
5079 %  The format of the MagickGetImageRedPrimary method is:
5080 %
5081 %      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5082 %        double *y)
5083 %
5084 %  A description of each parameter follows:
5085 %
5086 %    o wand: the magick wand.
5087 %
5088 %    o x: the chromaticity red primary x-point.
5089 %
5090 %    o y: the chromaticity red primary y-point.
5091 %
5092 */
5093 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5094   double *x,double *y)
5095 {
5096   assert(wand != (MagickWand *) NULL);
5097   assert(wand->signature == WandSignature);
5098   if (wand->debug != MagickFalse)
5099     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5100   if (wand->images == (Image *) NULL)
5101     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5102   *x=wand->images->chromaticity.red_primary.x;
5103   *y=wand->images->chromaticity.red_primary.y;
5104   return(MagickTrue);
5105 }
5106 \f
5107 /*
5108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5109 %                                                                             %
5110 %                                                                             %
5111 %                                                                             %
5112 %   M a g i c k G e t I m a g e R e g i o n                                   %
5113 %                                                                             %
5114 %                                                                             %
5115 %                                                                             %
5116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5117 %
5118 %  MagickGetImageRegion() extracts a region of the image and returns it as a
5119 %  a new wand.
5120 %
5121 %  The format of the MagickGetImageRegion method is:
5122 %
5123 %      MagickWand *MagickGetImageRegion(MagickWand *wand,
5124 %        const size_t width,const size_t height,const ssize_t x,
5125 %        const ssize_t y)
5126 %
5127 %  A description of each parameter follows:
5128 %
5129 %    o wand: the magick wand.
5130 %
5131 %    o width: the region width.
5132 %
5133 %    o height: the region height.
5134 %
5135 %    o x: the region x offset.
5136 %
5137 %    o y: the region y offset.
5138 %
5139 */
5140 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5141   const size_t width,const size_t height,const ssize_t x,
5142   const ssize_t y)
5143 {
5144   Image
5145     *region_image;
5146
5147   RectangleInfo
5148     region;
5149
5150   assert(wand != (MagickWand *) NULL);
5151   assert(wand->signature == WandSignature);
5152   if (wand->debug != MagickFalse)
5153     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5154   if (wand->images == (Image *) NULL)
5155     return((MagickWand *) NULL);
5156   region.width=width;
5157   region.height=height;
5158   region.x=x;
5159   region.y=y;
5160   region_image=CropImage(wand->images,&region,wand->exception);
5161   if (region_image == (Image *) NULL)
5162     return((MagickWand *) NULL);
5163   return(CloneMagickWandFromImages(wand,region_image));
5164 }
5165 \f
5166 /*
5167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5168 %                                                                             %
5169 %                                                                             %
5170 %                                                                             %
5171 %   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                 %
5172 %                                                                             %
5173 %                                                                             %
5174 %                                                                             %
5175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5176 %
5177 %  MagickGetImageRenderingIntent() gets the image rendering intent.
5178 %
5179 %  The format of the MagickGetImageRenderingIntent method is:
5180 %
5181 %      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5182 %
5183 %  A description of each parameter follows:
5184 %
5185 %    o wand: the magick wand.
5186 %
5187 */
5188 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5189 {
5190   assert(wand != (MagickWand *) NULL);
5191   assert(wand->signature == WandSignature);
5192   if (wand->debug != MagickFalse)
5193     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5194   if (wand->images == (Image *) NULL)
5195     {
5196       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5197         "ContainsNoImages","`%s'",wand->name);
5198       return(UndefinedIntent);
5199     }
5200   return((RenderingIntent) wand->images->rendering_intent);
5201 }
5202 \f
5203 /*
5204 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5205 %                                                                             %
5206 %                                                                             %
5207 %                                                                             %
5208 %   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5209 %                                                                             %
5210 %                                                                             %
5211 %                                                                             %
5212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5213 %
5214 %  MagickGetImageResolution() gets the image X and Y resolution.
5215 %
5216 %  The format of the MagickGetImageResolution method is:
5217 %
5218 %      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5219 %        double *y)
5220 %
5221 %  A description of each parameter follows:
5222 %
5223 %    o wand: the magick wand.
5224 %
5225 %    o x: the image x-resolution.
5226 %
5227 %    o y: the image y-resolution.
5228 %
5229 */
5230 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5231   double *x,double *y)
5232 {
5233   assert(wand != (MagickWand *) NULL);
5234   assert(wand->signature == WandSignature);
5235   if (wand->debug != MagickFalse)
5236     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5237   if (wand->images == (Image *) NULL)
5238     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5239   *x=wand->images->x_resolution;
5240   *y=wand->images->y_resolution;
5241   return(MagickTrue);
5242 }
5243 \f
5244 /*
5245 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5246 %                                                                             %
5247 %                                                                             %
5248 %                                                                             %
5249 %   M a g i c k G e t I m a g e S c e n e                                     %
5250 %                                                                             %
5251 %                                                                             %
5252 %                                                                             %
5253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5254 %
5255 %  MagickGetImageScene() gets the image scene.
5256 %
5257 %  The format of the MagickGetImageScene method is:
5258 %
5259 %      size_t MagickGetImageScene(MagickWand *wand)
5260 %
5261 %  A description of each parameter follows:
5262 %
5263 %    o wand: the magick wand.
5264 %
5265 */
5266 WandExport size_t MagickGetImageScene(MagickWand *wand)
5267 {
5268   assert(wand != (MagickWand *) NULL);
5269   assert(wand->signature == WandSignature);
5270   if (wand->debug != MagickFalse)
5271     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5272   if (wand->images == (Image *) NULL)
5273     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5274   return(wand->images->scene);
5275 }
5276 \f
5277 /*
5278 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5279 %                                                                             %
5280 %                                                                             %
5281 %                                                                             %
5282 %   M a g i c k G e t I m a g e S i g n a t u r e                             %
5283 %                                                                             %
5284 %                                                                             %
5285 %                                                                             %
5286 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5287 %
5288 %  MagickGetImageSignature() generates an SHA-256 message digest for the image
5289 %  pixel stream.
5290 %
5291 %  The format of the MagickGetImageSignature method is:
5292 %
5293 %      const char MagickGetImageSignature(MagickWand *wand)
5294 %
5295 %  A description of each parameter follows:
5296 %
5297 %    o wand: the magick wand.
5298 %
5299 */
5300 WandExport char *MagickGetImageSignature(MagickWand *wand)
5301 {
5302   const char
5303     *value;
5304
5305   MagickBooleanType
5306     status;
5307
5308   assert(wand != (MagickWand *) NULL);
5309   assert(wand->signature == WandSignature);
5310   if (wand->debug != MagickFalse)
5311     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5312   if (wand->images == (Image *) NULL)
5313     {
5314       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5315         "ContainsNoImages","`%s'",wand->name);
5316       return((char *) NULL);
5317     }
5318   status=SignatureImage(wand->images,wand->exception);
5319   if (status == MagickFalse)
5320     return((char *) NULL);
5321   value=GetImageProperty(wand->images,"signature",wand->exception);
5322   if (value == (const char *) NULL)
5323     return((char *) NULL);
5324   return(AcquireString(value));
5325 }
5326 \f
5327 /*
5328 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5329 %                                                                             %
5330 %                                                                             %
5331 %                                                                             %
5332 %   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                   %
5333 %                                                                             %
5334 %                                                                             %
5335 %                                                                             %
5336 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5337 %
5338 %  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5339 %
5340 %  The format of the MagickGetImageTicksPerSecond method is:
5341 %
5342 %      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5343 %
5344 %  A description of each parameter follows:
5345 %
5346 %    o wand: the magick wand.
5347 %
5348 */
5349 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5350 {
5351   assert(wand != (MagickWand *) NULL);
5352   assert(wand->signature == WandSignature);
5353   if (wand->debug != MagickFalse)
5354     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5355   if (wand->images == (Image *) NULL)
5356     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5357   return((size_t) wand->images->ticks_per_second);
5358 }
5359 \f
5360 /*
5361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5362 %                                                                             %
5363 %                                                                             %
5364 %                                                                             %
5365 %   M a g i c k G e t I m a g e T y p e                                       %
5366 %                                                                             %
5367 %                                                                             %
5368 %                                                                             %
5369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5370 %
5371 %  MagickGetImageType() gets the potential image type:
5372 %
5373 %        Bilevel        Grayscale       GrayscaleMatte
5374 %        Palette        PaletteMatte    TrueColor
5375 %        TrueColorMatte ColorSeparation ColorSeparationMatte
5376 %
5377 %  To ensure the image type matches its potential, use MagickSetImageType():
5378 %
5379 %    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5380 %
5381 %  The format of the MagickGetImageType method is:
5382 %
5383 %      ImageType MagickGetImageType(MagickWand *wand)
5384 %
5385 %  A description of each parameter follows:
5386 %
5387 %    o wand: the magick wand.
5388 %
5389 */
5390 WandExport ImageType MagickGetImageType(MagickWand *wand)
5391 {
5392   assert(wand != (MagickWand *) NULL);
5393   assert(wand->signature == WandSignature);
5394   if (wand->debug != MagickFalse)
5395     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5396   if (wand->images == (Image *) NULL)
5397     {
5398       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5399         "ContainsNoImages","`%s'",wand->name);
5400       return(UndefinedType);
5401     }
5402   return(GetImageType(wand->images,wand->exception));
5403 }
5404 \f
5405 /*
5406 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5407 %                                                                             %
5408 %                                                                             %
5409 %                                                                             %
5410 %   M a g i c k G e t I m a g e U n i t s                                     %
5411 %                                                                             %
5412 %                                                                             %
5413 %                                                                             %
5414 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5415 %
5416 %  MagickGetImageUnits() gets the image units of resolution.
5417 %
5418 %  The format of the MagickGetImageUnits method is:
5419 %
5420 %      ResolutionType MagickGetImageUnits(MagickWand *wand)
5421 %
5422 %  A description of each parameter follows:
5423 %
5424 %    o wand: the magick wand.
5425 %
5426 */
5427 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5428 {
5429   assert(wand != (MagickWand *) NULL);
5430   assert(wand->signature == WandSignature);
5431   if (wand->debug != MagickFalse)
5432     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5433   if (wand->images == (Image *) NULL)
5434     {
5435       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5436         "ContainsNoImages","`%s'",wand->name);
5437       return(UndefinedResolution);
5438     }
5439   return(wand->images->units);
5440 }
5441 \f
5442 /*
5443 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5444 %                                                                             %
5445 %                                                                             %
5446 %                                                                             %
5447 %   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           %
5448 %                                                                             %
5449 %                                                                             %
5450 %                                                                             %
5451 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5452 %
5453 %  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5454 %  sepcified image.
5455 %
5456 %  The format of the MagickGetImageVirtualPixelMethod method is:
5457 %
5458 %      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5459 %
5460 %  A description of each parameter follows:
5461 %
5462 %    o wand: the magick wand.
5463 %
5464 */
5465 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5466 {
5467   assert(wand != (MagickWand *) NULL);
5468   assert(wand->signature == WandSignature);
5469   if (wand->debug != MagickFalse)
5470     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5471   if (wand->images == (Image *) NULL)
5472     {
5473       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5474         "ContainsNoImages","`%s'",wand->name);
5475       return(UndefinedVirtualPixelMethod);
5476     }
5477   return(GetImageVirtualPixelMethod(wand->images));
5478 }
5479 \f
5480 /*
5481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5482 %                                                                             %
5483 %                                                                             %
5484 %                                                                             %
5485 %   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5486 %                                                                             %
5487 %                                                                             %
5488 %                                                                             %
5489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5490 %
5491 %  MagickGetImageWhitePoint() returns the chromaticy white point.
5492 %
5493 %  The format of the MagickGetImageWhitePoint method is:
5494 %
5495 %      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5496 %        double *y)
5497 %
5498 %  A description of each parameter follows:
5499 %
5500 %    o wand: the magick wand.
5501 %
5502 %    o x: the chromaticity white x-point.
5503 %
5504 %    o y: the chromaticity white y-point.
5505 %
5506 */
5507 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5508   double *x,double *y)
5509 {
5510   assert(wand != (MagickWand *) NULL);
5511   assert(wand->signature == WandSignature);
5512   if (wand->debug != MagickFalse)
5513     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5514   if (wand->images == (Image *) NULL)
5515     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5516   *x=wand->images->chromaticity.white_point.x;
5517   *y=wand->images->chromaticity.white_point.y;
5518   return(MagickTrue);
5519 }
5520 \f
5521 /*
5522 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5523 %                                                                             %
5524 %                                                                             %
5525 %                                                                             %
5526 %   M a g i c k G e t I m a g e W i d t h                                     %
5527 %                                                                             %
5528 %                                                                             %
5529 %                                                                             %
5530 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5531 %
5532 %  MagickGetImageWidth() returns the image width.
5533 %
5534 %  The format of the MagickGetImageWidth method is:
5535 %
5536 %      size_t MagickGetImageWidth(MagickWand *wand)
5537 %
5538 %  A description of each parameter follows:
5539 %
5540 %    o wand: the magick wand.
5541 %
5542 */
5543 WandExport size_t MagickGetImageWidth(MagickWand *wand)
5544 {
5545   assert(wand != (MagickWand *) NULL);
5546   assert(wand->signature == WandSignature);
5547   if (wand->debug != MagickFalse)
5548     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5549   if (wand->images == (Image *) NULL)
5550     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5551   return(wand->images->columns);
5552 }
5553 \f
5554 /*
5555 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5556 %                                                                             %
5557 %                                                                             %
5558 %                                                                             %
5559 %   M a g i c k G e t N u m b e r I m a g e s                                 %
5560 %                                                                             %
5561 %                                                                             %
5562 %                                                                             %
5563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5564 %
5565 %  MagickGetNumberImages() returns the number of images associated with a
5566 %  magick wand.
5567 %
5568 %  The format of the MagickGetNumberImages method is:
5569 %
5570 %      size_t MagickGetNumberImages(MagickWand *wand)
5571 %
5572 %  A description of each parameter follows:
5573 %
5574 %    o wand: the magick wand.
5575 %
5576 */
5577 WandExport size_t MagickGetNumberImages(MagickWand *wand)
5578 {
5579   assert(wand != (MagickWand *) NULL);
5580   assert(wand->signature == WandSignature);
5581   if (wand->debug != MagickFalse)
5582     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5583   return(GetImageListLength(wand->images));
5584 }
5585 \f
5586 /*
5587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5588 %                                                                             %
5589 %                                                                             %
5590 %                                                                             %
5591 %   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                 %
5592 %                                                                             %
5593 %                                                                             %
5594 %                                                                             %
5595 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5596 %
5597 %  MagickGetImageTotalInkDensity() gets the image total ink density.
5598 %
5599 %  The format of the MagickGetImageTotalInkDensity method is:
5600 %
5601 %      double MagickGetImageTotalInkDensity(MagickWand *wand)
5602 %
5603 %  A description of each parameter follows:
5604 %
5605 %    o wand: the magick wand.
5606 %
5607 */
5608 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5609 {
5610   assert(wand != (MagickWand *) NULL);
5611   assert(wand->signature == WandSignature);
5612   if (wand->debug != MagickFalse)
5613     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5614   if (wand->images == (Image *) NULL)
5615     {
5616       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5617         "ContainsNoImages","`%s'",wand->name);
5618       return(0.0);
5619     }
5620   return(GetImageTotalInkDensity(wand->images));
5621 }
5622 \f
5623 /*
5624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5625 %                                                                             %
5626 %                                                                             %
5627 %                                                                             %
5628 %   M a g i c k H a l d C l u t I m a g e                                     %
5629 %                                                                             %
5630 %                                                                             %
5631 %                                                                             %
5632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5633 %
5634 %  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5635 %  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5636 %  dimensions.  Create it with the HALD coder.  You can apply any color
5637 %  transformation to the Hald image and then use this method to apply the
5638 %  transform to the image.
5639 %
5640 %  The format of the MagickHaldClutImage method is:
5641 %
5642 %      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5643 %        const MagickWand *hald_wand)
5644 %
5645 %  A description of each parameter follows:
5646 %
5647 %    o wand: the magick wand.
5648 %
5649 %    o hald_image: the hald CLUT image.
5650 %
5651 */
5652 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5653   const MagickWand *hald_wand)
5654 {
5655   MagickBooleanType
5656     status;
5657
5658   assert(wand != (MagickWand *) NULL);
5659   assert(wand->signature == WandSignature);
5660   if (wand->debug != MagickFalse)
5661     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5662   if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5663     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5664   status=HaldClutImage(wand->images,hald_wand->images,&wand->images->exception);
5665   return(status);
5666 }
5667 \f
5668 /*
5669 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5670 %                                                                             %
5671 %                                                                             %
5672 %                                                                             %
5673 %   M a g i c k H a s N e x t I m a g e                                       %
5674 %                                                                             %
5675 %                                                                             %
5676 %                                                                             %
5677 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5678 %
5679 %  MagickHasNextImage() returns MagickTrue if the wand has more images when
5680 %  traversing the list in the forward direction
5681 %
5682 %  The format of the MagickHasNextImage method is:
5683 %
5684 %      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5685 %
5686 %  A description of each parameter follows:
5687 %
5688 %    o wand: the magick wand.
5689 %
5690 */
5691 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5692 {
5693   assert(wand != (MagickWand *) NULL);
5694   assert(wand->signature == WandSignature);
5695   if (wand->debug != MagickFalse)
5696     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5697   if (wand->images == (Image *) NULL)
5698     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5699   if (GetNextImageInList(wand->images) == (Image *) NULL)
5700     return(MagickFalse);
5701   return(MagickTrue);
5702 }
5703 \f
5704 /*
5705 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5706 %                                                                             %
5707 %                                                                             %
5708 %                                                                             %
5709 %   M a g i c k H a s P r e v i o u s I m a g e                               %
5710 %                                                                             %
5711 %                                                                             %
5712 %                                                                             %
5713 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5714 %
5715 %  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5716 %  traversing the list in the reverse direction
5717 %
5718 %  The format of the MagickHasPreviousImage method is:
5719 %
5720 %      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5721 %
5722 %  A description of each parameter follows:
5723 %
5724 %    o wand: the magick wand.
5725 %
5726 */
5727 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5728 {
5729   assert(wand != (MagickWand *) NULL);
5730   assert(wand->signature == WandSignature);
5731   if (wand->debug != MagickFalse)
5732     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5733   if (wand->images == (Image *) NULL)
5734     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5735   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5736     return(MagickFalse);
5737   return(MagickTrue);
5738 }
5739 \f
5740 /*
5741 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5742 %                                                                             %
5743 %                                                                             %
5744 %                                                                             %
5745 %   M a g i c k I d e n t i f y I m a g e                                     %
5746 %                                                                             %
5747 %                                                                             %
5748 %                                                                             %
5749 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5750 %
5751 %  MagickIdentifyImage() identifies an image by printing its attributes to the
5752 %  file.  Attributes include the image width, height, size, and others.
5753 %
5754 %  The format of the MagickIdentifyImage method is:
5755 %
5756 %      const char *MagickIdentifyImage(MagickWand *wand)
5757 %
5758 %  A description of each parameter follows:
5759 %
5760 %    o wand: the magick wand.
5761 %
5762 */
5763 WandExport char *MagickIdentifyImage(MagickWand *wand)
5764 {
5765   char
5766     *description,
5767     filename[MaxTextExtent];
5768
5769   FILE
5770     *file;
5771
5772   int
5773     unique_file;
5774
5775   assert(wand != (MagickWand *) NULL);
5776   assert(wand->signature == WandSignature);
5777   if (wand->debug != MagickFalse)
5778     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5779   if (wand->images == (Image *) NULL)
5780     {
5781       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5782         "ContainsNoImages","`%s'",wand->name);
5783       return((char *) NULL);
5784     }
5785   description=(char *) NULL;
5786   unique_file=AcquireUniqueFileResource(filename);
5787   file=(FILE *) NULL;
5788   if (unique_file != -1)
5789     file=fdopen(unique_file,"wb");
5790   if ((unique_file == -1) || (file == (FILE *) NULL))
5791     {
5792       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5793         "UnableToCreateTemporaryFile","`%s'",wand->name);
5794       return((char *) NULL);
5795     }
5796   (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
5797   (void) fclose(file);
5798   description=FileToString(filename,~0,wand->exception);
5799   (void) RelinquishUniqueFileResource(filename);
5800   return(description);
5801 }
5802 \f
5803 /*
5804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5805 %                                                                             %
5806 %                                                                             %
5807 %                                                                             %
5808 %   M a g i c k I m p l o d e I m a g e                                       %
5809 %                                                                             %
5810 %                                                                             %
5811 %                                                                             %
5812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5813 %
5814 %  MagickImplodeImage() creates a new image that is a copy of an existing
5815 %  one with the image pixels "implode" by the specified percentage.  It
5816 %  allocates the memory necessary for the new Image structure and returns a
5817 %  pointer to the new image.
5818 %
5819 %  The format of the MagickImplodeImage method is:
5820 %
5821 %      MagickBooleanType MagickImplodeImage(MagickWand *wand,
5822 %        const double radius,const PixelInterpolateMethod method)
5823 %
5824 %  A description of each parameter follows:
5825 %
5826 %    o wand: the magick wand.
5827 %
5828 %    o amount: Define the extent of the implosion.
5829 %
5830 %    o method: the pixel interpolation method.
5831 %
5832 */
5833 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
5834   const double amount,const PixelInterpolateMethod method)
5835 {
5836   Image
5837     *implode_image;
5838
5839   assert(wand != (MagickWand *) NULL);
5840   assert(wand->signature == WandSignature);
5841   if (wand->debug != MagickFalse)
5842     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5843   if (wand->images == (Image *) NULL)
5844     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5845   implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
5846   if (implode_image == (Image *) NULL)
5847     return(MagickFalse);
5848   ReplaceImageInList(&wand->images,implode_image);
5849   return(MagickTrue);
5850 }
5851 \f
5852 /*
5853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5854 %                                                                             %
5855 %                                                                             %
5856 %                                                                             %
5857 %   M a g i c k I m p o r t I m a g e P i x e l s                             %
5858 %                                                                             %
5859 %                                                                             %
5860 %                                                                             %
5861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5862 %
5863 %  MagickImportImagePixels() accepts pixel datand stores it in the image at the
5864 %  location you specify.  The method returns MagickFalse on success otherwise
5865 %  MagickTrue if an error is encountered.  The pixel data can be either char,
5866 %  short int, int, ssize_t, float, or double in the order specified by map.
5867 %
5868 %  Suppose your want to upload the first scanline of a 640x480 image from
5869 %  character data in red-green-blue order:
5870 %
5871 %      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
5872 %
5873 %  The format of the MagickImportImagePixels method is:
5874 %
5875 %      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5876 %        const ssize_t x,const ssize_t y,const size_t columns,
5877 %        const size_t rows,const char *map,const StorageType storage,
5878 %        const void *pixels)
5879 %
5880 %  A description of each parameter follows:
5881 %
5882 %    o wand: the magick wand.
5883 %
5884 %    o x, y, columns, rows:  These values define the perimeter of a region
5885 %      of pixels you want to define.
5886 %
5887 %    o map:  This string reflects the expected ordering of the pixel array.
5888 %      It can be any combination or order of R = red, G = green, B = blue,
5889 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
5890 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
5891 %      P = pad.
5892 %
5893 %    o storage: Define the data type of the pixels.  Float and double types are
5894 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
5895 %      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
5896 %      or DoublePixel.
5897 %
5898 %    o pixels: This array of values contain the pixel components as defined by
5899 %      map and type.  You must preallocate this array where the expected
5900 %      length varies depending on the values of width, height, map, and type.
5901 %
5902 */
5903 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5904   const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
5905   const char *map,const StorageType storage,const void *pixels)
5906 {
5907   MagickBooleanType
5908     status;
5909
5910   assert(wand != (MagickWand *) NULL);
5911   assert(wand->signature == WandSignature);
5912   if (wand->debug != MagickFalse)
5913     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5914   if (wand->images == (Image *) NULL)
5915     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5916   status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
5917     wand->exception);
5918   return(status);
5919 }
5920 \f
5921 /*
5922 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5923 %                                                                             %
5924 %                                                                             %
5925 %                                                                             %
5926 %   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       %
5927 %                                                                             %
5928 %                                                                             %
5929 %                                                                             %
5930 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5931 %
5932 %  MagickInverseFourierTransformImage() implements the inverse discrete
5933 %  Fourier transform (DFT) of the image either as a magnitude / phase or real /
5934 %  imaginary image pair.
5935 %
5936 %  The format of the MagickInverseFourierTransformImage method is:
5937 %
5938 %      MagickBooleanType MagickInverseFourierTransformImage(
5939 %        MagickWand *magnitude_wand,MagickWand *phase_wand,
5940 %        const MagickBooleanType magnitude)
5941 %
5942 %  A description of each parameter follows:
5943 %
5944 %    o magnitude_wand: the magnitude or real wand.
5945 %
5946 %    o phase_wand: the phase or imaginary wand.
5947 %
5948 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
5949 %      imaginary image pair.
5950 %
5951 */
5952 WandExport MagickBooleanType MagickInverseFourierTransformImage(
5953   MagickWand *magnitude_wand,MagickWand *phase_wand,
5954   const MagickBooleanType magnitude)
5955 {
5956   Image
5957     *inverse_image;
5958
5959   MagickWand
5960     *wand;
5961
5962   assert(magnitude_wand != (MagickWand *) NULL);
5963   assert(magnitude_wand->signature == WandSignature);
5964   if (magnitude_wand->debug != MagickFalse)
5965     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
5966       magnitude_wand->name);
5967   wand=magnitude_wand;
5968   if (magnitude_wand->images == (Image *) NULL)
5969     ThrowWandException(WandError,"ContainsNoImages",
5970       magnitude_wand->name);
5971   assert(phase_wand != (MagickWand *) NULL);
5972   assert(phase_wand->signature == WandSignature);
5973   inverse_image=InverseFourierTransformImage(magnitude_wand->images,
5974     phase_wand->images,magnitude,wand->exception);
5975   if (inverse_image == (Image *) NULL)
5976     return(MagickFalse);
5977   ReplaceImageInList(&wand->images,inverse_image);
5978   return(MagickTrue);
5979 }
5980 \f
5981 /*
5982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5983 %                                                                             %
5984 %                                                                             %
5985 %                                                                             %
5986 %   M a g i c k L a b e l I m a g e                                           %
5987 %                                                                             %
5988 %                                                                             %
5989 %                                                                             %
5990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5991 %
5992 %  MagickLabelImage() adds a label to your image.
5993 %
5994 %  The format of the MagickLabelImage method is:
5995 %
5996 %      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
5997 %
5998 %  A description of each parameter follows:
5999 %
6000 %    o wand: the magick wand.
6001 %
6002 %    o label: the image label.
6003 %
6004 */
6005 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6006   const char *label)
6007 {
6008   MagickBooleanType
6009     status;
6010
6011   assert(wand != (MagickWand *) NULL);
6012   assert(wand->signature == WandSignature);
6013   if (wand->debug != MagickFalse)
6014     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6015   if (wand->images == (Image *) NULL)
6016     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6017   status=SetImageProperty(wand->images,"label",label,wand->exception);
6018   return(status);
6019 }
6020 \f
6021 /*
6022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6023 %                                                                             %
6024 %                                                                             %
6025 %                                                                             %
6026 %   M a g i c k L e v e l I m a g e                                           %
6027 %                                                                             %
6028 %                                                                             %
6029 %                                                                             %
6030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6031 %
6032 %  MagickLevelImage() adjusts the levels of an image by scaling the colors
6033 %  falling between specified white and black points to the full available
6034 %  quantum range. The parameters provided represent the black, mid, and white
6035 %  points. The black point specifies the darkest color in the image. Colors
6036 %  darker than the black point are set to zero. Mid point specifies a gamma
6037 %  correction to apply to the image.  White point specifies the lightest color
6038 %  in the image. Colors brighter than the white point are set to the maximum
6039 %  quantum value.
6040 %
6041 %  The format of the MagickLevelImage method is:
6042 %
6043 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6044 %        const double black_point,const double gamma,const double white_point)
6045 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6046 %        const ChannelType channel,const double black_point,const double gamma,
6047 %        const double white_point)
6048 %
6049 %  A description of each parameter follows:
6050 %
6051 %    o wand: the magick wand.
6052 %
6053 %    o channel: Identify which channel to level: RedChannel, GreenChannel,
6054 %
6055 %    o black_point: the black point.
6056 %
6057 %    o gamma: the gamma.
6058 %
6059 %    o white_point: the white point.
6060 %
6061 */
6062 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6063   const double black_point,const double gamma,const double white_point)
6064 {
6065   MagickBooleanType
6066     status;
6067
6068   assert(wand != (MagickWand *) NULL);
6069   assert(wand->signature == WandSignature);
6070   if (wand->debug != MagickFalse)
6071     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6072   if (wand->images == (Image *) NULL)
6073     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6074   status=LevelImage(wand->images,black_point,white_point,gamma,
6075     &wand->images->exception);
6076   return(status);
6077 }
6078 \f
6079 /*
6080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6081 %                                                                             %
6082 %                                                                             %
6083 %                                                                             %
6084 %   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6085 %                                                                             %
6086 %                                                                             %
6087 %                                                                             %
6088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6089 %
6090 %  MagickLinearStretchImage() stretches with saturation the image intensity.
6091 %
6092 %  You can also reduce the influence of a particular channel with a gamma
6093 %  value of 0.
6094 %
6095 %  The format of the MagickLinearStretchImage method is:
6096 %
6097 %      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6098 %        const double black_point,const double white_point)
6099 %
6100 %  A description of each parameter follows:
6101 %
6102 %    o wand: the magick wand.
6103 %
6104 %    o black_point: the black point.
6105 %
6106 %    o white_point: the white point.
6107 %
6108 */
6109 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6110   const double black_point,const double white_point)
6111 {
6112   MagickBooleanType
6113     status;
6114
6115   assert(wand != (MagickWand *) NULL);
6116   assert(wand->signature == WandSignature);
6117   if (wand->debug != MagickFalse)
6118     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6119   if (wand->images == (Image *) NULL)
6120     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6121   status=LinearStretchImage(wand->images,black_point,white_point,
6122     &wand->images->exception);
6123   return(status);
6124 }
6125 \f
6126 /*
6127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6128 %                                                                             %
6129 %                                                                             %
6130 %                                                                             %
6131 %   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6132 %                                                                             %
6133 %                                                                             %
6134 %                                                                             %
6135 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6136 %
6137 %  MagickLiquidRescaleImage() rescales image with seam carving.
6138 %
6139 %      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6140 %        const size_t columns,const size_t rows,
6141 %        const double delta_x,const double rigidity)
6142 %
6143 %  A description of each parameter follows:
6144 %
6145 %    o wand: the magick wand.
6146 %
6147 %    o columns: the number of columns in the scaled image.
6148 %
6149 %    o rows: the number of rows in the scaled image.
6150 %
6151 %    o delta_x: maximum seam transversal step (0 means straight seams).
6152 %
6153 %    o rigidity: introduce a bias for non-straight seams (typically 0).
6154 %
6155 */
6156 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6157   const size_t columns,const size_t rows,const double delta_x,
6158   const double rigidity)
6159 {
6160   Image
6161     *rescale_image;
6162
6163   assert(wand != (MagickWand *) NULL);
6164   assert(wand->signature == WandSignature);
6165   if (wand->debug != MagickFalse)
6166     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6167   if (wand->images == (Image *) NULL)
6168     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6169   rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6170     rigidity,wand->exception);
6171   if (rescale_image == (Image *) NULL)
6172     return(MagickFalse);
6173   ReplaceImageInList(&wand->images,rescale_image);
6174   return(MagickTrue);
6175 }
6176 \f
6177 /*
6178 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6179 %                                                                             %
6180 %                                                                             %
6181 %                                                                             %
6182 %   M a g i c k M a g n i f y I m a g e                                       %
6183 %                                                                             %
6184 %                                                                             %
6185 %                                                                             %
6186 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6187 %
6188 %  MagickMagnifyImage() is a convenience method that scales an image
6189 %  proportionally to twice its original size.
6190 %
6191 %  The format of the MagickMagnifyImage method is:
6192 %
6193 %      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6194 %
6195 %  A description of each parameter follows:
6196 %
6197 %    o wand: the magick wand.
6198 %
6199 */
6200 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6201 {
6202   Image
6203     *magnify_image;
6204
6205   assert(wand != (MagickWand *) NULL);
6206   assert(wand->signature == WandSignature);
6207   if (wand->debug != MagickFalse)
6208     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6209   if (wand->images == (Image *) NULL)
6210     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6211   magnify_image=MagnifyImage(wand->images,wand->exception);
6212   if (magnify_image == (Image *) NULL)
6213     return(MagickFalse);
6214   ReplaceImageInList(&wand->images,magnify_image);
6215   return(MagickTrue);
6216 }
6217 \f
6218 /*
6219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6220 %                                                                             %
6221 %                                                                             %
6222 %                                                                             %
6223 %   M a g i c k M e r g e I m a g e L a y e r s                               %
6224 %                                                                             %
6225 %                                                                             %
6226 %                                                                             %
6227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6228 %
6229 %  MagickMergeImageLayers() composes all the image layers from the current
6230 %  given image onward to produce a single image of the merged layers.
6231 %
6232 %  The inital canvas's size depends on the given ImageLayerMethod, and is
6233 %  initialized using the first images background color.  The images
6234 %  are then compositied onto that image in sequence using the given
6235 %  composition that has been assigned to each individual image.
6236 %
6237 %  The format of the MagickMergeImageLayers method is:
6238 %
6239 %      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6240 %        const ImageLayerMethod method)
6241 %
6242 %  A description of each parameter follows:
6243 %
6244 %    o wand: the magick wand.
6245 %
6246 %    o method: the method of selecting the size of the initial canvas.
6247 %
6248 %        MergeLayer: Merge all layers onto a canvas just large enough
6249 %           to hold all the actual images. The virtual canvas of the
6250 %           first image is preserved but otherwise ignored.
6251 %
6252 %        FlattenLayer: Use the virtual canvas size of first image.
6253 %           Images which fall outside this canvas is clipped.
6254 %           This can be used to 'fill out' a given virtual canvas.
6255 %
6256 %        MosaicLayer: Start with the virtual canvas of the first image,
6257 %           enlarging left and right edges to contain all images.
6258 %           Images with negative offsets will be clipped.
6259 %
6260 */
6261 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6262   const ImageLayerMethod method)
6263 {
6264   Image
6265     *mosaic_image;
6266
6267   assert(wand != (MagickWand *) NULL);
6268   assert(wand->signature == WandSignature);
6269   if (wand->debug != MagickFalse)
6270     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6271   if (wand->images == (Image *) NULL)
6272     return((MagickWand *) NULL);
6273   mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6274   if (mosaic_image == (Image *) NULL)
6275     return((MagickWand *) NULL);
6276   return(CloneMagickWandFromImages(wand,mosaic_image));
6277 }
6278 \f
6279 /*
6280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6281 %                                                                             %
6282 %                                                                             %
6283 %                                                                             %
6284 %   M a g i c k M i n i f y I m a g e                                         %
6285 %                                                                             %
6286 %                                                                             %
6287 %                                                                             %
6288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6289 %
6290 %  MagickMinifyImage() is a convenience method that scales an image
6291 %  proportionally to one-half its original size
6292 %
6293 %  The format of the MagickMinifyImage method is:
6294 %
6295 %      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6296 %
6297 %  A description of each parameter follows:
6298 %
6299 %    o wand: the magick wand.
6300 %
6301 */
6302 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6303 {
6304   Image
6305     *minify_image;
6306
6307   assert(wand != (MagickWand *) NULL);
6308   assert(wand->signature == WandSignature);
6309   if (wand->debug != MagickFalse)
6310     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6311   if (wand->images == (Image *) NULL)
6312     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6313   minify_image=MinifyImage(wand->images,wand->exception);
6314   if (minify_image == (Image *) NULL)
6315     return(MagickFalse);
6316   ReplaceImageInList(&wand->images,minify_image);
6317   return(MagickTrue);
6318 }
6319 \f
6320 /*
6321 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6322 %                                                                             %
6323 %                                                                             %
6324 %                                                                             %
6325 %   M a g i c k M o d u l a t e I m a g e                                     %
6326 %                                                                             %
6327 %                                                                             %
6328 %                                                                             %
6329 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6330 %
6331 %  MagickModulateImage() lets you control the brightness, saturation, and hue
6332 %  of an image.  Hue is the percentage of absolute rotation from the current
6333 %  position.  For example 50 results in a counter-clockwise rotation of 90
6334 %  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6335 %  both resulting in a rotation of 180 degrees.
6336 %
6337 %  To increase the color brightness by 20% and decrease the color saturation by
6338 %  10% and leave the hue unchanged, use: 120,90,100.
6339 %
6340 %  The format of the MagickModulateImage method is:
6341 %
6342 %      MagickBooleanType MagickModulateImage(MagickWand *wand,
6343 %        const double brightness,const double saturation,const double hue)
6344 %
6345 %  A description of each parameter follows:
6346 %
6347 %    o wand: the magick wand.
6348 %
6349 %    o brightness: the percent change in brighness.
6350 %
6351 %    o saturation: the percent change in saturation.
6352 %
6353 %    o hue: the percent change in hue.
6354 %
6355 */
6356 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6357   const double brightness,const double saturation,const double hue)
6358 {
6359   char
6360     modulate[MaxTextExtent];
6361
6362   MagickBooleanType
6363     status;
6364
6365   assert(wand != (MagickWand *) NULL);
6366   assert(wand->signature == WandSignature);
6367   if (wand->debug != MagickFalse)
6368     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6369   if (wand->images == (Image *) NULL)
6370     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6371   (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6372     brightness,saturation,hue);
6373   status=ModulateImage(wand->images,modulate,&wand->images->exception);
6374   return(status);
6375 }
6376 \f
6377 /*
6378 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6379 %                                                                             %
6380 %                                                                             %
6381 %                                                                             %
6382 %   M a g i c k M o n t a g e I m a g e                                       %
6383 %                                                                             %
6384 %                                                                             %
6385 %                                                                             %
6386 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6387 %
6388 %  MagickMontageImage() creates a composite image by combining several
6389 %  separate images. The images are tiled on the composite image with the name
6390 %  of the image optionally appearing just below the individual tile.
6391 %
6392 %  The format of the MagickMontageImage method is:
6393 %
6394 %      MagickWand *MagickMontageImage(MagickWand *wand,
6395 %        const DrawingWand drawing_wand,const char *tile_geometry,
6396 %        const char *thumbnail_geometry,const MontageMode mode,
6397 %        const char *frame)
6398 %
6399 %  A description of each parameter follows:
6400 %
6401 %    o wand: the magick wand.
6402 %
6403 %    o drawing_wand: the drawing wand.  The font name, size, and color are
6404 %      obtained from this wand.
6405 %
6406 %    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6407 %
6408 %    o thumbnail_geometry: Preferred image size and border size of each
6409 %      thumbnail (e.g. 120x120+4+3>).
6410 %
6411 %    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6412 %
6413 %    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6414 %      The frame color is that of the thumbnail's matte color.
6415 %
6416 */
6417 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6418   const DrawingWand *drawing_wand,const char *tile_geometry,
6419   const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6420 {
6421   char
6422     *font;
6423
6424   Image
6425     *montage_image;
6426
6427   MontageInfo
6428     *montage_info;
6429
6430   PixelWand
6431     *pixel_wand;
6432
6433   assert(wand != (MagickWand *) NULL);
6434   assert(wand->signature == WandSignature);
6435   if (wand->debug != MagickFalse)
6436     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6437   if (wand->images == (Image *) NULL)
6438     return((MagickWand *) NULL);
6439   montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6440   switch (mode)
6441   {
6442     case FrameMode:
6443     {
6444       (void) CloneString(&montage_info->frame,"15x15+3+3");
6445       montage_info->shadow=MagickTrue;
6446       break;
6447     }
6448     case UnframeMode:
6449     {
6450       montage_info->frame=(char *) NULL;
6451       montage_info->shadow=MagickFalse;
6452       montage_info->border_width=0;
6453       break;
6454     }
6455     case ConcatenateMode:
6456     {
6457       montage_info->frame=(char *) NULL;
6458       montage_info->shadow=MagickFalse;
6459       (void) CloneString(&montage_info->geometry,"+0+0");
6460       montage_info->border_width=0;
6461       break;
6462     }
6463     default:
6464       break;
6465   }
6466   font=DrawGetFont(drawing_wand);
6467   if (font != (char *) NULL)
6468     (void) CloneString(&montage_info->font,font);
6469   if (frame != (char *) NULL)
6470     (void) CloneString(&montage_info->frame,frame);
6471   montage_info->pointsize=DrawGetFontSize(drawing_wand);
6472   pixel_wand=NewPixelWand();
6473   DrawGetFillColor(drawing_wand,pixel_wand);
6474   PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6475   DrawGetStrokeColor(drawing_wand,pixel_wand);
6476   PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6477   pixel_wand=DestroyPixelWand(pixel_wand);
6478   if (thumbnail_geometry != (char *) NULL)
6479     (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6480   if (tile_geometry != (char *) NULL)
6481     (void) CloneString(&montage_info->tile,tile_geometry);
6482   montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6483     wand->exception);
6484   montage_info=DestroyMontageInfo(montage_info);
6485   if (montage_image == (Image *) NULL)
6486     return((MagickWand *) NULL);
6487   return(CloneMagickWandFromImages(wand,montage_image));
6488 }
6489 \f
6490 /*
6491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6492 %                                                                             %
6493 %                                                                             %
6494 %                                                                             %
6495 %   M a g i c k M o r p h I m a g e s                                         %
6496 %                                                                             %
6497 %                                                                             %
6498 %                                                                             %
6499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6500 %
6501 %  MagickMorphImages() method morphs a set of images.  Both the image pixels
6502 %  and size are linearly interpolated to give the appearance of a
6503 %  meta-morphosis from one image to the next.
6504 %
6505 %  The format of the MagickMorphImages method is:
6506 %
6507 %      MagickWand *MagickMorphImages(MagickWand *wand,
6508 %        const size_t number_frames)
6509 %
6510 %  A description of each parameter follows:
6511 %
6512 %    o wand: the magick wand.
6513 %
6514 %    o number_frames: the number of in-between images to generate.
6515 %
6516 */
6517 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6518   const size_t number_frames)
6519 {
6520   Image
6521     *morph_image;
6522
6523   assert(wand != (MagickWand *) NULL);
6524   assert(wand->signature == WandSignature);
6525   if (wand->debug != MagickFalse)
6526     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6527   if (wand->images == (Image *) NULL)
6528     return((MagickWand *) NULL);
6529   morph_image=MorphImages(wand->images,number_frames,wand->exception);
6530   if (morph_image == (Image *) NULL)
6531     return((MagickWand *) NULL);
6532   return(CloneMagickWandFromImages(wand,morph_image));
6533 }
6534 \f
6535 /*
6536 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6537 %                                                                             %
6538 %                                                                             %
6539 %                                                                             %
6540 %   M a g i c k M o r p h o l o g y I m a g e                                 %
6541 %                                                                             %
6542 %                                                                             %
6543 %                                                                             %
6544 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6545 %
6546 %  MagickMorphologyImage() applies a user supplied kernel to the image
6547 %  according to the given mophology method.
6548 %
6549 %  The format of the MagickMorphologyImage method is:
6550 %
6551 %      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6552 %        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6553 %
6554 %  A description of each parameter follows:
6555 %
6556 %    o wand: the magick wand.
6557 %
6558 %    o method: the morphology method to be applied.
6559 %
6560 %    o iterations: apply the operation this many times (or no change).
6561 %      A value of -1 means loop until no change found.  How this is applied
6562 %      may depend on the morphology method.  Typically this is a value of 1.
6563 %
6564 %    o kernel: An array of doubles representing the morphology kernel.
6565 %
6566 */
6567 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6568   MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6569 {
6570   Image
6571     *morphology_image;
6572
6573   assert(wand != (MagickWand *) NULL);
6574   assert(wand->signature == WandSignature);
6575   if (wand->debug != MagickFalse)
6576     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6577   if (kernel == (const KernelInfo *) NULL)
6578     return(MagickFalse);
6579   if (wand->images == (Image *) NULL)
6580     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6581   morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6582     wand->exception);
6583   if (morphology_image == (Image *) NULL)
6584     return(MagickFalse);
6585   ReplaceImageInList(&wand->images,morphology_image);
6586   return(MagickTrue);
6587 }
6588 \f
6589 /*
6590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6591 %                                                                             %
6592 %                                                                             %
6593 %                                                                             %
6594 %   M a g i c k M o t i o n B l u r I m a g e                                 %
6595 %                                                                             %
6596 %                                                                             %
6597 %                                                                             %
6598 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6599 %
6600 %  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6601 %  Gaussian operator of the given radius and standard deviation (sigma).
6602 %  For reasonable results, radius should be larger than sigma.  Use a
6603 %  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6604 %  Angle gives the angle of the blurring motion.
6605 %
6606 %  The format of the MagickMotionBlurImage method is:
6607 %
6608 %      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6609 %        const double radius,const double sigma,const double angle,
6610 %        const double bias)
6611 %
6612 %  A description of each parameter follows:
6613 %
6614 %    o wand: the magick wand.
6615 %
6616 %    o radius: the radius of the Gaussian, in pixels, not counting
6617 %      the center pixel.
6618 %
6619 %    o sigma: the standard deviation of the Gaussian, in pixels.
6620 %
6621 %    o angle: Apply the effect along this angle.
6622 %
6623 */
6624 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6625   const double radius,const double sigma,const double angle,const double bias)
6626 {
6627   Image
6628     *blur_image;
6629
6630   assert(wand != (MagickWand *) NULL);
6631   assert(wand->signature == WandSignature);
6632   if (wand->debug != MagickFalse)
6633     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6634   if (wand->images == (Image *) NULL)
6635     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6636   blur_image=MotionBlurImage(wand->images,radius,sigma,angle,bias,
6637     wand->exception);
6638   if (blur_image == (Image *) NULL)
6639     return(MagickFalse);
6640   ReplaceImageInList(&wand->images,blur_image);
6641   return(MagickTrue);
6642 }
6643 \f
6644 /*
6645 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6646 %                                                                             %
6647 %                                                                             %
6648 %                                                                             %
6649 %   M a g i c k N e g a t e I m a g e                                         %
6650 %                                                                             %
6651 %                                                                             %
6652 %                                                                             %
6653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6654 %
6655 %  MagickNegateImage() negates the colors in the reference image.  The
6656 %  Grayscale option means that only grayscale values within the image are
6657 %  negated.
6658 %
6659 %  You can also reduce the influence of a particular channel with a gamma
6660 %  value of 0.
6661 %
6662 %  The format of the MagickNegateImage method is:
6663 %
6664 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
6665 %        const MagickBooleanType gray)
6666 %
6667 %  A description of each parameter follows:
6668 %
6669 %    o wand: the magick wand.
6670 %
6671 %    o gray: If MagickTrue, only negate grayscale pixels within the image.
6672 %
6673 */
6674 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6675   const MagickBooleanType gray)
6676 {
6677   MagickBooleanType
6678     status;
6679
6680   assert(wand != (MagickWand *) NULL);
6681   assert(wand->signature == WandSignature);
6682   if (wand->debug != MagickFalse)
6683     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6684   if (wand->images == (Image *) NULL)
6685     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6686   status=NegateImage(wand->images,gray,wand->exception);
6687   return(status);
6688 }
6689 \f
6690 /*
6691 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6692 %                                                                             %
6693 %                                                                             %
6694 %                                                                             %
6695 %   M a g i c k N e w I m a g e                                               %
6696 %                                                                             %
6697 %                                                                             %
6698 %                                                                             %
6699 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6700 %
6701 %  MagickNewImage() adds a blank image canvas of the specified size and
6702 %  background color to the wand.
6703 %
6704 %  The format of the MagickNewImage method is:
6705 %
6706 %      MagickBooleanType MagickNewImage(MagickWand *wand,
6707 %        const size_t columns,const size_t rows,
6708 %        const PixelWand *background)
6709 %
6710 %  A description of each parameter follows:
6711 %
6712 %    o wand: the magick wand.
6713 %
6714 %    o width: the image width.
6715 %
6716 %    o height: the image height.
6717 %
6718 %    o background: the image color.
6719 %
6720 */
6721 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
6722   const size_t height,const PixelWand *background)
6723 {
6724   Image
6725     *images;
6726
6727   PixelInfo
6728     pixel;
6729
6730   assert(wand != (MagickWand *) NULL);
6731   assert(wand->signature == WandSignature);
6732   if (wand->debug != MagickFalse)
6733     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6734   PixelGetMagickColor(background,&pixel);
6735   images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
6736   if (images == (Image *) NULL)
6737     return(MagickFalse);
6738   return(InsertImageInWand(wand,images));
6739 }
6740 \f
6741 /*
6742 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6743 %                                                                             %
6744 %                                                                             %
6745 %                                                                             %
6746 %   M a g i c k N e x t I m a g e                                             %
6747 %                                                                             %
6748 %                                                                             %
6749 %                                                                             %
6750 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6751 %
6752 %  MagickNextImage() associates the next image in the image list with a magick
6753 %  wand.  It returns true if the it succeeds, meaning the current image is the
6754 %  next image to be iterated over.
6755 %
6756 %  The format of the MagickNextImage method is:
6757 %
6758 %      MagickBooleanType MagickNextImage(MagickWand *wand)
6759 %
6760 %  A description of each parameter follows:
6761 %
6762 %    o wand: the magick wand.
6763 %
6764 */
6765 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
6766 {
6767   assert(wand != (MagickWand *) NULL);
6768   assert(wand->signature == WandSignature);
6769   if (wand->debug != MagickFalse)
6770     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6771   if (wand->images == (Image *) NULL)
6772     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6773   /* If current image is 'pending' just return true.  */
6774   if (wand->image_pending != MagickFalse)
6775     {
6776       wand->image_pending=MagickFalse;
6777       return(MagickTrue);
6778     }
6779   /* If there is no next image, (Iterator is finished) */
6780   if (GetNextImageInList(wand->images) == (Image *) NULL)
6781       return(MagickFalse);
6782   /* just move to next image - current image is not 'pending' */
6783   wand->images=GetNextImageInList(wand->images);
6784   return(MagickTrue);
6785 }
6786 \f
6787 /*
6788 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6789 %                                                                             %
6790 %                                                                             %
6791 %                                                                             %
6792 %   M a g i c k N o r m a l i z e I m a g e                                   %
6793 %                                                                             %
6794 %                                                                             %
6795 %                                                                             %
6796 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6797 %
6798 %  MagickNormalizeImage() enhances the contrast of a color image by adjusting
6799 %  the pixels color to span the entire range of colors available
6800 %
6801 %  You can also reduce the influence of a particular channel with a gamma
6802 %  value of 0.
6803 %
6804 %  The format of the MagickNormalizeImage method is:
6805 %
6806 %      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6807 %
6808 %  A description of each parameter follows:
6809 %
6810 %    o wand: the magick wand.
6811 %
6812 */
6813 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6814 {
6815   MagickBooleanType
6816     status;
6817
6818   assert(wand != (MagickWand *) NULL);
6819   assert(wand->signature == WandSignature);
6820   if (wand->debug != MagickFalse)
6821     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6822   if (wand->images == (Image *) NULL)
6823     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6824   status=NormalizeImage(wand->images,&wand->images->exception);
6825   return(status);
6826 }
6827 \f
6828 /*
6829 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6830 %                                                                             %
6831 %                                                                             %
6832 %                                                                             %
6833 %   M a g i c k O i l P a i n t I m a g e                                     %
6834 %                                                                             %
6835 %                                                                             %
6836 %                                                                             %
6837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6838 %
6839 %  MagickOilPaintImage() applies a special effect filter that simulates an oil
6840 %  painting.  Each pixel is replaced by the most frequent color occurring
6841 %  in a circular region defined by radius.
6842 %
6843 %  The format of the MagickOilPaintImage method is:
6844 %
6845 %      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6846 %        const double radius,const double sigma)
6847 %
6848 %  A description of each parameter follows:
6849 %
6850 %    o wand: the magick wand.
6851 %
6852 %    o radius: the radius of the circular neighborhood.
6853 %
6854 %    o sigma: the standard deviation of the Gaussian, in pixels.
6855 %
6856 */
6857 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6858   const double radius,const double sigma)
6859 {
6860   Image
6861     *paint_image;
6862
6863   assert(wand != (MagickWand *) NULL);
6864   assert(wand->signature == WandSignature);
6865   if (wand->debug != MagickFalse)
6866     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6867   if (wand->images == (Image *) NULL)
6868     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6869   paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
6870   if (paint_image == (Image *) NULL)
6871     return(MagickFalse);
6872   ReplaceImageInList(&wand->images,paint_image);
6873   return(MagickTrue);
6874 }
6875 \f
6876 /*
6877 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6878 %                                                                             %
6879 %                                                                             %
6880 %                                                                             %
6881 %   M a g i c k O p a q u e P a i n t I m a g e                               %
6882 %                                                                             %
6883 %                                                                             %
6884 %                                                                             %
6885 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6886 %
6887 %  MagickOpaquePaintImage() changes any pixel that matches color with the color
6888 %  defined by fill.
6889 %
6890 %  The format of the MagickOpaquePaintImage method is:
6891 %
6892 %      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6893 %        const PixelWand *target,const PixelWand *fill,const double fuzz,
6894 %        const MagickBooleanType invert)
6895 %
6896 %  A description of each parameter follows:
6897 %
6898 %    o wand: the magick wand.
6899 %
6900 %    o target: Change this target color to the fill color within the image.
6901 %
6902 %    o fill: the fill pixel wand.
6903 %
6904 %    o fuzz: By default target must match a particular pixel color
6905 %      exactly.  However, in many cases two colors may differ by a small amount.
6906 %      The fuzz member of image defines how much tolerance is acceptable to
6907 %      consider two colors as the same.  For example, set fuzz to 10 and the
6908 %      color red at intensities of 100 and 102 respectively are now interpreted
6909 %      as the same color for the purposes of the floodfill.
6910 %
6911 %    o invert: paint any pixel that does not match the target color.
6912 %
6913 */
6914 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6915   const PixelWand *target,const PixelWand *fill,const double fuzz,
6916   const MagickBooleanType invert)
6917 {
6918   MagickBooleanType
6919     status;
6920
6921   PixelInfo
6922     fill_pixel,
6923     target_pixel;
6924
6925   assert(wand != (MagickWand *) NULL);
6926   assert(wand->signature == WandSignature);
6927   if (wand->debug != MagickFalse)
6928     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6929   if (wand->images == (Image *) NULL)
6930     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6931   PixelGetMagickColor(target,&target_pixel);
6932   PixelGetMagickColor(fill,&fill_pixel);
6933   wand->images->fuzz=fuzz;
6934   status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
6935     &wand->images->exception);
6936   return(status);
6937 }
6938 \f
6939 /*
6940 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6941 %                                                                             %
6942 %                                                                             %
6943 %                                                                             %
6944 %   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                         %
6945 %                                                                             %
6946 %                                                                             %
6947 %                                                                             %
6948 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6949 %
6950 %  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
6951 %  previous image in the sequence.  From this it attempts to select the
6952 %  smallest cropped image to replace each frame, while preserving the results
6953 %  of the animation.
6954 %
6955 %  The format of the MagickOptimizeImageLayers method is:
6956 %
6957 %      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6958 %
6959 %  A description of each parameter follows:
6960 %
6961 %    o wand: the magick wand.
6962 %
6963 */
6964 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6965 {
6966   Image
6967     *optimize_image;
6968
6969   assert(wand != (MagickWand *) NULL);
6970   assert(wand->signature == WandSignature);
6971   if (wand->debug != MagickFalse)
6972     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6973   if (wand->images == (Image *) NULL)
6974     return((MagickWand *) NULL);
6975   optimize_image=OptimizeImageLayers(wand->images,wand->exception);
6976   if (optimize_image == (Image *) NULL)
6977     return((MagickWand *) NULL);
6978   return(CloneMagickWandFromImages(wand,optimize_image));
6979 }
6980 \f
6981 /*
6982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6983 %                                                                             %
6984 %                                                                             %
6985 %                                                                             %
6986 %     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                   %
6987 %                                                                             %
6988 %                                                                             %
6989 %                                                                             %
6990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6991 %
6992 %  MagickOrderedPosterizeImage() performs an ordered dither based on a number
6993 %  of pre-defined dithering threshold maps, but over multiple intensity levels,
6994 %  which can be different for different channels, according to the input
6995 %  arguments.
6996 %
6997 %  The format of the MagickOrderedPosterizeImage method is:
6998 %
6999 %      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7000 %        const char *threshold_map)
7001 %
7002 %  A description of each parameter follows:
7003 %
7004 %    o image: the image.
7005 %
7006 %    o threshold_map: A string containing the name of the threshold dither
7007 %      map to use, followed by zero or more numbers representing the number of
7008 %      color levels tho dither between.
7009 %
7010 %      Any level number less than 2 is equivalent to 2, and means only binary
7011 %      dithering will be applied to each color channel.
7012 %
7013 %      No numbers also means a 2 level (bitmap) dither will be applied to all
7014 %      channels, while a single number is the number of levels applied to each
7015 %      channel in sequence.  More numbers will be applied in turn to each of
7016 %      the color channels.
7017 %
7018 %      For example: "o3x3,6" generates a 6 level posterization of the image
7019 %      with a ordered 3x3 diffused pixel dither being applied between each
7020 %      level. While checker,8,8,4 will produce a 332 colormaped image with
7021 %      only a single checkerboard hash pattern (50% grey) between each color
7022 %      level, to basically double the number of color levels with a bare
7023 %      minimim of dithering.
7024 %
7025 */
7026 WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7027   const char *threshold_map)
7028 {
7029   MagickBooleanType
7030     status;
7031
7032   assert(wand != (MagickWand *) NULL);
7033   assert(wand->signature == WandSignature);
7034   if (wand->debug != MagickFalse)
7035     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7036   if (wand->images == (Image *) NULL)
7037     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7038   status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7039   return(status);
7040 }
7041 \f
7042 /*
7043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7044 %                                                                             %
7045 %                                                                             %
7046 %                                                                             %
7047 %   M a g i c k P i n g I m a g e                                             %
7048 %                                                                             %
7049 %                                                                             %
7050 %                                                                             %
7051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7052 %
7053 %  MagickPingImage() is the same as MagickReadImage() except the only valid
7054 %  information returned is the image width, height, size, and format.  It
7055 %  is designed to efficiently obtain this information from a file without
7056 %  reading the entire image sequence into memory.
7057 %
7058 %  The format of the MagickPingImage method is:
7059 %
7060 %      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7061 %
7062 %  A description of each parameter follows:
7063 %
7064 %    o wand: the magick wand.
7065 %
7066 %    o filename: the image filename.
7067 %
7068 */
7069 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7070   const char *filename)
7071 {
7072   Image
7073     *images;
7074
7075   ImageInfo
7076     *ping_info;
7077
7078   assert(wand != (MagickWand *) NULL);
7079   assert(wand->signature == WandSignature);
7080   if (wand->debug != MagickFalse)
7081     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7082   ping_info=CloneImageInfo(wand->image_info);
7083   if (filename != (const char *) NULL)
7084     (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7085   images=PingImage(ping_info,wand->exception);
7086   ping_info=DestroyImageInfo(ping_info);
7087   if (images == (Image *) NULL)
7088     return(MagickFalse);
7089   return(InsertImageInWand(wand,images));
7090 }
7091 \f
7092 /*
7093 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7094 %                                                                             %
7095 %                                                                             %
7096 %                                                                             %
7097 %   M a g i c k P i n g I m a g e B l o b                                     %
7098 %                                                                             %
7099 %                                                                             %
7100 %                                                                             %
7101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7102 %
7103 %  MagickPingImageBlob() pings an image or image sequence from a blob.
7104 %
7105 %  The format of the MagickPingImageBlob method is:
7106 %
7107 %      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7108 %        const void *blob,const size_t length)
7109 %
7110 %  A description of each parameter follows:
7111 %
7112 %    o wand: the magick wand.
7113 %
7114 %    o blob: the blob.
7115 %
7116 %    o length: the blob length.
7117 %
7118 */
7119 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7120   const void *blob,const size_t length)
7121 {
7122   Image
7123     *images;
7124
7125   ImageInfo
7126     *read_info;
7127
7128   assert(wand != (MagickWand *) NULL);
7129   assert(wand->signature == WandSignature);
7130   if (wand->debug != MagickFalse)
7131     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7132   read_info=CloneImageInfo(wand->image_info);
7133   SetImageInfoBlob(read_info,blob,length);
7134   images=PingImage(read_info,wand->exception);
7135   read_info=DestroyImageInfo(read_info);
7136   if (images == (Image *) NULL)
7137     return(MagickFalse);
7138   return(InsertImageInWand(wand,images));
7139 }
7140 \f
7141 /*
7142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7143 %                                                                             %
7144 %                                                                             %
7145 %                                                                             %
7146 %   M a g i c k P i n g I m a g e F i l e                                     %
7147 %                                                                             %
7148 %                                                                             %
7149 %                                                                             %
7150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7151 %
7152 %  MagickPingImageFile() pings an image or image sequence from an open file
7153 %  descriptor.
7154 %
7155 %  The format of the MagickPingImageFile method is:
7156 %
7157 %      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7158 %
7159 %  A description of each parameter follows:
7160 %
7161 %    o wand: the magick wand.
7162 %
7163 %    o file: the file descriptor.
7164 %
7165 */
7166 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7167 {
7168   Image
7169     *images;
7170
7171   ImageInfo
7172     *read_info;
7173
7174   assert(wand != (MagickWand *) NULL);
7175   assert(wand->signature == WandSignature);
7176   assert(file != (FILE *) NULL);
7177   if (wand->debug != MagickFalse)
7178     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7179   read_info=CloneImageInfo(wand->image_info);
7180   SetImageInfoFile(read_info,file);
7181   images=PingImage(read_info,wand->exception);
7182   read_info=DestroyImageInfo(read_info);
7183   if (images == (Image *) NULL)
7184     return(MagickFalse);
7185   return(InsertImageInWand(wand,images));
7186 }
7187 \f
7188 /*
7189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7190 %                                                                             %
7191 %                                                                             %
7192 %                                                                             %
7193 %   M a g i c k P o l a r o i d I m a g e                                     %
7194 %                                                                             %
7195 %                                                                             %
7196 %                                                                             %
7197 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7198 %
7199 %  MagickPolaroidImage() simulates a Polaroid picture.
7200 %
7201 %  The format of the MagickPolaroidImage method is:
7202 %
7203 %      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7204 %        const DrawingWand *drawing_wand,const double angle,
7205 %        const PixelInterpolateMethod method)
7206 %
7207 %  A description of each parameter follows:
7208 %
7209 %    o wand: the magick wand.
7210 %
7211 %    o drawing_wand: the draw wand.
7212 %
7213 %    o angle: Apply the effect along this angle.
7214 %
7215 %    o method: the pixel interpolation method.
7216 %
7217 */
7218 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7219   const DrawingWand *drawing_wand,const double angle,
7220   const PixelInterpolateMethod method)
7221 {
7222   DrawInfo
7223     *draw_info;
7224
7225   Image
7226     *polaroid_image;
7227
7228   assert(wand != (MagickWand *) NULL);
7229   assert(wand->signature == WandSignature);
7230   if (wand->debug != MagickFalse)
7231     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7232   if (wand->images == (Image *) NULL)
7233     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7234   draw_info=PeekDrawingWand(drawing_wand);
7235   if (draw_info == (DrawInfo *) NULL)
7236     return(MagickFalse);
7237   polaroid_image=PolaroidImage(wand->images,draw_info,angle,method,
7238     wand->exception);
7239   if (polaroid_image == (Image *) NULL)
7240     return(MagickFalse);
7241   ReplaceImageInList(&wand->images,polaroid_image);
7242   return(MagickTrue);
7243 }
7244 \f
7245 /*
7246 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7247 %                                                                             %
7248 %                                                                             %
7249 %                                                                             %
7250 %   M a g i c k P o s t e r i z e I m a g e                                   %
7251 %                                                                             %
7252 %                                                                             %
7253 %                                                                             %
7254 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7255 %
7256 %  MagickPosterizeImage() reduces the image to a limited number of color level.
7257 %
7258 %  The format of the MagickPosterizeImage method is:
7259 %
7260 %      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7261 %        const unsigned levels,const MagickBooleanType dither)
7262 %
7263 %  A description of each parameter follows:
7264 %
7265 %    o wand: the magick wand.
7266 %
7267 %    o levels: Number of color levels allowed in each channel.  Very low values
7268 %      (2, 3, or 4) have the most visible effect.
7269 %
7270 %    o dither: Set this integer value to something other than zero to dither
7271 %      the mapped image.
7272 %
7273 */
7274 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7275   const size_t levels,const MagickBooleanType dither)
7276 {
7277   MagickBooleanType
7278     status;
7279
7280   assert(wand != (MagickWand *) NULL);
7281   assert(wand->signature == WandSignature);
7282   if (wand->debug != MagickFalse)
7283     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7284   if (wand->images == (Image *) NULL)
7285     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7286   status=PosterizeImage(wand->images,levels,dither,wand->exception);
7287   return(status);
7288 }
7289 \f
7290 /*
7291 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7292 %                                                                             %
7293 %                                                                             %
7294 %                                                                             %
7295 %   M a g i c k P r e v i e w I m a g e s                                     %
7296 %                                                                             %
7297 %                                                                             %
7298 %                                                                             %
7299 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7300 %
7301 %  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7302 %  image processing operation applied at varying strengths.  This helpful
7303 %  to quickly pin-point an appropriate parameter for an image processing
7304 %  operation.
7305 %
7306 %  The format of the MagickPreviewImages method is:
7307 %
7308 %      MagickWand *MagickPreviewImages(MagickWand *wand,
7309 %        const PreviewType preview)
7310 %
7311 %  A description of each parameter follows:
7312 %
7313 %    o wand: the magick wand.
7314 %
7315 %    o preview: the preview type.
7316 %
7317 */
7318 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7319   const PreviewType preview)
7320 {
7321   Image
7322     *preview_image;
7323
7324   assert(wand != (MagickWand *) NULL);
7325   assert(wand->signature == WandSignature);
7326   if (wand->debug != MagickFalse)
7327     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7328   if (wand->images == (Image *) NULL)
7329     return((MagickWand *) NULL);
7330   preview_image=PreviewImage(wand->images,preview,wand->exception);
7331   if (preview_image == (Image *) NULL)
7332     return((MagickWand *) NULL);
7333   return(CloneMagickWandFromImages(wand,preview_image));
7334 }
7335 \f
7336 /*
7337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7338 %                                                                             %
7339 %                                                                             %
7340 %                                                                             %
7341 %   M a g i c k P r e v i o u s I m a g e                                     %
7342 %                                                                             %
7343 %                                                                             %
7344 %                                                                             %
7345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7346 %
7347 %  MagickPreviousImage() assocates the previous image in an image list with
7348 %  the magick wand.
7349 %
7350 %  The format of the MagickPreviousImage method is:
7351 %
7352 %      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7353 %
7354 %  A description of each parameter follows:
7355 %
7356 %    o wand: the magick wand.
7357 %
7358 */
7359 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7360 {
7361   assert(wand != (MagickWand *) NULL);
7362   assert(wand->signature == WandSignature);
7363   if (wand->debug != MagickFalse)
7364     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7365   if (wand->images == (Image *) NULL)
7366     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7367
7368   wand->image_pending=MagickFalse;  /* pending status has no meaning */
7369   /* If there is no prev image, return false (Iterator is finished) */
7370   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7371       return(MagickFalse);
7372   /* just do it - current image is not 'pending' */
7373   wand->images=GetPreviousImageInList(wand->images);
7374   return(MagickTrue);
7375 }
7376 \f
7377 /*
7378 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7379 %                                                                             %
7380 %                                                                             %
7381 %                                                                             %
7382 %   M a g i c k Q u a n t i z e I m a g e                                     %
7383 %                                                                             %
7384 %                                                                             %
7385 %                                                                             %
7386 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7387 %
7388 %  MagickQuantizeImage() analyzes the colors within a reference image and
7389 %  chooses a fixed number of colors to represent the image.  The goal of the
7390 %  algorithm is to minimize the color difference between the input and output
7391 %  image while minimizing the processing time.
7392 %
7393 %  The format of the MagickQuantizeImage method is:
7394 %
7395 %      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7396 %        const size_t number_colors,const ColorspaceType colorspace,
7397 %        const size_t treedepth,const MagickBooleanType dither,
7398 %        const MagickBooleanType measure_error)
7399 %
7400 %  A description of each parameter follows:
7401 %
7402 %    o wand: the magick wand.
7403 %
7404 %    o number_colors: the number of colors.
7405 %
7406 %    o colorspace: Perform color reduction in this colorspace, typically
7407 %      RGBColorspace.
7408 %
7409 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7410 %      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
7411 %      reference image with the least amount of memory and the fastest
7412 %      computational speed.  In some cases, such as an image with low color
7413 %      dispersion (a few number of colors), a value other than
7414 %      Log4(number_colors) is required.  To expand the color tree completely,
7415 %      use a value of 8.
7416 %
7417 %    o dither: A value other than zero distributes the difference between an
7418 %      original image and the corresponding color reduced image to
7419 %      neighboring pixels along a Hilbert curve.
7420 %
7421 %    o measure_error: A value other than zero measures the difference between
7422 %      the original and quantized images.  This difference is the total
7423 %      quantization error.  The error is computed by summing over all pixels
7424 %      in an image the distance squared in RGB space between each reference
7425 %      pixel value and its quantized value.
7426 %
7427 */
7428 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7429   const size_t number_colors,const ColorspaceType colorspace,
7430   const size_t treedepth,const MagickBooleanType dither,
7431   const MagickBooleanType measure_error)
7432 {
7433   MagickBooleanType
7434     status;
7435
7436   QuantizeInfo
7437     *quantize_info;
7438
7439   assert(wand != (MagickWand *) NULL);
7440   assert(wand->signature == WandSignature);
7441   if (wand->debug != MagickFalse)
7442     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7443   if (wand->images == (Image *) NULL)
7444     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7445   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7446   quantize_info->number_colors=number_colors;
7447   quantize_info->dither=dither;
7448   quantize_info->tree_depth=treedepth;
7449   quantize_info->colorspace=colorspace;
7450   quantize_info->measure_error=measure_error;
7451   status=QuantizeImage(quantize_info,wand->images,wand->exception);
7452   quantize_info=DestroyQuantizeInfo(quantize_info);
7453   return(status);
7454 }
7455 \f
7456 /*
7457 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7458 %                                                                             %
7459 %                                                                             %
7460 %                                                                             %
7461 %   M a g i c k Q u a n t i z e I m a g e s                                   %
7462 %                                                                             %
7463 %                                                                             %
7464 %                                                                             %
7465 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7466 %
7467 %  MagickQuantizeImages() analyzes the colors within a sequence of images and
7468 %  chooses a fixed number of colors to represent the image.  The goal of the
7469 %  algorithm is to minimize the color difference between the input and output
7470 %  image while minimizing the processing time.
7471 %
7472 %  The format of the MagickQuantizeImages method is:
7473 %
7474 %      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7475 %        const size_t number_colors,const ColorspaceType colorspace,
7476 %        const size_t treedepth,const MagickBooleanType dither,
7477 %        const MagickBooleanType measure_error)
7478 %
7479 %  A description of each parameter follows:
7480 %
7481 %    o wand: the magick wand.
7482 %
7483 %    o number_colors: the number of colors.
7484 %
7485 %    o colorspace: Perform color reduction in this colorspace, typically
7486 %      RGBColorspace.
7487 %
7488 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7489 %      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
7490 %      reference image with the least amount of memory and the fastest
7491 %      computational speed.  In some cases, such as an image with low color
7492 %      dispersion (a few number of colors), a value other than
7493 %      Log4(number_colors) is required.  To expand the color tree completely,
7494 %      use a value of 8.
7495 %
7496 %    o dither: A value other than zero distributes the difference between an
7497 %      original image and the corresponding color reduced algorithm to
7498 %      neighboring pixels along a Hilbert curve.
7499 %
7500 %    o measure_error: A value other than zero measures the difference between
7501 %      the original and quantized images.  This difference is the total
7502 %      quantization error.  The error is computed by summing over all pixels
7503 %      in an image the distance squared in RGB space between each reference
7504 %      pixel value and its quantized value.
7505 %
7506 */
7507 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7508   const size_t number_colors,const ColorspaceType colorspace,
7509   const size_t treedepth,const MagickBooleanType dither,
7510   const MagickBooleanType measure_error)
7511 {
7512   MagickBooleanType
7513     status;
7514
7515   QuantizeInfo
7516     *quantize_info;
7517
7518   assert(wand != (MagickWand *) NULL);
7519   assert(wand->signature == WandSignature);
7520   if (wand->debug != MagickFalse)
7521     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7522   if (wand->images == (Image *) NULL)
7523     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7524   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7525   quantize_info->number_colors=number_colors;
7526   quantize_info->dither=dither;
7527   quantize_info->tree_depth=treedepth;
7528   quantize_info->colorspace=colorspace;
7529   quantize_info->measure_error=measure_error;
7530   status=QuantizeImages(quantize_info,wand->images,wand->exception);
7531   quantize_info=DestroyQuantizeInfo(quantize_info);
7532   return(status);
7533 }
7534 \f
7535 /*
7536 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7537 %                                                                             %
7538 %                                                                             %
7539 %                                                                             %
7540 %   M a g i c k R a d i a l B l u r I m a g e                                 %
7541 %                                                                             %
7542 %                                                                             %
7543 %                                                                             %
7544 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7545 %
7546 %  MagickRadialBlurImage() radial blurs an image.
7547 %
7548 %  The format of the MagickRadialBlurImage method is:
7549 %
7550 %      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7551 %        const double angle,const double bias)
7552 %
7553 %  A description of each parameter follows:
7554 %
7555 %    o wand: the magick wand.
7556 %
7557 %    o angle: the angle of the blur in degrees.
7558 %
7559 %    o bias: the bias.
7560 %
7561 */
7562 WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7563   const double angle,const double bias)
7564 {
7565   Image
7566     *blur_image;
7567
7568   assert(wand != (MagickWand *) NULL);
7569   assert(wand->signature == WandSignature);
7570   if (wand->debug != MagickFalse)
7571     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7572   if (wand->images == (Image *) NULL)
7573     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7574   blur_image=RadialBlurImage(wand->images,angle,bias,wand->exception);
7575   if (blur_image == (Image *) NULL)
7576     return(MagickFalse);
7577   ReplaceImageInList(&wand->images,blur_image);
7578   return(MagickTrue);
7579 }
7580 \f
7581 /*
7582 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7583 %                                                                             %
7584 %                                                                             %
7585 %                                                                             %
7586 %   M a g i c k R a i s e I m a g e                                           %
7587 %                                                                             %
7588 %                                                                             %
7589 %                                                                             %
7590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7591 %
7592 %  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7593 %  by lightening and darkening the edges of the image.  Members width and
7594 %  height of raise_info define the width of the vertical and horizontal
7595 %  edge of the effect.
7596 %
7597 %  The format of the MagickRaiseImage method is:
7598 %
7599 %      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7600 %        const size_t width,const size_t height,const ssize_t x,
7601 %        const ssize_t y,const MagickBooleanType raise)
7602 %
7603 %  A description of each parameter follows:
7604 %
7605 %    o wand: the magick wand.
7606 %
7607 %    o width,height,x,y:  Define the dimensions of the area to raise.
7608 %
7609 %    o raise: A value other than zero creates a 3-D raise effect,
7610 %      otherwise it has a lowered effect.
7611 %
7612 */
7613 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7614   const size_t width,const size_t height,const ssize_t x,
7615   const ssize_t y,const MagickBooleanType raise)
7616 {
7617   MagickBooleanType
7618     status;
7619
7620   RectangleInfo
7621     raise_info;
7622
7623   assert(wand != (MagickWand *) NULL);
7624   assert(wand->signature == WandSignature);
7625   if (wand->debug != MagickFalse)
7626     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7627   if (wand->images == (Image *) NULL)
7628     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7629   raise_info.width=width;
7630   raise_info.height=height;
7631   raise_info.x=x;
7632   raise_info.y=y;
7633   status=RaiseImage(wand->images,&raise_info,raise,&wand->images->exception);
7634   return(status);
7635 }
7636 \f
7637 /*
7638 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7639 %                                                                             %
7640 %                                                                             %
7641 %                                                                             %
7642 %   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                       %
7643 %                                                                             %
7644 %                                                                             %
7645 %                                                                             %
7646 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7647 %
7648 %  MagickRandomThresholdImage() changes the value of individual pixels based on
7649 %  the intensity of each pixel compared to threshold.  The result is a
7650 %  high-contrast, two color image.
7651 %
7652 %  The format of the MagickRandomThresholdImage method is:
7653 %
7654 %      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7655 %        const double low,const double high)
7656 %
7657 %  A description of each parameter follows:
7658 %
7659 %    o wand: the magick wand.
7660 %
7661 %    o low,high: Specify the high and low thresholds.  These values range from
7662 %      0 to QuantumRange.
7663 %
7664 */
7665 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7666   const double low,const double high)
7667 {
7668   char
7669     threshold[MaxTextExtent];
7670
7671   assert(wand != (MagickWand *) NULL);
7672   assert(wand->signature == WandSignature);
7673   if (wand->debug != MagickFalse)
7674     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7675   if (wand->images == (Image *) NULL)
7676     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7677   (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
7678   return(RandomThresholdImage(wand->images,threshold,wand->exception));
7679 }
7680 \f
7681 /*
7682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7683 %                                                                             %
7684 %                                                                             %
7685 %                                                                             %
7686 %   M a g i c k R e a d I m a g e                                             %
7687 %                                                                             %
7688 %                                                                             %
7689 %                                                                             %
7690 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7691 %
7692 %  MagickReadImage() reads an image or image sequence.  The images are inserted
7693 %  at the current image pointer position.
7694 %
7695 %  Use MagickSetFirstIterator(), to insert new images before all the current
7696 %  images in the wand, MagickSetLastIterator() to append add to the end,
7697 %  MagickSetImageIndex() to place images just after the given index.
7698 %
7699 %  The format of the MagickReadImage method is:
7700 %
7701 %      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
7702 %
7703 %  A description of each parameter follows:
7704 %
7705 %    o wand: the magick wand.
7706 %
7707 %    o filename: the image filename.
7708 %
7709 */
7710 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
7711   const char *filename)
7712 {
7713   Image
7714     *images;
7715
7716   ImageInfo
7717     *read_info;
7718
7719   assert(wand != (MagickWand *) NULL);
7720   assert(wand->signature == WandSignature);
7721   if (wand->debug != MagickFalse)
7722     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7723   read_info=CloneImageInfo(wand->image_info);
7724   if (filename != (const char *) NULL)
7725     (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
7726   images=ReadImage(read_info,wand->exception);
7727   read_info=DestroyImageInfo(read_info);
7728   if (images == (Image *) NULL)
7729     return(MagickFalse);
7730   return(InsertImageInWand(wand,images));
7731 }
7732 \f
7733 /*
7734 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7735 %                                                                             %
7736 %                                                                             %
7737 %                                                                             %
7738 %   M a g i c k R e a d I m a g e B l o b                                     %
7739 %                                                                             %
7740 %                                                                             %
7741 %                                                                             %
7742 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7743 %
7744 %  MagickReadImageBlob() reads an image or image sequence from a blob.
7745 %  In all other respects it is like MagickReadImage().
7746 %
7747 %  The format of the MagickReadImageBlob method is:
7748 %
7749 %      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7750 %        const void *blob,const size_t length)
7751 %
7752 %  A description of each parameter follows:
7753 %
7754 %    o wand: the magick wand.
7755 %
7756 %    o blob: the blob.
7757 %
7758 %    o length: the blob length.
7759 %
7760 */
7761 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7762   const void *blob,const size_t length)
7763 {
7764   Image
7765     *images;
7766
7767   assert(wand != (MagickWand *) NULL);
7768   assert(wand->signature == WandSignature);
7769   if (wand->debug != MagickFalse)
7770     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7771   images=BlobToImage(wand->image_info,blob,length,wand->exception);
7772   if (images == (Image *) NULL)
7773     return(MagickFalse);
7774   return(InsertImageInWand(wand,images));
7775 }
7776 \f
7777 /*
7778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7779 %                                                                             %
7780 %                                                                             %
7781 %                                                                             %
7782 %   M a g i c k R e a d I m a g e F i l e                                     %
7783 %                                                                             %
7784 %                                                                             %
7785 %                                                                             %
7786 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7787 %
7788 %  MagickReadImageFile() reads an image or image sequence from an already
7789 %  opened file descriptor.  Otherwise it is like MagickReadImage().
7790 %
7791 %  The format of the MagickReadImageFile method is:
7792 %
7793 %      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7794 %
7795 %  A description of each parameter follows:
7796 %
7797 %    o wand: the magick wand.
7798 %
7799 %    o file: the file descriptor.
7800 %
7801 */
7802 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7803 {
7804   Image
7805     *images;
7806
7807   ImageInfo
7808     *read_info;
7809
7810   assert(wand != (MagickWand *) NULL);
7811   assert(wand->signature == WandSignature);
7812   assert(file != (FILE *) NULL);
7813   if (wand->debug != MagickFalse)
7814     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7815   read_info=CloneImageInfo(wand->image_info);
7816   SetImageInfoFile(read_info,file);
7817   images=ReadImage(read_info,wand->exception);
7818   read_info=DestroyImageInfo(read_info);
7819   if (images == (Image *) NULL)
7820     return(MagickFalse);
7821   return(InsertImageInWand(wand,images));
7822 }
7823 \f
7824 /*
7825 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7826 %                                                                             %
7827 %                                                                             %
7828 %                                                                             %
7829 %   M a g i c k R e m a p I m a g e                                           %
7830 %                                                                             %
7831 %                                                                             %
7832 %                                                                             %
7833 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7834 %
7835 %  MagickRemapImage() replaces the colors of an image with the closest color
7836 %  from a reference image.
7837 %
7838 %  The format of the MagickRemapImage method is:
7839 %
7840 %      MagickBooleanType MagickRemapImage(MagickWand *wand,
7841 %        const MagickWand *remap_wand,const DitherMethod method)
7842 %
7843 %  A description of each parameter follows:
7844 %
7845 %    o wand: the magick wand.
7846 %
7847 %    o affinity: the affinity wand.
7848 %
7849 %    o method: choose from these dither methods: NoDitherMethod,
7850 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7851 %
7852 */
7853 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
7854   const MagickWand *remap_wand,const DitherMethod method)
7855 {
7856   MagickBooleanType
7857     status;
7858
7859   QuantizeInfo
7860     *quantize_info;
7861
7862   assert(wand != (MagickWand *) NULL);
7863   assert(wand->signature == WandSignature);
7864   if (wand->debug != MagickFalse)
7865     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7866   if ((wand->images == (Image *) NULL) ||
7867       (remap_wand->images == (Image *) NULL))
7868     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7869   quantize_info=AcquireQuantizeInfo(wand->image_info);
7870   quantize_info->dither_method=method;
7871   if (method == NoDitherMethod)
7872     quantize_info->dither=MagickFalse;
7873   status=RemapImage(quantize_info,wand->images,remap_wand->images,
7874     wand->exception);
7875   quantize_info=DestroyQuantizeInfo(quantize_info);
7876   return(status);
7877 }
7878 \f
7879 /*
7880 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7881 %                                                                             %
7882 %                                                                             %
7883 %                                                                             %
7884 %   M a g i c k R e m o v e I m a g e                                         %
7885 %                                                                             %
7886 %                                                                             %
7887 %                                                                             %
7888 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7889 %
7890 %  MagickRemoveImage() removes an image from the image list.
7891 %
7892 %  The format of the MagickRemoveImage method is:
7893 %
7894 %      MagickBooleanType MagickRemoveImage(MagickWand *wand)
7895 %
7896 %  A description of each parameter follows:
7897 %
7898 %    o wand: the magick wand.
7899 %
7900 %    o insert: the splice wand.
7901 %
7902 */
7903 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
7904 {
7905   assert(wand != (MagickWand *) NULL);
7906   assert(wand->signature == WandSignature);
7907   if (wand->debug != MagickFalse)
7908     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7909   if (wand->images == (Image *) NULL)
7910     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7911   DeleteImageFromList(&wand->images);
7912   return(MagickTrue);
7913 }
7914 \f
7915 /*
7916 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7917 %                                                                             %
7918 %                                                                             %
7919 %                                                                             %
7920 %   M a g i c k R e s a m p l e I m a g e                                     %
7921 %                                                                             %
7922 %                                                                             %
7923 %                                                                             %
7924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7925 %
7926 %  MagickResampleImage() resample image to desired resolution.
7927 %
7928 %    Bessel   Blackman   Box
7929 %    Catrom   Cubic      Gaussian
7930 %    Hanning  Hermite    Lanczos
7931 %    Mitchell Point      Quandratic
7932 %    Sinc     Triangle
7933 %
7934 %  Most of the filters are FIR (finite impulse response), however, Bessel,
7935 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
7936 %  are windowed (brought down to zero) with the Blackman filter.
7937 %
7938 %  The format of the MagickResampleImage method is:
7939 %
7940 %      MagickBooleanType MagickResampleImage(MagickWand *wand,
7941 %        const double x_resolution,const double y_resolution,
7942 %        const FilterTypes filter,const double blur)
7943 %
7944 %  A description of each parameter follows:
7945 %
7946 %    o wand: the magick wand.
7947 %
7948 %    o x_resolution: the new image x resolution.
7949 %
7950 %    o y_resolution: the new image y resolution.
7951 %
7952 %    o filter: Image filter to use.
7953 %
7954 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
7955 %
7956 */
7957 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
7958   const double x_resolution,const double y_resolution,const FilterTypes filter,
7959   const double blur)
7960 {
7961   Image
7962     *resample_image;
7963
7964   assert(wand != (MagickWand *) NULL);
7965   assert(wand->signature == WandSignature);
7966   if (wand->debug != MagickFalse)
7967     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7968   if (wand->images == (Image *) NULL)
7969     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7970   resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
7971     blur,wand->exception);
7972   if (resample_image == (Image *) NULL)
7973     return(MagickFalse);
7974   ReplaceImageInList(&wand->images,resample_image);
7975   return(MagickTrue);
7976 }
7977 \f
7978 /*
7979 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7980 %                                                                             %
7981 %                                                                             %
7982 %                                                                             %
7983 %   M a g i c k R e s e t I m a g e P a g e                                   %
7984 %                                                                             %
7985 %                                                                             %
7986 %                                                                             %
7987 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7988 %
7989 %  MagickResetImagePage() resets the Wand page canvas and position.
7990 %
7991 %  The format of the MagickResetImagePage method is:
7992 %
7993 %      MagickBooleanType MagickResetImagePage(MagickWand *wand,
7994 %        const char *page)
7995 %
7996 %  A description of each parameter follows:
7997 %
7998 %    o wand: the magick wand.
7999 %
8000 %    o page: the relative page specification.
8001 %
8002 */
8003 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8004   const char *page)
8005 {
8006   assert(wand != (MagickWand *) NULL);
8007   assert(wand->signature == WandSignature);
8008   if (wand->debug != MagickFalse)
8009     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8010   if (wand->images == (Image *) NULL)
8011     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8012   if ((page == (char *) NULL) || (*page == '\0'))
8013     {
8014       (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8015       return(MagickTrue);
8016     }
8017   return(ResetImagePage(wand->images,page));
8018 }
8019 \f
8020 /*
8021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8022 %                                                                             %
8023 %                                                                             %
8024 %                                                                             %
8025 %   M a g i c k R e s i z e I m a g e                                         %
8026 %                                                                             %
8027 %                                                                             %
8028 %                                                                             %
8029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8030 %
8031 %  MagickResizeImage() scales an image to the desired dimensions with one of
8032 %  these filters:
8033 %
8034 %    Bessel   Blackman   Box
8035 %    Catrom   Cubic      Gaussian
8036 %    Hanning  Hermite    Lanczos
8037 %    Mitchell Point      Quandratic
8038 %    Sinc     Triangle
8039 %
8040 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8041 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8042 %  are windowed (brought down to zero) with the Blackman filter.
8043 %
8044 %  The format of the MagickResizeImage method is:
8045 %
8046 %      MagickBooleanType MagickResizeImage(MagickWand *wand,
8047 %        const size_t columns,const size_t rows,
8048 %        const FilterTypes filter,const double blur)
8049 %
8050 %  A description of each parameter follows:
8051 %
8052 %    o wand: the magick wand.
8053 %
8054 %    o columns: the number of columns in the scaled image.
8055 %
8056 %    o rows: the number of rows in the scaled image.
8057 %
8058 %    o filter: Image filter to use.
8059 %
8060 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8061 %
8062 */
8063 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8064   const size_t columns,const size_t rows,const FilterTypes filter,
8065   const double blur)
8066 {
8067   Image
8068     *resize_image;
8069
8070   assert(wand != (MagickWand *) NULL);
8071   assert(wand->signature == WandSignature);
8072   if (wand->debug != MagickFalse)
8073     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8074   if (wand->images == (Image *) NULL)
8075     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8076   resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8077     wand->exception);
8078   if (resize_image == (Image *) NULL)
8079     return(MagickFalse);
8080   ReplaceImageInList(&wand->images,resize_image);
8081   return(MagickTrue);
8082 }
8083 \f
8084 /*
8085 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8086 %                                                                             %
8087 %                                                                             %
8088 %                                                                             %
8089 %   M a g i c k R o l l I m a g e                                             %
8090 %                                                                             %
8091 %                                                                             %
8092 %                                                                             %
8093 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8094 %
8095 %  MagickRollImage() offsets an image as defined by x and y.
8096 %
8097 %  The format of the MagickRollImage method is:
8098 %
8099 %      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8100 %        const size_t y)
8101 %
8102 %  A description of each parameter follows:
8103 %
8104 %    o wand: the magick wand.
8105 %
8106 %    o x: the x offset.
8107 %
8108 %    o y: the y offset.
8109 %
8110 %
8111 */
8112 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8113   const ssize_t x,const ssize_t y)
8114 {
8115   Image
8116     *roll_image;
8117
8118   assert(wand != (MagickWand *) NULL);
8119   assert(wand->signature == WandSignature);
8120   if (wand->debug != MagickFalse)
8121     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8122   if (wand->images == (Image *) NULL)
8123     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8124   roll_image=RollImage(wand->images,x,y,wand->exception);
8125   if (roll_image == (Image *) NULL)
8126     return(MagickFalse);
8127   ReplaceImageInList(&wand->images,roll_image);
8128   return(MagickTrue);
8129 }
8130 \f
8131 /*
8132 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8133 %                                                                             %
8134 %                                                                             %
8135 %                                                                             %
8136 %   M a g i c k R o t a t e I m a g e                                         %
8137 %                                                                             %
8138 %                                                                             %
8139 %                                                                             %
8140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8141 %
8142 %  MagickRotateImage() rotates an image the specified number of degrees. Empty
8143 %  triangles left over from rotating the image are filled with the
8144 %  background color.
8145 %
8146 %  The format of the MagickRotateImage method is:
8147 %
8148 %      MagickBooleanType MagickRotateImage(MagickWand *wand,
8149 %        const PixelWand *background,const double degrees)
8150 %
8151 %  A description of each parameter follows:
8152 %
8153 %    o wand: the magick wand.
8154 %
8155 %    o background: the background pixel wand.
8156 %
8157 %    o degrees: the number of degrees to rotate the image.
8158 %
8159 %
8160 */
8161 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8162   const PixelWand *background,const double degrees)
8163 {
8164   Image
8165     *rotate_image;
8166
8167   assert(wand != (MagickWand *) NULL);
8168   assert(wand->signature == WandSignature);
8169   if (wand->debug != MagickFalse)
8170     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8171   if (wand->images == (Image *) NULL)
8172     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8173   PixelGetQuantumPacket(background,&wand->images->background_color);
8174   rotate_image=RotateImage(wand->images,degrees,wand->exception);
8175   if (rotate_image == (Image *) NULL)
8176     return(MagickFalse);
8177   ReplaceImageInList(&wand->images,rotate_image);
8178   return(MagickTrue);
8179 }
8180 \f
8181 /*
8182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8183 %                                                                             %
8184 %                                                                             %
8185 %                                                                             %
8186 %   M a g i c k S a m p l e I m a g e                                         %
8187 %                                                                             %
8188 %                                                                             %
8189 %                                                                             %
8190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8191 %
8192 %  MagickSampleImage() scales an image to the desired dimensions with pixel
8193 %  sampling.  Unlike other scaling methods, this method does not introduce
8194 %  any additional color into the scaled image.
8195 %
8196 %  The format of the MagickSampleImage method is:
8197 %
8198 %      MagickBooleanType MagickSampleImage(MagickWand *wand,
8199 %        const size_t columns,const size_t rows)
8200 %
8201 %  A description of each parameter follows:
8202 %
8203 %    o wand: the magick wand.
8204 %
8205 %    o columns: the number of columns in the scaled image.
8206 %
8207 %    o rows: the number of rows in the scaled image.
8208 %
8209 %
8210 */
8211 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8212   const size_t columns,const size_t rows)
8213 {
8214   Image
8215     *sample_image;
8216
8217   assert(wand != (MagickWand *) NULL);
8218   assert(wand->signature == WandSignature);
8219   if (wand->debug != MagickFalse)
8220     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8221   if (wand->images == (Image *) NULL)
8222     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8223   sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8224   if (sample_image == (Image *) NULL)
8225     return(MagickFalse);
8226   ReplaceImageInList(&wand->images,sample_image);
8227   return(MagickTrue);
8228 }
8229 \f
8230 /*
8231 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8232 %                                                                             %
8233 %                                                                             %
8234 %                                                                             %
8235 %   M a g i c k S c a l e I m a g e                                           %
8236 %                                                                             %
8237 %                                                                             %
8238 %                                                                             %
8239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8240 %
8241 %  MagickScaleImage() scales the size of an image to the given dimensions.
8242 %
8243 %  The format of the MagickScaleImage method is:
8244 %
8245 %      MagickBooleanType MagickScaleImage(MagickWand *wand,
8246 %        const size_t columns,const size_t rows)
8247 %
8248 %  A description of each parameter follows:
8249 %
8250 %    o wand: the magick wand.
8251 %
8252 %    o columns: the number of columns in the scaled image.
8253 %
8254 %    o rows: the number of rows in the scaled image.
8255 %
8256 %
8257 */
8258 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8259   const size_t columns,const size_t rows)
8260 {
8261   Image
8262     *scale_image;
8263
8264   assert(wand != (MagickWand *) NULL);
8265   assert(wand->signature == WandSignature);
8266   if (wand->debug != MagickFalse)
8267     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8268   if (wand->images == (Image *) NULL)
8269     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8270   scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8271   if (scale_image == (Image *) NULL)
8272     return(MagickFalse);
8273   ReplaceImageInList(&wand->images,scale_image);
8274   return(MagickTrue);
8275 }
8276 \f
8277 /*
8278 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8279 %                                                                             %
8280 %                                                                             %
8281 %                                                                             %
8282 %   M a g i c k S e g m e n t I m a g e                                       %
8283 %                                                                             %
8284 %                                                                             %
8285 %                                                                             %
8286 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8287 %
8288 %  MagickSegmentImage() segments an image by analyzing the histograms of the
8289 %  color components and identifying units that are homogeneous with the fuzzy
8290 %  C-means technique.
8291 %
8292 %  The format of the SegmentImage method is:
8293 %
8294 %      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8295 %        const ColorspaceType colorspace,const MagickBooleanType verbose,
8296 %        const double cluster_threshold,const double smooth_threshold)
8297 %
8298 %  A description of each parameter follows.
8299 %
8300 %    o wand: the wand.
8301 %
8302 %    o colorspace: the image colorspace.
8303 %
8304 %    o verbose:  Set to MagickTrue to print detailed information about the
8305 %      identified classes.
8306 %
8307 %    o cluster_threshold:  This represents the minimum number of pixels
8308 %      contained in a hexahedra before it can be considered valid (expressed as
8309 %      a percentage).
8310 %
8311 %    o smooth_threshold: the smoothing threshold eliminates noise in the second
8312 %      derivative of the histogram.  As the value is increased, you can expect a
8313 %      smoother second derivative.
8314 %
8315 */
8316 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8317   const ColorspaceType colorspace,const MagickBooleanType verbose,
8318   const double cluster_threshold,const double smooth_threshold)
8319 {
8320   MagickBooleanType
8321     status;
8322
8323   assert(wand != (MagickWand *) NULL);
8324   assert(wand->signature == WandSignature);
8325   if (wand->debug != MagickFalse)
8326     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8327   if (wand->images == (Image *) NULL)
8328     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8329   status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8330     smooth_threshold,wand->exception);
8331   return(status);
8332 }
8333 \f
8334 /*
8335 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8336 %                                                                             %
8337 %                                                                             %
8338 %                                                                             %
8339 %   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8340 %                                                                             %
8341 %                                                                             %
8342 %                                                                             %
8343 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8344 %
8345 %  MagickSelectiveBlurImage() selectively blur an image within a contrast
8346 %  threshold. It is similar to the unsharpen mask that sharpens everything with
8347 %  contrast above a certain threshold.
8348 %
8349 %  The format of the MagickSelectiveBlurImage method is:
8350 %
8351 %      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8352 %        const double radius,const double sigma,const double threshold,
8353 %        const double bias)
8354 %
8355 %  A description of each parameter follows:
8356 %
8357 %    o wand: the magick wand.
8358 %
8359 %    o radius: the radius of the gaussian, in pixels, not counting the center
8360 %      pixel.
8361 %
8362 %    o sigma: the standard deviation of the gaussian, in pixels.
8363 %
8364 %    o threshold: only pixels within this contrast threshold are included
8365 %      in the blur operation.
8366 %
8367 %    o bias: the bias.
8368 %
8369 */
8370 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8371   const double radius,const double sigma,const double threshold,
8372   const double bias)
8373 {
8374   Image
8375     *blur_image;
8376
8377   assert(wand != (MagickWand *) NULL);
8378   assert(wand->signature == WandSignature);
8379   if (wand->debug != MagickFalse)
8380     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8381   if (wand->images == (Image *) NULL)
8382     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8383   blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,bias,
8384     wand->exception);
8385   if (blur_image == (Image *) NULL)
8386     return(MagickFalse);
8387   ReplaceImageInList(&wand->images,blur_image);
8388   return(MagickTrue);
8389 }
8390 \f
8391 /*
8392 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8393 %                                                                             %
8394 %                                                                             %
8395 %                                                                             %
8396 %   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                       %
8397 %                                                                             %
8398 %                                                                             %
8399 %                                                                             %
8400 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8401 %
8402 %  MagickSeparateImage() separates a channel from the image and returns a
8403 %  grayscale image.  A channel is a particular color component of each pixel
8404 %  in the image.
8405 %
8406 %  The format of the MagickSeparateImage method is:
8407 %
8408 %      MagickBooleanType MagickSeparateImage(MagickWand *wand)
8409 %
8410 %  A description of each parameter follows:
8411 %
8412 %    o wand: the magick wand.
8413 %
8414 */
8415 WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand)
8416 {
8417   assert(wand != (MagickWand *) NULL);
8418   assert(wand->signature == WandSignature);
8419   if (wand->debug != MagickFalse)
8420     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8421   if (wand->images == (Image *) NULL)
8422     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8423   return(SeparateImage(wand->images,wand->exception));
8424 }
8425 \f
8426 /*
8427 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8428 %                                                                             %
8429 %                                                                             %
8430 %                                                                             %
8431 %     M a g i c k S e p i a T o n e I m a g e                                 %
8432 %                                                                             %
8433 %                                                                             %
8434 %                                                                             %
8435 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8436 %
8437 %  MagickSepiaToneImage() applies a special effect to the image, similar to the
8438 %  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8439 %  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8440 %  threshold of 80% is a good starting point for a reasonable tone.
8441 %
8442 %  The format of the MagickSepiaToneImage method is:
8443 %
8444 %      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8445 %        const double threshold)
8446 %
8447 %  A description of each parameter follows:
8448 %
8449 %    o wand: the magick wand.
8450 %
8451 %    o threshold:  Define the extent of the sepia toning.
8452 %
8453 */
8454 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8455   const double threshold)
8456 {
8457   Image
8458     *sepia_image;
8459
8460   assert(wand != (MagickWand *) NULL);
8461   assert(wand->signature == WandSignature);
8462   if (wand->debug != MagickFalse)
8463     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8464   if (wand->images == (Image *) NULL)
8465     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8466   sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8467   if (sepia_image == (Image *) NULL)
8468     return(MagickFalse);
8469   ReplaceImageInList(&wand->images,sepia_image);
8470   return(MagickTrue);
8471 }
8472 \f
8473 /*
8474 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8475 %                                                                             %
8476 %                                                                             %
8477 %                                                                             %
8478 %   M a g i c k S e t I m a g e                                               %
8479 %                                                                             %
8480 %                                                                             %
8481 %                                                                             %
8482 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8483 %
8484 %  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8485 %  MagickNextImage(), MagickPreviousImage() with the images from the specified
8486 %  wand.
8487 %
8488 %  The format of the MagickSetImage method is:
8489 %
8490 %      MagickBooleanType MagickSetImage(MagickWand *wand,
8491 %        const MagickWand *set_wand)
8492 %
8493 %  A description of each parameter follows:
8494 %
8495 %    o wand: the magick wand.
8496 %
8497 %    o set_wand: the set_wand wand.
8498 %
8499 */
8500 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8501   const MagickWand *set_wand)
8502 {
8503   Image
8504     *images;
8505
8506   assert(wand != (MagickWand *) NULL);
8507   assert(wand->signature == WandSignature);
8508   if (wand->debug != MagickFalse)
8509     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8510   assert(set_wand != (MagickWand *) NULL);
8511   assert(set_wand->signature == WandSignature);
8512   if (wand->debug != MagickFalse)
8513     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8514   if (set_wand->images == (Image *) NULL)
8515     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8516   images=CloneImageList(set_wand->images,wand->exception);
8517   if (images == (Image *) NULL)
8518     return(MagickFalse);
8519   ReplaceImageInList(&wand->images,images);
8520   return(MagickTrue);
8521 }
8522 \f
8523 /*
8524 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8525 %                                                                             %
8526 %                                                                             %
8527 %                                                                             %
8528 %   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                       %
8529 %                                                                             %
8530 %                                                                             %
8531 %                                                                             %
8532 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8533 %
8534 %  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8535 %  alpha channel.
8536 %
8537 %  The format of the MagickSetImageAlphaChannel method is:
8538 %
8539 %      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8540 %        const AlphaChannelType alpha_type)
8541 %
8542 %  A description of each parameter follows:
8543 %
8544 %    o wand: the magick wand.
8545 %
8546 %    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8547 %      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8548 %
8549 */
8550 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8551   const AlphaChannelType alpha_type)
8552 {
8553   assert(wand != (MagickWand *) NULL);
8554   assert(wand->signature == WandSignature);
8555   if (wand->debug != MagickFalse)
8556     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8557   if (wand->images == (Image *) NULL)
8558     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8559   return(SetImageAlphaChannel(wand->images,alpha_type,&wand->images->exception));
8560 }
8561 \f
8562 /*
8563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8564 %                                                                             %
8565 %                                                                             %
8566 %                                                                             %
8567 %   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                 %
8568 %                                                                             %
8569 %                                                                             %
8570 %                                                                             %
8571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8572 %
8573 %  MagickSetImageBackgroundColor() sets the image background color.
8574 %
8575 %  The format of the MagickSetImageBackgroundColor method is:
8576 %
8577 %      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8578 %        const PixelWand *background)
8579 %
8580 %  A description of each parameter follows:
8581 %
8582 %    o wand: the magick wand.
8583 %
8584 %    o background: the background pixel wand.
8585 %
8586 */
8587 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8588   const PixelWand *background)
8589 {
8590   assert(wand != (MagickWand *) NULL);
8591   assert(wand->signature == WandSignature);
8592   if (wand->debug != MagickFalse)
8593     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8594   if (wand->images == (Image *) NULL)
8595     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8596   PixelGetQuantumPacket(background,&wand->images->background_color);
8597   return(MagickTrue);
8598 }
8599 \f
8600 /*
8601 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8602 %                                                                             %
8603 %                                                                             %
8604 %                                                                             %
8605 %   M a g i c k S e t I m a g e B i a s                                       %
8606 %                                                                             %
8607 %                                                                             %
8608 %                                                                             %
8609 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8610 %
8611 %  MagickSetImageBias() sets the image bias for any method that convolves an
8612 %  image (e.g. MagickConvolveImage()).
8613 %
8614 %  The format of the MagickSetImageBias method is:
8615 %
8616 %      MagickBooleanType MagickSetImageBias(MagickWand *wand,
8617 %        const double bias)
8618 %
8619 %  A description of each parameter follows:
8620 %
8621 %    o wand: the magick wand.
8622 %
8623 %    o bias: the image bias.
8624 %
8625 */
8626 WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
8627   const double bias)
8628 {
8629   assert(wand != (MagickWand *) NULL);
8630   assert(wand->signature == WandSignature);
8631   if (wand->debug != MagickFalse)
8632     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8633   if (wand->images == (Image *) NULL)
8634     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8635   wand->images->bias=bias;
8636   return(MagickTrue);
8637 }
8638 \f
8639 /*
8640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8641 %                                                                             %
8642 %                                                                             %
8643 %                                                                             %
8644 %   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                         %
8645 %                                                                             %
8646 %                                                                             %
8647 %                                                                             %
8648 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8649 %
8650 %  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8651 %
8652 %  The format of the MagickSetImageBluePrimary method is:
8653 %
8654 %      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8655 %        const double x,const double y)
8656 %
8657 %  A description of each parameter follows:
8658 %
8659 %    o wand: the magick wand.
8660 %
8661 %    o x: the blue primary x-point.
8662 %
8663 %    o y: the blue primary y-point.
8664 %
8665 */
8666 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8667   const double x,const double y)
8668 {
8669   assert(wand != (MagickWand *) NULL);
8670   assert(wand->signature == WandSignature);
8671   if (wand->debug != MagickFalse)
8672     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8673   if (wand->images == (Image *) NULL)
8674     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8675   wand->images->chromaticity.blue_primary.x=x;
8676   wand->images->chromaticity.blue_primary.y=y;
8677   return(MagickTrue);
8678 }
8679 \f
8680 /*
8681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8682 %                                                                             %
8683 %                                                                             %
8684 %                                                                             %
8685 %   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                         %
8686 %                                                                             %
8687 %                                                                             %
8688 %                                                                             %
8689 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8690 %
8691 %  MagickSetImageBorderColor() sets the image border color.
8692 %
8693 %  The format of the MagickSetImageBorderColor method is:
8694 %
8695 %      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8696 %        const PixelWand *border)
8697 %
8698 %  A description of each parameter follows:
8699 %
8700 %    o wand: the magick wand.
8701 %
8702 %    o border: the border pixel wand.
8703 %
8704 */
8705 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8706   const PixelWand *border)
8707 {
8708   assert(wand != (MagickWand *) NULL);
8709   assert(wand->signature == WandSignature);
8710   if (wand->debug != MagickFalse)
8711     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8712   if (wand->images == (Image *) NULL)
8713     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8714   PixelGetQuantumPacket(border,&wand->images->border_color);
8715   return(MagickTrue);
8716 }
8717 \f
8718 /*
8719 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8720 %                                                                             %
8721 %                                                                             %
8722 %                                                                             %
8723 %   M a g i c k S e t I m a g e C l i p M a s k                               %
8724 %                                                                             %
8725 %                                                                             %
8726 %                                                                             %
8727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8728 %
8729 %  MagickSetImageClipMask() sets image clip mask.
8730 %
8731 %  The format of the MagickSetImageClipMask method is:
8732 %
8733 %      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8734 %        const MagickWand *clip_mask)
8735 %
8736 %  A description of each parameter follows:
8737 %
8738 %    o wand: the magick wand.
8739 %
8740 %    o clip_mask: the clip_mask wand.
8741 %
8742 */
8743 WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8744   const MagickWand *clip_mask)
8745 {
8746   assert(wand != (MagickWand *) NULL);
8747   assert(wand->signature == WandSignature);
8748   if (wand->debug != MagickFalse)
8749     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8750   assert(clip_mask != (MagickWand *) NULL);
8751   assert(clip_mask->signature == WandSignature);
8752   if (wand->debug != MagickFalse)
8753     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
8754   if (clip_mask->images == (Image *) NULL)
8755     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8756   return(SetImageClipMask(wand->images,clip_mask->images,wand->exception));
8757 }
8758 \f
8759 /*
8760 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8761 %                                                                             %
8762 %                                                                             %
8763 %                                                                             %
8764 %   M a g i c k S e t I m a g e C o l o r                                     %
8765 %                                                                             %
8766 %                                                                             %
8767 %                                                                             %
8768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8769 %
8770 %  MagickSetImageColor() set the entire wand canvas to the specified color.
8771 %
8772 %  The format of the MagickSetImageColor method is:
8773 %
8774 %      MagickBooleanType MagickSetImageColor(MagickWand *wand,
8775 %        const PixelWand *color)
8776 %
8777 %  A description of each parameter follows:
8778 %
8779 %    o wand: the magick wand.
8780 %
8781 %    o background: the image color.
8782 %
8783 */
8784 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
8785   const PixelWand *color)
8786 {
8787   PixelInfo
8788     pixel;
8789
8790   assert(wand != (MagickWand *) NULL);
8791   assert(wand->signature == WandSignature);
8792   if (wand->debug != MagickFalse)
8793     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8794   PixelGetMagickColor(color,&pixel);
8795   return(SetImageColor(wand->images,&pixel,wand->exception));
8796 }
8797 \f
8798 /*
8799 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8800 %                                                                             %
8801 %                                                                             %
8802 %                                                                             %
8803 %   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                     %
8804 %                                                                             %
8805 %                                                                             %
8806 %                                                                             %
8807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8808 %
8809 %  MagickSetImageColormapColor() sets the color of the specified colormap
8810 %  index.
8811 %
8812 %  The format of the MagickSetImageColormapColor method is:
8813 %
8814 %      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8815 %        const size_t index,const PixelWand *color)
8816 %
8817 %  A description of each parameter follows:
8818 %
8819 %    o wand: the magick wand.
8820 %
8821 %    o index: the offset into the image colormap.
8822 %
8823 %    o color: Return the colormap color in this wand.
8824 %
8825 */
8826 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8827   const size_t index,const PixelWand *color)
8828 {
8829   assert(wand != (MagickWand *) NULL);
8830   assert(wand->signature == WandSignature);
8831   if (wand->debug != MagickFalse)
8832     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8833   if (wand->images == (Image *) NULL)
8834     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8835   if ((wand->images->colormap == (PixelInfo *) NULL) ||
8836       (index >= wand->images->colors))
8837     ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
8838   PixelGetQuantumPacket(color,wand->images->colormap+index);
8839   return(SyncImage(wand->images));
8840 }
8841 \f
8842 /*
8843 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8844 %                                                                             %
8845 %                                                                             %
8846 %                                                                             %
8847 %   M a g i c k S e t I m a g e C o l o r s p a c e                           %
8848 %                                                                             %
8849 %                                                                             %
8850 %                                                                             %
8851 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8852 %
8853 %  MagickSetImageColorspace() sets the image colorspace.
8854 %
8855 %  The format of the MagickSetImageColorspace method is:
8856 %
8857 %      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8858 %        const ColorspaceType colorspace)
8859 %
8860 %  A description of each parameter follows:
8861 %
8862 %    o wand: the magick wand.
8863 %
8864 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
8865 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
8866 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
8867 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
8868 %      HSLColorspace, or HWBColorspace.
8869 %
8870 */
8871 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8872   const ColorspaceType colorspace)
8873 {
8874   assert(wand != (MagickWand *) NULL);
8875   assert(wand->signature == WandSignature);
8876   if (wand->debug != MagickFalse)
8877     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8878   if (wand->images == (Image *) NULL)
8879     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8880   return(SetImageColorspace(wand->images,colorspace,&wand->images->exception));
8881 }
8882 \f
8883 /*
8884 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8885 %                                                                             %
8886 %                                                                             %
8887 %                                                                             %
8888 %   M a g i c k S e t I m a g e C o m p o s e                                 %
8889 %                                                                             %
8890 %                                                                             %
8891 %                                                                             %
8892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8893 %
8894 %  MagickSetImageCompose() sets the image composite operator, useful for
8895 %  specifying how to composite the image thumbnail when using the
8896 %  MagickMontageImage() method.
8897 %
8898 %  The format of the MagickSetImageCompose method is:
8899 %
8900 %      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8901 %        const CompositeOperator compose)
8902 %
8903 %  A description of each parameter follows:
8904 %
8905 %    o wand: the magick wand.
8906 %
8907 %    o compose: the image composite operator.
8908 %
8909 */
8910 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8911   const CompositeOperator compose)
8912 {
8913   assert(wand != (MagickWand *) NULL);
8914   assert(wand->signature == WandSignature);
8915   if (wand->debug != MagickFalse)
8916     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8917   if (wand->images == (Image *) NULL)
8918     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8919   wand->images->compose=compose;
8920   return(MagickTrue);
8921 }
8922 \f
8923 /*
8924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8925 %                                                                             %
8926 %                                                                             %
8927 %                                                                             %
8928 %   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                         %
8929 %                                                                             %
8930 %                                                                             %
8931 %                                                                             %
8932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8933 %
8934 %  MagickSetImageCompression() sets the image compression.
8935 %
8936 %  The format of the MagickSetImageCompression method is:
8937 %
8938 %      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8939 %        const CompressionType compression)
8940 %
8941 %  A description of each parameter follows:
8942 %
8943 %    o wand: the magick wand.
8944 %
8945 %    o compression: the image compression type.
8946 %
8947 */
8948 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8949   const CompressionType compression)
8950 {
8951   assert(wand != (MagickWand *) NULL);
8952   assert(wand->signature == WandSignature);
8953   if (wand->debug != MagickFalse)
8954     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8955   if (wand->images == (Image *) NULL)
8956     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8957   wand->images->compression=compression;
8958   return(MagickTrue);
8959 }
8960 \f
8961 /*
8962 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8963 %                                                                             %
8964 %                                                                             %
8965 %                                                                             %
8966 %   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           %
8967 %                                                                             %
8968 %                                                                             %
8969 %                                                                             %
8970 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8971 %
8972 %  MagickSetImageCompressionQuality() sets the image compression quality.
8973 %
8974 %  The format of the MagickSetImageCompressionQuality method is:
8975 %
8976 %      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
8977 %        const size_t quality)
8978 %
8979 %  A description of each parameter follows:
8980 %
8981 %    o wand: the magick wand.
8982 %
8983 %    o quality: the image compression tlityype.
8984 %
8985 */
8986 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
8987   const size_t quality)
8988 {
8989   assert(wand != (MagickWand *) NULL);
8990   assert(wand->signature == WandSignature);
8991   if (wand->debug != MagickFalse)
8992     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8993   if (wand->images == (Image *) NULL)
8994     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8995   wand->images->quality=quality;
8996   return(MagickTrue);
8997 }
8998 \f
8999 /*
9000 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9001 %                                                                             %
9002 %                                                                             %
9003 %                                                                             %
9004 %   M a g i c k S e t I m a g e D e l a y                                     %
9005 %                                                                             %
9006 %                                                                             %
9007 %                                                                             %
9008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9009 %
9010 %  MagickSetImageDelay() sets the image delay.
9011 %
9012 %  The format of the MagickSetImageDelay method is:
9013 %
9014 %      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9015 %        const size_t delay)
9016 %
9017 %  A description of each parameter follows:
9018 %
9019 %    o wand: the magick wand.
9020 %
9021 %    o delay: the image delay in ticks-per-second units.
9022 %
9023 */
9024 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9025   const size_t delay)
9026 {
9027   assert(wand != (MagickWand *) NULL);
9028   assert(wand->signature == WandSignature);
9029   if (wand->debug != MagickFalse)
9030     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9031   if (wand->images == (Image *) NULL)
9032     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9033   wand->images->delay=delay;
9034   return(MagickTrue);
9035 }
9036 \f
9037 /*
9038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9039 %                                                                             %
9040 %                                                                             %
9041 %                                                                             %
9042 %   M a g i c k S e t I m a g e D e p t h                                     %
9043 %                                                                             %
9044 %                                                                             %
9045 %                                                                             %
9046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9047 %
9048 %  MagickSetImageDepth() sets the image depth.
9049 %
9050 %  The format of the MagickSetImageDepth method is:
9051 %
9052 %      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9053 %        const size_t depth)
9054 %
9055 %  A description of each parameter follows:
9056 %
9057 %    o wand: the magick wand.
9058 %
9059 %    o depth: the image depth in bits: 8, 16, or 32.
9060 %
9061 */
9062 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9063   const size_t depth)
9064 {
9065   assert(wand != (MagickWand *) NULL);
9066   assert(wand->signature == WandSignature);
9067   if (wand->debug != MagickFalse)
9068     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9069   if (wand->images == (Image *) NULL)
9070     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9071   return(SetImageDepth(wand->images,depth));
9072 }
9073 \f
9074 /*
9075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9076 %                                                                             %
9077 %                                                                             %
9078 %                                                                             %
9079 %   M a g i c k S e t I m a g e D i s p o s e                                 %
9080 %                                                                             %
9081 %                                                                             %
9082 %                                                                             %
9083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9084 %
9085 %  MagickSetImageDispose() sets the image disposal method.
9086 %
9087 %  The format of the MagickSetImageDispose method is:
9088 %
9089 %      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9090 %        const DisposeType dispose)
9091 %
9092 %  A description of each parameter follows:
9093 %
9094 %    o wand: the magick wand.
9095 %
9096 %    o dispose: the image disposeal type.
9097 %
9098 */
9099 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9100   const DisposeType dispose)
9101 {
9102   assert(wand != (MagickWand *) NULL);
9103   assert(wand->signature == WandSignature);
9104   if (wand->debug != MagickFalse)
9105     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9106   if (wand->images == (Image *) NULL)
9107     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9108   wand->images->dispose=dispose;
9109   return(MagickTrue);
9110 }
9111 \f
9112 /*
9113 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9114 %                                                                             %
9115 %                                                                             %
9116 %                                                                             %
9117 %   M a g i c k S e t I m a g e E x t e n t                                   %
9118 %                                                                             %
9119 %                                                                             %
9120 %                                                                             %
9121 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9122 %
9123 %  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9124 %
9125 %  The format of the MagickSetImageExtent method is:
9126 %
9127 %      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9128 %        const size_t columns,const unsigned rows)
9129 %
9130 %  A description of each parameter follows:
9131 %
9132 %    o wand: the magick wand.
9133 %
9134 %    o columns:  The image width in pixels.
9135 %
9136 %    o rows:  The image height in pixels.
9137 %
9138 */
9139 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9140   const size_t columns,const size_t rows)
9141 {
9142   assert(wand != (MagickWand *) NULL);
9143   assert(wand->signature == WandSignature);
9144   if (wand->debug != MagickFalse)
9145     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9146   if (wand->images == (Image *) NULL)
9147     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9148   return(SetImageExtent(wand->images,columns,rows,&wand->images->exception));
9149 }
9150 \f
9151 /*
9152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9153 %                                                                             %
9154 %                                                                             %
9155 %                                                                             %
9156 %   M a g i c k S e t I m a g e F i l e n a m e                               %
9157 %                                                                             %
9158 %                                                                             %
9159 %                                                                             %
9160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9161 %
9162 %  MagickSetImageFilename() sets the filename of a particular image in a
9163 %  sequence.
9164 %
9165 %  The format of the MagickSetImageFilename method is:
9166 %
9167 %      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9168 %        const char *filename)
9169 %
9170 %  A description of each parameter follows:
9171 %
9172 %    o wand: the magick wand.
9173 %
9174 %    o filename: the image filename.
9175 %
9176 */
9177 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9178   const char *filename)
9179 {
9180   assert(wand != (MagickWand *) NULL);
9181   assert(wand->signature == WandSignature);
9182   if (wand->debug != MagickFalse)
9183     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9184   if (wand->images == (Image *) NULL)
9185     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9186   if (filename != (const char *) NULL)
9187     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9188   return(MagickTrue);
9189 }
9190 \f
9191 /*
9192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9193 %                                                                             %
9194 %                                                                             %
9195 %                                                                             %
9196 %   M a g i c k S e t I m a g e F o r m a t                                   %
9197 %                                                                             %
9198 %                                                                             %
9199 %                                                                             %
9200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9201 %
9202 %  MagickSetImageFormat() sets the format of a particular image in a
9203 %  sequence.
9204 %
9205 %  The format of the MagickSetImageFormat method is:
9206 %
9207 %      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9208 %        const char *format)
9209 %
9210 %  A description of each parameter follows:
9211 %
9212 %    o wand: the magick wand.
9213 %
9214 %    o format: the image format.
9215 %
9216 */
9217 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9218   const char *format)
9219 {
9220   const MagickInfo
9221     *magick_info;
9222
9223   assert(wand != (MagickWand *) NULL);
9224   assert(wand->signature == WandSignature);
9225   if (wand->debug != MagickFalse)
9226     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9227   if (wand->images == (Image *) NULL)
9228     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9229   if ((format == (char *) NULL) || (*format == '\0'))
9230     {
9231       *wand->images->magick='\0';
9232       return(MagickTrue);
9233     }
9234   magick_info=GetMagickInfo(format,wand->exception);
9235   if (magick_info == (const MagickInfo *) NULL)
9236     return(MagickFalse);
9237   ClearMagickException(wand->exception);
9238   (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9239   return(MagickTrue);
9240 }
9241 \f
9242 /*
9243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9244 %                                                                             %
9245 %                                                                             %
9246 %                                                                             %
9247 %   M a g i c k S e t I m a g e F u z z                                       %
9248 %                                                                             %
9249 %                                                                             %
9250 %                                                                             %
9251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9252 %
9253 %  MagickSetImageFuzz() sets the image fuzz.
9254 %
9255 %  The format of the MagickSetImageFuzz method is:
9256 %
9257 %      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9258 %        const double fuzz)
9259 %
9260 %  A description of each parameter follows:
9261 %
9262 %    o wand: the magick wand.
9263 %
9264 %    o fuzz: the image fuzz.
9265 %
9266 */
9267 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9268   const double fuzz)
9269 {
9270   assert(wand != (MagickWand *) NULL);
9271   assert(wand->signature == WandSignature);
9272   if (wand->debug != MagickFalse)
9273     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9274   if (wand->images == (Image *) NULL)
9275     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9276   wand->images->fuzz=fuzz;
9277   return(MagickTrue);
9278 }
9279 \f
9280 /*
9281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9282 %                                                                             %
9283 %                                                                             %
9284 %                                                                             %
9285 %   M a g i c k S e t I m a g e G a m m a                                     %
9286 %                                                                             %
9287 %                                                                             %
9288 %                                                                             %
9289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9290 %
9291 %  MagickSetImageGamma() sets the image gamma.
9292 %
9293 %  The format of the MagickSetImageGamma method is:
9294 %
9295 %      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9296 %        const double gamma)
9297 %
9298 %  A description of each parameter follows:
9299 %
9300 %    o wand: the magick wand.
9301 %
9302 %    o gamma: the image gamma.
9303 %
9304 */
9305 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9306   const double gamma)
9307 {
9308   assert(wand != (MagickWand *) NULL);
9309   assert(wand->signature == WandSignature);
9310   if (wand->debug != MagickFalse)
9311     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9312   if (wand->images == (Image *) NULL)
9313     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9314   wand->images->gamma=gamma;
9315   return(MagickTrue);
9316 }
9317 \f
9318 /*
9319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9320 %                                                                             %
9321 %                                                                             %
9322 %                                                                             %
9323 %   M a g i c k S e t I m a g e G r a v i t y                                 %
9324 %                                                                             %
9325 %                                                                             %
9326 %                                                                             %
9327 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9328 %
9329 %  MagickSetImageGravity() sets the image gravity type.
9330 %
9331 %  The format of the MagickSetImageGravity method is:
9332 %
9333 %      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9334 %        const GravityType gravity)
9335 %
9336 %  A description of each parameter follows:
9337 %
9338 %    o wand: the magick wand.
9339 %
9340 %    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9341 %      PlaneInterlace, PartitionInterlace.
9342 %
9343 */
9344 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9345   const GravityType gravity)
9346 {
9347   assert(wand != (MagickWand *) NULL);
9348   assert(wand->signature == WandSignature);
9349   if (wand->debug != MagickFalse)
9350     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9351   if (wand->images == (Image *) NULL)
9352     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9353   wand->images->gravity=gravity;
9354   return(MagickTrue);
9355 }
9356 \f
9357 /*
9358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9359 %                                                                             %
9360 %                                                                             %
9361 %                                                                             %
9362 %   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                       %
9363 %                                                                             %
9364 %                                                                             %
9365 %                                                                             %
9366 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9367 %
9368 %  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9369 %  point.
9370 %
9371 %  The format of the MagickSetImageGreenPrimary method is:
9372 %
9373 %      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9374 %        const double x,const double y)
9375 %
9376 %  A description of each parameter follows:
9377 %
9378 %    o wand: the magick wand.
9379 %
9380 %    o x: the green primary x-point.
9381 %
9382 %    o y: the green primary y-point.
9383 %
9384 %
9385 */
9386 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9387   const double x,const double y)
9388 {
9389   assert(wand != (MagickWand *) NULL);
9390   assert(wand->signature == WandSignature);
9391   if (wand->debug != MagickFalse)
9392     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9393   if (wand->images == (Image *) NULL)
9394     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9395   wand->images->chromaticity.green_primary.x=x;
9396   wand->images->chromaticity.green_primary.y=y;
9397   return(MagickTrue);
9398 }
9399 \f
9400 /*
9401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9402 %                                                                             %
9403 %                                                                             %
9404 %                                                                             %
9405 %   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                 %
9406 %                                                                             %
9407 %                                                                             %
9408 %                                                                             %
9409 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9410 %
9411 %  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9412 %
9413 %  The format of the MagickSetImageInterlaceScheme method is:
9414 %
9415 %      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9416 %        const InterlaceType interlace)
9417 %
9418 %  A description of each parameter follows:
9419 %
9420 %    o wand: the magick wand.
9421 %
9422 %    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9423 %      PlaneInterlace, PartitionInterlace.
9424 %
9425 */
9426 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9427   const InterlaceType interlace)
9428 {
9429   assert(wand != (MagickWand *) NULL);
9430   assert(wand->signature == WandSignature);
9431   if (wand->debug != MagickFalse)
9432     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9433   if (wand->images == (Image *) NULL)
9434     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9435   wand->images->interlace=interlace;
9436   return(MagickTrue);
9437 }
9438 \f
9439 /*
9440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9441 %                                                                             %
9442 %                                                                             %
9443 %                                                                             %
9444 %   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             %
9445 %                                                                             %
9446 %                                                                             %
9447 %                                                                             %
9448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9449 %
9450 %  MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel method.
9451 %
9452 %  The format of the MagickSetImagePixelInterpolateMethod method is:
9453 %
9454 %      MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9455 %        const PixelInterpolateMethod method)
9456 %
9457 %  A description of each parameter follows:
9458 %
9459 %    o wand: the magick wand.
9460 %
9461 %    o method: the image interpole pixel methods: choose from Undefined,
9462 %      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9463 %
9464 */
9465 WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9466   const PixelInterpolateMethod method)
9467 {
9468   assert(wand != (MagickWand *) NULL);
9469   assert(wand->signature == WandSignature);
9470   if (wand->debug != MagickFalse)
9471     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9472   if (wand->images == (Image *) NULL)
9473     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9474   wand->images->interpolate=method;
9475   return(MagickTrue);
9476 }
9477 \f
9478 /*
9479 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9480 %                                                                             %
9481 %                                                                             %
9482 %                                                                             %
9483 %   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9484 %                                                                             %
9485 %                                                                             %
9486 %                                                                             %
9487 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9488 %
9489 %  MagickSetImageIterations() sets the image iterations.
9490 %
9491 %  The format of the MagickSetImageIterations method is:
9492 %
9493 %      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9494 %        const size_t iterations)
9495 %
9496 %  A description of each parameter follows:
9497 %
9498 %    o wand: the magick wand.
9499 %
9500 %    o delay: the image delay in 1/100th of a second.
9501 %
9502 */
9503 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9504   const size_t iterations)
9505 {
9506   assert(wand != (MagickWand *) NULL);
9507   assert(wand->signature == WandSignature);
9508   if (wand->debug != MagickFalse)
9509     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9510   if (wand->images == (Image *) NULL)
9511     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9512   wand->images->iterations=iterations;
9513   return(MagickTrue);
9514 }
9515 \f
9516 /*
9517 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9518 %                                                                             %
9519 %                                                                             %
9520 %                                                                             %
9521 %   M a g i c k S e t I m a g e M a t t e                                     %
9522 %                                                                             %
9523 %                                                                             %
9524 %                                                                             %
9525 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9526 %
9527 %  MagickSetImageMatte() sets the image matte channel.
9528 %
9529 %  The format of the MagickSetImageMatteColor method is:
9530 %
9531 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9532 %        const MagickBooleanType *matte)
9533 %
9534 %  A description of each parameter follows:
9535 %
9536 %    o wand: the magick wand.
9537 %
9538 %    o matte: Set to MagickTrue to enable the image matte channel otherwise
9539 %      MagickFalse.
9540 %
9541 */
9542 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9543   const MagickBooleanType matte)
9544 {
9545   assert(wand != (MagickWand *) NULL);
9546   assert(wand->signature == WandSignature);
9547   if (wand->debug != MagickFalse)
9548     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9549   if (wand->images == (Image *) NULL)
9550     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9551   if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
9552     (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
9553   wand->images->matte=matte;
9554   return(MagickTrue);
9555 }
9556 \f
9557 /*
9558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9559 %                                                                             %
9560 %                                                                             %
9561 %                                                                             %
9562 %   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9563 %                                                                             %
9564 %                                                                             %
9565 %                                                                             %
9566 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9567 %
9568 %  MagickSetImageMatteColor() sets the image matte color.
9569 %
9570 %  The format of the MagickSetImageMatteColor method is:
9571 %
9572 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9573 %        const PixelWand *matte)
9574 %
9575 %  A description of each parameter follows:
9576 %
9577 %    o wand: the magick wand.
9578 %
9579 %    o matte: the matte pixel wand.
9580 %
9581 */
9582 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9583   const PixelWand *matte)
9584 {
9585   assert(wand != (MagickWand *) NULL);
9586   assert(wand->signature == WandSignature);
9587   if (wand->debug != MagickFalse)
9588     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9589   if (wand->images == (Image *) NULL)
9590     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9591   PixelGetQuantumPacket(matte,&wand->images->matte_color);
9592   return(MagickTrue);
9593 }
9594 \f
9595 /*
9596 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9597 %                                                                             %
9598 %                                                                             %
9599 %                                                                             %
9600 %   M a g i c k S e t I m a g e O p a c i t y                                 %
9601 %                                                                             %
9602 %                                                                             %
9603 %                                                                             %
9604 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9605 %
9606 %  MagickSetImageAlpha() sets the image to the specified alpha level.
9607 %
9608 %  The format of the MagickSetImageAlpha method is:
9609 %
9610 %      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9611 %        const double alpha)
9612 %
9613 %  A description of each parameter follows:
9614 %
9615 %    o wand: the magick wand.
9616 %
9617 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9618 %      transparent.
9619 %
9620 */
9621 WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9622   const double alpha)
9623 {
9624   MagickBooleanType
9625     status;
9626
9627   assert(wand != (MagickWand *) NULL);
9628   assert(wand->signature == WandSignature);
9629   if (wand->debug != MagickFalse)
9630     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9631   if (wand->images == (Image *) NULL)
9632     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9633   status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
9634     wand->exception);
9635   return(status);
9636 }
9637 \f
9638 /*
9639 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9640 %                                                                             %
9641 %                                                                             %
9642 %                                                                             %
9643 %   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                         %
9644 %                                                                             %
9645 %                                                                             %
9646 %                                                                             %
9647 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9648 %
9649 %  MagickSetImageOrientation() sets the image orientation.
9650 %
9651 %  The format of the MagickSetImageOrientation method is:
9652 %
9653 %      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9654 %        const OrientationType orientation)
9655 %
9656 %  A description of each parameter follows:
9657 %
9658 %    o wand: the magick wand.
9659 %
9660 %    o orientation: the image orientation type.
9661 %
9662 */
9663 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9664   const OrientationType orientation)
9665 {
9666   assert(wand != (MagickWand *) NULL);
9667   assert(wand->signature == WandSignature);
9668   if (wand->debug != MagickFalse)
9669     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9670   if (wand->images == (Image *) NULL)
9671     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9672   wand->images->orientation=orientation;
9673   return(MagickTrue);
9674 }
9675 \f
9676 /*
9677 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9678 %                                                                             %
9679 %                                                                             %
9680 %                                                                             %
9681 %   M a g i c k S e t I m a g e P a g e                                       %
9682 %                                                                             %
9683 %                                                                             %
9684 %                                                                             %
9685 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9686 %
9687 %  MagickSetImagePage() sets the page geometry of the image.
9688 %
9689 %  The format of the MagickSetImagePage method is:
9690 %
9691 %      MagickBooleanType MagickSetImagePage(MagickWand *wand,
9692 %        const size_t width,const size_t height,const ssize_t x,
9693 %        const ssize_t y)
9694 %
9695 %  A description of each parameter follows:
9696 %
9697 %    o wand: the magick wand.
9698 %
9699 %    o width: the page width.
9700 %
9701 %    o height: the page height.
9702 %
9703 %    o x: the page x-offset.
9704 %
9705 %    o y: the page y-offset.
9706 %
9707 */
9708 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
9709   const size_t width,const size_t height,const ssize_t x,
9710   const ssize_t y)
9711 {
9712   assert(wand != (MagickWand *) NULL);
9713   assert(wand->signature == WandSignature);
9714   if (wand->debug != MagickFalse)
9715     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9716   if (wand->images == (Image *) NULL)
9717     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9718   wand->images->page.width=width;
9719   wand->images->page.height=height;
9720   wand->images->page.x=x;
9721   wand->images->page.y=y;
9722   return(MagickTrue);
9723 }
9724 \f
9725 /*
9726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9727 %                                                                             %
9728 %                                                                             %
9729 %                                                                             %
9730 %   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                 %
9731 %                                                                             %
9732 %                                                                             %
9733 %                                                                             %
9734 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9735 %
9736 %  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
9737 %  specified method and returns the previous progress monitor if any.  The
9738 %  progress monitor method looks like this:
9739 %
9740 %    MagickBooleanType MagickProgressMonitor(const char *text,
9741 %      const MagickOffsetType offset,const MagickSizeType span,
9742 %      void *client_data)
9743 %
9744 %  If the progress monitor returns MagickFalse, the current operation is
9745 %  interrupted.
9746 %
9747 %  The format of the MagickSetImageProgressMonitor method is:
9748 %
9749 %      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
9750 %        const MagickProgressMonitor progress_monitor,void *client_data)
9751 %
9752 %  A description of each parameter follows:
9753 %
9754 %    o wand: the magick wand.
9755 %
9756 %    o progress_monitor: Specifies a pointer to a method to monitor progress
9757 %      of an image operation.
9758 %
9759 %    o client_data: Specifies a pointer to any client data.
9760 %
9761 */
9762 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
9763   const MagickProgressMonitor progress_monitor,void *client_data)
9764 {
9765   MagickProgressMonitor
9766     previous_monitor;
9767
9768   assert(wand != (MagickWand *) NULL);
9769   assert(wand->signature == WandSignature);
9770   if (wand->debug != MagickFalse)
9771     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9772   if (wand->images == (Image *) NULL)
9773     {
9774       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
9775         "ContainsNoImages","`%s'",wand->name);
9776       return((MagickProgressMonitor) NULL);
9777     }
9778   previous_monitor=SetImageProgressMonitor(wand->images,
9779     progress_monitor,client_data);
9780   return(previous_monitor);
9781 }
9782 \f
9783 /*
9784 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9785 %                                                                             %
9786 %                                                                             %
9787 %                                                                             %
9788 %   M a g i c k S e t I m a g e R e d P r i m a r y                           %
9789 %                                                                             %
9790 %                                                                             %
9791 %                                                                             %
9792 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9793 %
9794 %  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
9795 %
9796 %  The format of the MagickSetImageRedPrimary method is:
9797 %
9798 %      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9799 %        const double x,const double y)
9800 %
9801 %  A description of each parameter follows:
9802 %
9803 %    o wand: the magick wand.
9804 %
9805 %    o x: the red primary x-point.
9806 %
9807 %    o y: the red primary y-point.
9808 %
9809 */
9810 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9811   const double x,const double y)
9812 {
9813   assert(wand != (MagickWand *) NULL);
9814   assert(wand->signature == WandSignature);
9815   if (wand->debug != MagickFalse)
9816     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9817   if (wand->images == (Image *) NULL)
9818     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9819   wand->images->chromaticity.red_primary.x=x;
9820   wand->images->chromaticity.red_primary.y=y;
9821   return(MagickTrue);
9822 }
9823 \f
9824 /*
9825 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9826 %                                                                             %
9827 %                                                                             %
9828 %                                                                             %
9829 %   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                 %
9830 %                                                                             %
9831 %                                                                             %
9832 %                                                                             %
9833 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9834 %
9835 %  MagickSetImageRenderingIntent() sets the image rendering intent.
9836 %
9837 %  The format of the MagickSetImageRenderingIntent method is:
9838 %
9839 %      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9840 %        const RenderingIntent rendering_intent)
9841 %
9842 %  A description of each parameter follows:
9843 %
9844 %    o wand: the magick wand.
9845 %
9846 %    o rendering_intent: the image rendering intent: UndefinedIntent,
9847 %      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
9848 %
9849 */
9850 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9851   const RenderingIntent rendering_intent)
9852 {
9853   assert(wand != (MagickWand *) NULL);
9854   assert(wand->signature == WandSignature);
9855   if (wand->debug != MagickFalse)
9856     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9857   if (wand->images == (Image *) NULL)
9858     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9859   wand->images->rendering_intent=rendering_intent;
9860   return(MagickTrue);
9861 }
9862 \f
9863 /*
9864 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9865 %                                                                             %
9866 %                                                                             %
9867 %                                                                             %
9868 %   M a g i c k S e t I m a g e R e s o l u t i o n                           %
9869 %                                                                             %
9870 %                                                                             %
9871 %                                                                             %
9872 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9873 %
9874 %  MagickSetImageResolution() sets the image resolution.
9875 %
9876 %  The format of the MagickSetImageResolution method is:
9877 %
9878 %      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9879 %        const double x_resolution,const doubtl y_resolution)
9880 %
9881 %  A description of each parameter follows:
9882 %
9883 %    o wand: the magick wand.
9884 %
9885 %    o x_resolution: the image x resolution.
9886 %
9887 %    o y_resolution: the image y resolution.
9888 %
9889 */
9890 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9891   const double x_resolution,const double y_resolution)
9892 {
9893   assert(wand != (MagickWand *) NULL);
9894   assert(wand->signature == WandSignature);
9895   if (wand->debug != MagickFalse)
9896     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9897   if (wand->images == (Image *) NULL)
9898     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9899   wand->images->x_resolution=x_resolution;
9900   wand->images->y_resolution=y_resolution;
9901   return(MagickTrue);
9902 }
9903 \f
9904 /*
9905 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9906 %                                                                             %
9907 %                                                                             %
9908 %                                                                             %
9909 %   M a g i c k S e t I m a g e S c e n e                                     %
9910 %                                                                             %
9911 %                                                                             %
9912 %                                                                             %
9913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9914 %
9915 %  MagickSetImageScene() sets the image scene.
9916 %
9917 %  The format of the MagickSetImageScene method is:
9918 %
9919 %      MagickBooleanType MagickSetImageScene(MagickWand *wand,
9920 %        const size_t scene)
9921 %
9922 %  A description of each parameter follows:
9923 %
9924 %    o wand: the magick wand.
9925 %
9926 %    o delay: the image scene number.
9927 %
9928 */
9929 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
9930   const size_t scene)
9931 {
9932   assert(wand != (MagickWand *) NULL);
9933   assert(wand->signature == WandSignature);
9934   if (wand->debug != MagickFalse)
9935     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9936   if (wand->images == (Image *) NULL)
9937     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9938   wand->images->scene=scene;
9939   return(MagickTrue);
9940 }
9941 \f
9942 /*
9943 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9944 %                                                                             %
9945 %                                                                             %
9946 %                                                                             %
9947 %   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                   %
9948 %                                                                             %
9949 %                                                                             %
9950 %                                                                             %
9951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9952 %
9953 %  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
9954 %
9955 %  The format of the MagickSetImageTicksPerSecond method is:
9956 %
9957 %      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9958 %        const ssize_t ticks_per-second)
9959 %
9960 %  A description of each parameter follows:
9961 %
9962 %    o wand: the magick wand.
9963 %
9964 %    o ticks_per_second: the units to use for the image delay.
9965 %
9966 */
9967 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9968   const ssize_t ticks_per_second)
9969 {
9970   assert(wand != (MagickWand *) NULL);
9971   assert(wand->signature == WandSignature);
9972   if (wand->debug != MagickFalse)
9973     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9974   if (wand->images == (Image *) NULL)
9975     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9976   wand->images->ticks_per_second=ticks_per_second;
9977   return(MagickTrue);
9978 }
9979 \f
9980 /*
9981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9982 %                                                                             %
9983 %                                                                             %
9984 %                                                                             %
9985 %   M a g i c k S e t I m a g e T y p e                                       %
9986 %                                                                             %
9987 %                                                                             %
9988 %                                                                             %
9989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9990 %
9991 %  MagickSetImageType() sets the image type.
9992 %
9993 %  The format of the MagickSetImageType method is:
9994 %
9995 %      MagickBooleanType MagickSetImageType(MagickWand *wand,
9996 %        const ImageType image_type)
9997 %
9998 %  A description of each parameter follows:
9999 %
10000 %    o wand: the magick wand.
10001 %
10002 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10003 %      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10004 %      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10005 %      or OptimizeType.
10006 %
10007 */
10008 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10009   const ImageType image_type)
10010 {
10011   assert(wand != (MagickWand *) NULL);
10012   assert(wand->signature == WandSignature);
10013   if (wand->debug != MagickFalse)
10014     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10015   if (wand->images == (Image *) NULL)
10016     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10017   return(SetImageType(wand->images,image_type,wand->exception));
10018 }
10019 \f
10020 /*
10021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10022 %                                                                             %
10023 %                                                                             %
10024 %                                                                             %
10025 %   M a g i c k S e t I m a g e U n i t s                                     %
10026 %                                                                             %
10027 %                                                                             %
10028 %                                                                             %
10029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10030 %
10031 %  MagickSetImageUnits() sets the image units of resolution.
10032 %
10033 %  The format of the MagickSetImageUnits method is:
10034 %
10035 %      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10036 %        const ResolutionType units)
10037 %
10038 %  A description of each parameter follows:
10039 %
10040 %    o wand: the magick wand.
10041 %
10042 %    o units: the image units of resolution : UndefinedResolution,
10043 %      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10044 %
10045 */
10046 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10047   const ResolutionType units)
10048 {
10049   assert(wand != (MagickWand *) NULL);
10050   assert(wand->signature == WandSignature);
10051   if (wand->debug != MagickFalse)
10052     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10053   if (wand->images == (Image *) NULL)
10054     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10055   wand->images->units=units;
10056   return(MagickTrue);
10057 }
10058 \f
10059 /*
10060 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10061 %                                                                             %
10062 %                                                                             %
10063 %                                                                             %
10064 %   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           %
10065 %                                                                             %
10066 %                                                                             %
10067 %                                                                             %
10068 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10069 %
10070 %  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10071 %
10072 %  The format of the MagickSetImageVirtualPixelMethod method is:
10073 %
10074 %      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10075 %        const VirtualPixelMethod method)
10076 %
10077 %  A description of each parameter follows:
10078 %
10079 %    o wand: the magick wand.
10080 %
10081 %    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10082 %      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10083 %      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10084 %
10085 */
10086 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10087   const VirtualPixelMethod method)
10088 {
10089   assert(wand != (MagickWand *) NULL);
10090   assert(wand->signature == WandSignature);
10091   if (wand->debug != MagickFalse)
10092     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10093   if (wand->images == (Image *) NULL)
10094     return(UndefinedVirtualPixelMethod);
10095   return(SetImageVirtualPixelMethod(wand->images,method));
10096 }
10097 \f
10098 /*
10099 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10100 %                                                                             %
10101 %                                                                             %
10102 %                                                                             %
10103 %   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10104 %                                                                             %
10105 %                                                                             %
10106 %                                                                             %
10107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10108 %
10109 %  MagickSetImageWhitePoint() sets the image chromaticity white point.
10110 %
10111 %  The format of the MagickSetImageWhitePoint method is:
10112 %
10113 %      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10114 %        const double x,const double y)
10115 %
10116 %  A description of each parameter follows:
10117 %
10118 %    o wand: the magick wand.
10119 %
10120 %    o x: the white x-point.
10121 %
10122 %    o y: the white y-point.
10123 %
10124 */
10125 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10126   const double x,const double y)
10127 {
10128   assert(wand != (MagickWand *) NULL);
10129   assert(wand->signature == WandSignature);
10130   if (wand->debug != MagickFalse)
10131     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10132   if (wand->images == (Image *) NULL)
10133     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10134   wand->images->chromaticity.white_point.x=x;
10135   wand->images->chromaticity.white_point.y=y;
10136   return(MagickTrue);
10137 }
10138 \f
10139 /*
10140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10141 %                                                                             %
10142 %                                                                             %
10143 %                                                                             %
10144 %   M a g i c k S h a d e I m a g e C h a n n e l                             %
10145 %                                                                             %
10146 %                                                                             %
10147 %                                                                             %
10148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10149 %
10150 %  MagickShadeImage() shines a distant light on an image to create a
10151 %  three-dimensional effect. You control the positioning of the light with
10152 %  azimuth and elevation; azimuth is measured in degrees off the x axis
10153 %  and elevation is measured in pixels above the Z axis.
10154 %
10155 %  The format of the MagickShadeImage method is:
10156 %
10157 %      MagickBooleanType MagickShadeImage(MagickWand *wand,
10158 %        const MagickBooleanType gray,const double azimuth,
10159 %        const double elevation)
10160 %
10161 %  A description of each parameter follows:
10162 %
10163 %    o wand: the magick wand.
10164 %
10165 %    o gray: A value other than zero shades the intensity of each pixel.
10166 %
10167 %    o azimuth, elevation:  Define the light source direction.
10168 %
10169 */
10170 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10171   const MagickBooleanType gray,const double asimuth,const double elevation)
10172 {
10173   Image
10174     *shade_image;
10175
10176   assert(wand != (MagickWand *) NULL);
10177   assert(wand->signature == WandSignature);
10178   if (wand->debug != MagickFalse)
10179     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10180   if (wand->images == (Image *) NULL)
10181     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10182   shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10183   if (shade_image == (Image *) NULL)
10184     return(MagickFalse);
10185   ReplaceImageInList(&wand->images,shade_image);
10186   return(MagickTrue);
10187 }
10188 \f
10189 /*
10190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10191 %                                                                             %
10192 %                                                                             %
10193 %                                                                             %
10194 %   M a g i c k S h a d o w I m a g e                                         %
10195 %                                                                             %
10196 %                                                                             %
10197 %                                                                             %
10198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10199 %
10200 %  MagickShadowImage() simulates an image shadow.
10201 %
10202 %  The format of the MagickShadowImage method is:
10203 %
10204 %      MagickBooleanType MagickShadowImage(MagickWand *wand,
10205 %        const double alpha,const double sigma,const ssize_t x,const ssize_t y)
10206 %
10207 %  A description of each parameter follows:
10208 %
10209 %    o wand: the magick wand.
10210 %
10211 %    o alpha: percentage transparency.
10212 %
10213 %    o sigma: the standard deviation of the Gaussian, in pixels.
10214 %
10215 %    o x: the shadow x-offset.
10216 %
10217 %    o y: the shadow y-offset.
10218 %
10219 */
10220 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10221   const double alpha,const double sigma,const ssize_t x,const ssize_t y)
10222 {
10223   Image
10224     *shadow_image;
10225
10226   assert(wand != (MagickWand *) NULL);
10227   assert(wand->signature == WandSignature);
10228   if (wand->debug != MagickFalse)
10229     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10230   if (wand->images == (Image *) NULL)
10231     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10232   shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
10233   if (shadow_image == (Image *) NULL)
10234     return(MagickFalse);
10235   ReplaceImageInList(&wand->images,shadow_image);
10236   return(MagickTrue);
10237 }
10238 \f
10239 /*
10240 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10241 %                                                                             %
10242 %                                                                             %
10243 %                                                                             %
10244 %   M a g i c k S h a r p e n I m a g e                                       %
10245 %                                                                             %
10246 %                                                                             %
10247 %                                                                             %
10248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10249 %
10250 %  MagickSharpenImage() sharpens an image.  We convolve the image with a
10251 %  Gaussian operator of the given radius and standard deviation (sigma).
10252 %  For reasonable results, the radius should be larger than sigma.  Use a
10253 %  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10254 %
10255 %  The format of the MagickSharpenImage method is:
10256 %
10257 %      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10258 %        const double radius,const double sigma,const double bias)
10259 %
10260 %  A description of each parameter follows:
10261 %
10262 %    o wand: the magick wand.
10263 %
10264 %    o radius: the radius of the Gaussian, in pixels, not counting the center
10265 %      pixel.
10266 %
10267 %    o sigma: the standard deviation of the Gaussian, in pixels.
10268 %
10269 %    o bias: the bias.
10270 %
10271 */
10272 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10273   const double radius,const double sigma,const double bias)
10274 {
10275   Image
10276     *sharp_image;
10277
10278   assert(wand != (MagickWand *) NULL);
10279   assert(wand->signature == WandSignature);
10280   if (wand->debug != MagickFalse)
10281     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10282   if (wand->images == (Image *) NULL)
10283     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10284   sharp_image=SharpenImage(wand->images,radius,sigma,bias,wand->exception);
10285   if (sharp_image == (Image *) NULL)
10286     return(MagickFalse);
10287   ReplaceImageInList(&wand->images,sharp_image);
10288   return(MagickTrue);
10289 }
10290 \f
10291 /*
10292 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10293 %                                                                             %
10294 %                                                                             %
10295 %                                                                             %
10296 %   M a g i c k S h a v e I m a g e                                           %
10297 %                                                                             %
10298 %                                                                             %
10299 %                                                                             %
10300 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10301 %
10302 %  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10303 %  memory necessary for the new Image structure and returns a pointer to the
10304 %  new image.
10305 %
10306 %  The format of the MagickShaveImage method is:
10307 %
10308 %      MagickBooleanType MagickShaveImage(MagickWand *wand,
10309 %        const size_t columns,const size_t rows)
10310 %
10311 %  A description of each parameter follows:
10312 %
10313 %    o wand: the magick wand.
10314 %
10315 %    o columns: the number of columns in the scaled image.
10316 %
10317 %    o rows: the number of rows in the scaled image.
10318 %
10319 %
10320 */
10321 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10322   const size_t columns,const size_t rows)
10323 {
10324   Image
10325     *shave_image;
10326
10327   RectangleInfo
10328     shave_info;
10329
10330   assert(wand != (MagickWand *) NULL);
10331   assert(wand->signature == WandSignature);
10332   if (wand->debug != MagickFalse)
10333     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10334   if (wand->images == (Image *) NULL)
10335     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10336   shave_info.width=columns;
10337   shave_info.height=rows;
10338   shave_info.x=0;
10339   shave_info.y=0;
10340   shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10341   if (shave_image == (Image *) NULL)
10342     return(MagickFalse);
10343   ReplaceImageInList(&wand->images,shave_image);
10344   return(MagickTrue);
10345 }
10346 \f
10347 /*
10348 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10349 %                                                                             %
10350 %                                                                             %
10351 %                                                                             %
10352 %   M a g i c k S h e a r I m a g e                                           %
10353 %                                                                             %
10354 %                                                                             %
10355 %                                                                             %
10356 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10357 %
10358 %  MagickShearImage() slides one edge of an image along the X or Y axis,
10359 %  creating a parallelogram.  An X direction shear slides an edge along the X
10360 %  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10361 %  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10362 %  is measured relative to the Y axis, and similarly, for Y direction shears
10363 %  y_shear is measured relative to the X axis.  Empty triangles left over from
10364 %  shearing the image are filled with the background color.
10365 %
10366 %  The format of the MagickShearImage method is:
10367 %
10368 %      MagickBooleanType MagickShearImage(MagickWand *wand,
10369 %        const PixelWand *background,const double x_shear,onst double y_shear)
10370 %
10371 %  A description of each parameter follows:
10372 %
10373 %    o wand: the magick wand.
10374 %
10375 %    o background: the background pixel wand.
10376 %
10377 %    o x_shear: the number of degrees to shear the image.
10378 %
10379 %    o y_shear: the number of degrees to shear the image.
10380 %
10381 */
10382 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10383   const PixelWand *background,const double x_shear,const double y_shear)
10384 {
10385   Image
10386     *shear_image;
10387
10388   assert(wand != (MagickWand *) NULL);
10389   assert(wand->signature == WandSignature);
10390   if (wand->debug != MagickFalse)
10391     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10392   if (wand->images == (Image *) NULL)
10393     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10394   PixelGetQuantumPacket(background,&wand->images->background_color);
10395   shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10396   if (shear_image == (Image *) NULL)
10397     return(MagickFalse);
10398   ReplaceImageInList(&wand->images,shear_image);
10399   return(MagickTrue);
10400 }
10401 \f
10402 /*
10403 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10404 %                                                                             %
10405 %                                                                             %
10406 %                                                                             %
10407 %   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                   %
10408 %                                                                             %
10409 %                                                                             %
10410 %                                                                             %
10411 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10412 %
10413 %  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10414 %  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10415 %  image using a sigmoidal transfer function without saturating highlights or
10416 %  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10417 %  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10418 %  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10419 %  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10420 %  is reduced.
10421 %
10422 %  The format of the MagickSigmoidalContrastImage method is:
10423 %
10424 %      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10425 %        const MagickBooleanType sharpen,const double alpha,const double beta)
10426 %
10427 %  A description of each parameter follows:
10428 %
10429 %    o wand: the magick wand.
10430 %
10431 %    o sharpen: Increase or decrease image contrast.
10432 %
10433 %    o alpha: strength of the contrast, the larger the number the more
10434 %      'threshold-like' it becomes.
10435 %
10436 %    o beta: midpoint of the function as a color value 0 to QuantumRange.
10437 %
10438 */
10439 WandExport MagickBooleanType MagickSigmoidalContrastImage(
10440   MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10441   const double beta)
10442 {
10443   MagickBooleanType
10444     status;
10445
10446   assert(wand != (MagickWand *) NULL);
10447   assert(wand->signature == WandSignature);
10448   if (wand->debug != MagickFalse)
10449     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10450   if (wand->images == (Image *) NULL)
10451     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10452   status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10453     &wand->images->exception);
10454   return(status);
10455 }
10456 \f
10457 /*
10458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10459 %                                                                             %
10460 %                                                                             %
10461 %                                                                             %
10462 %   M a g i c k S i m i l a r i t y I m a g e                                 %
10463 %                                                                             %
10464 %                                                                             %
10465 %                                                                             %
10466 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10467 %
10468 %  MagickSimilarityImage() compares the reference image of the image and
10469 %  returns the best match offset.  In addition, it returns a similarity image
10470 %  such that an exact match location is completely white and if none of the
10471 %  pixels match, black, otherwise some gray level in-between.
10472 %
10473 %  The format of the MagickSimilarityImage method is:
10474 %
10475 %      MagickWand *MagickSimilarityImage(MagickWand *wand,
10476 %        const MagickWand *reference,RectangeInfo *offset,double *similarity)
10477 %
10478 %  A description of each parameter follows:
10479 %
10480 %    o wand: the magick wand.
10481 %
10482 %    o reference: the reference wand.
10483 %
10484 %    o offset: the best match offset of the reference image within the image.
10485 %
10486 %    o similarity: the computed similarity between the images.
10487 %
10488 */
10489 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10490   const MagickWand *reference,RectangleInfo *offset,double *similarity)
10491 {
10492   Image
10493     *similarity_image;
10494
10495   assert(wand != (MagickWand *) NULL);
10496   assert(wand->signature == WandSignature);
10497   if (wand->debug != MagickFalse)
10498     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10499   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10500     {
10501       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10502         "ContainsNoImages","`%s'",wand->name);
10503       return((MagickWand *) NULL);
10504     }
10505   similarity_image=SimilarityImage(wand->images,reference->images,offset,
10506     similarity,&wand->images->exception);
10507   if (similarity_image == (Image *) NULL)
10508     return((MagickWand *) NULL);
10509   return(CloneMagickWandFromImages(wand,similarity_image));
10510 }
10511 \f
10512 /*
10513 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10514 %                                                                             %
10515 %                                                                             %
10516 %                                                                             %
10517 %   M a g i c k S k e t c h I m a g e                                         %
10518 %                                                                             %
10519 %                                                                             %
10520 %                                                                             %
10521 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10522 %
10523 %  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10524 %  a Gaussian operator of the given radius and standard deviation (sigma).
10525 %  For reasonable results, radius should be larger than sigma.  Use a
10526 %  radius of 0 and SketchImage() selects a suitable radius for you.
10527 %  Angle gives the angle of the blurring motion.
10528 %
10529 %  The format of the MagickSketchImage method is:
10530 %
10531 %      MagickBooleanType MagickSketchImage(MagickWand *wand,
10532 %        const double radius,const double sigma,const double angle,
10533 %        const double bias)
10534 %
10535 %  A description of each parameter follows:
10536 %
10537 %    o wand: the magick wand.
10538 %
10539 %    o radius: the radius of the Gaussian, in pixels, not counting
10540 %      the center pixel.
10541 %
10542 %    o sigma: the standard deviation of the Gaussian, in pixels.
10543 %
10544 %    o angle: apply the effect along this angle.
10545 %
10546 %    o bias: the bias.
10547 %
10548 */
10549 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10550   const double radius,const double sigma,const double angle,const double bias)
10551 {
10552   Image
10553     *sketch_image;
10554
10555   assert(wand != (MagickWand *) NULL);
10556   assert(wand->signature == WandSignature);
10557   if (wand->debug != MagickFalse)
10558     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10559   if (wand->images == (Image *) NULL)
10560     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10561   sketch_image=SketchImage(wand->images,radius,sigma,angle,bias,
10562     wand->exception);
10563   if (sketch_image == (Image *) NULL)
10564     return(MagickFalse);
10565   ReplaceImageInList(&wand->images,sketch_image);
10566   return(MagickTrue);
10567 }
10568 \f
10569 /*
10570 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10571 %                                                                             %
10572 %                                                                             %
10573 %                                                                             %
10574 %   M a g i c k S m u s h I m a g e s                                         %
10575 %                                                                             %
10576 %                                                                             %
10577 %                                                                             %
10578 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10579 %
10580 %  MagickSmushImages() takes all images from the current image pointer to the
10581 %  end of the image list and smushs them to each other top-to-bottom if the
10582 %  stack parameter is true, otherwise left-to-right.
10583 %
10584 %  The format of the MagickSmushImages method is:
10585 %
10586 %      MagickWand *MagickSmushImages(MagickWand *wand,
10587 %        const MagickBooleanType stack,const ssize_t offset)
10588 %
10589 %  A description of each parameter follows:
10590 %
10591 %    o wand: the magick wand.
10592 %
10593 %    o stack: By default, images are stacked left-to-right. Set stack to
10594 %      MagickTrue to stack them top-to-bottom.
10595 %
10596 %    o offset: minimum distance in pixels between images.
10597 %
10598 */
10599 WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10600   const MagickBooleanType stack,const ssize_t offset)
10601 {
10602   Image
10603     *smush_image;
10604
10605   assert(wand != (MagickWand *) NULL);
10606   assert(wand->signature == WandSignature);
10607   if (wand->debug != MagickFalse)
10608     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10609   if (wand->images == (Image *) NULL)
10610     return((MagickWand *) NULL);
10611   smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10612   if (smush_image == (Image *) NULL)
10613     return((MagickWand *) NULL);
10614   return(CloneMagickWandFromImages(wand,smush_image));
10615 }
10616 \f
10617 /*
10618 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10619 %                                                                             %
10620 %                                                                             %
10621 %                                                                             %
10622 %     M a g i c k S o l a r i z e I m a g e                                   %
10623 %                                                                             %
10624 %                                                                             %
10625 %                                                                             %
10626 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10627 %
10628 %  MagickSolarizeImage() applies a special effect to the image, similar to the
10629 %  effect achieved in a photo darkroom by selectively exposing areas of photo
10630 %  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
10631 %  measure of the extent of the solarization.
10632 %
10633 %  The format of the MagickSolarizeImage method is:
10634 %
10635 %      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10636 %        const double threshold)
10637 %
10638 %  A description of each parameter follows:
10639 %
10640 %    o wand: the magick wand.
10641 %
10642 %    o threshold:  Define the extent of the solarization.
10643 %
10644 */
10645 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10646   const double threshold)
10647 {
10648   MagickBooleanType
10649     status;
10650
10651   assert(wand != (MagickWand *) NULL);
10652   assert(wand->signature == WandSignature);
10653   if (wand->debug != MagickFalse)
10654     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10655   if (wand->images == (Image *) NULL)
10656     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10657   status=SolarizeImage(wand->images,threshold,&wand->images->exception);
10658   return(status);
10659 }
10660 \f
10661 /*
10662 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10663 %                                                                             %
10664 %                                                                             %
10665 %                                                                             %
10666 %   M a g i c k S p a r s e C o l o r I m a g e                               %
10667 %                                                                             %
10668 %                                                                             %
10669 %                                                                             %
10670 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10671 %
10672 %  MagickSparseColorImage(), given a set of coordinates, interpolates the
10673 %  colors found at those coordinates, across the whole image, using various
10674 %  methods.
10675 %
10676 %  The format of the MagickSparseColorImage method is:
10677 %
10678 %      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10679 %        const SparseColorMethod method,const size_t number_arguments,
10680 %        const double *arguments)
10681 %
10682 %  A description of each parameter follows:
10683 %
10684 %    o image: the image to be sparseed.
10685 %
10686 %    o method: the method of image sparseion.
10687 %
10688 %        ArcSparseColorion will always ignore source image offset, and always
10689 %        'bestfit' the destination image with the top left corner offset
10690 %        relative to the polar mapping center.
10691 %
10692 %        Bilinear has no simple inverse mapping so will not allow 'bestfit'
10693 %        style of image sparseion.
10694 %
10695 %        Affine, Perspective, and Bilinear, will do least squares fitting of
10696 %        the distrotion when more than the minimum number of control point
10697 %        pairs are provided.
10698 %
10699 %        Perspective, and Bilinear, will fall back to a Affine sparseion when
10700 %        less than 4 control point pairs are provided. While Affine sparseions
10701 %        will let you use any number of control point pairs, that is Zero pairs
10702 %        is a No-Op (viewport only) distrotion, one pair is a translation and
10703 %        two pairs of control points will do a scale-rotate-translate, without
10704 %        any shearing.
10705 %
10706 %    o number_arguments: the number of arguments given for this sparseion
10707 %      method.
10708 %
10709 %    o arguments: the arguments for this sparseion method.
10710 %
10711 */
10712 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10713   const SparseColorMethod method,const size_t number_arguments,
10714   const double *arguments)
10715 {
10716   Image
10717     *sparse_image;
10718
10719   assert(wand != (MagickWand *) NULL);
10720   assert(wand->signature == WandSignature);
10721   if (wand->debug != MagickFalse)
10722     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10723   if (wand->images == (Image *) NULL)
10724     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10725   sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
10726     wand->exception);
10727   if (sparse_image == (Image *) NULL)
10728     return(MagickFalse);
10729   ReplaceImageInList(&wand->images,sparse_image);
10730   return(MagickTrue);
10731 }
10732 \f
10733 /*
10734 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10735 %                                                                             %
10736 %                                                                             %
10737 %                                                                             %
10738 %   M a g i c k S p l i c e I m a g e                                         %
10739 %                                                                             %
10740 %                                                                             %
10741 %                                                                             %
10742 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10743 %
10744 %  MagickSpliceImage() splices a solid color into the image.
10745 %
10746 %  The format of the MagickSpliceImage method is:
10747 %
10748 %      MagickBooleanType MagickSpliceImage(MagickWand *wand,
10749 %        const size_t width,const size_t height,const ssize_t x,
10750 %        const ssize_t y)
10751 %
10752 %  A description of each parameter follows:
10753 %
10754 %    o wand: the magick wand.
10755 %
10756 %    o width: the region width.
10757 %
10758 %    o height: the region height.
10759 %
10760 %    o x: the region x offset.
10761 %
10762 %    o y: the region y offset.
10763 %
10764 */
10765 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
10766   const size_t width,const size_t height,const ssize_t x,
10767   const ssize_t y)
10768 {
10769   Image
10770     *splice_image;
10771
10772   RectangleInfo
10773     splice;
10774
10775   assert(wand != (MagickWand *) NULL);
10776   assert(wand->signature == WandSignature);
10777   if (wand->debug != MagickFalse)
10778     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10779   if (wand->images == (Image *) NULL)
10780     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10781   splice.width=width;
10782   splice.height=height;
10783   splice.x=x;
10784   splice.y=y;
10785   splice_image=SpliceImage(wand->images,&splice,wand->exception);
10786   if (splice_image == (Image *) NULL)
10787     return(MagickFalse);
10788   ReplaceImageInList(&wand->images,splice_image);
10789   return(MagickTrue);
10790 }
10791 \f
10792 /*
10793 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10794 %                                                                             %
10795 %                                                                             %
10796 %                                                                             %
10797 %   M a g i c k S p r e a d I m a g e                                         %
10798 %                                                                             %
10799 %                                                                             %
10800 %                                                                             %
10801 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10802 %
10803 %  MagickSpreadImage() is a special effects method that randomly displaces each
10804 %  pixel in a block defined by the radius parameter.
10805 %
10806 %  The format of the MagickSpreadImage method is:
10807 %
10808 %      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius,
10809 %        const PixelInterpolateMethod method)
10810 %
10811 %  A description of each parameter follows:
10812 %
10813 %    o wand: the magick wand.
10814 %
10815 %    o radius:  Choose a random pixel in a neighborhood of this extent.
10816 %
10817 %    o method: the pixel interpolation method.
10818 %
10819 */
10820 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
10821   const double radius,const PixelInterpolateMethod method)
10822 {
10823   Image
10824     *spread_image;
10825
10826   assert(wand != (MagickWand *) NULL);
10827   assert(wand->signature == WandSignature);
10828   if (wand->debug != MagickFalse)
10829     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10830   if (wand->images == (Image *) NULL)
10831     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10832   spread_image=SpreadImage(wand->images,radius,method,wand->exception);
10833   if (spread_image == (Image *) NULL)
10834     return(MagickFalse);
10835   ReplaceImageInList(&wand->images,spread_image);
10836   return(MagickTrue);
10837 }
10838 \f
10839 /*
10840 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10841 %                                                                             %
10842 %                                                                             %
10843 %                                                                             %
10844 %   M a g i c k S t a t i s t i c I m a g e                                   %
10845 %                                                                             %
10846 %                                                                             %
10847 %                                                                             %
10848 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10849 %
10850 %  MagickStatisticImage() replace each pixel with corresponding statistic from
10851 %  the neighborhood of the specified width and height.
10852 %
10853 %  The format of the MagickStatisticImage method is:
10854 %
10855 %      MagickBooleanType MagickStatisticImage(MagickWand *wand,
10856 %        const StatisticType type,const double width,const size_t height)
10857 %
10858 %  A description of each parameter follows:
10859 %
10860 %    o wand: the magick wand.
10861 %
10862 %    o type: the statistic type (e.g. median, mode, etc.).
10863 %
10864 %    o width: the width of the pixel neighborhood.
10865 %
10866 %    o height: the height of the pixel neighborhood.
10867 %
10868 */
10869 WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
10870   const StatisticType type,const size_t width,const size_t height)
10871 {
10872   Image
10873     *statistic_image;
10874
10875   assert(wand != (MagickWand *) NULL);
10876   assert(wand->signature == WandSignature);
10877   if (wand->debug != MagickFalse)
10878     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10879   if (wand->images == (Image *) NULL)
10880     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10881   statistic_image=StatisticImage(wand->images,type,width,height,
10882     wand->exception);
10883   if (statistic_image == (Image *) NULL)
10884     return(MagickFalse);
10885   ReplaceImageInList(&wand->images,statistic_image);
10886   return(MagickTrue);
10887 }
10888 \f
10889 /*
10890 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10891 %                                                                             %
10892 %                                                                             %
10893 %                                                                             %
10894 %   M a g i c k S t e g a n o I m a g e                                       %
10895 %                                                                             %
10896 %                                                                             %
10897 %                                                                             %
10898 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10899 %
10900 %  MagickSteganoImage() hides a digital watermark within the image.
10901 %  Recover the hidden watermark later to prove that the authenticity of
10902 %  an image.  Offset defines the start position within the image to hide
10903 %  the watermark.
10904 %
10905 %  The format of the MagickSteganoImage method is:
10906 %
10907 %      MagickWand *MagickSteganoImage(MagickWand *wand,
10908 %        const MagickWand *watermark_wand,const ssize_t offset)
10909 %
10910 %  A description of each parameter follows:
10911 %
10912 %    o wand: the magick wand.
10913 %
10914 %    o watermark_wand: the watermark wand.
10915 %
10916 %    o offset: Start hiding at this offset into the image.
10917 %
10918 */
10919 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
10920   const MagickWand *watermark_wand,const ssize_t offset)
10921 {
10922   Image
10923     *stegano_image;
10924
10925   assert(wand != (MagickWand *) NULL);
10926   assert(wand->signature == WandSignature);
10927   if (wand->debug != MagickFalse)
10928     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10929   if ((wand->images == (Image *) NULL) ||
10930       (watermark_wand->images == (Image *) NULL))
10931     {
10932       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10933         "ContainsNoImages","`%s'",wand->name);
10934       return((MagickWand *) NULL);
10935     }
10936   wand->images->offset=offset;
10937   stegano_image=SteganoImage(wand->images,watermark_wand->images,
10938     wand->exception);
10939   if (stegano_image == (Image *) NULL)
10940     return((MagickWand *) NULL);
10941   return(CloneMagickWandFromImages(wand,stegano_image));
10942 }
10943 \f
10944 /*
10945 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10946 %                                                                             %
10947 %                                                                             %
10948 %                                                                             %
10949 %   M a g i c k S t e r e o I m a g e                                         %
10950 %                                                                             %
10951 %                                                                             %
10952 %                                                                             %
10953 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10954 %
10955 %  MagickStereoImage() composites two images and produces a single image that
10956 %  is the composite of a left and right image of a stereo pair
10957 %
10958 %  The format of the MagickStereoImage method is:
10959 %
10960 %      MagickWand *MagickStereoImage(MagickWand *wand,
10961 %        const MagickWand *offset_wand)
10962 %
10963 %  A description of each parameter follows:
10964 %
10965 %    o wand: the magick wand.
10966 %
10967 %    o offset_wand: Another image wand.
10968 %
10969 */
10970 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
10971   const MagickWand *offset_wand)
10972 {
10973   Image
10974     *stereo_image;
10975
10976   assert(wand != (MagickWand *) NULL);
10977   assert(wand->signature == WandSignature);
10978   if (wand->debug != MagickFalse)
10979     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10980   if ((wand->images == (Image *) NULL) ||
10981       (offset_wand->images == (Image *) NULL))
10982     {
10983       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10984         "ContainsNoImages","`%s'",wand->name);
10985       return((MagickWand *) NULL);
10986     }
10987   stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
10988   if (stereo_image == (Image *) NULL)
10989     return((MagickWand *) NULL);
10990   return(CloneMagickWandFromImages(wand,stereo_image));
10991 }
10992 \f
10993 /*
10994 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10995 %                                                                             %
10996 %                                                                             %
10997 %                                                                             %
10998 %   M a g i c k S t r i p I m a g e                                           %
10999 %                                                                             %
11000 %                                                                             %
11001 %                                                                             %
11002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11003 %
11004 %  MagickStripImage() strips an image of all profiles and comments.
11005 %
11006 %  The format of the MagickStripImage method is:
11007 %
11008 %      MagickBooleanType MagickStripImage(MagickWand *wand)
11009 %
11010 %  A description of each parameter follows:
11011 %
11012 %    o wand: the magick wand.
11013 %
11014 */
11015 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11016 {
11017   assert(wand != (MagickWand *) NULL);
11018   assert(wand->signature == WandSignature);
11019   if (wand->debug != MagickFalse)
11020     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11021   if (wand->images == (Image *) NULL)
11022     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11023   return(StripImage(wand->images,wand->exception));
11024 }
11025 \f
11026 /*
11027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11028 %                                                                             %
11029 %                                                                             %
11030 %                                                                             %
11031 %   M a g i c k S w i r l I m a g e                                           %
11032 %                                                                             %
11033 %                                                                             %
11034 %                                                                             %
11035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11036 %
11037 %  MagickSwirlImage() swirls the pixels about the center of the image, where
11038 %  degrees indicates the sweep of the arc through which each pixel is moved.
11039 %  You get a more dramatic effect as the degrees move from 1 to 360.
11040 %
11041 %  The format of the MagickSwirlImage method is:
11042 %
11043 %      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11044 %        const PixelInterpolateMethod method)
11045 %
11046 %  A description of each parameter follows:
11047 %
11048 %    o wand: the magick wand.
11049 %
11050 %    o degrees: Define the tightness of the swirling effect.
11051 %
11052 %    o method: the pixel interpolation method.
11053 %
11054 */
11055 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11056   const double degrees,const PixelInterpolateMethod method)
11057 {
11058   Image
11059     *swirl_image;
11060
11061   assert(wand != (MagickWand *) NULL);
11062   assert(wand->signature == WandSignature);
11063   if (wand->debug != MagickFalse)
11064     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11065   if (wand->images == (Image *) NULL)
11066     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11067   swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
11068   if (swirl_image == (Image *) NULL)
11069     return(MagickFalse);
11070   ReplaceImageInList(&wand->images,swirl_image);
11071   return(MagickTrue);
11072 }
11073 \f
11074 /*
11075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11076 %                                                                             %
11077 %                                                                             %
11078 %                                                                             %
11079 %   M a g i c k T e x t u r e I m a g e                                       %
11080 %                                                                             %
11081 %                                                                             %
11082 %                                                                             %
11083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11084 %
11085 %  MagickTextureImage() repeatedly tiles the texture image across and down the
11086 %  image canvas.
11087 %
11088 %  The format of the MagickTextureImage method is:
11089 %
11090 %      MagickWand *MagickTextureImage(MagickWand *wand,
11091 %        const MagickWand *texture_wand)
11092 %
11093 %  A description of each parameter follows:
11094 %
11095 %    o wand: the magick wand.
11096 %
11097 %    o texture_wand: the texture wand
11098 %
11099 */
11100 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11101   const MagickWand *texture_wand)
11102 {
11103   Image
11104     *texture_image;
11105
11106   MagickBooleanType
11107     status;
11108
11109   assert(wand != (MagickWand *) NULL);
11110   assert(wand->signature == WandSignature);
11111   if (wand->debug != MagickFalse)
11112     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11113   if ((wand->images == (Image *) NULL) ||
11114       (texture_wand->images == (Image *) NULL))
11115     {
11116       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11117         "ContainsNoImages","`%s'",wand->name);
11118       return((MagickWand *) NULL);
11119     }
11120   texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11121   if (texture_image == (Image *) NULL)
11122     return((MagickWand *) NULL);
11123   status=TextureImage(texture_image,texture_wand->images,wand->exception);
11124   if (status == MagickFalse)
11125     {
11126       texture_image=DestroyImage(texture_image);
11127       return((MagickWand *) NULL);
11128     }
11129   return(CloneMagickWandFromImages(wand,texture_image));
11130 }
11131 \f
11132 /*
11133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11134 %                                                                             %
11135 %                                                                             %
11136 %                                                                             %
11137 %   M a g i c k T h r e s h o l d I m a g e                                   %
11138 %                                                                             %
11139 %                                                                             %
11140 %                                                                             %
11141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11142 %
11143 %  MagickThresholdImage() changes the value of individual pixels based on
11144 %  the intensity of each pixel compared to threshold.  The result is a
11145 %  high-contrast, two color image.
11146 %
11147 %  The format of the MagickThresholdImage method is:
11148 %
11149 %      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11150 %        const double threshold)
11151 %      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11152 %        const ChannelType channel,const double threshold)
11153 %
11154 %  A description of each parameter follows:
11155 %
11156 %    o wand: the magick wand.
11157 %
11158 %    o channel: the image channel(s).
11159 %
11160 %    o threshold: Define the threshold value.
11161 %
11162 */
11163 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11164   const double threshold)
11165 {
11166   MagickBooleanType
11167     status;
11168
11169   status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11170   return(status);
11171 }
11172
11173 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11174   const ChannelType channel,const double threshold)
11175 {
11176   MagickBooleanType
11177     status;
11178
11179   assert(wand != (MagickWand *) NULL);
11180   assert(wand->signature == WandSignature);
11181   if (wand->debug != MagickFalse)
11182     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11183   if (wand->images == (Image *) NULL)
11184     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11185   status=BilevelImage(wand->images,threshold,wand->exception);
11186   return(status);
11187 }
11188 \f
11189 /*
11190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11191 %                                                                             %
11192 %                                                                             %
11193 %                                                                             %
11194 %   M a g i c k T h u m b n a i l I m a g e                                   %
11195 %                                                                             %
11196 %                                                                             %
11197 %                                                                             %
11198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11199 %
11200 %  MagickThumbnailImage()  changes the size of an image to the given dimensions
11201 %  and removes any associated profiles.  The goal is to produce small low cost
11202 %  thumbnail images suited for display on the Web.
11203 %
11204 %  The format of the MagickThumbnailImage method is:
11205 %
11206 %      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11207 %        const size_t columns,const size_t rows)
11208 %
11209 %  A description of each parameter follows:
11210 %
11211 %    o wand: the magick wand.
11212 %
11213 %    o columns: the number of columns in the scaled image.
11214 %
11215 %    o rows: the number of rows in the scaled image.
11216 %
11217 */
11218 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11219   const size_t columns,const size_t rows)
11220 {
11221   Image
11222     *thumbnail_image;
11223
11224   assert(wand != (MagickWand *) NULL);
11225   assert(wand->signature == WandSignature);
11226   if (wand->debug != MagickFalse)
11227     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11228   if (wand->images == (Image *) NULL)
11229     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11230   thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11231   if (thumbnail_image == (Image *) NULL)
11232     return(MagickFalse);
11233   ReplaceImageInList(&wand->images,thumbnail_image);
11234   return(MagickTrue);
11235 }
11236 \f
11237 /*
11238 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11239 %                                                                             %
11240 %                                                                             %
11241 %                                                                             %
11242 %   M a g i c k T i n t I m a g e                                             %
11243 %                                                                             %
11244 %                                                                             %
11245 %                                                                             %
11246 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11247 %
11248 %  MagickTintImage() applies a color vector to each pixel in the image.  The
11249 %  length of the vector is 0 for black and white and at its maximum for the
11250 %  midtones.  The vector weighting function is
11251 %  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11252 %
11253 %  The format of the MagickTintImage method is:
11254 %
11255 %      MagickBooleanType MagickTintImage(MagickWand *wand,
11256 %        const PixelWand *tint,const PixelWand *blend)
11257 %
11258 %  A description of each parameter follows:
11259 %
11260 %    o wand: the magick wand.
11261 %
11262 %    o tint: the tint pixel wand.
11263 %
11264 %    o alpha: the alpha pixel wand.
11265 %
11266 */
11267 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11268   const PixelWand *tint,const PixelWand *blend)
11269 {
11270   char
11271     percent_blend[MaxTextExtent];
11272
11273   Image
11274     *tint_image;
11275
11276   PixelInfo
11277     target;
11278
11279   assert(wand != (MagickWand *) NULL);
11280   assert(wand->signature == WandSignature);
11281   if (wand->debug != MagickFalse)
11282     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11283   if (wand->images == (Image *) NULL)
11284     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11285   if (wand->images->colorspace != CMYKColorspace)
11286     (void) FormatLocaleString(percent_blend,MaxTextExtent,
11287       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11288       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11289       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11290       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11291       PixelGetAlphaQuantum(blend)));
11292   else
11293     (void) FormatLocaleString(percent_blend,MaxTextExtent,
11294       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
11295       PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11296       PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11297       PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11298       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11299       PixelGetAlphaQuantum(blend)));
11300   target=PixelGetPixel(tint);
11301   tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
11302   if (tint_image == (Image *) NULL)
11303     return(MagickFalse);
11304   ReplaceImageInList(&wand->images,tint_image);
11305   return(MagickTrue);
11306 }
11307 \f
11308 /*
11309 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11310 %                                                                             %
11311 %                                                                             %
11312 %                                                                             %
11313 %   M a g i c k T r a n s f o r m I m a g e                                   %
11314 %                                                                             %
11315 %                                                                             %
11316 %                                                                             %
11317 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11318 %
11319 %  MagickTransformImage() is a convenience method that behaves like
11320 %  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11321 %  information as a region geometry specification.  If the operation fails,
11322 %  a NULL image handle is returned.
11323 %
11324 %  The format of the MagickTransformImage method is:
11325 %
11326 %      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11327 %        const char *geometry)
11328 %
11329 %  A description of each parameter follows:
11330 %
11331 %    o wand: the magick wand.
11332 %
11333 %    o crop: A crop geometry string.  This geometry defines a subregion of the
11334 %      image to crop.
11335 %
11336 %    o geometry: An image geometry string.  This geometry defines the final
11337 %      size of the image.
11338 %
11339 */
11340 WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11341   const char *crop,const char *geometry)
11342 {
11343   Image
11344     *transform_image;
11345
11346   MagickBooleanType
11347     status;
11348
11349   assert(wand != (MagickWand *) NULL);
11350   assert(wand->signature == WandSignature);
11351   if (wand->debug != MagickFalse)
11352     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11353   if (wand->images == (Image *) NULL)
11354     return((MagickWand *) NULL);
11355   transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11356   if (transform_image == (Image *) NULL)
11357     return((MagickWand *) NULL);
11358   status=TransformImage(&transform_image,crop,geometry,wand->exception);
11359   if (status == MagickFalse)
11360     {
11361       transform_image=DestroyImage(transform_image);
11362       return((MagickWand *) NULL);
11363     }
11364   return(CloneMagickWandFromImages(wand,transform_image));
11365 }
11366 \f
11367 /*
11368 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11369 %                                                                             %
11370 %                                                                             %
11371 %                                                                             %
11372 %   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               %
11373 %                                                                             %
11374 %                                                                             %
11375 %                                                                             %
11376 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11377 %
11378 %  MagickTransformImageColorspace() transform the image colorspace.
11379 %
11380 %  The format of the MagickTransformImageColorspace method is:
11381 %
11382 %      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11383 %        const ColorspaceType colorspace)
11384 %
11385 %  A description of each parameter follows:
11386 %
11387 %    o wand: the magick wand.
11388 %
11389 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
11390 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
11391 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
11392 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
11393 %      HSLColorspace, or HWBColorspace.
11394 %
11395 */
11396 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11397   const ColorspaceType colorspace)
11398 {
11399   assert(wand != (MagickWand *) NULL);
11400   assert(wand->signature == WandSignature);
11401   if (wand->debug != MagickFalse)
11402     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11403   if (wand->images == (Image *) NULL)
11404     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11405   return(TransformImageColorspace(wand->images,colorspace,wand->exception));
11406 }
11407 \f
11408 /*
11409 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11410 %                                                                             %
11411 %                                                                             %
11412 %                                                                             %
11413 %   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                     %
11414 %                                                                             %
11415 %                                                                             %
11416 %                                                                             %
11417 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11418 %
11419 %  MagickTransparentPaintImage() changes any pixel that matches color with the
11420 %  color defined by fill.
11421 %
11422 %  The format of the MagickTransparentPaintImage method is:
11423 %
11424 %      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11425 %        const PixelWand *target,const double alpha,const double fuzz,
11426 %        const MagickBooleanType invert)
11427 %
11428 %  A description of each parameter follows:
11429 %
11430 %    o wand: the magick wand.
11431 %
11432 %    o target: Change this target color to specified alpha value within
11433 %      the image.
11434 %
11435 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11436 %      transparent.
11437 %
11438 %    o fuzz: By default target must match a particular pixel color
11439 %      exactly.  However, in many cases two colors may differ by a small amount.
11440 %      The fuzz member of image defines how much tolerance is acceptable to
11441 %      consider two colors as the same.  For example, set fuzz to 10 and the
11442 %      color red at intensities of 100 and 102 respectively are now interpreted
11443 %      as the same color for the purposes of the floodfill.
11444 %
11445 %    o invert: paint any pixel that does not match the target color.
11446 %
11447 */
11448 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11449   const PixelWand *target,const double alpha,const double fuzz,
11450   const MagickBooleanType invert)
11451 {
11452   MagickBooleanType
11453     status;
11454
11455   PixelInfo
11456     target_pixel;
11457
11458   assert(wand != (MagickWand *) NULL);
11459   assert(wand->signature == WandSignature);
11460   if (wand->debug != MagickFalse)
11461     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11462   if (wand->images == (Image *) NULL)
11463     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11464   PixelGetMagickColor(target,&target_pixel);
11465   wand->images->fuzz=fuzz;
11466   status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11467     QuantumRange*alpha),invert,&wand->images->exception);
11468   return(status);
11469 }
11470 \f
11471 /*
11472 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11473 %                                                                             %
11474 %                                                                             %
11475 %                                                                             %
11476 %   M a g i c k T r a n s p o s e I m a g e                                   %
11477 %                                                                             %
11478 %                                                                             %
11479 %                                                                             %
11480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11481 %
11482 %  MagickTransposeImage() creates a vertical mirror image by reflecting the
11483 %  pixels around the central x-axis while rotating them 90-degrees.
11484 %
11485 %  The format of the MagickTransposeImage method is:
11486 %
11487 %      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11488 %
11489 %  A description of each parameter follows:
11490 %
11491 %    o wand: the magick wand.
11492 %
11493 */
11494 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11495 {
11496   Image
11497     *transpose_image;
11498
11499   assert(wand != (MagickWand *) NULL);
11500   assert(wand->signature == WandSignature);
11501   if (wand->debug != MagickFalse)
11502     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11503   if (wand->images == (Image *) NULL)
11504     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11505   transpose_image=TransposeImage(wand->images,wand->exception);
11506   if (transpose_image == (Image *) NULL)
11507     return(MagickFalse);
11508   ReplaceImageInList(&wand->images,transpose_image);
11509   return(MagickTrue);
11510 }
11511 \f
11512 /*
11513 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11514 %                                                                             %
11515 %                                                                             %
11516 %                                                                             %
11517 %   M a g i c k T r a n s v e r s e I m a g e                                 %
11518 %                                                                             %
11519 %                                                                             %
11520 %                                                                             %
11521 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11522 %
11523 %  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11524 %  pixels around the central y-axis while rotating them 270-degrees.
11525 %
11526 %  The format of the MagickTransverseImage method is:
11527 %
11528 %      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11529 %
11530 %  A description of each parameter follows:
11531 %
11532 %    o wand: the magick wand.
11533 %
11534 */
11535 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11536 {
11537   Image
11538     *transverse_image;
11539
11540   assert(wand != (MagickWand *) NULL);
11541   assert(wand->signature == WandSignature);
11542   if (wand->debug != MagickFalse)
11543     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11544   if (wand->images == (Image *) NULL)
11545     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11546   transverse_image=TransverseImage(wand->images,wand->exception);
11547   if (transverse_image == (Image *) NULL)
11548     return(MagickFalse);
11549   ReplaceImageInList(&wand->images,transverse_image);
11550   return(MagickTrue);
11551 }
11552 \f
11553 /*
11554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11555 %                                                                             %
11556 %                                                                             %
11557 %                                                                             %
11558 %   M a g i c k T r i m I m a g e                                             %
11559 %                                                                             %
11560 %                                                                             %
11561 %                                                                             %
11562 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11563 %
11564 %  MagickTrimImage() remove edges that are the background color from the image.
11565 %
11566 %  The format of the MagickTrimImage method is:
11567 %
11568 %      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11569 %
11570 %  A description of each parameter follows:
11571 %
11572 %    o wand: the magick wand.
11573 %
11574 %    o fuzz: By default target must match a particular pixel color
11575 %      exactly.  However, in many cases two colors may differ by a small amount.
11576 %      The fuzz member of image defines how much tolerance is acceptable to
11577 %      consider two colors as the same.  For example, set fuzz to 10 and the
11578 %      color red at intensities of 100 and 102 respectively are now interpreted
11579 %      as the same color for the purposes of the floodfill.
11580 %
11581 */
11582 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11583 {
11584   Image
11585     *trim_image;
11586
11587   assert(wand != (MagickWand *) NULL);
11588   assert(wand->signature == WandSignature);
11589   if (wand->debug != MagickFalse)
11590     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11591   if (wand->images == (Image *) NULL)
11592     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11593   wand->images->fuzz=fuzz;
11594   trim_image=TrimImage(wand->images,wand->exception);
11595   if (trim_image == (Image *) NULL)
11596     return(MagickFalse);
11597   ReplaceImageInList(&wand->images,trim_image);
11598   return(MagickTrue);
11599 }
11600 \f
11601 /*
11602 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11603 %                                                                             %
11604 %                                                                             %
11605 %                                                                             %
11606 %   M a g i c k U n i q u e I m a g e C o l o r s                             %
11607 %                                                                             %
11608 %                                                                             %
11609 %                                                                             %
11610 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11611 %
11612 %  MagickUniqueImageColors() discards all but one of any pixel color.
11613 %
11614 %  The format of the MagickUniqueImageColors method is:
11615 %
11616 %      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11617 %
11618 %  A description of each parameter follows:
11619 %
11620 %    o wand: the magick wand.
11621 %
11622 */
11623 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11624 {
11625   Image
11626     *unique_image;
11627
11628   assert(wand != (MagickWand *) NULL);
11629   assert(wand->signature == WandSignature);
11630   if (wand->debug != MagickFalse)
11631     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11632   if (wand->images == (Image *) NULL)
11633     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11634   unique_image=UniqueImageColors(wand->images,wand->exception);
11635   if (unique_image == (Image *) NULL)
11636     return(MagickFalse);
11637   ReplaceImageInList(&wand->images,unique_image);
11638   return(MagickTrue);
11639 }
11640 \f
11641 /*
11642 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11643 %                                                                             %
11644 %                                                                             %
11645 %                                                                             %
11646 %   M a g i c k U n s h a r p M a s k I m a g e                               %
11647 %                                                                             %
11648 %                                                                             %
11649 %                                                                             %
11650 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11651 %
11652 %  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
11653 %  Gaussian operator of the given radius and standard deviation (sigma).
11654 %  For reasonable results, radius should be larger than sigma.  Use a radius
11655 %  of 0 and UnsharpMaskImage() selects a suitable radius for you.
11656 %
11657 %  The format of the MagickUnsharpMaskImage method is:
11658 %
11659 %      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11660 %        const double radius,const double sigma,const double amount,
11661 %        const double threshold)
11662 %
11663 %  A description of each parameter follows:
11664 %
11665 %    o wand: the magick wand.
11666 %
11667 %    o radius: the radius of the Gaussian, in pixels, not counting the center
11668 %      pixel.
11669 %
11670 %    o sigma: the standard deviation of the Gaussian, in pixels.
11671 %
11672 %    o amount: the percentage of the difference between the original and the
11673 %      blur image that is added back into the original.
11674 %
11675 %    o threshold: the threshold in pixels needed to apply the diffence amount.
11676 %
11677 */
11678 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11679   const double radius,const double sigma,const double amount,
11680   const double threshold)
11681 {
11682   Image
11683     *unsharp_image;
11684
11685   assert(wand != (MagickWand *) NULL);
11686   assert(wand->signature == WandSignature);
11687   if (wand->debug != MagickFalse)
11688     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11689   if (wand->images == (Image *) NULL)
11690     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11691   unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
11692     wand->exception);
11693   if (unsharp_image == (Image *) NULL)
11694     return(MagickFalse);
11695   ReplaceImageInList(&wand->images,unsharp_image);
11696   return(MagickTrue);
11697 }
11698 \f
11699 /*
11700 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11701 %                                                                             %
11702 %                                                                             %
11703 %                                                                             %
11704 %   M a g i c k V i g n e t t e I m a g e                                     %
11705 %                                                                             %
11706 %                                                                             %
11707 %                                                                             %
11708 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11709 %
11710 %  MagickVignetteImage() softens the edges of the image in vignette style.
11711 %
11712 %  The format of the MagickVignetteImage method is:
11713 %
11714 %      MagickBooleanType MagickVignetteImage(MagickWand *wand,
11715 %        const double black_point,const double white_point,const ssize_t x,
11716 %        const ssize_t y)
11717 %
11718 %  A description of each parameter follows:
11719 %
11720 %    o wand: the magick wand.
11721 %
11722 %    o black_point: the black point.
11723 %
11724 %    o white_point: the white point.
11725 %
11726 %    o x, y:  Define the x and y ellipse offset.
11727 %
11728 */
11729 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
11730   const double black_point,const double white_point,const ssize_t x,const ssize_t y)
11731 {
11732   Image
11733     *vignette_image;
11734
11735   assert(wand != (MagickWand *) NULL);
11736   assert(wand->signature == WandSignature);
11737   if (wand->debug != MagickFalse)
11738     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11739   if (wand->images == (Image *) NULL)
11740     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11741   vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
11742     wand->exception);
11743   if (vignette_image == (Image *) NULL)
11744     return(MagickFalse);
11745   ReplaceImageInList(&wand->images,vignette_image);
11746   return(MagickTrue);
11747 }
11748 \f
11749 /*
11750 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11751 %                                                                             %
11752 %                                                                             %
11753 %                                                                             %
11754 %   M a g i c k W a v e I m a g e                                             %
11755 %                                                                             %
11756 %                                                                             %
11757 %                                                                             %
11758 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11759 %
11760 %  MagickWaveImage()  creates a "ripple" effect in the image by shifting
11761 %  the pixels vertically along a sine wave whose amplitude and wavelength
11762 %  is specified by the given parameters.
11763 %
11764 %  The format of the MagickWaveImage method is:
11765 %
11766 %      MagickBooleanType MagickWaveImage(MagickWand *wand,
11767 %        const double amplitude,const double wave_length,
11768 %        const PixelInterpolateMethod method)
11769 %
11770 %  A description of each parameter follows:
11771 %
11772 %    o wand: the magick wand.
11773 %
11774 %    o amplitude, wave_length:  Define the amplitude and wave length of the
11775 %      sine wave.
11776 %
11777 %    o method: the pixel interpolation method.
11778 %
11779 */
11780 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
11781   const double amplitude,const double wave_length,
11782   const PixelInterpolateMethod method)
11783 {
11784   Image
11785     *wave_image;
11786
11787   assert(wand != (MagickWand *) NULL);
11788   assert(wand->signature == WandSignature);
11789   if (wand->debug != MagickFalse)
11790     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11791   if (wand->images == (Image *) NULL)
11792     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11793   wave_image=WaveImage(wand->images,amplitude,wave_length,method,
11794     wand->exception);
11795   if (wave_image == (Image *) NULL)
11796     return(MagickFalse);
11797   ReplaceImageInList(&wand->images,wave_image);
11798   return(MagickTrue);
11799 }
11800 \f
11801 /*
11802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11803 %                                                                             %
11804 %                                                                             %
11805 %                                                                             %
11806 %   M a g i c k W h i t e T h r e s h o l d I m a g e                         %
11807 %                                                                             %
11808 %                                                                             %
11809 %                                                                             %
11810 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11811 %
11812 %  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
11813 %  above the threshold into white while leaving all pixels below the threshold
11814 %  unchanged.
11815 %
11816 %  The format of the MagickWhiteThresholdImage method is:
11817 %
11818 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11819 %        const PixelWand *threshold)
11820 %
11821 %  A description of each parameter follows:
11822 %
11823 %    o wand: the magick wand.
11824 %
11825 %    o threshold: the pixel wand.
11826 %
11827 */
11828 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11829   const PixelWand *threshold)
11830 {
11831   char
11832     thresholds[MaxTextExtent];
11833
11834   assert(wand != (MagickWand *) NULL);
11835   assert(wand->signature == WandSignature);
11836   if (wand->debug != MagickFalse)
11837     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11838   if (wand->images == (Image *) NULL)
11839     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11840   (void) FormatLocaleString(thresholds,MaxTextExtent,
11841     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
11842     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
11843     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
11844   return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
11845 }
11846 \f
11847 /*
11848 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11849 %                                                                             %
11850 %                                                                             %
11851 %                                                                             %
11852 %   M a g i c k W r i t e I m a g e                                           %
11853 %                                                                             %
11854 %                                                                             %
11855 %                                                                             %
11856 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11857 %
11858 %  MagickWriteImage() writes an image to the specified filename.  If the
11859 %  filename parameter is NULL, the image is written to the filename set
11860 %  by MagickReadImage() or MagickSetImageFilename().
11861 %
11862 %  The format of the MagickWriteImage method is:
11863 %
11864 %      MagickBooleanType MagickWriteImage(MagickWand *wand,
11865 %        const char *filename)
11866 %
11867 %  A description of each parameter follows:
11868 %
11869 %    o wand: the magick wand.
11870 %
11871 %    o filename: the image filename.
11872 %
11873 %
11874 */
11875 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
11876   const char *filename)
11877 {
11878   Image
11879     *image;
11880
11881   ImageInfo
11882     *write_info;
11883
11884   MagickBooleanType
11885     status;
11886
11887   assert(wand != (MagickWand *) NULL);
11888   assert(wand->signature == WandSignature);
11889   if (wand->debug != MagickFalse)
11890     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11891   if (wand->images == (Image *) NULL)
11892     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11893   if (filename != (const char *) NULL)
11894     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
11895   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11896   if (image == (Image *) NULL)
11897     return(MagickFalse);
11898   write_info=CloneImageInfo(wand->image_info);
11899   write_info->adjoin=MagickTrue;
11900   status=WriteImage(write_info,image,wand->exception);
11901   image=DestroyImage(image);
11902   write_info=DestroyImageInfo(write_info);
11903   return(status);
11904 }
11905 \f
11906 /*
11907 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11908 %                                                                             %
11909 %                                                                             %
11910 %                                                                             %
11911 %   M a g i c k W r i t e I m a g e F i l e                                   %
11912 %                                                                             %
11913 %                                                                             %
11914 %                                                                             %
11915 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11916 %
11917 %  MagickWriteImageFile() writes an image to an open file descriptor.
11918 %
11919 %  The format of the MagickWriteImageFile method is:
11920 %
11921 %      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11922 %
11923 %  A description of each parameter follows:
11924 %
11925 %    o wand: the magick wand.
11926 %
11927 %    o file: the file descriptor.
11928 %
11929 */
11930 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11931 {
11932   Image
11933     *image;
11934
11935   ImageInfo
11936     *write_info;
11937
11938   MagickBooleanType
11939     status;
11940
11941   assert(wand != (MagickWand *) NULL);
11942   assert(wand->signature == WandSignature);
11943   assert(file != (FILE *) NULL);
11944   if (wand->debug != MagickFalse)
11945     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11946   if (wand->images == (Image *) NULL)
11947     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11948   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11949   if (image == (Image *) NULL)
11950     return(MagickFalse);
11951   write_info=CloneImageInfo(wand->image_info);
11952   SetImageInfoFile(write_info,file);
11953   write_info->adjoin=MagickTrue;
11954   status=WriteImage(write_info,image,wand->exception);
11955   write_info=DestroyImageInfo(write_info);
11956   image=DestroyImage(image);
11957   return(status);
11958 }
11959 \f
11960 /*
11961 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11962 %                                                                             %
11963 %                                                                             %
11964 %                                                                             %
11965 %   M a g i c k W r i t e I m a g e s                                         %
11966 %                                                                             %
11967 %                                                                             %
11968 %                                                                             %
11969 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11970 %
11971 %  MagickWriteImages() writes an image or image sequence.
11972 %
11973 %  The format of the MagickWriteImages method is:
11974 %
11975 %      MagickBooleanType MagickWriteImages(MagickWand *wand,
11976 %        const char *filename,const MagickBooleanType adjoin)
11977 %
11978 %  A description of each parameter follows:
11979 %
11980 %    o wand: the magick wand.
11981 %
11982 %    o filename: the image filename.
11983 %
11984 %    o adjoin: join images into a single multi-image file.
11985 %
11986 */
11987 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
11988   const char *filename,const MagickBooleanType adjoin)
11989 {
11990   ImageInfo
11991     *write_info;
11992
11993   MagickBooleanType
11994     status;
11995
11996   assert(wand != (MagickWand *) NULL);
11997   assert(wand->signature == WandSignature);
11998   if (wand->debug != MagickFalse)
11999     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12000   if (wand->images == (Image *) NULL)
12001     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12002   write_info=CloneImageInfo(wand->image_info);
12003   write_info->adjoin=adjoin;
12004   status=WriteImages(write_info,wand->images,filename,wand->exception);
12005   write_info=DestroyImageInfo(write_info);
12006   return(status);
12007 }
12008 \f
12009 /*
12010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12011 %                                                                             %
12012 %                                                                             %
12013 %                                                                             %
12014 %   M a g i c k W r i t e I m a g e s F i l e                                 %
12015 %                                                                             %
12016 %                                                                             %
12017 %                                                                             %
12018 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12019 %
12020 %  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12021 %
12022 %  The format of the MagickWriteImagesFile method is:
12023 %
12024 %      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12025 %
12026 %  A description of each parameter follows:
12027 %
12028 %    o wand: the magick wand.
12029 %
12030 %    o file: the file descriptor.
12031 %
12032 */
12033 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12034 {
12035   ImageInfo
12036     *write_info;
12037
12038   MagickBooleanType
12039     status;
12040
12041   assert(wand != (MagickWand *) NULL);
12042   assert(wand->signature == WandSignature);
12043   if (wand->debug != MagickFalse)
12044     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12045   if (wand->images == (Image *) NULL)
12046     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12047   write_info=CloneImageInfo(wand->image_info);
12048   SetImageInfoFile(write_info,file);
12049   write_info->adjoin=MagickTrue;
12050   status=WriteImages(write_info,wand->images,(const char *) NULL,
12051     wand->exception);
12052   write_info=DestroyImageInfo(write_info);
12053   return(status);
12054 }