]> 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)
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 */
192 WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
193   const double radius,const double sigma)
194 {
195   Image
196     *sharp_image;
197
198   assert(wand != (MagickWand *) NULL);
199   assert(wand->signature == WandSignature);
200   if (wand->debug != MagickFalse)
201     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
202   if (wand->images == (Image *) NULL)
203     ThrowWandException(WandError,"ContainsNoImages",wand->name);
204   sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,wand->exception);
205   if (sharp_image == (Image *) NULL)
206     return(MagickFalse);
207   ReplaceImageInList(&wand->images,sharp_image);
208   return(MagickTrue);
209 }
210 \f
211 /*
212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
213 %                                                                             %
214 %                                                                             %
215 %                                                                             %
216 %   M a g i c k A d a p t i v e R e s i z e I m a g e                         %
217 %                                                                             %
218 %                                                                             %
219 %                                                                             %
220 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
221 %
222 %  MagickAdaptiveResizeImage() adaptively resize image with data dependent
223 %  triangulation.
224 %
225 %      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
226 %        const size_t columns,const size_t rows)
227 %
228 %  A description of each parameter follows:
229 %
230 %    o wand: the magick wand.
231 %
232 %    o columns: the number of columns in the scaled image.
233 %
234 %    o rows: the number of rows in the scaled image.
235 %
236 */
237 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
238   const size_t columns,const size_t rows)
239 {
240   Image
241     *resize_image;
242
243   assert(wand != (MagickWand *) NULL);
244   assert(wand->signature == WandSignature);
245   if (wand->debug != MagickFalse)
246     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
247   if (wand->images == (Image *) NULL)
248     ThrowWandException(WandError,"ContainsNoImages",wand->name);
249   resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
250   if (resize_image == (Image *) NULL)
251     return(MagickFalse);
252   ReplaceImageInList(&wand->images,resize_image);
253   return(MagickTrue);
254 }
255 \f
256 /*
257 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
258 %                                                                             %
259 %                                                                             %
260 %                                                                             %
261 %   M a g i c k A d a p t i v e S h a r p e n I m a g e                       %
262 %                                                                             %
263 %                                                                             %
264 %                                                                             %
265 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
266 %
267 %  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
268 %  more intensely near image edges and less intensely far from edges. We
269 %  sharpen the image with a Gaussian operator of the given radius and standard
270 %  deviation (sigma).  For reasonable results, radius should be larger than
271 %  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
272 %  suitable radius for you.
273 %
274 %  The format of the MagickAdaptiveSharpenImage method is:
275 %
276 %      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
277 %        const double radius,const double sigma)
278 %
279 %  A description of each parameter follows:
280 %
281 %    o wand: the magick wand.
282 %
283 %    o radius: the radius of the Gaussian, in pixels, not counting the center
284 %      pixel.
285 %
286 %    o sigma: the standard deviation of the Gaussian, in pixels.
287 %
288 */
289 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
290   const double radius,const double sigma)
291 {
292   Image
293     *sharp_image;
294
295   assert(wand != (MagickWand *) NULL);
296   assert(wand->signature == WandSignature);
297   if (wand->debug != MagickFalse)
298     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
299   if (wand->images == (Image *) NULL)
300     ThrowWandException(WandError,"ContainsNoImages",wand->name);
301   sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,wand->exception);
302   if (sharp_image == (Image *) NULL)
303     return(MagickFalse);
304   ReplaceImageInList(&wand->images,sharp_image);
305   return(MagickTrue);
306 }
307 \f
308 /*
309 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
310 %                                                                             %
311 %                                                                             %
312 %                                                                             %
313 %   M a g i c k A d a p t i v e T h r e s h o l d I m a g e                   %
314 %                                                                             %
315 %                                                                             %
316 %                                                                             %
317 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
318 %
319 %  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
320 %  based on the range of intensity values in its local neighborhood.  This
321 %  allows for thresholding of an image whose global intensity histogram
322 %  doesn't contain distinctive peaks.
323 %
324 %  The format of the AdaptiveThresholdImage method is:
325 %
326 %      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
327 %        const size_t width,const size_t height,const ssize_t offset)
328 %
329 %  A description of each parameter follows:
330 %
331 %    o wand: the magick wand.
332 %
333 %    o width: the width of the local neighborhood.
334 %
335 %    o height: the height of the local neighborhood.
336 %
337 %    o offset: the mean offset.
338 %
339 */
340 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
341   const size_t width,const size_t height,const ssize_t offset)
342 {
343   Image
344     *threshold_image;
345
346   assert(wand != (MagickWand *) NULL);
347   assert(wand->signature == WandSignature);
348   if (wand->debug != MagickFalse)
349     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
350   if (wand->images == (Image *) NULL)
351     ThrowWandException(WandError,"ContainsNoImages",wand->name);
352   threshold_image=AdaptiveThresholdImage(wand->images,width,height,offset,
353     wand->exception);
354   if (threshold_image == (Image *) NULL)
355     return(MagickFalse);
356   ReplaceImageInList(&wand->images,threshold_image);
357   return(MagickTrue);
358 }
359 \f
360 /*
361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
362 %                                                                             %
363 %                                                                             %
364 %                                                                             %
365 %   M a g i c k A d d I m a g e                                               %
366 %                                                                             %
367 %                                                                             %
368 %                                                                             %
369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
370 %
371 %  MagickAddImage() adds the specified images at the current image location.
372 %
373 %  The format of the MagickAddImage method is:
374 %
375 %      MagickBooleanType MagickAddImage(MagickWand *wand,
376 %        const MagickWand *add_wand)
377 %
378 %  A description of each parameter follows:
379 %
380 %    o wand: the magick wand.
381 %
382 %    o add_wand: A wand that contains images to add at the current image
383 %      location.
384 %
385 */
386
387 static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
388   Image *images)
389 {
390   Image
391     *sentinel;
392
393   sentinel=wand->images;
394   if (sentinel == (Image *) NULL)
395     {
396       wand->images=GetFirstImageInList(images);
397       return(MagickTrue);
398     }
399   if (wand->active == MagickFalse)
400     {
401       if ((wand->pend != MagickFalse) && (sentinel->next == (Image *) NULL))
402         {
403           AppendImageToList(&sentinel,images);
404           wand->images=GetLastImageInList(images);
405           return(MagickTrue);
406         }
407       if ((wand->pend != MagickFalse) && (sentinel->previous == (Image *) NULL))
408         {
409           PrependImageToList(&sentinel,images);
410           wand->images=GetFirstImageInList(images);
411           return(MagickTrue);
412         }
413     }
414   if (sentinel->next == (Image *) NULL)
415     {
416       InsertImageInList(&sentinel,images);
417       wand->images=GetLastImageInList(images);
418       return(MagickTrue);
419     }
420   InsertImageInList(&sentinel,images);
421   wand->images=GetFirstImageInList(images);
422   return(MagickTrue);
423 }
424
425 WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
426   const MagickWand *add_wand)
427 {
428   Image
429     *images;
430
431   assert(wand != (MagickWand *) NULL);
432   assert(wand->signature == WandSignature);
433   if (wand->debug != MagickFalse)
434     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
435   assert(add_wand != (MagickWand *) NULL);
436   assert(add_wand->signature == WandSignature);
437   if (add_wand->images == (Image *) NULL)
438     ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
439   images=CloneImageList(add_wand->images,wand->exception);
440   if (images == (Image *) NULL)
441     return(MagickFalse);
442   return(InsertImageInWand(wand,images));
443 }
444 \f
445 /*
446 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
447 %                                                                             %
448 %                                                                             %
449 %                                                                             %
450 %     M a g i c k A d d N o i s e I m a g e                                   %
451 %                                                                             %
452 %                                                                             %
453 %                                                                             %
454 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
455 %
456 %  MagickAddNoiseImage() adds random noise to the image.
457 %
458 %  The format of the MagickAddNoiseImage method is:
459 %
460 %      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
461 %        const NoiseType noise_type)
462 %
463 %  A description of each parameter follows:
464 %
465 %    o wand: the magick wand.
466 %
467 %    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
468 %      Impulse, Laplacian, or Poisson.
469 %
470 */
471 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
472   const NoiseType noise_type)
473 {
474   Image
475     *noise_image;
476
477   assert(wand != (MagickWand *) NULL);
478   assert(wand->signature == WandSignature);
479   if (wand->debug != MagickFalse)
480     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
481   if (wand->images == (Image *) NULL)
482     ThrowWandException(WandError,"ContainsNoImages",wand->name);
483   noise_image=AddNoiseImage(wand->images,noise_type,wand->exception);
484   if (noise_image == (Image *) NULL)
485     return(MagickFalse);
486   ReplaceImageInList(&wand->images,noise_image);
487   return(MagickTrue);
488 }
489 \f
490 /*
491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
492 %                                                                             %
493 %                                                                             %
494 %                                                                             %
495 %   M a g i c k A f f i n e T r a n s f o r m I m a g e                       %
496 %                                                                             %
497 %                                                                             %
498 %                                                                             %
499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
500 %
501 %  MagickAffineTransformImage() transforms an image as dictated by the affine
502 %  matrix of the drawing wand.
503 %
504 %  The format of the MagickAffineTransformImage method is:
505 %
506 %      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
507 %        const DrawingWand *drawing_wand)
508 %
509 %  A description of each parameter follows:
510 %
511 %    o wand: the magick wand.
512 %
513 %    o drawing_wand: the draw wand.
514 %
515 */
516 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
517   const DrawingWand *drawing_wand)
518 {
519   DrawInfo
520     *draw_info;
521
522   Image
523     *affine_image;
524
525   assert(wand != (MagickWand *) NULL);
526   assert(wand->signature == WandSignature);
527   if (wand->debug != MagickFalse)
528     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
529   if (wand->images == (Image *) NULL)
530     ThrowWandException(WandError,"ContainsNoImages",wand->name);
531   draw_info=PeekDrawingWand(drawing_wand);
532   if (draw_info == (DrawInfo *) NULL)
533     return(MagickFalse);
534   affine_image=AffineTransformImage(wand->images,&draw_info->affine,
535     wand->exception);
536   draw_info=DestroyDrawInfo(draw_info);
537   if (affine_image == (Image *) NULL)
538     return(MagickFalse);
539   ReplaceImageInList(&wand->images,affine_image);
540   return(MagickTrue);
541 }
542 \f
543 /*
544 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
545 %                                                                             %
546 %                                                                             %
547 %                                                                             %
548 %   M a g i c k A n n o t a t e I m a g e                                     %
549 %                                                                             %
550 %                                                                             %
551 %                                                                             %
552 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
553 %
554 %  MagickAnnotateImage() annotates an image with text.
555 %
556 %  The format of the MagickAnnotateImage method is:
557 %
558 %      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
559 %        const DrawingWand *drawing_wand,const double x,const double y,
560 %        const double angle,const char *text)
561 %
562 %  A description of each parameter follows:
563 %
564 %    o wand: the magick wand.
565 %
566 %    o drawing_wand: the draw wand.
567 %
568 %    o x: x ordinate to left of text
569 %
570 %    o y: y ordinate to text baseline
571 %
572 %    o angle: rotate text relative to this angle.
573 %
574 %    o text: text to draw
575 %
576 */
577 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
578   const DrawingWand *drawing_wand,const double x,const double y,
579   const double angle,const char *text)
580 {
581   char
582     geometry[MaxTextExtent];
583
584   DrawInfo
585     *draw_info;
586
587   MagickBooleanType
588     status;
589
590   assert(wand != (MagickWand *) NULL);
591   assert(wand->signature == WandSignature);
592   if (wand->debug != MagickFalse)
593     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
594   if (wand->images == (Image *) NULL)
595     ThrowWandException(WandError,"ContainsNoImages",wand->name);
596   draw_info=PeekDrawingWand(drawing_wand);
597   if (draw_info == (DrawInfo *) NULL)
598     return(MagickFalse);
599   (void) CloneString(&draw_info->text,text);
600   (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",x,y);
601   draw_info->affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
602   draw_info->affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
603   draw_info->affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
604   draw_info->affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
605   (void) CloneString(&draw_info->geometry,geometry);
606   status=AnnotateImage(wand->images,draw_info);
607   draw_info=DestroyDrawInfo(draw_info);
608   if (status == MagickFalse)
609     InheritException(wand->exception,&wand->images->exception);
610   return(status);
611 }
612 \f
613 /*
614 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
615 %                                                                             %
616 %                                                                             %
617 %                                                                             %
618 %   M a g i c k A n i m a t e I m a g e s                                     %
619 %                                                                             %
620 %                                                                             %
621 %                                                                             %
622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
623 %
624 %  MagickAnimateImages() animates an image or image sequence.
625 %
626 %  The format of the MagickAnimateImages method is:
627 %
628 %      MagickBooleanType MagickAnimateImages(MagickWand *wand,
629 %        const char *server_name)
630 %
631 %  A description of each parameter follows:
632 %
633 %    o wand: the magick wand.
634 %
635 %    o server_name: the X server name.
636 %
637 */
638 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
639   const char *server_name)
640 {
641   MagickBooleanType
642     status;
643
644   assert(wand != (MagickWand *) NULL);
645   assert(wand->signature == WandSignature);
646   if (wand->debug != MagickFalse)
647     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
648   (void) CloneString(&wand->image_info->server_name,server_name);
649   status=AnimateImages(wand->image_info,wand->images);
650   if (status == MagickFalse)
651     InheritException(wand->exception,&wand->images->exception);
652   return(status);
653 }
654 \f
655 /*
656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
657 %                                                                             %
658 %                                                                             %
659 %                                                                             %
660 %   M a g i c k A p p e n d I m a g e s                                       %
661 %                                                                             %
662 %                                                                             %
663 %                                                                             %
664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
665 %
666 %  MagickAppendImages() append a set of images.
667 %
668 %  The format of the MagickAppendImages method is:
669 %
670 %      MagickWand *MagickAppendImages(MagickWand *wand,
671 %        const MagickBooleanType stack)
672 %
673 %  A description of each parameter follows:
674 %
675 %    o wand: the magick wand.
676 %
677 %    o stack: By default, images are stacked left-to-right. Set stack to
678 %      MagickTrue to stack them top-to-bottom.
679 %
680 */
681 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
682   const MagickBooleanType stack)
683 {
684   Image
685     *append_image;
686
687   assert(wand != (MagickWand *) NULL);
688   assert(wand->signature == WandSignature);
689   if (wand->debug != MagickFalse)
690     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
691   if (wand->images == (Image *) NULL)
692     return((MagickWand *) NULL);
693   append_image=AppendImages(wand->images,stack,wand->exception);
694   if (append_image == (Image *) NULL)
695     return((MagickWand *) NULL);
696   return(CloneMagickWandFromImages(wand,append_image));
697 }
698 \f
699 /*
700 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
701 %                                                                             %
702 %                                                                             %
703 %                                                                             %
704 %   M a g i c k A u t o G a m m a I m a g e                                   %
705 %                                                                             %
706 %                                                                             %
707 %                                                                             %
708 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
709 %
710 %  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
711 %  image to try make set its gamma appropriatally.
712 %
713 %  The format of the MagickAutoGammaImage method is:
714 %
715 %      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
716 %
717 %  A description of each parameter follows:
718 %
719 %    o wand: the magick wand.
720 %
721 */
722 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
723 {
724   MagickBooleanType
725     status;
726
727   assert(wand != (MagickWand *) NULL);
728   assert(wand->signature == WandSignature);
729   if (wand->debug != MagickFalse)
730     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
731   if (wand->images == (Image *) NULL)
732     ThrowWandException(WandError,"ContainsNoImages",wand->name);
733   status=AutoGammaImage(wand->images,&wand->images->exception);
734   return(status);
735 }
736 \f
737 /*
738 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
739 %                                                                             %
740 %                                                                             %
741 %                                                                             %
742 %   M a g i c k A u t o L e v e l I m a g e                                   %
743 %                                                                             %
744 %                                                                             %
745 %                                                                             %
746 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
747 %
748 %  MagickAutoLevelImage() adjusts the levels of a particular image channel by
749 %  scaling the minimum and maximum values to the full quantum range.
750 %
751 %  The format of the MagickAutoLevelImage method is:
752 %
753 %      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
754 %
755 %  A description of each parameter follows:
756 %
757 %    o wand: the magick wand.
758 %
759 */
760 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
761 {
762   MagickBooleanType
763     status;
764
765   assert(wand != (MagickWand *) NULL);
766   assert(wand->signature == WandSignature);
767   if (wand->debug != MagickFalse)
768     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
769   if (wand->images == (Image *) NULL)
770     ThrowWandException(WandError,"ContainsNoImages",wand->name);
771   status=AutoLevelImage(wand->images,&wand->images->exception);
772   return(status);
773 }
774 \f
775 /*
776 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
777 %                                                                             %
778 %                                                                             %
779 %                                                                             %
780 %   M a g i c k B l a c k T h r e s h o l d I m a g e                         %
781 %                                                                             %
782 %                                                                             %
783 %                                                                             %
784 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
785 %
786 %  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
787 %  pixels below the threshold into black while leaving all pixels above the
788 %  threshold unchanged.
789 %
790 %  The format of the MagickBlackThresholdImage method is:
791 %
792 %      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
793 %        const PixelWand *threshold)
794 %
795 %  A description of each parameter follows:
796 %
797 %    o wand: the magick wand.
798 %
799 %    o threshold: the pixel wand.
800 %
801 */
802 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
803   const PixelWand *threshold)
804 {
805   char
806     thresholds[MaxTextExtent];
807
808   MagickBooleanType
809     status;
810
811   assert(wand != (MagickWand *) NULL);
812   assert(wand->signature == WandSignature);
813   if (wand->debug != MagickFalse)
814     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
815   if (wand->images == (Image *) NULL)
816     ThrowWandException(WandError,"ContainsNoImages",wand->name);
817   (void) FormatLocaleString(thresholds,MaxTextExtent,
818     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
819     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
820     PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
821   status=BlackThresholdImage(wand->images,thresholds,&wand->images->exception);
822   if (status == MagickFalse)
823     InheritException(wand->exception,&wand->images->exception);
824   return(status);
825 }
826 \f
827 /*
828 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
829 %                                                                             %
830 %                                                                             %
831 %                                                                             %
832 %   M a g i c k B l u e S h i f t I m a g e                                   %
833 %                                                                             %
834 %                                                                             %
835 %                                                                             %
836 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
837 %
838 %  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
839 %  nighttime in the moonlight.
840 %
841 %  The format of the MagickBlueShiftImage method is:
842 %
843 %      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
844 %        const double factor)
845 %
846 %  A description of each parameter follows:
847 %
848 %    o wand: the magick wand.
849 %
850 %    o factor: the blue shift factor (default 1.5)
851 %
852 */
853 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
854   const double factor)
855 {
856   Image
857     *shift_image;
858
859   assert(wand != (MagickWand *) NULL);
860   assert(wand->signature == WandSignature);
861   if (wand->debug != MagickFalse)
862     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
863   if (wand->images == (Image *) NULL)
864     ThrowWandException(WandError,"ContainsNoImages",wand->name);
865   shift_image=BlueShiftImage(wand->images,factor,wand->exception);
866   if (shift_image == (Image *) NULL)
867     return(MagickFalse);
868   ReplaceImageInList(&wand->images,shift_image);
869   return(MagickTrue);
870 }
871 \f
872 /*
873 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
874 %                                                                             %
875 %                                                                             %
876 %                                                                             %
877 %   M a g i c k B l u r I m a g e                                             %
878 %                                                                             %
879 %                                                                             %
880 %                                                                             %
881 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
882 %
883 %  MagickBlurImage() blurs an image.  We convolve the image with a
884 %  gaussian operator of the given radius and standard deviation (sigma).
885 %  For reasonable results, the radius should be larger than sigma.  Use a
886 %  radius of 0 and BlurImage() selects a suitable radius for you.
887 %
888 %  The format of the MagickBlurImage method is:
889 %
890 %      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
891 %        const double sigma)
892 %
893 %  A description of each parameter follows:
894 %
895 %    o wand: the magick wand.
896 %
897 %    o radius: the radius of the , in pixels, not counting the center
898 %      pixel.
899 %
900 %    o sigma: the standard deviation of the , in pixels.
901 %
902 */
903 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
904   const double radius,const double sigma)
905 {
906   Image
907     *blur_image;
908
909   assert(wand != (MagickWand *) NULL);
910   assert(wand->signature == WandSignature);
911   if (wand->debug != MagickFalse)
912     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
913   if (wand->images == (Image *) NULL)
914     ThrowWandException(WandError,"ContainsNoImages",wand->name);
915   blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
916   if (blur_image == (Image *) NULL)
917     return(MagickFalse);
918   ReplaceImageInList(&wand->images,blur_image);
919   return(MagickTrue);
920 }
921 \f
922 /*
923 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
924 %                                                                             %
925 %                                                                             %
926 %                                                                             %
927 %   M a g i c k B o r d e r I m a g e                                         %
928 %                                                                             %
929 %                                                                             %
930 %                                                                             %
931 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
932 %
933 %  MagickBorderImage() surrounds the image with a border of the color defined
934 %  by the bordercolor pixel wand.
935 %
936 %  The format of the MagickBorderImage method is:
937 %
938 %      MagickBooleanType MagickBorderImage(MagickWand *wand,
939 %        const PixelWand *bordercolor,const size_t width,
940 %        const size_t height)
941 %
942 %  A description of each parameter follows:
943 %
944 %    o wand: the magick wand.
945 %
946 %    o bordercolor: the border color pixel wand.
947 %
948 %    o width: the border width.
949 %
950 %    o height: the border height.
951 %
952 */
953 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
954   const PixelWand *bordercolor,const size_t width,
955   const size_t height)
956 {
957   Image
958     *border_image;
959
960   RectangleInfo
961     border_info;
962
963   assert(wand != (MagickWand *) NULL);
964   assert(wand->signature == WandSignature);
965   if (wand->debug != MagickFalse)
966     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
967   if (wand->images == (Image *) NULL)
968     ThrowWandException(WandError,"ContainsNoImages",wand->name);
969   border_info.width=width;
970   border_info.height=height;
971   border_info.x=0;
972   border_info.y=0;
973   PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
974   border_image=BorderImage(wand->images,&border_info,wand->exception);
975   if (border_image == (Image *) NULL)
976     return(MagickFalse);
977   ReplaceImageInList(&wand->images,border_image);
978   return(MagickTrue);
979 }
980 \f
981 /*
982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
983 %                                                                             %
984 %                                                                             %
985 %                                                                             %
986 %   M a g i c k B r i g h t n e s s C o n t r a s t S t r e t c h I m a g e   %
987 %                                                                             %
988 %                                                                             %
989 %                                                                             %
990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
991 %
992 %  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
993 %  of an image.  It converts the brightness and contrast parameters into slope
994 %  and intercept and calls a polynomical function to apply to the image.
995
996 %
997 %  The format of the MagickBrightnessContrastImage method is:
998 %
999 %      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1000 %        const double brightness,const double contrast)
1001 %
1002 %  A description of each parameter follows:
1003 %
1004 %    o wand: the magick wand.
1005 %
1006 %    o brightness: the brightness percent (-100 .. 100).
1007 %
1008 %    o contrast: the contrast percent (-100 .. 100).
1009 %
1010 */
1011 WandExport MagickBooleanType MagickBrightnessContrastImage(
1012   MagickWand *wand,const double brightness,const double contrast)
1013 {
1014   MagickBooleanType
1015     status;
1016
1017   assert(wand != (MagickWand *) NULL);
1018   assert(wand->signature == WandSignature);
1019   if (wand->debug != MagickFalse)
1020     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1021   if (wand->images == (Image *) NULL)
1022     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1023   status=BrightnessContrastImage(wand->images,brightness,contrast,
1024     &wand->images->exception);
1025   return(status);
1026 }
1027 \f
1028 /*
1029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1030 %                                                                             %
1031 %                                                                             %
1032 %                                                                             %
1033 %   M a g i c k C h a r c o a l I m a g e                                     %
1034 %                                                                             %
1035 %                                                                             %
1036 %                                                                             %
1037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1038 %
1039 %  MagickCharcoalImage() simulates a charcoal drawing.
1040 %
1041 %  The format of the MagickCharcoalImage method is:
1042 %
1043 %      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1044 %        const double radius,const double sigma)
1045 %
1046 %  A description of each parameter follows:
1047 %
1048 %    o wand: the magick wand.
1049 %
1050 %    o radius: the radius of the Gaussian, in pixels, not counting the center
1051 %      pixel.
1052 %
1053 %    o sigma: the standard deviation of the Gaussian, in pixels.
1054 %
1055 */
1056 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1057   const double radius,const double sigma)
1058 {
1059   Image
1060     *charcoal_image;
1061
1062   assert(wand != (MagickWand *) NULL);
1063   assert(wand->signature == WandSignature);
1064   if (wand->debug != MagickFalse)
1065     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1066   if (wand->images == (Image *) NULL)
1067     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1068   charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1069   if (charcoal_image == (Image *) NULL)
1070     return(MagickFalse);
1071   ReplaceImageInList(&wand->images,charcoal_image);
1072   return(MagickTrue);
1073 }
1074 \f
1075 /*
1076 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1077 %                                                                             %
1078 %                                                                             %
1079 %                                                                             %
1080 %   M a g i c k C h o p I m a g e                                             %
1081 %                                                                             %
1082 %                                                                             %
1083 %                                                                             %
1084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1085 %
1086 %  MagickChopImage() removes a region of an image and collapses the image to
1087 %  occupy the removed portion
1088 %
1089 %  The format of the MagickChopImage method is:
1090 %
1091 %      MagickBooleanType MagickChopImage(MagickWand *wand,
1092 %        const size_t width,const size_t height,const ssize_t x,
1093 %        const ssize_t y)
1094 %
1095 %  A description of each parameter follows:
1096 %
1097 %    o wand: the magick wand.
1098 %
1099 %    o width: the region width.
1100 %
1101 %    o height: the region height.
1102 %
1103 %    o x: the region x offset.
1104 %
1105 %    o y: the region y offset.
1106 %
1107 %
1108 */
1109 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1110   const size_t width,const size_t height,const ssize_t x,
1111   const ssize_t y)
1112 {
1113   Image
1114     *chop_image;
1115
1116   RectangleInfo
1117     chop;
1118
1119   assert(wand != (MagickWand *) NULL);
1120   assert(wand->signature == WandSignature);
1121   if (wand->debug != MagickFalse)
1122     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1123   if (wand->images == (Image *) NULL)
1124     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1125   chop.width=width;
1126   chop.height=height;
1127   chop.x=x;
1128   chop.y=y;
1129   chop_image=ChopImage(wand->images,&chop,wand->exception);
1130   if (chop_image == (Image *) NULL)
1131     return(MagickFalse);
1132   ReplaceImageInList(&wand->images,chop_image);
1133   return(MagickTrue);
1134 }
1135 \f
1136 /*
1137 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1138 %                                                                             %
1139 %                                                                             %
1140 %                                                                             %
1141 %   M a g i c k C l a m p I m a g e                                           %
1142 %                                                                             %
1143 %                                                                             %
1144 %                                                                             %
1145 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1146 %
1147 %  MagickClampImage() restricts the color range from 0 to the quantum depth.
1148 %
1149 %  The format of the MagickClampImage method is:
1150 %
1151 %      MagickBooleanType MagickClampImage(MagickWand *wand)
1152 %
1153 %  A description of each parameter follows:
1154 %
1155 %    o wand: the magick wand.
1156 %
1157 %    o channel: the channel.
1158 %
1159 */
1160 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1161 {
1162   MagickBooleanType
1163     status;
1164
1165   assert(wand != (MagickWand *) NULL);
1166   assert(wand->signature == WandSignature);
1167   if (wand->debug != MagickFalse)
1168     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1169   if (wand->images == (Image *) NULL)
1170     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1171   status=ClampImage(wand->images);
1172   if (status == MagickFalse)
1173     InheritException(wand->exception,&wand->images->exception);
1174   return(status);
1175 }
1176 \f
1177 /*
1178 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1179 %                                                                             %
1180 %                                                                             %
1181 %                                                                             %
1182 %   M a g i c k C l i p I m a g e                                             %
1183 %                                                                             %
1184 %                                                                             %
1185 %                                                                             %
1186 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1187 %
1188 %  MagickClipImage() clips along the first path from the 8BIM profile, if
1189 %  present.
1190 %
1191 %  The format of the MagickClipImage method is:
1192 %
1193 %      MagickBooleanType MagickClipImage(MagickWand *wand)
1194 %
1195 %  A description of each parameter follows:
1196 %
1197 %    o wand: the magick wand.
1198 %
1199 */
1200 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1201 {
1202   MagickBooleanType
1203     status;
1204
1205   assert(wand != (MagickWand *) NULL);
1206   assert(wand->signature == WandSignature);
1207   if (wand->debug != MagickFalse)
1208     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1209   if (wand->images == (Image *) NULL)
1210     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1211   status=ClipImage(wand->images);
1212   if (status == MagickFalse)
1213     InheritException(wand->exception,&wand->images->exception);
1214   return(status);
1215 }
1216 \f
1217 /*
1218 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1219 %                                                                             %
1220 %                                                                             %
1221 %                                                                             %
1222 %   M a g i c k C l i p I m a g e P a t h                                     %
1223 %                                                                             %
1224 %                                                                             %
1225 %                                                                             %
1226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1227 %
1228 %  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1229 %  present. Later operations take effect inside the path.  Id may be a number
1230 %  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1231 %  path.
1232 %
1233 %  The format of the MagickClipImagePath method is:
1234 %
1235 %      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1236 %        const char *pathname,const MagickBooleanType inside)
1237 %
1238 %  A description of each parameter follows:
1239 %
1240 %    o wand: the magick wand.
1241 %
1242 %    o pathname: name of clipping path resource. If name is preceded by #, use
1243 %      clipping path numbered by name.
1244 %
1245 %    o inside: if non-zero, later operations take effect inside clipping path.
1246 %      Otherwise later operations take effect outside clipping path.
1247 %
1248 */
1249 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1250   const char *pathname,const MagickBooleanType inside)
1251 {
1252   MagickBooleanType
1253     status;
1254
1255   assert(wand != (MagickWand *) NULL);
1256   assert(wand->signature == WandSignature);
1257   if (wand->debug != MagickFalse)
1258     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1259   if (wand->images == (Image *) NULL)
1260     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1261   status=ClipImagePath(wand->images,pathname,inside);
1262   if (status == MagickFalse)
1263     InheritException(wand->exception,&wand->images->exception);
1264   return(status);
1265 }
1266 \f
1267 /*
1268 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1269 %                                                                             %
1270 %                                                                             %
1271 %                                                                             %
1272 %   M a g i c k C l u t I m a g e                                             %
1273 %                                                                             %
1274 %                                                                             %
1275 %                                                                             %
1276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1277 %
1278 %  MagickClutImage() replaces colors in the image from a color lookup table.
1279 %
1280 %  The format of the MagickClutImage method is:
1281 %
1282 %      MagickBooleanType MagickClutImage(MagickWand *wand,
1283 %        const MagickWand *clut_wand)
1284 %
1285 %  A description of each parameter follows:
1286 %
1287 %    o wand: the magick wand.
1288 %
1289 %    o clut_image: the clut image.
1290 %
1291 */
1292 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1293   const MagickWand *clut_wand)
1294 {
1295   MagickBooleanType
1296     status;
1297
1298   assert(wand != (MagickWand *) NULL);
1299   assert(wand->signature == WandSignature);
1300   if (wand->debug != MagickFalse)
1301     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1302   if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1303     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1304   status=ClutImage(wand->images,clut_wand->images,&wand->images->exception);
1305   return(status);
1306 }
1307 \f
1308 /*
1309 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1310 %                                                                             %
1311 %                                                                             %
1312 %                                                                             %
1313 %   M a g i c k C o a l e s c e I m a g e s                                   %
1314 %                                                                             %
1315 %                                                                             %
1316 %                                                                             %
1317 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1318 %
1319 %  MagickCoalesceImages() composites a set of images while respecting any page
1320 %  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1321 %  typically start with an image background and each subsequent image
1322 %  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1323 %  where each image in the sequence is the same size as the first and
1324 %  composited with the next image in the sequence.
1325 %
1326 %  The format of the MagickCoalesceImages method is:
1327 %
1328 %      MagickWand *MagickCoalesceImages(MagickWand *wand)
1329 %
1330 %  A description of each parameter follows:
1331 %
1332 %    o wand: the magick wand.
1333 %
1334 */
1335 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1336 {
1337   Image
1338     *coalesce_image;
1339
1340   assert(wand != (MagickWand *) NULL);
1341   assert(wand->signature == WandSignature);
1342   if (wand->debug != MagickFalse)
1343     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1344   if (wand->images == (Image *) NULL)
1345     return((MagickWand *) NULL);
1346   coalesce_image=CoalesceImages(wand->images,wand->exception);
1347   if (coalesce_image == (Image *) NULL)
1348     return((MagickWand *) NULL);
1349   return(CloneMagickWandFromImages(wand,coalesce_image));
1350 }
1351 \f
1352 /*
1353 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1354 %                                                                             %
1355 %                                                                             %
1356 %                                                                             %
1357 %   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1358 %                                                                             %
1359 %                                                                             %
1360 %                                                                             %
1361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1362 %
1363 %  MagickColorDecisionListImage() accepts a lightweight Color Correction
1364 %  Collection (CCC) file which solely contains one or more color corrections
1365 %  and applies the color correction to the image.  Here is a sample CCC file:
1366 %
1367 %    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1368 %          <ColorCorrection id="cc03345">
1369 %                <SOPNode>
1370 %                     <Slope> 0.9 1.2 0.5 </Slope>
1371 %                     <Offset> 0.4 -0.5 0.6 </Offset>
1372 %                     <Power> 1.0 0.8 1.5 </Power>
1373 %                </SOPNode>
1374 %                <SATNode>
1375 %                     <Saturation> 0.85 </Saturation>
1376 %                </SATNode>
1377 %          </ColorCorrection>
1378 %    </ColorCorrectionCollection>
1379 %
1380 %  which includes the offset, slope, and power for each of the RGB channels
1381 %  as well as the saturation.
1382 %
1383 %  The format of the MagickColorDecisionListImage method is:
1384 %
1385 %      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1386 %        const double gamma)
1387 %
1388 %  A description of each parameter follows:
1389 %
1390 %    o wand: the magick wand.
1391 %
1392 %    o color_correction_collection: the color correction collection in XML.
1393 %
1394 */
1395 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1396   const char *color_correction_collection)
1397 {
1398   MagickBooleanType
1399     status;
1400
1401   assert(wand != (MagickWand *) NULL);
1402   assert(wand->signature == WandSignature);
1403   if (wand->debug != MagickFalse)
1404     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1405   if (wand->images == (Image *) NULL)
1406     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1407   status=ColorDecisionListImage(wand->images,color_correction_collection);
1408   if (status == MagickFalse)
1409     InheritException(wand->exception,&wand->images->exception);
1410   return(status);
1411 }
1412 \f
1413 /*
1414 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1415 %                                                                             %
1416 %                                                                             %
1417 %                                                                             %
1418 %   M a g i c k C o l o r i z e I m a g e                                     %
1419 %                                                                             %
1420 %                                                                             %
1421 %                                                                             %
1422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1423 %
1424 %  MagickColorizeImage() blends the fill color with each pixel in the image.
1425 %
1426 %  The format of the MagickColorizeImage method is:
1427 %
1428 %      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1429 %        const PixelWand *colorize,const PixelWand *opacity)
1430 %
1431 %  A description of each parameter follows:
1432 %
1433 %    o wand: the magick wand.
1434 %
1435 %    o colorize: the colorize pixel wand.
1436 %
1437 %    o opacity: the opacity pixel wand.
1438 %
1439 */
1440 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1441   const PixelWand *colorize,const PixelWand *opacity)
1442 {
1443   char
1444     percent_opaque[MaxTextExtent];
1445
1446   Image
1447     *colorize_image;
1448
1449   PixelPacket
1450     target;
1451
1452   assert(wand != (MagickWand *) NULL);
1453   assert(wand->signature == WandSignature);
1454   if (wand->debug != MagickFalse)
1455     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1456   if (wand->images == (Image *) NULL)
1457     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1458   (void) FormatLocaleString(percent_opaque,MaxTextExtent,
1459     "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1460     PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
1461     PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
1462     PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
1463     PixelGetOpacityQuantum(opacity)));
1464   PixelGetQuantumPacket(colorize,&target);
1465   colorize_image=ColorizeImage(wand->images,percent_opaque,target,
1466     wand->exception);
1467   if (colorize_image == (Image *) NULL)
1468     return(MagickFalse);
1469   ReplaceImageInList(&wand->images,colorize_image);
1470   return(MagickTrue);
1471 }
1472 \f
1473 /*
1474 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1475 %                                                                             %
1476 %                                                                             %
1477 %                                                                             %
1478 %   M a g i c k C o l o r M a t r i x I m a g e                               %
1479 %                                                                             %
1480 %                                                                             %
1481 %                                                                             %
1482 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1483 %
1484 %  MagickColorMatrixImage() apply color transformation to an image. The method
1485 %  permits saturation changes, hue rotation, luminance to alpha, and various
1486 %  other effects.  Although variable-sized transformation matrices can be used,
1487 %  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1488 %  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1489 %  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1490 %  and offsets are normalized (divide Flash offset by 255).
1491 %
1492 %  The format of the MagickColorMatrixImage method is:
1493 %
1494 %      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1495 %        const KernelInfo *color_matrix)
1496 %
1497 %  A description of each parameter follows:
1498 %
1499 %    o wand: the magick wand.
1500 %
1501 %    o color_matrix:  the color matrix.
1502 %
1503 */
1504 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1505   const KernelInfo *color_matrix)
1506 {
1507   Image
1508     *color_image;
1509
1510   assert(wand != (MagickWand *) NULL);
1511   assert(wand->signature == WandSignature);
1512   if (wand->debug != MagickFalse)
1513     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1514   if (color_matrix == (const KernelInfo *) NULL)
1515     return(MagickFalse);
1516   if (wand->images == (Image *) NULL)
1517     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1518   color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1519   if (color_image == (Image *) NULL)
1520     return(MagickFalse);
1521   ReplaceImageInList(&wand->images,color_image);
1522   return(MagickTrue);
1523 }
1524 \f
1525 /*
1526 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1527 %                                                                             %
1528 %                                                                             %
1529 %                                                                             %
1530 %   M a g i c k C o m b i n e I m a g e s                                     %
1531 %                                                                             %
1532 %                                                                             %
1533 %                                                                             %
1534 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1535 %
1536 %  MagickCombineImages() combines one or more images into a single image.  The
1537 %  grayscale value of the pixels of each image in the sequence is assigned in
1538 %  order to the specified  hannels of the combined image.   The typical
1539 %  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1540 %
1541 %  The format of the MagickCombineImages method is:
1542 %
1543 %      MagickWand *MagickCombineImages(MagickWand *wand)
1544 %
1545 %  A description of each parameter follows:
1546 %
1547 %    o wand: the magick wand.
1548 %
1549 */
1550 WandExport MagickWand *MagickCombineImages(MagickWand *wand)
1551 {
1552   Image
1553     *combine_image;
1554
1555   assert(wand != (MagickWand *) NULL);
1556   assert(wand->signature == WandSignature);
1557   if (wand->debug != MagickFalse)
1558     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1559   if (wand->images == (Image *) NULL)
1560     return((MagickWand *) NULL);
1561   combine_image=CombineImages(wand->images,wand->exception);
1562   if (combine_image == (Image *) NULL)
1563     return((MagickWand *) NULL);
1564   return(CloneMagickWandFromImages(wand,combine_image));
1565 }
1566 \f
1567 /*
1568 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1569 %                                                                             %
1570 %                                                                             %
1571 %                                                                             %
1572 %   M a g i c k C o m m e n t I m a g e                                       %
1573 %                                                                             %
1574 %                                                                             %
1575 %                                                                             %
1576 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1577 %
1578 %  MagickCommentImage() adds a comment to your image.
1579 %
1580 %  The format of the MagickCommentImage method is:
1581 %
1582 %      MagickBooleanType MagickCommentImage(MagickWand *wand,
1583 %        const char *comment)
1584 %
1585 %  A description of each parameter follows:
1586 %
1587 %    o wand: the magick wand.
1588 %
1589 %    o comment: the image comment.
1590 %
1591 */
1592 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1593   const char *comment)
1594 {
1595   MagickBooleanType
1596     status;
1597
1598   assert(wand != (MagickWand *) NULL);
1599   assert(wand->signature == WandSignature);
1600   if (wand->debug != MagickFalse)
1601     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1602   if (wand->images == (Image *) NULL)
1603     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1604   status=SetImageProperty(wand->images,"comment",comment);
1605   if (status == MagickFalse)
1606     InheritException(wand->exception,&wand->images->exception);
1607   return(status);
1608 }
1609 \f
1610 /*
1611 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1612 %                                                                             %
1613 %                                                                             %
1614 %                                                                             %
1615 %   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1616 %                                                                             %
1617 %                                                                             %
1618 %                                                                             %
1619 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1620 %
1621 %  MagickCompareImagesLayers() compares each image with the next in a sequence
1622 %  and returns the maximum bounding region of any pixel differences it
1623 %  discovers.
1624 %
1625 %  The format of the MagickCompareImagesLayers method is:
1626 %
1627 %      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1628 %        const ImageLayerMethod method)
1629 %
1630 %  A description of each parameter follows:
1631 %
1632 %    o wand: the magick wand.
1633 %
1634 %    o method: the compare method.
1635 %
1636 */
1637 WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1638   const ImageLayerMethod method)
1639 {
1640   Image
1641     *layers_image;
1642
1643   assert(wand != (MagickWand *) NULL);
1644   assert(wand->signature == WandSignature);
1645   if (wand->debug != MagickFalse)
1646     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1647   if (wand->images == (Image *) NULL)
1648     return((MagickWand *) NULL);
1649   layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1650   if (layers_image == (Image *) NULL)
1651     return((MagickWand *) NULL);
1652   return(CloneMagickWandFromImages(wand,layers_image));
1653 }
1654 \f
1655 /*
1656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1657 %                                                                             %
1658 %                                                                             %
1659 %                                                                             %
1660 %   M a g i c k C o m p a r e I m a g e s                                     %
1661 %                                                                             %
1662 %                                                                             %
1663 %                                                                             %
1664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1665 %
1666 %  MagickCompareImages() compares an image to a reconstructed image and returns
1667 %  the specified difference image.
1668 %
1669 %  The format of the MagickCompareImages method is:
1670 %
1671 %      MagickWand *MagickCompareImages(MagickWand *wand,
1672 %        const MagickWand *reference,const MetricType metric,
1673 %        double *distortion)
1674 %
1675 %  A description of each parameter follows:
1676 %
1677 %    o wand: the magick wand.
1678 %
1679 %    o reference: the reference wand.
1680 %
1681 %    o metric: the metric.
1682 %
1683 %    o distortion: the computed distortion between the images.
1684 %
1685 */
1686 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1687   const MagickWand *reference,const MetricType metric,double *distortion)
1688 {
1689   Image
1690     *compare_image;
1691
1692
1693   assert(wand != (MagickWand *) NULL);
1694   assert(wand->signature == WandSignature);
1695   if (wand->debug != MagickFalse)
1696     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1697   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1698     {
1699       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1700         "ContainsNoImages","`%s'",wand->name);
1701       return((MagickWand *) NULL);
1702     }
1703   compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1704     &wand->images->exception);
1705   if (compare_image == (Image *) NULL)
1706     return((MagickWand *) NULL);
1707   return(CloneMagickWandFromImages(wand,compare_image));
1708 }
1709 \f
1710 /*
1711 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1712 %                                                                             %
1713 %                                                                             %
1714 %                                                                             %
1715 %   M a g i c k C o m p o s i t e I m a g e                                   %
1716 %                                                                             %
1717 %                                                                             %
1718 %                                                                             %
1719 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1720 %
1721 %  MagickCompositeImage() composite one image onto another at the specified
1722 %  offset.
1723 %
1724 %  The format of the MagickCompositeImage method is:
1725 %
1726 %      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1727 %        const MagickWand *composite_wand,const CompositeOperator compose,
1728 %        const ssize_t x,const ssize_t y)
1729 %
1730 %  A description of each parameter follows:
1731 %
1732 %    o wand: the magick wand.
1733 %
1734 %    o composite_image: the composite image.
1735 %
1736 %    o compose: This operator affects how the composite is applied to the
1737 %      image.  The default is Over.  Choose from these operators:
1738 %
1739 %        OverCompositeOp       InCompositeOp         OutCompositeOp
1740 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1741 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1742 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1743 %        DisplaceCompositeOp
1744 %
1745 %    o x: the column offset of the composited image.
1746 %
1747 %    o y: the row offset of the composited image.
1748 %
1749 */
1750 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1751   const MagickWand *composite_wand,const CompositeOperator compose,
1752   const ssize_t x,const ssize_t y)
1753 {
1754   MagickBooleanType
1755     status;
1756
1757   assert(wand != (MagickWand *) NULL);
1758   assert(wand->signature == WandSignature);
1759   if (wand->debug != MagickFalse)
1760     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1761   if ((wand->images == (Image *) NULL) ||
1762       (composite_wand->images == (Image *) NULL))
1763     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1764   status=CompositeImage(wand->images,compose,composite_wand->images,x,y);
1765   if (status == MagickFalse)
1766     InheritException(wand->exception,&wand->images->exception);
1767   return(status);
1768 }
1769 \f
1770 /*
1771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1772 %                                                                             %
1773 %                                                                             %
1774 %                                                                             %
1775 %   M a g i c k C o n t r a s t I m a g e                                     %
1776 %                                                                             %
1777 %                                                                             %
1778 %                                                                             %
1779 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1780 %
1781 %  MagickContrastImage() enhances the intensity differences between the lighter
1782 %  and darker elements of the image.  Set sharpen to a value other than 0 to
1783 %  increase the image contrast otherwise the contrast is reduced.
1784 %
1785 %  The format of the MagickContrastImage method is:
1786 %
1787 %      MagickBooleanType MagickContrastImage(MagickWand *wand,
1788 %        const MagickBooleanType sharpen)
1789 %
1790 %  A description of each parameter follows:
1791 %
1792 %    o wand: the magick wand.
1793 %
1794 %    o sharpen: Increase or decrease image contrast.
1795 %
1796 %
1797 */
1798 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1799   const MagickBooleanType sharpen)
1800 {
1801   MagickBooleanType
1802     status;
1803
1804   assert(wand != (MagickWand *) NULL);
1805   assert(wand->signature == WandSignature);
1806   if (wand->debug != MagickFalse)
1807     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1808   if (wand->images == (Image *) NULL)
1809     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1810   status=ContrastImage(wand->images,sharpen);
1811   if (status == MagickFalse)
1812     InheritException(wand->exception,&wand->images->exception);
1813   return(status);
1814 }
1815 \f
1816 /*
1817 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1818 %                                                                             %
1819 %                                                                             %
1820 %                                                                             %
1821 %   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                       %
1822 %                                                                             %
1823 %                                                                             %
1824 %                                                                             %
1825 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1826 %
1827 %  MagickContrastStretchImage() enhances the contrast of a color image by
1828 %  adjusting the pixels color to span the entire range of colors available.
1829 %  You can also reduce the influence of a particular channel with a gamma
1830 %  value of 0.
1831 %
1832 %  The format of the MagickContrastStretchImage method is:
1833 %
1834 %      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1835 %        const double black_point,const double white_point)
1836 %
1837 %  A description of each parameter follows:
1838 %
1839 %    o wand: the magick wand.
1840 %
1841 %    o black_point: the black point.
1842 %
1843 %    o white_point: the white point.
1844 %
1845 */
1846 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1847   const double black_point,const double white_point)
1848 {
1849   MagickBooleanType
1850     status;
1851
1852   assert(wand != (MagickWand *) NULL);
1853   assert(wand->signature == WandSignature);
1854   if (wand->debug != MagickFalse)
1855     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1856   if (wand->images == (Image *) NULL)
1857     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1858   status=ContrastStretchImage(wand->images,black_point,white_point);
1859   if (status == MagickFalse)
1860     InheritException(wand->exception,&wand->images->exception);
1861   return(status);
1862 }
1863 \f
1864 /*
1865 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1866 %                                                                             %
1867 %                                                                             %
1868 %                                                                             %
1869 %   M a g i c k C o n v o l v e I m a g e                                     %
1870 %                                                                             %
1871 %                                                                             %
1872 %                                                                             %
1873 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1874 %
1875 %  MagickConvolveImage() applies a custom convolution kernel to the image.
1876 %
1877 %  The format of the MagickConvolveImage method is:
1878 %
1879 %      MagickBooleanType MagickConvolveImage(MagickWand *wand,
1880 %        const KernelInfo *kernel)
1881 %
1882 %  A description of each parameter follows:
1883 %
1884 %    o wand: the magick wand.
1885 %
1886 %    o kernel: An array of doubles representing the convolution kernel.
1887 %
1888 */
1889 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
1890   const KernelInfo *kernel)
1891 {
1892   Image
1893     *filter_image;
1894
1895   assert(wand != (MagickWand *) NULL);
1896   assert(wand->signature == WandSignature);
1897   if (wand->debug != MagickFalse)
1898     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1899   if (kernel == (const KernelInfo *) NULL)
1900     return(MagickFalse);
1901   if (wand->images == (Image *) NULL)
1902     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1903   filter_image=ConvolveImage(wand->images,kernel,wand->exception);
1904   if (filter_image == (Image *) NULL)
1905     return(MagickFalse);
1906   ReplaceImageInList(&wand->images,filter_image);
1907   return(MagickTrue);
1908 }
1909 \f
1910 /*
1911 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1912 %                                                                             %
1913 %                                                                             %
1914 %                                                                             %
1915 %   M a g i c k C r o p I m a g e                                             %
1916 %                                                                             %
1917 %                                                                             %
1918 %                                                                             %
1919 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1920 %
1921 %  MagickCropImage() extracts a region of the image.
1922 %
1923 %  The format of the MagickCropImage method is:
1924 %
1925 %      MagickBooleanType MagickCropImage(MagickWand *wand,
1926 %        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1927 %
1928 %  A description of each parameter follows:
1929 %
1930 %    o wand: the magick wand.
1931 %
1932 %    o width: the region width.
1933 %
1934 %    o height: the region height.
1935 %
1936 %    o x: the region x-offset.
1937 %
1938 %    o y: the region y-offset.
1939 %
1940 */
1941 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
1942   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1943 {
1944   Image
1945     *crop_image;
1946
1947   RectangleInfo
1948     crop;
1949
1950   assert(wand != (MagickWand *) NULL);
1951   assert(wand->signature == WandSignature);
1952   if (wand->debug != MagickFalse)
1953     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1954   if (wand->images == (Image *) NULL)
1955     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1956   crop.width=width;
1957   crop.height=height;
1958   crop.x=x;
1959   crop.y=y;
1960   crop_image=CropImage(wand->images,&crop,wand->exception);
1961   if (crop_image == (Image *) NULL)
1962     return(MagickFalse);
1963   ReplaceImageInList(&wand->images,crop_image);
1964   return(MagickTrue);
1965 }
1966 \f
1967 /*
1968 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1969 %                                                                             %
1970 %                                                                             %
1971 %                                                                             %
1972 %   M a g i c k C y c l e C o l o r m a p I m a g e                           %
1973 %                                                                             %
1974 %                                                                             %
1975 %                                                                             %
1976 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1977 %
1978 %  MagickCycleColormapImage() displaces an image's colormap by a given number
1979 %  of positions.  If you cycle the colormap a number of times you can produce
1980 %  a psychodelic effect.
1981 %
1982 %  The format of the MagickCycleColormapImage method is:
1983 %
1984 %      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
1985 %        const ssize_t displace)
1986 %
1987 %  A description of each parameter follows:
1988 %
1989 %    o wand: the magick wand.
1990 %
1991 %    o pixel_wand: the pixel wand.
1992 %
1993 */
1994 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
1995   const ssize_t displace)
1996 {
1997   MagickBooleanType
1998     status;
1999
2000   assert(wand != (MagickWand *) NULL);
2001   assert(wand->signature == WandSignature);
2002   if (wand->debug != MagickFalse)
2003     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2004   if (wand->images == (Image *) NULL)
2005     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2006   status=CycleColormapImage(wand->images,displace);
2007   if (status == MagickFalse)
2008     InheritException(wand->exception,&wand->images->exception);
2009   return(status);
2010 }
2011 \f
2012 /*
2013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2014 %                                                                             %
2015 %                                                                             %
2016 %                                                                             %
2017 %   M a g i c k C o n s t i t u t e I m a g e                                 %
2018 %                                                                             %
2019 %                                                                             %
2020 %                                                                             %
2021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2022 %
2023 %  MagickConstituteImage() adds an image to the wand comprised of the pixel
2024 %  data you supply.  The pixel data must be in scanline order top-to-bottom.
2025 %  The data can be char, short int, int, float, or double.  Float and double
2026 %  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2027 %  is the maximum value the type can accomodate (e.g. 255 for char).  For
2028 %  example, to create a 640x480 image from unsigned red-green-blue character
2029 %  data, use
2030 %
2031 %      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2032 %
2033 %  The format of the MagickConstituteImage method is:
2034 %
2035 %      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2036 %        const size_t columns,const size_t rows,const char *map,
2037 %        const StorageType storage,void *pixels)
2038 %
2039 %  A description of each parameter follows:
2040 %
2041 %    o wand: the magick wand.
2042 %
2043 %    o columns: width in pixels of the image.
2044 %
2045 %    o rows: height in pixels of the image.
2046 %
2047 %    o map:  This string reflects the expected ordering of the pixel array.
2048 %      It can be any combination or order of R = red, G = green, B = blue,
2049 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2050 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2051 %      P = pad.
2052 %
2053 %    o storage: Define the data type of the pixels.  Float and double types are
2054 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2055 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2056 %      LongPixel, QuantumPixel, or ShortPixel.
2057 %
2058 %    o pixels: This array of values contain the pixel components as defined by
2059 %      map and type.  You must preallocate this array where the expected
2060 %      length varies depending on the values of width, height, map, and type.
2061 %
2062 %
2063 */
2064 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2065   const size_t columns,const size_t rows,const char *map,
2066   const StorageType storage,const void *pixels)
2067 {
2068   Image
2069     *images;
2070
2071   assert(wand != (MagickWand *) NULL);
2072   assert(wand->signature == WandSignature);
2073   if (wand->debug != MagickFalse)
2074     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2075   images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2076   if (images == (Image *) NULL)
2077     return(MagickFalse);
2078   return(InsertImageInWand(wand,images));
2079 }
2080 \f
2081 /*
2082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2083 %                                                                             %
2084 %                                                                             %
2085 %                                                                             %
2086 %   M a g i c k D e c i p h e r I m a g e                                     %
2087 %                                                                             %
2088 %                                                                             %
2089 %                                                                             %
2090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2091 %
2092 %  MagickDecipherImage() converts cipher pixels to plain pixels.
2093 %
2094 %  The format of the MagickDecipherImage method is:
2095 %
2096 %      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2097 %        const char *passphrase)
2098 %
2099 %  A description of each parameter follows:
2100 %
2101 %    o wand: the magick wand.
2102 %
2103 %    o passphrase: the passphrase.
2104 %
2105 */
2106 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2107   const char *passphrase)
2108 {
2109   assert(wand != (MagickWand *) NULL);
2110   assert(wand->signature == WandSignature);
2111   if (wand->debug != MagickFalse)
2112     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2113   if (wand->images == (Image *) NULL)
2114     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2115   return(DecipherImage(wand->images,passphrase,&wand->images->exception));
2116 }
2117 \f
2118 /*
2119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2120 %                                                                             %
2121 %                                                                             %
2122 %                                                                             %
2123 %   M a g i c k D e c o n s t r u c t I m a g e s                             %
2124 %                                                                             %
2125 %                                                                             %
2126 %                                                                             %
2127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2128 %
2129 %  MagickDeconstructImages() compares each image with the next in a sequence
2130 %  and returns the maximum bounding region of any pixel differences it
2131 %  discovers.
2132 %
2133 %  The format of the MagickDeconstructImages method is:
2134 %
2135 %      MagickWand *MagickDeconstructImages(MagickWand *wand)
2136 %
2137 %  A description of each parameter follows:
2138 %
2139 %    o wand: the magick wand.
2140 %
2141 */
2142 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2143 {
2144   Image
2145     *deconstruct_image;
2146
2147   assert(wand != (MagickWand *) NULL);
2148   assert(wand->signature == WandSignature);
2149   if (wand->debug != MagickFalse)
2150     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2151   if (wand->images == (Image *) NULL)
2152     return((MagickWand *) NULL);
2153   deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2154     wand->exception);
2155   if (deconstruct_image == (Image *) NULL)
2156     return((MagickWand *) NULL);
2157   return(CloneMagickWandFromImages(wand,deconstruct_image));
2158 }
2159 \f
2160 /*
2161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2162 %                                                                             %
2163 %                                                                             %
2164 %                                                                             %
2165 %     M a g i c k D e s k e w I m a g e                                       %
2166 %                                                                             %
2167 %                                                                             %
2168 %                                                                             %
2169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2170 %
2171 %  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2172 %  occurs in scanned images because of the camera being misaligned,
2173 %  imperfections in the scanning or surface, or simply because the paper was
2174 %  not placed completely flat when scanned.
2175 %
2176 %  The format of the MagickDeskewImage method is:
2177 %
2178 %      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2179 %        const double threshold)
2180 %
2181 %  A description of each parameter follows:
2182 %
2183 %    o wand: the magick wand.
2184 %
2185 %    o threshold: separate background from foreground.
2186 %
2187 */
2188 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2189   const double threshold)
2190 {
2191   Image
2192     *sepia_image;
2193
2194   assert(wand != (MagickWand *) NULL);
2195   assert(wand->signature == WandSignature);
2196   if (wand->debug != MagickFalse)
2197     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2198   if (wand->images == (Image *) NULL)
2199     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2200   sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2201   if (sepia_image == (Image *) NULL)
2202     return(MagickFalse);
2203   ReplaceImageInList(&wand->images,sepia_image);
2204   return(MagickTrue);
2205 }
2206 \f
2207 /*
2208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2209 %                                                                             %
2210 %                                                                             %
2211 %                                                                             %
2212 %     M a g i c k D e s p e c k l e I m a g e                                 %
2213 %                                                                             %
2214 %                                                                             %
2215 %                                                                             %
2216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2217 %
2218 %  MagickDespeckleImage() reduces the speckle noise in an image while
2219 %  perserving the edges of the original image.
2220 %
2221 %  The format of the MagickDespeckleImage method is:
2222 %
2223 %      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2224 %
2225 %  A description of each parameter follows:
2226 %
2227 %    o wand: the magick wand.
2228 %
2229 */
2230 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2231 {
2232   Image
2233     *despeckle_image;
2234
2235   assert(wand != (MagickWand *) NULL);
2236   assert(wand->signature == WandSignature);
2237   if (wand->debug != MagickFalse)
2238     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2239   if (wand->images == (Image *) NULL)
2240     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2241   despeckle_image=DespeckleImage(wand->images,wand->exception);
2242   if (despeckle_image == (Image *) NULL)
2243     return(MagickFalse);
2244   ReplaceImageInList(&wand->images,despeckle_image);
2245   return(MagickTrue);
2246 }
2247 \f
2248 /*
2249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2250 %                                                                             %
2251 %                                                                             %
2252 %                                                                             %
2253 %   M a g i c k D e s t r o y I m a g e                                       %
2254 %                                                                             %
2255 %                                                                             %
2256 %                                                                             %
2257 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2258 %
2259 %  MagickDestroyImage() dereferences an image, deallocating memory associated
2260 %  with the image if the reference count becomes zero.
2261 %
2262 %  The format of the MagickDestroyImage method is:
2263 %
2264 %      Image *MagickDestroyImage(Image *image)
2265 %
2266 %  A description of each parameter follows:
2267 %
2268 %    o image: the image.
2269 %
2270 */
2271 WandExport Image *MagickDestroyImage(Image *image)
2272 {
2273   return(DestroyImage(image));
2274 }
2275 \f
2276 /*
2277 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2278 %                                                                             %
2279 %                                                                             %
2280 %                                                                             %
2281 %   M a g i c k D i s p l a y I m a g e                                       %
2282 %                                                                             %
2283 %                                                                             %
2284 %                                                                             %
2285 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2286 %
2287 %  MagickDisplayImage() displays an image.
2288 %
2289 %  The format of the MagickDisplayImage method is:
2290 %
2291 %      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2292 %        const char *server_name)
2293 %
2294 %  A description of each parameter follows:
2295 %
2296 %    o wand: the magick wand.
2297 %
2298 %    o server_name: the X server name.
2299 %
2300 */
2301 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2302   const char *server_name)
2303 {
2304   Image
2305     *image;
2306
2307   MagickBooleanType
2308     status;
2309
2310   assert(wand != (MagickWand *) NULL);
2311   assert(wand->signature == WandSignature);
2312   if (wand->debug != MagickFalse)
2313     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2314   if (wand->images == (Image *) NULL)
2315     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2316   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2317   if (image == (Image *) NULL)
2318     return(MagickFalse);
2319   (void) CloneString(&wand->image_info->server_name,server_name);
2320   status=DisplayImages(wand->image_info,image);
2321   if (status == MagickFalse)
2322     InheritException(wand->exception,&image->exception);
2323   image=DestroyImage(image);
2324   return(status);
2325 }
2326 \f
2327 /*
2328 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2329 %                                                                             %
2330 %                                                                             %
2331 %                                                                             %
2332 %   M a g i c k D i s p l a y I m a g e s                                     %
2333 %                                                                             %
2334 %                                                                             %
2335 %                                                                             %
2336 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2337 %
2338 %  MagickDisplayImages() displays an image or image sequence.
2339 %
2340 %  The format of the MagickDisplayImages method is:
2341 %
2342 %      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2343 %        const char *server_name)
2344 %
2345 %  A description of each parameter follows:
2346 %
2347 %    o wand: the magick wand.
2348 %
2349 %    o server_name: the X server name.
2350 %
2351 */
2352 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2353   const char *server_name)
2354 {
2355   MagickBooleanType
2356     status;
2357
2358   assert(wand != (MagickWand *) NULL);
2359   assert(wand->signature == WandSignature);
2360   if (wand->debug != MagickFalse)
2361     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2362   (void) CloneString(&wand->image_info->server_name,server_name);
2363   status=DisplayImages(wand->image_info,wand->images);
2364   if (status == MagickFalse)
2365     InheritException(wand->exception,&wand->images->exception);
2366   return(status);
2367 }
2368 \f
2369 /*
2370 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2371 %                                                                             %
2372 %                                                                             %
2373 %                                                                             %
2374 %   M a g i c k D i s t o r t I m a g e                                       %
2375 %                                                                             %
2376 %                                                                             %
2377 %                                                                             %
2378 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2379 %
2380 %  MagickDistortImage() distorts an image using various distortion methods, by
2381 %  mapping color lookups of the source image to a new destination image
2382 %  usally of the same size as the source image, unless 'bestfit' is set to
2383 %  true.
2384 %
2385 %  If 'bestfit' is enabled, and distortion allows it, the destination image is
2386 %  adjusted to ensure the whole source 'image' will just fit within the final
2387 %  destination image, which will be sized and offset accordingly.  Also in
2388 %  many cases the virtual offset of the source image will be taken into
2389 %  account in the mapping.
2390 %
2391 %  The format of the MagickDistortImage method is:
2392 %
2393 %      MagickBooleanType MagickDistortImage(MagickWand *wand,
2394 %        const DistortImageMethod method,const size_t number_arguments,
2395 %        const double *arguments,const MagickBooleanType bestfit)
2396 %
2397 %  A description of each parameter follows:
2398 %
2399 %    o image: the image to be distorted.
2400 %
2401 %    o method: the method of image distortion.
2402 %
2403 %        ArcDistortion always ignores the source image offset, and always
2404 %        'bestfit' the destination image with the top left corner offset
2405 %        relative to the polar mapping center.
2406 %
2407 %        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2408 %        style of image distortion.
2409 %
2410 %        Affine, Perspective, and Bilinear, do least squares fitting of the
2411 %        distortion when more than the minimum number of control point pairs
2412 %        are provided.
2413 %
2414 %        Perspective, and Bilinear, falls back to a Affine distortion when less
2415 %        that 4 control point pairs are provided. While Affine distortions let
2416 %        you use any number of control point pairs, that is Zero pairs is a
2417 %        no-Op (viewport only) distrotion, one pair is a translation and two
2418 %        pairs of control points do a scale-rotate-translate, without any
2419 %        shearing.
2420 %
2421 %    o number_arguments: the number of arguments given for this distortion
2422 %      method.
2423 %
2424 %    o arguments: the arguments for this distortion method.
2425 %
2426 %    o bestfit: Attempt to resize destination to fit distorted source.
2427 %
2428 */
2429 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2430   const DistortImageMethod method,const size_t number_arguments,
2431   const double *arguments,const MagickBooleanType bestfit)
2432 {
2433   Image
2434     *distort_image;
2435
2436   assert(wand != (MagickWand *) NULL);
2437   assert(wand->signature == WandSignature);
2438   if (wand->debug != MagickFalse)
2439     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2440   if (wand->images == (Image *) NULL)
2441     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2442   distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2443     bestfit,wand->exception);
2444   if (distort_image == (Image *) NULL)
2445     return(MagickFalse);
2446   ReplaceImageInList(&wand->images,distort_image);
2447   return(MagickTrue);
2448 }
2449 \f
2450 /*
2451 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2452 %                                                                             %
2453 %                                                                             %
2454 %                                                                             %
2455 %   M a g i c k D r a w I m a g e                                             %
2456 %                                                                             %
2457 %                                                                             %
2458 %                                                                             %
2459 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2460 %
2461 %  MagickDrawImage() renders the drawing wand on the current image.
2462 %
2463 %  The format of the MagickDrawImage method is:
2464 %
2465 %      MagickBooleanType MagickDrawImage(MagickWand *wand,
2466 %        const DrawingWand *drawing_wand)
2467 %
2468 %  A description of each parameter follows:
2469 %
2470 %    o wand: the magick wand.
2471 %
2472 %    o drawing_wand: the draw wand.
2473 %
2474 */
2475 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2476   const DrawingWand *drawing_wand)
2477 {
2478   char
2479     *primitive;
2480
2481   DrawInfo
2482     *draw_info;
2483
2484   MagickBooleanType
2485     status;
2486
2487   assert(wand != (MagickWand *) NULL);
2488   assert(wand->signature == WandSignature);
2489   if (wand->debug != MagickFalse)
2490     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2491   if (wand->images == (Image *) NULL)
2492     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2493   draw_info=PeekDrawingWand(drawing_wand);
2494   if ((draw_info == (DrawInfo *) NULL) ||
2495       (draw_info->primitive == (char *) NULL))
2496     return(MagickFalse);
2497   primitive=AcquireString(draw_info->primitive);
2498   draw_info=DestroyDrawInfo(draw_info);
2499   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2500   draw_info->primitive=primitive;
2501   status=DrawImage(wand->images,draw_info);
2502   if (status == MagickFalse)
2503     InheritException(wand->exception,&wand->images->exception);
2504   draw_info=DestroyDrawInfo(draw_info);
2505   return(status);
2506 }
2507 \f
2508 /*
2509 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2510 %                                                                             %
2511 %                                                                             %
2512 %                                                                             %
2513 %   M a g i c k E d g e I m a g e                                             %
2514 %                                                                             %
2515 %                                                                             %
2516 %                                                                             %
2517 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2518 %
2519 %  MagickEdgeImage() enhance edges within the image with a convolution filter
2520 %  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2521 %  radius for you.
2522 %
2523 %  The format of the MagickEdgeImage method is:
2524 %
2525 %      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2526 %
2527 %  A description of each parameter follows:
2528 %
2529 %    o wand: the magick wand.
2530 %
2531 %    o radius: the radius of the pixel neighborhood.
2532 %
2533 */
2534 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2535   const double radius)
2536 {
2537   Image
2538     *edge_image;
2539
2540   assert(wand != (MagickWand *) NULL);
2541   assert(wand->signature == WandSignature);
2542   if (wand->debug != MagickFalse)
2543     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2544   if (wand->images == (Image *) NULL)
2545     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2546   edge_image=EdgeImage(wand->images,radius,wand->exception);
2547   if (edge_image == (Image *) NULL)
2548     return(MagickFalse);
2549   ReplaceImageInList(&wand->images,edge_image);
2550   return(MagickTrue);
2551 }
2552 \f
2553 /*
2554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2555 %                                                                             %
2556 %                                                                             %
2557 %                                                                             %
2558 %   M a g i c k E m b o s s I m a g e                                         %
2559 %                                                                             %
2560 %                                                                             %
2561 %                                                                             %
2562 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2563 %
2564 %  MagickEmbossImage() returns a grayscale image with a three-dimensional
2565 %  effect.  We convolve the image with a Gaussian operator of the given radius
2566 %  and standard deviation (sigma).  For reasonable results, radius should be
2567 %  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2568 %  radius for you.
2569 %
2570 %  The format of the MagickEmbossImage method is:
2571 %
2572 %      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2573 %        const double sigma)
2574 %
2575 %  A description of each parameter follows:
2576 %
2577 %    o wand: the magick wand.
2578 %
2579 %    o radius: the radius of the Gaussian, in pixels, not counting the center
2580 %      pixel.
2581 %
2582 %    o sigma: the standard deviation of the Gaussian, in pixels.
2583 %
2584 */
2585 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2586   const double radius,const double sigma)
2587 {
2588   Image
2589     *emboss_image;
2590
2591   assert(wand != (MagickWand *) NULL);
2592   assert(wand->signature == WandSignature);
2593   if (wand->debug != MagickFalse)
2594     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2595   if (wand->images == (Image *) NULL)
2596     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2597   emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2598   if (emboss_image == (Image *) NULL)
2599     return(MagickFalse);
2600   ReplaceImageInList(&wand->images,emboss_image);
2601   return(MagickTrue);
2602 }
2603 \f
2604 /*
2605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2606 %                                                                             %
2607 %                                                                             %
2608 %                                                                             %
2609 %   M a g i c k E n c i p h e r I m a g e                                     %
2610 %                                                                             %
2611 %                                                                             %
2612 %                                                                             %
2613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2614 %
2615 %  MagickEncipherImage() converts plaint pixels to cipher pixels.
2616 %
2617 %  The format of the MagickEncipherImage method is:
2618 %
2619 %      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2620 %        const char *passphrase)
2621 %
2622 %  A description of each parameter follows:
2623 %
2624 %    o wand: the magick wand.
2625 %
2626 %    o passphrase: the passphrase.
2627 %
2628 */
2629 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2630   const char *passphrase)
2631 {
2632   assert(wand != (MagickWand *) NULL);
2633   assert(wand->signature == WandSignature);
2634   if (wand->debug != MagickFalse)
2635     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2636   if (wand->images == (Image *) NULL)
2637     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2638   return(EncipherImage(wand->images,passphrase,&wand->images->exception));
2639 }
2640 \f
2641 /*
2642 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2643 %                                                                             %
2644 %                                                                             %
2645 %                                                                             %
2646 %   M a g i c k E n h a n c e I m a g e                                       %
2647 %                                                                             %
2648 %                                                                             %
2649 %                                                                             %
2650 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2651 %
2652 %  MagickEnhanceImage() applies a digital filter that improves the quality of a
2653 %  noisy image.
2654 %
2655 %  The format of the MagickEnhanceImage method is:
2656 %
2657 %      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2658 %
2659 %  A description of each parameter follows:
2660 %
2661 %    o wand: the magick wand.
2662 %
2663 */
2664 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2665 {
2666   Image
2667     *enhance_image;
2668
2669   assert(wand != (MagickWand *) NULL);
2670   assert(wand->signature == WandSignature);
2671   if (wand->debug != MagickFalse)
2672     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2673   if (wand->images == (Image *) NULL)
2674     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2675   enhance_image=EnhanceImage(wand->images,wand->exception);
2676   if (enhance_image == (Image *) NULL)
2677     return(MagickFalse);
2678   ReplaceImageInList(&wand->images,enhance_image);
2679   return(MagickTrue);
2680 }
2681 \f
2682 /*
2683 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2684 %                                                                             %
2685 %                                                                             %
2686 %                                                                             %
2687 %   M a g i c k E q u a l i z e I m a g e                                     %
2688 %                                                                             %
2689 %                                                                             %
2690 %                                                                             %
2691 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2692 %
2693 %  MagickEqualizeImage() equalizes the image histogram.
2694 %
2695 %  The format of the MagickEqualizeImage method is:
2696 %
2697 %      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2698 %
2699 %  A description of each parameter follows:
2700 %
2701 %    o wand: the magick wand.
2702 %
2703 %    o channel: the image channel(s).
2704 %
2705 */
2706 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2707 {
2708   MagickBooleanType
2709     status;
2710
2711   assert(wand != (MagickWand *) NULL);
2712   assert(wand->signature == WandSignature);
2713   if (wand->debug != MagickFalse)
2714     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2715   if (wand->images == (Image *) NULL)
2716     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2717   status=EqualizeImage(wand->images);
2718   if (status == MagickFalse)
2719     InheritException(wand->exception,&wand->images->exception);
2720   return(status);
2721 }
2722 \f
2723 /*
2724 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2725 %                                                                             %
2726 %                                                                             %
2727 %                                                                             %
2728 %   M a g i c k E v a l u a t e I m a g e                                     %
2729 %                                                                             %
2730 %                                                                             %
2731 %                                                                             %
2732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2733 %
2734 %  MagickEvaluateImage() applys an arithmetic, relational, or logical
2735 %  expression to an image.  Use these operators to lighten or darken an image,
2736 %  to increase or decrease contrast in an image, or to produce the "negative"
2737 %  of an image.
2738 %
2739 %  The format of the MagickEvaluateImage method is:
2740 %
2741 %      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2742 %        const MagickEvaluateOperator operator,const double value)
2743 %      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2744 %        const MagickEvaluateOperator operator)
2745 %
2746 %  A description of each parameter follows:
2747 %
2748 %    o wand: the magick wand.
2749 %
2750 %    o op: A channel operator.
2751 %
2752 %    o value: A value value.
2753 %
2754 */
2755
2756 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2757   const MagickEvaluateOperator op)
2758 {
2759   Image
2760     *evaluate_image;
2761
2762   assert(wand != (MagickWand *) NULL);
2763   assert(wand->signature == WandSignature);
2764   if (wand->debug != MagickFalse)
2765     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2766   if (wand->images == (Image *) NULL)
2767     return((MagickWand *) NULL);
2768   evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2769   if (evaluate_image == (Image *) NULL)
2770     return((MagickWand *) NULL);
2771   return(CloneMagickWandFromImages(wand,evaluate_image));
2772 }
2773
2774 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2775   const MagickEvaluateOperator op,const double value)
2776 {
2777   MagickBooleanType
2778     status;
2779
2780   assert(wand != (MagickWand *) NULL);
2781   assert(wand->signature == WandSignature);
2782   if (wand->debug != MagickFalse)
2783     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2784   if (wand->images == (Image *) NULL)
2785     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2786   status=EvaluateImage(wand->images,op,value,&wand->images->exception);
2787   return(status);
2788 }
2789 \f
2790 /*
2791 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2792 %                                                                             %
2793 %                                                                             %
2794 %                                                                             %
2795 %   M a g i c k E x p o r t I m a g e P i x e l s                             %
2796 %                                                                             %
2797 %                                                                             %
2798 %                                                                             %
2799 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2800 %
2801 %  MagickExportImagePixels() extracts pixel data from an image and returns it
2802 %  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2803 %  an error is encountered.  The data is returned as char, short int, int,
2804 %  ssize_t, float, or double in the order specified by map.
2805 %
2806 %  Suppose you want to extract the first scanline of a 640x480 image as
2807 %  character data in red-green-blue order:
2808 %
2809 %      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
2810 %
2811 %  The format of the MagickExportImagePixels method is:
2812 %
2813 %      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2814 %        const ssize_t x,const ssize_t y,const size_t columns,
2815 %        const size_t rows,const char *map,const StorageType storage,
2816 %        void *pixels)
2817 %
2818 %  A description of each parameter follows:
2819 %
2820 %    o wand: the magick wand.
2821 %
2822 %    o x, y, columns, rows:  These values define the perimeter
2823 %      of a region of pixels you want to extract.
2824 %
2825 %    o map:  This string reflects the expected ordering of the pixel array.
2826 %      It can be any combination or order of R = red, G = green, B = blue,
2827 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2828 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2829 %      P = pad.
2830 %
2831 %    o storage: Define the data type of the pixels.  Float and double types are
2832 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2833 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2834 %      LongPixel, QuantumPixel, or ShortPixel.
2835 %
2836 %    o pixels: This array of values contain the pixel components as defined by
2837 %      map and type.  You must preallocate this array where the expected
2838 %      length varies depending on the values of width, height, map, and type.
2839 %
2840 */
2841 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2842   const ssize_t x,const ssize_t y,const size_t columns,
2843   const size_t rows,const char *map,const StorageType storage,
2844   void *pixels)
2845 {
2846   MagickBooleanType
2847     status;
2848
2849   assert(wand != (MagickWand *) NULL);
2850   assert(wand->signature == WandSignature);
2851   if (wand->debug != MagickFalse)
2852     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2853   if (wand->images == (Image *) NULL)
2854     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2855   status=ExportImagePixels(wand->images,x,y,columns,rows,map,
2856     storage,pixels,wand->exception);
2857   if (status == MagickFalse)
2858     InheritException(wand->exception,&wand->images->exception);
2859   return(status);
2860 }
2861 \f
2862 /*
2863 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2864 %                                                                             %
2865 %                                                                             %
2866 %                                                                             %
2867 %   M a g i c k E x t e n t I m a g e                                         %
2868 %                                                                             %
2869 %                                                                             %
2870 %                                                                             %
2871 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2872 %
2873 %  MagickExtentImage() extends the image as defined by the geometry, gravity,
2874 %  and wand background color.  Set the (x,y) offset of the geometry to move
2875 %  the original wand relative to the extended wand.
2876 %
2877 %  The format of the MagickExtentImage method is:
2878 %
2879 %      MagickBooleanType MagickExtentImage(MagickWand *wand,
2880 %        const size_t width,const size_t height,const ssize_t x,
2881 %        const ssize_t y)
2882 %
2883 %  A description of each parameter follows:
2884 %
2885 %    o wand: the magick wand.
2886 %
2887 %    o width: the region width.
2888 %
2889 %    o height: the region height.
2890 %
2891 %    o x: the region x offset.
2892 %
2893 %    o y: the region y offset.
2894 %
2895 */
2896 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
2897   const size_t width,const size_t height,const ssize_t x,
2898   const ssize_t y)
2899 {
2900   Image
2901     *extent_image;
2902
2903   RectangleInfo
2904     extent;
2905
2906   assert(wand != (MagickWand *) NULL);
2907   assert(wand->signature == WandSignature);
2908   if (wand->debug != MagickFalse)
2909     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2910   if (wand->images == (Image *) NULL)
2911     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2912   extent.width=width;
2913   extent.height=height;
2914   extent.x=x;
2915   extent.y=y;
2916   extent_image=ExtentImage(wand->images,&extent,wand->exception);
2917   if (extent_image == (Image *) NULL)
2918     return(MagickFalse);
2919   ReplaceImageInList(&wand->images,extent_image);
2920   return(MagickTrue);
2921 }
2922 \f
2923 /*
2924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2925 %                                                                             %
2926 %                                                                             %
2927 %                                                                             %
2928 %   M a g i c k F l i p I m a g e                                             %
2929 %                                                                             %
2930 %                                                                             %
2931 %                                                                             %
2932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2933 %
2934 %  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
2935 %  around the central x-axis.
2936 %
2937 %  The format of the MagickFlipImage method is:
2938 %
2939 %      MagickBooleanType MagickFlipImage(MagickWand *wand)
2940 %
2941 %  A description of each parameter follows:
2942 %
2943 %    o wand: the magick wand.
2944 %
2945 */
2946 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
2947 {
2948   Image
2949     *flip_image;
2950
2951   assert(wand != (MagickWand *) NULL);
2952   assert(wand->signature == WandSignature);
2953   if (wand->debug != MagickFalse)
2954     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2955   if (wand->images == (Image *) NULL)
2956     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2957   flip_image=FlipImage(wand->images,wand->exception);
2958   if (flip_image == (Image *) NULL)
2959     return(MagickFalse);
2960   ReplaceImageInList(&wand->images,flip_image);
2961   return(MagickTrue);
2962 }
2963 \f
2964 /*
2965 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2966 %                                                                             %
2967 %                                                                             %
2968 %                                                                             %
2969 %   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                         %
2970 %                                                                             %
2971 %                                                                             %
2972 %                                                                             %
2973 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2974 %
2975 %  MagickFloodfillPaintImage() changes the color value of any pixel that matches
2976 %  target and is an immediate neighbor.  If the method FillToBorderMethod is
2977 %  specified, the color value is changed for any neighbor pixel that does not
2978 %  match the bordercolor member of image.
2979 %
2980 %  The format of the MagickFloodfillPaintImage method is:
2981 %
2982 %      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
2983 %        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
2984 %        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
2985 %
2986 %  A description of each parameter follows:
2987 %
2988 %    o wand: the magick wand.
2989 %
2990 %    o fill: the floodfill color pixel wand.
2991 %
2992 %    o fuzz: By default target must match a particular pixel color
2993 %      exactly.  However, in many cases two colors may differ by a small amount.
2994 %      The fuzz member of image defines how much tolerance is acceptable to
2995 %      consider two colors as the same.  For example, set fuzz to 10 and the
2996 %      color red at intensities of 100 and 102 respectively are now interpreted
2997 %      as the same color for the purposes of the floodfill.
2998 %
2999 %    o bordercolor: the border color pixel wand.
3000 %
3001 %    o x,y: the starting location of the operation.
3002 %
3003 %    o invert: paint any pixel that does not match the target color.
3004 %
3005 */
3006 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3007   const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3008   const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3009 {
3010   DrawInfo
3011     *draw_info;
3012
3013   MagickBooleanType
3014     status;
3015
3016   PixelInfo
3017     target;
3018
3019   assert(wand != (MagickWand *) NULL);
3020   assert(wand->signature == WandSignature);
3021   if (wand->debug != MagickFalse)
3022     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3023   if (wand->images == (Image *) NULL)
3024     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3025   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3026   PixelGetQuantumPacket(fill,&draw_info->fill);
3027   (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
3028     y % wand->images->rows,&target,wand->exception);
3029   if (bordercolor != (PixelWand *) NULL)
3030     PixelGetMagickColor(bordercolor,&target);
3031   wand->images->fuzz=fuzz;
3032   status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert);
3033   if (status == MagickFalse)
3034     InheritException(wand->exception,&wand->images->exception);
3035   draw_info=DestroyDrawInfo(draw_info);
3036   return(status);
3037 }
3038 \f
3039 /*
3040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3041 %                                                                             %
3042 %                                                                             %
3043 %                                                                             %
3044 %   M a g i c k F l o p I m a g e                                             %
3045 %                                                                             %
3046 %                                                                             %
3047 %                                                                             %
3048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3049 %
3050 %  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3051 %  around the central y-axis.
3052 %
3053 %  The format of the MagickFlopImage method is:
3054 %
3055 %      MagickBooleanType MagickFlopImage(MagickWand *wand)
3056 %
3057 %  A description of each parameter follows:
3058 %
3059 %    o wand: the magick wand.
3060 %
3061 */
3062 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3063 {
3064   Image
3065     *flop_image;
3066
3067   assert(wand != (MagickWand *) NULL);
3068   assert(wand->signature == WandSignature);
3069   if (wand->debug != MagickFalse)
3070     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3071   if (wand->images == (Image *) NULL)
3072     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3073   flop_image=FlopImage(wand->images,wand->exception);
3074   if (flop_image == (Image *) NULL)
3075     return(MagickFalse);
3076   ReplaceImageInList(&wand->images,flop_image);
3077   return(MagickTrue);
3078 }
3079 \f
3080 /*
3081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3082 %                                                                             %
3083 %                                                                             %
3084 %                                                                             %
3085 %   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                     %
3086 %                                                                             %
3087 %                                                                             %
3088 %                                                                             %
3089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3090 %
3091 %  MagickForwardFourierTransformImage() implements the discrete Fourier
3092 %  transform (DFT) of the image either as a magnitude / phase or real /
3093 %  imaginary image pair.
3094 %
3095 %  The format of the MagickForwardFourierTransformImage method is:
3096 %
3097 %      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3098 %        const MagickBooleanType magnitude)
3099 %
3100 %  A description of each parameter follows:
3101 %
3102 %    o wand: the magick wand.
3103 %
3104 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3105 %      imaginary image pair.
3106 %
3107 */
3108 WandExport MagickBooleanType MagickForwardFourierTransformImage(
3109   MagickWand *wand,const MagickBooleanType magnitude)
3110 {
3111   Image
3112     *forward_image;
3113
3114   assert(wand != (MagickWand *) NULL);
3115   assert(wand->signature == WandSignature);
3116   if (wand->debug != MagickFalse)
3117     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3118   if (wand->images == (Image *) NULL)
3119     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3120   forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3121     wand->exception);
3122   if (forward_image == (Image *) NULL)
3123     return(MagickFalse);
3124   ReplaceImageInList(&wand->images,forward_image);
3125   return(MagickTrue);
3126 }
3127 \f
3128 /*
3129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3130 %                                                                             %
3131 %                                                                             %
3132 %                                                                             %
3133 %   M a g i c k F r a m e I m a g e                                           %
3134 %                                                                             %
3135 %                                                                             %
3136 %                                                                             %
3137 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3138 %
3139 %  MagickFrameImage() adds a simulated three-dimensional border around the
3140 %  image.  The width and height specify the border width of the vertical and
3141 %  horizontal sides of the frame.  The inner and outer bevels indicate the
3142 %  width of the inner and outer shadows of the frame.
3143 %
3144 %  The format of the MagickFrameImage method is:
3145 %
3146 %      MagickBooleanType MagickFrameImage(MagickWand *wand,
3147 %        const PixelWand *matte_color,const size_t width,
3148 %        const size_t height,const ssize_t inner_bevel,
3149 %        const ssize_t outer_bevel)
3150 %
3151 %  A description of each parameter follows:
3152 %
3153 %    o wand: the magick wand.
3154 %
3155 %    o matte_color: the frame color pixel wand.
3156 %
3157 %    o width: the border width.
3158 %
3159 %    o height: the border height.
3160 %
3161 %    o inner_bevel: the inner bevel width.
3162 %
3163 %    o outer_bevel: the outer bevel width.
3164 %
3165 */
3166 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3167   const PixelWand *matte_color,const size_t width,
3168   const size_t height,const ssize_t inner_bevel,const ssize_t outer_bevel)
3169 {
3170   Image
3171     *frame_image;
3172
3173   FrameInfo
3174     frame_info;
3175
3176   assert(wand != (MagickWand *) NULL);
3177   assert(wand->signature == WandSignature);
3178   if (wand->debug != MagickFalse)
3179     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3180   if (wand->images == (Image *) NULL)
3181     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3182   (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3183   frame_info.width=wand->images->columns+2*width;
3184   frame_info.height=wand->images->rows+2*height;
3185   frame_info.x=(ssize_t) width;
3186   frame_info.y=(ssize_t) height;
3187   frame_info.inner_bevel=inner_bevel;
3188   frame_info.outer_bevel=outer_bevel;
3189   PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3190   frame_image=FrameImage(wand->images,&frame_info,wand->exception);
3191   if (frame_image == (Image *) NULL)
3192     return(MagickFalse);
3193   ReplaceImageInList(&wand->images,frame_image);
3194   return(MagickTrue);
3195 }
3196 \f
3197 /*
3198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3199 %                                                                             %
3200 %                                                                             %
3201 %                                                                             %
3202 %   M a g i c k F u n c t i o n I m a g e                                     %
3203 %                                                                             %
3204 %                                                                             %
3205 %                                                                             %
3206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3207 %
3208 %  MagickFunctionImage() applys an arithmetic, relational, or logical
3209 %  expression to an image.  Use these operators to lighten or darken an image,
3210 %  to increase or decrease contrast in an image, or to produce the "negative"
3211 %  of an image.
3212 %
3213 %  The format of the MagickFunctionImage method is:
3214 %
3215 %      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3216 %        const MagickFunction function,const size_t number_arguments,
3217 %        const double *arguments)
3218 %
3219 %  A description of each parameter follows:
3220 %
3221 %    o wand: the magick wand.
3222 %
3223 %    o function: the image function.
3224 %
3225 %    o number_arguments: the number of function arguments.
3226 %
3227 %    o arguments: the function arguments.
3228 %
3229 */
3230 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3231   const MagickFunction function,const size_t number_arguments,
3232   const double *arguments)
3233 {
3234   MagickBooleanType
3235     status;
3236
3237   assert(wand != (MagickWand *) NULL);
3238   assert(wand->signature == WandSignature);
3239   if (wand->debug != MagickFalse)
3240     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3241   if (wand->images == (Image *) NULL)
3242     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3243   status=FunctionImage(wand->images,function,number_arguments,arguments,
3244     &wand->images->exception);
3245   return(status);
3246 }
3247 \f
3248 /*
3249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3250 %                                                                             %
3251 %                                                                             %
3252 %                                                                             %
3253 %   M a g i c k F x I m a g e                                                 %
3254 %                                                                             %
3255 %                                                                             %
3256 %                                                                             %
3257 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3258 %
3259 %  MagickFxImage() evaluate expression for each pixel in the image.
3260 %
3261 %  The format of the MagickFxImage method is:
3262 %
3263 %      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3264 %
3265 %  A description of each parameter follows:
3266 %
3267 %    o wand: the magick wand.
3268 %
3269 %    o expression: the expression.
3270 %
3271 */
3272 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3273 {
3274   Image
3275     *fx_image;
3276
3277   assert(wand != (MagickWand *) NULL);
3278   assert(wand->signature == WandSignature);
3279   if (wand->debug != MagickFalse)
3280     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3281   if (wand->images == (Image *) NULL)
3282     return((MagickWand *) NULL);
3283   fx_image=FxImage(wand->images,expression,wand->exception);
3284   if (fx_image == (Image *) NULL)
3285     return((MagickWand *) NULL);
3286   return(CloneMagickWandFromImages(wand,fx_image));
3287 }
3288 \f
3289 /*
3290 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3291 %                                                                             %
3292 %                                                                             %
3293 %                                                                             %
3294 %   M a g i c k G a m m a I m a g e                                           %
3295 %                                                                             %
3296 %                                                                             %
3297 %                                                                             %
3298 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3299 %
3300 %  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3301 %  different devices will have perceptual differences in the way the image's
3302 %  intensities are represented on the screen.  Specify individual gamma levels
3303 %  for the red, green, and blue channels, or adjust all three with the gamma
3304 %  parameter.  Values typically range from 0.8 to 2.3.
3305 %
3306 %  You can also reduce the influence of a particular channel with a gamma
3307 %  value of 0.
3308 %
3309 %  The format of the MagickGammaImage method is:
3310 %
3311 %      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3312 %
3313 %  A description of each parameter follows:
3314 %
3315 %    o wand: the magick wand.
3316 %
3317 %    o level: Define the level of gamma correction.
3318 %
3319 */
3320 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3321   const double gamma)
3322 {
3323   MagickBooleanType
3324     status;
3325
3326   assert(wand != (MagickWand *) NULL);
3327   assert(wand->signature == WandSignature);
3328   if (wand->debug != MagickFalse)
3329     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3330   if (wand->images == (Image *) NULL)
3331     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3332   status=GammaImage(wand->images,gamma,wand->exception);
3333   return(status);
3334 }
3335 \f
3336 /*
3337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3338 %                                                                             %
3339 %                                                                             %
3340 %                                                                             %
3341 %   M a g i c k G a u s s i a n B l u r I m a g e                             %
3342 %                                                                             %
3343 %                                                                             %
3344 %                                                                             %
3345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3346 %
3347 %  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3348 %  Gaussian operator of the given radius and standard deviation (sigma).
3349 %  For reasonable results, the radius should be larger than sigma.  Use a
3350 %  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3351 %
3352 %  The format of the MagickGaussianBlurImage method is:
3353 %
3354 %      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3355 %        const double radius,const double sigma)
3356 %
3357 %  A description of each parameter follows:
3358 %
3359 %    o wand: the magick wand.
3360 %
3361 %    o radius: the radius of the Gaussian, in pixels, not counting the center
3362 %      pixel.
3363 %
3364 %    o sigma: the standard deviation of the Gaussian, in pixels.
3365 %
3366 */
3367 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3368   const double radius,const double sigma)
3369 {
3370   Image
3371     *blur_image;
3372
3373   assert(wand != (MagickWand *) NULL);
3374   assert(wand->signature == WandSignature);
3375   if (wand->debug != MagickFalse)
3376     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3377   if (wand->images == (Image *) NULL)
3378     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3379   blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3380   if (blur_image == (Image *) NULL)
3381     return(MagickFalse);
3382   ReplaceImageInList(&wand->images,blur_image);
3383   return(MagickTrue);
3384 }
3385 \f
3386 /*
3387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3388 %                                                                             %
3389 %                                                                             %
3390 %                                                                             %
3391 %   M a g i c k G e t I m a g e                                               %
3392 %                                                                             %
3393 %                                                                             %
3394 %                                                                             %
3395 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3396 %
3397 %  MagickGetImage() gets the image at the current image index.
3398 %
3399 %  The format of the MagickGetImage method is:
3400 %
3401 %      MagickWand *MagickGetImage(MagickWand *wand)
3402 %
3403 %  A description of each parameter follows:
3404 %
3405 %    o wand: the magick wand.
3406 %
3407 */
3408 WandExport MagickWand *MagickGetImage(MagickWand *wand)
3409 {
3410   Image
3411     *image;
3412
3413   assert(wand != (MagickWand *) NULL);
3414   assert(wand->signature == WandSignature);
3415   if (wand->debug != MagickFalse)
3416     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3417   if (wand->images == (Image *) NULL)
3418     {
3419       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3420         "ContainsNoImages","`%s'",wand->name);
3421       return((MagickWand *) NULL);
3422     }
3423   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3424   if (image == (Image *) NULL)
3425     return((MagickWand *) NULL);
3426   return(CloneMagickWandFromImages(wand,image));
3427 }
3428 \f
3429 /*
3430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3431 %                                                                             %
3432 %                                                                             %
3433 %                                                                             %
3434 %   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                       %
3435 %                                                                             %
3436 %                                                                             %
3437 %                                                                             %
3438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3439 %
3440 %  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3441 %  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3442 %  than CMYKA.
3443 %
3444 %  The format of the MagickGetImageAlphaChannel method is:
3445 %
3446 %      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3447 %
3448 %  A description of each parameter follows:
3449 %
3450 %    o wand: the magick wand.
3451 %
3452 */
3453 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3454 {
3455   assert(wand != (MagickWand *) NULL);
3456   assert(wand->signature == WandSignature);
3457   if (wand->debug != MagickFalse)
3458     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3459   if (wand->images == (Image *) NULL)
3460     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3461   return(GetImageAlphaChannel(wand->images));
3462 }
3463 \f
3464 /*
3465 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3466 %                                                                             %
3467 %                                                                             %
3468 %                                                                             %
3469 %   M a g i c k G e t I m a g e C l i p M a s k                               %
3470 %                                                                             %
3471 %                                                                             %
3472 %                                                                             %
3473 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3474 %
3475 %  MagickGetImageClipMask() gets the image clip mask at the current image index.
3476 %
3477 %  The format of the MagickGetImageClipMask method is:
3478 %
3479 %      MagickWand *MagickGetImageClipMask(MagickWand *wand)
3480 %
3481 %  A description of each parameter follows:
3482 %
3483 %    o wand: the magick wand.
3484 %
3485 */
3486 WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
3487 {
3488   Image
3489     *image;
3490
3491   assert(wand != (MagickWand *) NULL);
3492   assert(wand->signature == WandSignature);
3493   if (wand->debug != MagickFalse)
3494     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3495   if (wand->images == (Image *) NULL)
3496     {
3497       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3498         "ContainsNoImages","`%s'",wand->name);
3499       return((MagickWand *) NULL);
3500     }
3501   image=GetImageClipMask(wand->images,wand->exception);
3502   if (image == (Image *) NULL)
3503     return((MagickWand *) NULL);
3504   return(CloneMagickWandFromImages(wand,image));
3505 }
3506 \f
3507 /*
3508 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3509 %                                                                             %
3510 %                                                                             %
3511 %                                                                             %
3512 %   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                 %
3513 %                                                                             %
3514 %                                                                             %
3515 %                                                                             %
3516 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3517 %
3518 %  MagickGetImageBackgroundColor() returns the image background color.
3519 %
3520 %  The format of the MagickGetImageBackgroundColor method is:
3521 %
3522 %      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3523 %        PixelWand *background_color)
3524 %
3525 %  A description of each parameter follows:
3526 %
3527 %    o wand: the magick wand.
3528 %
3529 %    o background_color: Return the background color.
3530 %
3531 */
3532 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3533   PixelWand *background_color)
3534 {
3535   assert(wand != (MagickWand *) NULL);
3536   assert(wand->signature == WandSignature);
3537   if (wand->debug != MagickFalse)
3538     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3539   if (wand->images == (Image *) NULL)
3540     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3541   PixelSetQuantumPacket(background_color,&wand->images->background_color);
3542   return(MagickTrue);
3543 }
3544 \f
3545 /*
3546 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3547 %                                                                             %
3548 %                                                                             %
3549 %                                                                             %
3550 %   M a g i c k G e t I m a g e B l o b                                       %
3551 %                                                                             %
3552 %                                                                             %
3553 %                                                                             %
3554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3555 %
3556 %  MagickGetImageBlob() implements direct to memory image formats.  It returns
3557 %  the image as a blob (a formatted "file" in memory) and its length, starting
3558 %  from the current position in the image sequence.  Use MagickSetImageFormat() 
3559 %  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3560 %
3561 %  Utilize MagickResetIterator() to ensure the write is from the beginning of
3562 %  the image sequence.
3563 %
3564 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
3565 %
3566 %  The format of the MagickGetImageBlob method is:
3567 %
3568 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3569 %
3570 %  A description of each parameter follows:
3571 %
3572 %    o wand: the magick wand.
3573 %
3574 %    o length: the length of the blob.
3575 %
3576 */
3577 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3578 {
3579   assert(wand != (MagickWand *) NULL);
3580   assert(wand->signature == WandSignature);
3581   if (wand->debug != MagickFalse)
3582     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3583   if (wand->images == (Image *) NULL)
3584     {
3585       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3586         "ContainsNoImages","`%s'",wand->name);
3587       return((unsigned char *) NULL);
3588     }
3589   return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3590 }
3591 \f
3592 /*
3593 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3594 %                                                                             %
3595 %                                                                             %
3596 %                                                                             %
3597 %   M a g i c k G e t I m a g e s B l o b                                     %
3598 %                                                                             %
3599 %                                                                             %
3600 %                                                                             %
3601 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3602 %
3603 %  MagickGetImageBlob() implements direct to memory image formats.  It
3604 %  returns the image sequence as a blob and its length.  The format of the image
3605 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3606 %  return a different image format, use MagickSetImageFormat().
3607 %
3608 %  Note, some image formats do not permit multiple images to the same image
3609 %  stream (e.g. JPEG).  in this instance, just the first image of the
3610 %  sequence is returned as a blob.
3611 %
3612 %  The format of the MagickGetImagesBlob method is:
3613 %
3614 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3615 %
3616 %  A description of each parameter follows:
3617 %
3618 %    o wand: the magick wand.
3619 %
3620 %    o length: the length of the blob.
3621 %
3622 */
3623 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3624 {
3625   unsigned char
3626     *blob;
3627
3628   assert(wand != (MagickWand *) NULL);
3629   assert(wand->signature == WandSignature);
3630   if (wand->debug != MagickFalse)
3631     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3632   if (wand->images == (Image *) NULL)
3633     {
3634       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3635         "ContainsNoImages","`%s'",wand->name);
3636       return((unsigned char *) NULL);
3637     }
3638   blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3639     wand->exception);
3640   return(blob);
3641 }
3642 \f
3643 /*
3644 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3645 %                                                                             %
3646 %                                                                             %
3647 %                                                                             %
3648 %   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                         %
3649 %                                                                             %
3650 %                                                                             %
3651 %                                                                             %
3652 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3653 %
3654 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3655 %  image.
3656 %
3657 %  The format of the MagickGetImageBluePrimary method is:
3658 %
3659 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3660 %        double *y)
3661 %
3662 %  A description of each parameter follows:
3663 %
3664 %    o wand: the magick wand.
3665 %
3666 %    o x: the chromaticity blue primary x-point.
3667 %
3668 %    o y: the chromaticity blue primary y-point.
3669 %
3670 */
3671 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3672   double *x,double *y)
3673 {
3674   assert(wand != (MagickWand *) NULL);
3675   assert(wand->signature == WandSignature);
3676   if (wand->debug != MagickFalse)
3677     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3678   if (wand->images == (Image *) NULL)
3679     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3680   *x=wand->images->chromaticity.blue_primary.x;
3681   *y=wand->images->chromaticity.blue_primary.y;
3682   return(MagickTrue);
3683 }
3684 \f
3685 /*
3686 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3687 %                                                                             %
3688 %                                                                             %
3689 %                                                                             %
3690 %   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                         %
3691 %                                                                             %
3692 %                                                                             %
3693 %                                                                             %
3694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3695 %
3696 %  MagickGetImageBorderColor() returns the image border color.
3697 %
3698 %  The format of the MagickGetImageBorderColor method is:
3699 %
3700 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3701 %        PixelWand *border_color)
3702 %
3703 %  A description of each parameter follows:
3704 %
3705 %    o wand: the magick wand.
3706 %
3707 %    o border_color: Return the border color.
3708 %
3709 */
3710 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3711   PixelWand *border_color)
3712 {
3713   assert(wand != (MagickWand *) NULL);
3714   assert(wand->signature == WandSignature);
3715   if (wand->debug != MagickFalse)
3716     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3717   if (wand->images == (Image *) NULL)
3718     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3719   PixelSetQuantumPacket(border_color,&wand->images->border_color);
3720   return(MagickTrue);
3721 }
3722 \f
3723 /*
3724 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3725 %                                                                             %
3726 %                                                                             %
3727 %                                                                             %
3728 %   M a g i c k G e t I m a g e F e a t u r e s                               %
3729 %                                                                             %
3730 %                                                                             %
3731 %                                                                             %
3732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3733 %
3734 %  MagickGetImageFeatures() returns features for each channel in the
3735 %  image in each of four directions (horizontal, vertical, left and right
3736 %  diagonals) for the specified distance.  The features include the angular
3737 %  second moment, contrast, correlation, sum of squares: variance, inverse
3738 %  difference moment, sum average, sum varience, sum entropy, entropy,
3739 %  difference variance, difference entropy, information measures of
3740 %  correlation 1, information measures of correlation 2, and maximum
3741 %  correlation coefficient.  You can access the red channel contrast, for
3742 %  example, like this:
3743 %
3744 %      channel_features=MagickGetImageFeatures(wand,1);
3745 %      contrast=channel_features[RedChannel].contrast[0];
3746 %
3747 %  Use MagickRelinquishMemory() to free the statistics buffer.
3748 %
3749 %  The format of the MagickGetImageFeatures method is:
3750 %
3751 %      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3752 %        const size_t distance)
3753 %
3754 %  A description of each parameter follows:
3755 %
3756 %    o wand: the magick wand.
3757 %
3758 %    o distance: the distance.
3759 %
3760 */
3761 WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3762   const size_t distance)
3763 {
3764   assert(wand != (MagickWand *) NULL);
3765   assert(wand->signature == WandSignature);
3766   if (wand->debug != MagickFalse)
3767     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3768   if (wand->images == (Image *) NULL)
3769     {
3770       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3771         "ContainsNoImages","`%s'",wand->name);
3772       return((ChannelFeatures *) NULL);
3773     }
3774   return(GetImageFeatures(wand->images,distance,wand->exception));
3775 }
3776 \f
3777 /*
3778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3779 %                                                                             %
3780 %                                                                             %
3781 %                                                                             %
3782 %   M a g i c k G e t I m a g e K u r t o s i s                               %
3783 %                                                                             %
3784 %                                                                             %
3785 %                                                                             %
3786 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3787 %
3788 %  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
3789 %  more image channels.
3790 %
3791 %  The format of the MagickGetImageKurtosis method is:
3792 %
3793 %      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3794 %        double *kurtosis,double *skewness)
3795 %
3796 %  A description of each parameter follows:
3797 %
3798 %    o wand: the magick wand.
3799 %
3800 %    o kurtosis:  The kurtosis for the specified channel(s).
3801 %
3802 %    o skewness:  The skewness for the specified channel(s).
3803 %
3804 */
3805 WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3806   double *kurtosis,double *skewness)
3807 {
3808   MagickBooleanType
3809     status;
3810
3811   assert(wand != (MagickWand *) NULL);
3812   assert(wand->signature == WandSignature);
3813   if (wand->debug != MagickFalse)
3814     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3815   if (wand->images == (Image *) NULL)
3816     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3817   status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
3818   return(status);
3819 }
3820 \f
3821 /*
3822 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3823 %                                                                             %
3824 %                                                                             %
3825 %                                                                             %
3826 %   M a g i c k G e t I m a g e M e a n                                       %
3827 %                                                                             %
3828 %                                                                             %
3829 %                                                                             %
3830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3831 %
3832 %  MagickGetImageMean() gets the mean and standard deviation of one or more
3833 %  image channels.
3834 %
3835 %  The format of the MagickGetImageMean method is:
3836 %
3837 %      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3838 %        double *standard_deviation)
3839 %
3840 %  A description of each parameter follows:
3841 %
3842 %    o wand: the magick wand.
3843 %
3844 %    o channel: the image channel(s).
3845 %
3846 %    o mean:  The mean pixel value for the specified channel(s).
3847 %
3848 %    o standard_deviation:  The standard deviation for the specified channel(s).
3849 %
3850 */
3851 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3852   double *standard_deviation)
3853 {
3854   MagickBooleanType
3855     status;
3856
3857   assert(wand != (MagickWand *) NULL);
3858   assert(wand->signature == WandSignature);
3859   if (wand->debug != MagickFalse)
3860     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3861   if (wand->images == (Image *) NULL)
3862     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3863   status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
3864   return(status);
3865 }
3866 \f
3867 /*
3868 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3869 %                                                                             %
3870 %                                                                             %
3871 %                                                                             %
3872 %   M a g i c k G e t I m a g e R a n g e                                     %
3873 %                                                                             %
3874 %                                                                             %
3875 %                                                                             %
3876 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3877 %
3878 %  MagickGetImageRange() gets the range for one or more image channels.
3879 %
3880 %  The format of the MagickGetImageRange method is:
3881 %
3882 %      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
3883 %        double *maxima)
3884 %
3885 %  A description of each parameter follows:
3886 %
3887 %    o wand: the magick wand.
3888 %
3889 %    o minima:  The minimum pixel value for the specified channel(s).
3890 %
3891 %    o maxima:  The maximum pixel value for the specified channel(s).
3892 %
3893 */
3894 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
3895   double *minima,double *maxima)
3896 {
3897   MagickBooleanType
3898     status;
3899
3900   assert(wand != (MagickWand *) NULL);
3901   assert(wand->signature == WandSignature);
3902   if (wand->debug != MagickFalse)
3903     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3904   if (wand->images == (Image *) NULL)
3905     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3906   status=GetImageRange(wand->images,minima,maxima,wand->exception);
3907   return(status);
3908 }
3909 \f
3910 /*
3911 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3912 %                                                                             %
3913 %                                                                             %
3914 %                                                                             %
3915 %   M a g i c k G e t I m a g e S t a t i s t i c s                           %
3916 %                                                                             %
3917 %                                                                             %
3918 %                                                                             %
3919 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3920 %
3921 %  MagickGetImageStatistics() returns statistics for each channel in the
3922 %  image.  The statistics include the channel depth, its minima and
3923 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
3924 %  You can access the red channel mean, for example, like this:
3925 %
3926 %      channel_statistics=MagickGetImageStatistics(wand);
3927 %      red_mean=channel_statistics[RedChannel].mean;
3928 %
3929 %  Use MagickRelinquishMemory() to free the statistics buffer.
3930 %
3931 %  The format of the MagickGetImageStatistics method is:
3932 %
3933 %      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3934 %
3935 %  A description of each parameter follows:
3936 %
3937 %    o wand: the magick wand.
3938 %
3939 */
3940 WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3941 {
3942   assert(wand != (MagickWand *) NULL);
3943   assert(wand->signature == WandSignature);
3944   if (wand->debug != MagickFalse)
3945     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3946   if (wand->images == (Image *) NULL)
3947     {
3948       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3949         "ContainsNoImages","`%s'",wand->name);
3950       return((ChannelStatistics *) NULL);
3951     }
3952   return(GetImageStatistics(wand->images,wand->exception));
3953 }
3954 \f
3955 /*
3956 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3957 %                                                                             %
3958 %                                                                             %
3959 %                                                                             %
3960 %   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                     %
3961 %                                                                             %
3962 %                                                                             %
3963 %                                                                             %
3964 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3965 %
3966 %  MagickGetImageColormapColor() returns the color of the specified colormap
3967 %  index.
3968 %
3969 %  The format of the MagickGetImageColormapColor method is:
3970 %
3971 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
3972 %        const size_t index,PixelWand *color)
3973 %
3974 %  A description of each parameter follows:
3975 %
3976 %    o wand: the magick wand.
3977 %
3978 %    o index: the offset into the image colormap.
3979 %
3980 %    o color: Return the colormap color in this wand.
3981 %
3982 */
3983 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
3984   const size_t index,PixelWand *color)
3985 {
3986   assert(wand != (MagickWand *) NULL);
3987   assert(wand->signature == WandSignature);
3988   if (wand->debug != MagickFalse)
3989     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3990   if (wand->images == (Image *) NULL)
3991     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3992   if ((wand->images->colormap == (PixelPacket *) NULL) ||
3993       (index >= wand->images->colors))
3994     {
3995       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3996         "InvalidColormapIndex","`%s'",wand->name);
3997       return(MagickFalse);
3998     }
3999   PixelSetQuantumPacket(color,wand->images->colormap+index);
4000   return(MagickTrue);
4001 }
4002 \f
4003 /*
4004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4005 %                                                                             %
4006 %                                                                             %
4007 %                                                                             %
4008 %   M a g i c k G e t I m a g e C o l o r s                                   %
4009 %                                                                             %
4010 %                                                                             %
4011 %                                                                             %
4012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4013 %
4014 %  MagickGetImageColors() gets the number of unique colors in the image.
4015 %
4016 %  The format of the MagickGetImageColors method is:
4017 %
4018 %      size_t MagickGetImageColors(MagickWand *wand)
4019 %
4020 %  A description of each parameter follows:
4021 %
4022 %    o wand: the magick wand.
4023 %
4024 */
4025 WandExport size_t MagickGetImageColors(MagickWand *wand)
4026 {
4027   assert(wand != (MagickWand *) NULL);
4028   assert(wand->signature == WandSignature);
4029   if (wand->debug != MagickFalse)
4030     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4031   if (wand->images == (Image *) NULL)
4032     {
4033       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4034         "ContainsNoImages","`%s'",wand->name);
4035       return(0);
4036     }
4037   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4038 }
4039 \f
4040 /*
4041 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4042 %                                                                             %
4043 %                                                                             %
4044 %                                                                             %
4045 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4046 %                                                                             %
4047 %                                                                             %
4048 %                                                                             %
4049 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4050 %
4051 %  MagickGetImageColorspace() gets the image colorspace.
4052 %
4053 %  The format of the MagickGetImageColorspace method is:
4054 %
4055 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4056 %
4057 %  A description of each parameter follows:
4058 %
4059 %    o wand: the magick wand.
4060 %
4061 */
4062 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4063 {
4064   assert(wand != (MagickWand *) NULL);
4065   assert(wand->signature == WandSignature);
4066   if (wand->debug != MagickFalse)
4067     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4068   if (wand->images == (Image *) NULL)
4069     {
4070       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4071         "ContainsNoImages","`%s'",wand->name);
4072       return(UndefinedColorspace);
4073     }
4074   return(wand->images->colorspace);
4075 }
4076 \f
4077 /*
4078 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4079 %                                                                             %
4080 %                                                                             %
4081 %                                                                             %
4082 %   M a g i c k G e t I m a g e C o m p o s e                                 %
4083 %                                                                             %
4084 %                                                                             %
4085 %                                                                             %
4086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4087 %
4088 %  MagickGetImageCompose() returns the composite operator associated with the
4089 %  image.
4090 %
4091 %  The format of the MagickGetImageCompose method is:
4092 %
4093 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4094 %
4095 %  A description of each parameter follows:
4096 %
4097 %    o wand: the magick wand.
4098 %
4099 */
4100 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4101 {
4102   assert(wand != (MagickWand *) NULL);
4103   assert(wand->signature == WandSignature);
4104   if (wand->debug != MagickFalse)
4105     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4106   if (wand->images == (Image *) NULL)
4107     {
4108       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4109         "ContainsNoImages","`%s'",wand->name);
4110       return(UndefinedCompositeOp);
4111     }
4112   return(wand->images->compose);
4113 }
4114 \f
4115 /*
4116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4117 %                                                                             %
4118 %                                                                             %
4119 %                                                                             %
4120 %   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                         %
4121 %                                                                             %
4122 %                                                                             %
4123 %                                                                             %
4124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4125 %
4126 %  MagickGetImageCompression() gets the image compression.
4127 %
4128 %  The format of the MagickGetImageCompression method is:
4129 %
4130 %      CompressionType MagickGetImageCompression(MagickWand *wand)
4131 %
4132 %  A description of each parameter follows:
4133 %
4134 %    o wand: the magick wand.
4135 %
4136 */
4137 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4138 {
4139   assert(wand != (MagickWand *) NULL);
4140   assert(wand->signature == WandSignature);
4141   if (wand->debug != MagickFalse)
4142     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4143   if (wand->images == (Image *) NULL)
4144     {
4145       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4146         "ContainsNoImages","`%s'",wand->name);
4147       return(UndefinedCompression);
4148     }
4149   return(wand->images->compression);
4150 }
4151 \f
4152 /*
4153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4154 %                                                                             %
4155 %                                                                             %
4156 %                                                                             %
4157 %   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           %
4158 %                                                                             %
4159 %                                                                             %
4160 %                                                                             %
4161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4162 %
4163 %  MagickGetImageCompression() gets the image compression quality.
4164 %
4165 %  The format of the MagickGetImageCompression method is:
4166 %
4167 %      size_t MagickGetImageCompression(MagickWand *wand)
4168 %
4169 %  A description of each parameter follows:
4170 %
4171 %    o wand: the magick wand.
4172 %
4173 */
4174 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4175 {
4176   assert(wand != (MagickWand *) NULL);
4177   assert(wand->signature == WandSignature);
4178   if (wand->debug != MagickFalse)
4179     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4180   if (wand->images == (Image *) NULL)
4181     {
4182       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4183         "ContainsNoImages","`%s'",wand->name);
4184       return(0UL);
4185     }
4186   return(wand->images->quality);
4187 }
4188 \f
4189 /*
4190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4191 %                                                                             %
4192 %                                                                             %
4193 %                                                                             %
4194 %   M a g i c k G e t I m a g e D e l a y                                     %
4195 %                                                                             %
4196 %                                                                             %
4197 %                                                                             %
4198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4199 %
4200 %  MagickGetImageDelay() gets the image delay.
4201 %
4202 %  The format of the MagickGetImageDelay method is:
4203 %
4204 %      size_t MagickGetImageDelay(MagickWand *wand)
4205 %
4206 %  A description of each parameter follows:
4207 %
4208 %    o wand: the magick wand.
4209 %
4210 */
4211 WandExport size_t MagickGetImageDelay(MagickWand *wand)
4212 {
4213   assert(wand != (MagickWand *) NULL);
4214   assert(wand->signature == WandSignature);
4215   if (wand->debug != MagickFalse)
4216     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4217   if (wand->images == (Image *) NULL)
4218     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4219   return(wand->images->delay);
4220 }
4221 \f
4222 /*
4223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4224 %                                                                             %
4225 %                                                                             %
4226 %                                                                             %
4227 %   M a g i c k G e t I m a g e D e p t h                                     %
4228 %                                                                             %
4229 %                                                                             %
4230 %                                                                             %
4231 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4232 %
4233 %  MagickGetImageDepth() gets the image depth.
4234 %
4235 %  The format of the MagickGetImageDepth method is:
4236 %
4237 %      size_t MagickGetImageDepth(MagickWand *wand)
4238 %
4239 %  A description of each parameter follows:
4240 %
4241 %    o wand: the magick wand.
4242 %
4243 */
4244 WandExport size_t MagickGetImageDepth(MagickWand *wand)
4245 {
4246   assert(wand != (MagickWand *) NULL);
4247   assert(wand->signature == WandSignature);
4248   if (wand->debug != MagickFalse)
4249     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4250   if (wand->images == (Image *) NULL)
4251     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4252   return(GetImageDepth(wand->images,wand->exception));
4253 }
4254 \f
4255 /*
4256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4257 %                                                                             %
4258 %                                                                             %
4259 %                                                                             %
4260 %   M a g i c k G e t I m a g e D i s p o s e                                 %
4261 %                                                                             %
4262 %                                                                             %
4263 %                                                                             %
4264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4265 %
4266 %  MagickGetImageDispose() gets the image disposal method.
4267 %
4268 %  The format of the MagickGetImageDispose method is:
4269 %
4270 %      DisposeType MagickGetImageDispose(MagickWand *wand)
4271 %
4272 %  A description of each parameter follows:
4273 %
4274 %    o wand: the magick wand.
4275 %
4276 */
4277 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4278 {
4279   assert(wand != (MagickWand *) NULL);
4280   assert(wand->signature == WandSignature);
4281   if (wand->debug != MagickFalse)
4282     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4283   if (wand->images == (Image *) NULL)
4284     {
4285       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4286         "ContainsNoImages","`%s'",wand->name);
4287       return(UndefinedDispose);
4288     }
4289   return((DisposeType) wand->images->dispose);
4290 }
4291 \f
4292 /*
4293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4294 %                                                                             %
4295 %                                                                             %
4296 %                                                                             %
4297 %   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4298 %                                                                             %
4299 %                                                                             %
4300 %                                                                             %
4301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4302 %
4303 %  MagickGetImageDistortion() compares an image to a reconstructed image and
4304 %  returns the specified distortion metric.
4305 %
4306 %  The format of the MagickGetImageDistortion method is:
4307 %
4308 %      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4309 %        const MagickWand *reference,const MetricType metric,
4310 %        double *distortion)
4311 %
4312 %  A description of each parameter follows:
4313 %
4314 %    o wand: the magick wand.
4315 %
4316 %    o reference: the reference wand.
4317 %
4318 %    o metric: the metric.
4319 %
4320 %    o distortion: the computed distortion between the images.
4321 %
4322 */
4323 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4324   const MagickWand *reference,const MetricType metric,double *distortion)
4325 {
4326   MagickBooleanType
4327     status;
4328
4329   assert(wand != (MagickWand *) NULL);
4330   assert(wand->signature == WandSignature);
4331   if (wand->debug != MagickFalse)
4332     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4333   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4334     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4335   status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4336     &wand->images->exception);
4337   return(status);
4338 }
4339 \f
4340 /*
4341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4342 %                                                                             %
4343 %                                                                             %
4344 %                                                                             %
4345 %   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                         %
4346 %                                                                             %
4347 %                                                                             %
4348 %                                                                             %
4349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4350 %
4351 %  MagickGetImageDistortions() compares one or more pixel channels of an
4352 %  image to a reconstructed image and returns the specified distortion metrics.
4353 %
4354 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4355 %
4356 %  The format of the MagickGetImageDistortion method is:
4357 %
4358 %      double *MagickGetImageDistortion(MagickWand *wand,
4359 %        const MagickWand *reference,const MetricType metric)
4360 %
4361 %  A description of each parameter follows:
4362 %
4363 %    o wand: the magick wand.
4364 %
4365 %    o reference: the reference wand.
4366 %
4367 %    o metric: the metric.
4368 %
4369 */
4370 WandExport double *MagickGetImageDistortions(MagickWand *wand,
4371   const MagickWand *reference,const MetricType metric)
4372 {
4373   double
4374     *channel_distortion;
4375
4376   assert(wand != (MagickWand *) NULL);
4377   assert(wand->signature == WandSignature);
4378   if (wand->debug != MagickFalse)
4379     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4380   assert(reference != (MagickWand *) NULL);
4381   assert(reference->signature == WandSignature);
4382   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4383     {
4384       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4385         "ContainsNoImages","`%s'",wand->name);
4386       return((double *) NULL);
4387     }
4388   channel_distortion=GetImageDistortions(wand->images,reference->images,
4389     metric,&wand->images->exception);
4390   return(channel_distortion);
4391 }
4392 \f
4393 /*
4394 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4395 %                                                                             %
4396 %                                                                             %
4397 %                                                                             %
4398 %   M a g i c k G e t I m a g e F i l e n a m e                               %
4399 %                                                                             %
4400 %                                                                             %
4401 %                                                                             %
4402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4403 %
4404 %  MagickGetImageFilename() returns the filename of a particular image in a
4405 %  sequence.
4406 %
4407 %  The format of the MagickGetImageFilename method is:
4408 %
4409 %      char *MagickGetImageFilename(MagickWand *wand)
4410 %
4411 %  A description of each parameter follows:
4412 %
4413 %    o wand: the magick wand.
4414 %
4415 */
4416 WandExport char *MagickGetImageFilename(MagickWand *wand)
4417 {
4418   assert(wand != (MagickWand *) NULL);
4419   assert(wand->signature == WandSignature);
4420   if (wand->debug != MagickFalse)
4421     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4422   if (wand->images == (Image *) NULL)
4423     {
4424       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4425         "ContainsNoImages","`%s'",wand->name);
4426       return((char *) NULL);
4427     }
4428   return(AcquireString(wand->images->filename));
4429 }
4430 \f
4431 /*
4432 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4433 %                                                                             %
4434 %                                                                             %
4435 %                                                                             %
4436 %   M a g i c k G e t I m a g e F o r m a t                                   %
4437 %                                                                             %
4438 %                                                                             %
4439 %                                                                             %
4440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4441 %
4442 %  MagickGetImageFormat() returns the format of a particular image in a
4443 %  sequence.
4444 %
4445 %  The format of the MagickGetImageFormat method is:
4446 %
4447 %      const char *MagickGetImageFormat(MagickWand *wand)
4448 %
4449 %  A description of each parameter follows:
4450 %
4451 %    o wand: the magick wand.
4452 %
4453 */
4454 WandExport char *MagickGetImageFormat(MagickWand *wand)
4455 {
4456   assert(wand != (MagickWand *) NULL);
4457   assert(wand->signature == WandSignature);
4458   if (wand->debug != MagickFalse)
4459     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4460   if (wand->images == (Image *) NULL)
4461     {
4462       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4463         "ContainsNoImages","`%s'",wand->name);
4464       return((char *) NULL);
4465     }
4466   return(AcquireString(wand->images->magick));
4467 }
4468 \f
4469 /*
4470 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4471 %                                                                             %
4472 %                                                                             %
4473 %                                                                             %
4474 %   M a g i c k G e t I m a g e F u z z                                       %
4475 %                                                                             %
4476 %                                                                             %
4477 %                                                                             %
4478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4479 %
4480 %  MagickGetImageFuzz() gets the image fuzz.
4481 %
4482 %  The format of the MagickGetImageFuzz method is:
4483 %
4484 %      double MagickGetImageFuzz(MagickWand *wand)
4485 %
4486 %  A description of each parameter follows:
4487 %
4488 %    o wand: the magick wand.
4489 %
4490 */
4491 WandExport double MagickGetImageFuzz(MagickWand *wand)
4492 {
4493   assert(wand != (MagickWand *) NULL);
4494   assert(wand->signature == WandSignature);
4495   if (wand->debug != MagickFalse)
4496     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4497   if (wand->images == (Image *) NULL)
4498     {
4499       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4500         "ContainsNoImages","`%s'",wand->name);
4501       return(0.0);
4502     }
4503   return(wand->images->fuzz);
4504 }
4505 \f
4506 /*
4507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4508 %                                                                             %
4509 %                                                                             %
4510 %                                                                             %
4511 %   M a g i c k G e t I m a g e G a m m a                                     %
4512 %                                                                             %
4513 %                                                                             %
4514 %                                                                             %
4515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4516 %
4517 %  MagickGetImageGamma() gets the image gamma.
4518 %
4519 %  The format of the MagickGetImageGamma method is:
4520 %
4521 %      double MagickGetImageGamma(MagickWand *wand)
4522 %
4523 %  A description of each parameter follows:
4524 %
4525 %    o wand: the magick wand.
4526 %
4527 */
4528 WandExport double MagickGetImageGamma(MagickWand *wand)
4529 {
4530   assert(wand != (MagickWand *) NULL);
4531   assert(wand->signature == WandSignature);
4532   if (wand->debug != MagickFalse)
4533     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4534   if (wand->images == (Image *) NULL)
4535     {
4536       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4537         "ContainsNoImages","`%s'",wand->name);
4538       return(0.0);
4539     }
4540   return(wand->images->gamma);
4541 }
4542 \f
4543 /*
4544 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4545 %                                                                             %
4546 %                                                                             %
4547 %                                                                             %
4548 %   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                 %
4549 %                                                                             %
4550 %                                                                             %
4551 %                                                                             %
4552 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4553 %
4554 %  MagickGetImageGravity() gets the image gravity.
4555 %
4556 %  The format of the MagickGetImageGravity method is:
4557 %
4558 %      GravityType MagickGetImageGravity(MagickWand *wand)
4559 %
4560 %  A description of each parameter follows:
4561 %
4562 %    o wand: the magick wand.
4563 %
4564 */
4565 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4566 {
4567   assert(wand != (MagickWand *) NULL);
4568   assert(wand->signature == WandSignature);
4569   if (wand->debug != MagickFalse)
4570     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4571   if (wand->images == (Image *) NULL)
4572     {
4573       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4574         "ContainsNoImages","`%s'",wand->name);
4575       return(UndefinedGravity);
4576     }
4577   return(wand->images->gravity);
4578 }
4579 \f
4580 /*
4581 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4582 %                                                                             %
4583 %                                                                             %
4584 %                                                                             %
4585 %   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                       %
4586 %                                                                             %
4587 %                                                                             %
4588 %                                                                             %
4589 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4590 %
4591 %  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4592 %
4593 %  The format of the MagickGetImageGreenPrimary method is:
4594 %
4595 %      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4596 %        double *y)
4597 %
4598 %  A description of each parameter follows:
4599 %
4600 %    o wand: the magick wand.
4601 %
4602 %    o x: the chromaticity green primary x-point.
4603 %
4604 %    o y: the chromaticity green primary y-point.
4605 %
4606 */
4607 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4608   double *x,double *y)
4609 {
4610   assert(wand != (MagickWand *) NULL);
4611   assert(wand->signature == WandSignature);
4612   if (wand->debug != MagickFalse)
4613     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4614   if (wand->images == (Image *) NULL)
4615     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4616   *x=wand->images->chromaticity.green_primary.x;
4617   *y=wand->images->chromaticity.green_primary.y;
4618   return(MagickTrue);
4619 }
4620 \f
4621 /*
4622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4623 %                                                                             %
4624 %                                                                             %
4625 %                                                                             %
4626 %   M a g i c k G e t I m a g e H e i g h t                                   %
4627 %                                                                             %
4628 %                                                                             %
4629 %                                                                             %
4630 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4631 %
4632 %  MagickGetImageHeight() returns the image height.
4633 %
4634 %  The format of the MagickGetImageHeight method is:
4635 %
4636 %      size_t MagickGetImageHeight(MagickWand *wand)
4637 %
4638 %  A description of each parameter follows:
4639 %
4640 %    o wand: the magick wand.
4641 %
4642 */
4643 WandExport size_t MagickGetImageHeight(MagickWand *wand)
4644 {
4645   assert(wand != (MagickWand *) NULL);
4646   assert(wand->signature == WandSignature);
4647   if (wand->debug != MagickFalse)
4648     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4649   if (wand->images == (Image *) NULL)
4650     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4651   return(wand->images->rows);
4652 }
4653 \f
4654 /*
4655 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4656 %                                                                             %
4657 %                                                                             %
4658 %                                                                             %
4659 %   M a g i c k G e t I m a g e H i s t o g r a m                             %
4660 %                                                                             %
4661 %                                                                             %
4662 %                                                                             %
4663 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4664 %
4665 %  MagickGetImageHistogram() returns the image histogram as an array of
4666 %  PixelWand wands.
4667 %
4668 %  The format of the MagickGetImageHistogram method is:
4669 %
4670 %      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4671 %        size_t *number_colors)
4672 %
4673 %  A description of each parameter follows:
4674 %
4675 %    o wand: the magick wand.
4676 %
4677 %    o number_colors: the number of unique colors in the image and the number
4678 %      of pixel wands returned.
4679 %
4680 */
4681 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4682   size_t *number_colors)
4683 {
4684   PixelPacket
4685     *histogram;
4686
4687   PixelWand
4688     **pixel_wands;
4689
4690   register ssize_t
4691     i;
4692
4693   assert(wand != (MagickWand *) NULL);
4694   assert(wand->signature == WandSignature);
4695   if (wand->debug != MagickFalse)
4696     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4697   if (wand->images == (Image *) NULL)
4698     {
4699       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4700         "ContainsNoImages","`%s'",wand->name);
4701       return((PixelWand **) NULL);
4702     }
4703   histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4704   if (histogram == (PixelPacket *) NULL)
4705     return((PixelWand **) NULL);
4706   pixel_wands=NewPixelWands(*number_colors);
4707   for (i=0; i < (ssize_t) *number_colors; i++)
4708   {
4709     PixelSetQuantumPacket(pixel_wands[i],&histogram[i]);
4710     PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4711   }
4712   histogram=(PixelPacket *) RelinquishMagickMemory(histogram);
4713   return(pixel_wands);
4714 }
4715 \f
4716 /*
4717 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4718 %                                                                             %
4719 %                                                                             %
4720 %                                                                             %
4721 %   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                 %
4722 %                                                                             %
4723 %                                                                             %
4724 %                                                                             %
4725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4726 %
4727 %  MagickGetImageInterlaceScheme() gets the image interlace scheme.
4728 %
4729 %  The format of the MagickGetImageInterlaceScheme method is:
4730 %
4731 %      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4732 %
4733 %  A description of each parameter follows:
4734 %
4735 %    o wand: the magick wand.
4736 %
4737 */
4738 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4739 {
4740   assert(wand != (MagickWand *) NULL);
4741   assert(wand->signature == WandSignature);
4742   if (wand->debug != MagickFalse)
4743     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4744   if (wand->images == (Image *) NULL)
4745     {
4746       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4747         "ContainsNoImages","`%s'",wand->name);
4748       return(UndefinedInterlace);
4749     }
4750   return(wand->images->interlace);
4751 }
4752 \f
4753 /*
4754 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4755 %                                                                             %
4756 %                                                                             %
4757 %                                                                             %
4758 %   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             %
4759 %                                                                             %
4760 %                                                                             %
4761 %                                                                             %
4762 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4763 %
4764 %  MagickGetImageInterpolateMethod() returns the interpolation method for the
4765 %  sepcified image.
4766 %
4767 %  The format of the MagickGetImageInterpolateMethod method is:
4768 %
4769 %      InterpolatePixelMethod MagickGetImageInterpolateMethod(MagickWand *wand)
4770 %
4771 %  A description of each parameter follows:
4772 %
4773 %    o wand: the magick wand.
4774 %
4775 */
4776 WandExport InterpolatePixelMethod MagickGetImageInterpolateMethod(
4777   MagickWand *wand)
4778 {
4779   assert(wand != (MagickWand *) NULL);
4780   assert(wand->signature == WandSignature);
4781   if (wand->debug != MagickFalse)
4782     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4783   if (wand->images == (Image *) NULL)
4784     {
4785       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4786         "ContainsNoImages","`%s'",wand->name);
4787       return(UndefinedInterpolatePixel);
4788     }
4789   return(wand->images->interpolate);
4790 }
4791 \f
4792 /*
4793 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4794 %                                                                             %
4795 %                                                                             %
4796 %                                                                             %
4797 %   M a g i c k G e t I m a g e I t e r a t i o n s                           %
4798 %                                                                             %
4799 %                                                                             %
4800 %                                                                             %
4801 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4802 %
4803 %  MagickGetImageIterations() gets the image iterations.
4804 %
4805 %  The format of the MagickGetImageIterations method is:
4806 %
4807 %      size_t MagickGetImageIterations(MagickWand *wand)
4808 %
4809 %  A description of each parameter follows:
4810 %
4811 %    o wand: the magick wand.
4812 %
4813 */
4814 WandExport size_t MagickGetImageIterations(MagickWand *wand)
4815 {
4816   assert(wand != (MagickWand *) NULL);
4817   assert(wand->signature == WandSignature);
4818   if (wand->debug != MagickFalse)
4819     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4820   if (wand->images == (Image *) NULL)
4821     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4822   return(wand->images->iterations);
4823 }
4824 \f
4825 /*
4826 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4827 %                                                                             %
4828 %                                                                             %
4829 %                                                                             %
4830 %   M a g i c k G e t I m a g e L e n g t h                                   %
4831 %                                                                             %
4832 %                                                                             %
4833 %                                                                             %
4834 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4835 %
4836 %  MagickGetImageLength() returns the image length in bytes.
4837 %
4838 %  The format of the MagickGetImageLength method is:
4839 %
4840 %      MagickBooleanType MagickGetImageLength(MagickWand *wand,
4841 %        MagickSizeType *length)
4842 %
4843 %  A description of each parameter follows:
4844 %
4845 %    o wand: the magick wand.
4846 %
4847 %    o length: the image length in bytes.
4848 %
4849 */
4850 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
4851   MagickSizeType *length)
4852 {
4853   assert(wand != (MagickWand *) NULL);
4854   assert(wand->signature == WandSignature);
4855   if (wand->debug != MagickFalse)
4856     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4857   if (wand->images == (Image *) NULL)
4858     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4859   *length=GetBlobSize(wand->images);
4860   return(MagickTrue);
4861 }
4862 \f
4863 /*
4864 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4865 %                                                                             %
4866 %                                                                             %
4867 %                                                                             %
4868 %   M a g i c k G e t I m a g e M a t t e C o l o r                           %
4869 %                                                                             %
4870 %                                                                             %
4871 %                                                                             %
4872 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4873 %
4874 %  MagickGetImageMatteColor() returns the image matte color.
4875 %
4876 %  The format of the MagickGetImageMatteColor method is:
4877 %
4878 %      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
4879 %        PixelWand *matte_color)
4880 %
4881 %  A description of each parameter follows:
4882 %
4883 %    o wand: the magick wand.
4884 %
4885 %    o matte_color: Return the matte color.
4886 %
4887 */
4888 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
4889   PixelWand *matte_color)
4890 {
4891   assert(wand != (MagickWand *) NULL);
4892   assert(wand->signature == WandSignature);
4893   if (wand->debug != MagickFalse)
4894     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4895   if (wand->images == (Image *) NULL)
4896     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4897   PixelSetQuantumPacket(matte_color,&wand->images->matte_color);
4898   return(MagickTrue);
4899 }
4900 \f
4901 /*
4902 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4903 %                                                                             %
4904 %                                                                             %
4905 %                                                                             %
4906 %   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                         %
4907 %                                                                             %
4908 %                                                                             %
4909 %                                                                             %
4910 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4911 %
4912 %  MagickGetImageOrientation() returns the image orientation.
4913 %
4914 %  The format of the MagickGetImageOrientation method is:
4915 %
4916 %      OrientationType MagickGetImageOrientation(MagickWand *wand)
4917 %
4918 %  A description of each parameter follows:
4919 %
4920 %    o wand: the magick wand.
4921 %
4922 */
4923 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
4924 {
4925   assert(wand != (MagickWand *) NULL);
4926   assert(wand->signature == WandSignature);
4927   if (wand->debug != MagickFalse)
4928     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4929   if (wand->images == (Image *) NULL)
4930     {
4931       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4932         "ContainsNoImages","`%s'",wand->name);
4933       return(UndefinedOrientation);
4934     }
4935   return(wand->images->orientation);
4936 }
4937 \f
4938 /*
4939 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4940 %                                                                             %
4941 %                                                                             %
4942 %                                                                             %
4943 %   M a g i c k G e t I m a g e P a g e                                       %
4944 %                                                                             %
4945 %                                                                             %
4946 %                                                                             %
4947 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4948 %
4949 %  MagickGetImagePage() returns the page geometry associated with the image.
4950 %
4951 %  The format of the MagickGetImagePage method is:
4952 %
4953 %      MagickBooleanType MagickGetImagePage(MagickWand *wand,
4954 %        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4955 %
4956 %  A description of each parameter follows:
4957 %
4958 %    o wand: the magick wand.
4959 %
4960 %    o width: the page width.
4961 %
4962 %    o height: the page height.
4963 %
4964 %    o x: the page x-offset.
4965 %
4966 %    o y: the page y-offset.
4967 %
4968 */
4969 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
4970   size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4971 {
4972   assert(wand != (const MagickWand *) NULL);
4973   assert(wand->signature == WandSignature);
4974   if (wand->debug != MagickFalse)
4975     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4976   if (wand->images == (Image *) NULL)
4977     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4978   *width=wand->images->page.width;
4979   *height=wand->images->page.height;
4980   *x=wand->images->page.x;
4981   *y=wand->images->page.y;
4982   return(MagickTrue);
4983 }
4984 \f
4985 /*
4986 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4987 %                                                                             %
4988 %                                                                             %
4989 %                                                                             %
4990 %   M a g i c k G e t I m a g e P i x e l C o l o r                           %
4991 %                                                                             %
4992 %                                                                             %
4993 %                                                                             %
4994 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4995 %
4996 %  MagickGetImagePixelColor() returns the color of the specified pixel.
4997 %
4998 %  The format of the MagickGetImagePixelColor method is:
4999 %
5000 %      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5001 %        const ssize_t x,const ssize_t y,PixelWand *color)
5002 %
5003 %  A description of each parameter follows:
5004 %
5005 %    o wand: the magick wand.
5006 %
5007 %    o x,y: the pixel offset into the image.
5008 %
5009 %    o color: Return the colormap color in this wand.
5010 %
5011 */
5012 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5013   const ssize_t x,const ssize_t y,PixelWand *color)
5014 {
5015   register const Quantum
5016     *p;
5017
5018   CacheView
5019     *image_view;
5020
5021   assert(wand != (MagickWand *) NULL);
5022   assert(wand->signature == WandSignature);
5023   if (wand->debug != MagickFalse)
5024     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5025   if (wand->images == (Image *) NULL)
5026     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5027   image_view=AcquireCacheView(wand->images);
5028   p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5029   if (p == (const Quantum *) NULL)
5030     {
5031       image_view=DestroyCacheView(image_view);
5032       return(MagickFalse);
5033     }
5034   PixelSetQuantumPixel(wand->images,p,color);
5035   image_view=DestroyCacheView(image_view);
5036   return(MagickTrue);
5037 }
5038 \f
5039 /*
5040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5041 %                                                                             %
5042 %                                                                             %
5043 %                                                                             %
5044 %   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5045 %                                                                             %
5046 %                                                                             %
5047 %                                                                             %
5048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5049 %
5050 %  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5051 %
5052 %  The format of the MagickGetImageRedPrimary method is:
5053 %
5054 %      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5055 %        double *y)
5056 %
5057 %  A description of each parameter follows:
5058 %
5059 %    o wand: the magick wand.
5060 %
5061 %    o x: the chromaticity red primary x-point.
5062 %
5063 %    o y: the chromaticity red primary y-point.
5064 %
5065 */
5066 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5067   double *x,double *y)
5068 {
5069   assert(wand != (MagickWand *) NULL);
5070   assert(wand->signature == WandSignature);
5071   if (wand->debug != MagickFalse)
5072     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5073   if (wand->images == (Image *) NULL)
5074     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5075   *x=wand->images->chromaticity.red_primary.x;
5076   *y=wand->images->chromaticity.red_primary.y;
5077   return(MagickTrue);
5078 }
5079 \f
5080 /*
5081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5082 %                                                                             %
5083 %                                                                             %
5084 %                                                                             %
5085 %   M a g i c k G e t I m a g e R e g i o n                                   %
5086 %                                                                             %
5087 %                                                                             %
5088 %                                                                             %
5089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5090 %
5091 %  MagickGetImageRegion() extracts a region of the image and returns it as a
5092 %  a new wand.
5093 %
5094 %  The format of the MagickGetImageRegion method is:
5095 %
5096 %      MagickWand *MagickGetImageRegion(MagickWand *wand,
5097 %        const size_t width,const size_t height,const ssize_t x,
5098 %        const ssize_t y)
5099 %
5100 %  A description of each parameter follows:
5101 %
5102 %    o wand: the magick wand.
5103 %
5104 %    o width: the region width.
5105 %
5106 %    o height: the region height.
5107 %
5108 %    o x: the region x offset.
5109 %
5110 %    o y: the region y offset.
5111 %
5112 */
5113 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5114   const size_t width,const size_t height,const ssize_t x,
5115   const ssize_t y)
5116 {
5117   Image
5118     *region_image;
5119
5120   RectangleInfo
5121     region;
5122
5123   assert(wand != (MagickWand *) NULL);
5124   assert(wand->signature == WandSignature);
5125   if (wand->debug != MagickFalse)
5126     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5127   if (wand->images == (Image *) NULL)
5128     return((MagickWand *) NULL);
5129   region.width=width;
5130   region.height=height;
5131   region.x=x;
5132   region.y=y;
5133   region_image=CropImage(wand->images,&region,wand->exception);
5134   if (region_image == (Image *) NULL)
5135     return((MagickWand *) NULL);
5136   return(CloneMagickWandFromImages(wand,region_image));
5137 }
5138 \f
5139 /*
5140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5141 %                                                                             %
5142 %                                                                             %
5143 %                                                                             %
5144 %   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                 %
5145 %                                                                             %
5146 %                                                                             %
5147 %                                                                             %
5148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5149 %
5150 %  MagickGetImageRenderingIntent() gets the image rendering intent.
5151 %
5152 %  The format of the MagickGetImageRenderingIntent method is:
5153 %
5154 %      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5155 %
5156 %  A description of each parameter follows:
5157 %
5158 %    o wand: the magick wand.
5159 %
5160 */
5161 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5162 {
5163   assert(wand != (MagickWand *) NULL);
5164   assert(wand->signature == WandSignature);
5165   if (wand->debug != MagickFalse)
5166     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5167   if (wand->images == (Image *) NULL)
5168     {
5169       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5170         "ContainsNoImages","`%s'",wand->name);
5171       return(UndefinedIntent);
5172     }
5173   return((RenderingIntent) wand->images->rendering_intent);
5174 }
5175 \f
5176 /*
5177 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5178 %                                                                             %
5179 %                                                                             %
5180 %                                                                             %
5181 %   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5182 %                                                                             %
5183 %                                                                             %
5184 %                                                                             %
5185 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5186 %
5187 %  MagickGetImageResolution() gets the image X and Y resolution.
5188 %
5189 %  The format of the MagickGetImageResolution method is:
5190 %
5191 %      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5192 %        double *y)
5193 %
5194 %  A description of each parameter follows:
5195 %
5196 %    o wand: the magick wand.
5197 %
5198 %    o x: the image x-resolution.
5199 %
5200 %    o y: the image y-resolution.
5201 %
5202 */
5203 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5204   double *x,double *y)
5205 {
5206   assert(wand != (MagickWand *) NULL);
5207   assert(wand->signature == WandSignature);
5208   if (wand->debug != MagickFalse)
5209     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5210   if (wand->images == (Image *) NULL)
5211     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5212   *x=wand->images->x_resolution;
5213   *y=wand->images->y_resolution;
5214   return(MagickTrue);
5215 }
5216 \f
5217 /*
5218 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5219 %                                                                             %
5220 %                                                                             %
5221 %                                                                             %
5222 %   M a g i c k G e t I m a g e S c e n e                                     %
5223 %                                                                             %
5224 %                                                                             %
5225 %                                                                             %
5226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5227 %
5228 %  MagickGetImageScene() gets the image scene.
5229 %
5230 %  The format of the MagickGetImageScene method is:
5231 %
5232 %      size_t MagickGetImageScene(MagickWand *wand)
5233 %
5234 %  A description of each parameter follows:
5235 %
5236 %    o wand: the magick wand.
5237 %
5238 */
5239 WandExport size_t MagickGetImageScene(MagickWand *wand)
5240 {
5241   assert(wand != (MagickWand *) NULL);
5242   assert(wand->signature == WandSignature);
5243   if (wand->debug != MagickFalse)
5244     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5245   if (wand->images == (Image *) NULL)
5246     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5247   return(wand->images->scene);
5248 }
5249 \f
5250 /*
5251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5252 %                                                                             %
5253 %                                                                             %
5254 %                                                                             %
5255 %   M a g i c k G e t I m a g e S i g n a t u r e                             %
5256 %                                                                             %
5257 %                                                                             %
5258 %                                                                             %
5259 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5260 %
5261 %  MagickGetImageSignature() generates an SHA-256 message digest for the image
5262 %  pixel stream.
5263 %
5264 %  The format of the MagickGetImageSignature method is:
5265 %
5266 %      const char MagickGetImageSignature(MagickWand *wand)
5267 %
5268 %  A description of each parameter follows:
5269 %
5270 %    o wand: the magick wand.
5271 %
5272 */
5273 WandExport char *MagickGetImageSignature(MagickWand *wand)
5274 {
5275   const char
5276     *value;
5277
5278   MagickBooleanType
5279     status;
5280
5281   assert(wand != (MagickWand *) NULL);
5282   assert(wand->signature == WandSignature);
5283   if (wand->debug != MagickFalse)
5284     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5285   if (wand->images == (Image *) NULL)
5286     {
5287       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5288         "ContainsNoImages","`%s'",wand->name);
5289       return((char *) NULL);
5290     }
5291   status=SignatureImage(wand->images);
5292   if (status == MagickFalse)
5293     InheritException(wand->exception,&wand->images->exception);
5294   value=GetImageProperty(wand->images,"signature");
5295   if (value != (const char *) NULL)
5296     return(AcquireString(value));
5297   InheritException(wand->exception,&wand->images->exception);
5298   return((char *) NULL);
5299 }
5300 \f
5301 /*
5302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5303 %                                                                             %
5304 %                                                                             %
5305 %                                                                             %
5306 %   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                   %
5307 %                                                                             %
5308 %                                                                             %
5309 %                                                                             %
5310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5311 %
5312 %  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5313 %
5314 %  The format of the MagickGetImageTicksPerSecond method is:
5315 %
5316 %      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5317 %
5318 %  A description of each parameter follows:
5319 %
5320 %    o wand: the magick wand.
5321 %
5322 */
5323 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5324 {
5325   assert(wand != (MagickWand *) NULL);
5326   assert(wand->signature == WandSignature);
5327   if (wand->debug != MagickFalse)
5328     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5329   if (wand->images == (Image *) NULL)
5330     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5331   return((size_t) wand->images->ticks_per_second);
5332 }
5333 \f
5334 /*
5335 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5336 %                                                                             %
5337 %                                                                             %
5338 %                                                                             %
5339 %   M a g i c k G e t I m a g e T y p e                                       %
5340 %                                                                             %
5341 %                                                                             %
5342 %                                                                             %
5343 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5344 %
5345 %  MagickGetImageType() gets the potential image type:
5346 %
5347 %        Bilevel        Grayscale       GrayscaleMatte
5348 %        Palette        PaletteMatte    TrueColor
5349 %        TrueColorMatte ColorSeparation ColorSeparationMatte
5350 %
5351 %  To ensure the image type matches its potential, use MagickSetImageType():
5352 %
5353 %    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5354 %
5355 %  The format of the MagickGetImageType method is:
5356 %
5357 %      ImageType MagickGetImageType(MagickWand *wand)
5358 %
5359 %  A description of each parameter follows:
5360 %
5361 %    o wand: the magick wand.
5362 %
5363 */
5364 WandExport ImageType MagickGetImageType(MagickWand *wand)
5365 {
5366   assert(wand != (MagickWand *) NULL);
5367   assert(wand->signature == WandSignature);
5368   if (wand->debug != MagickFalse)
5369     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5370   if (wand->images == (Image *) NULL)
5371     {
5372       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5373         "ContainsNoImages","`%s'",wand->name);
5374       return(UndefinedType);
5375     }
5376   return(GetImageType(wand->images,wand->exception));
5377 }
5378 \f
5379 /*
5380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5381 %                                                                             %
5382 %                                                                             %
5383 %                                                                             %
5384 %   M a g i c k G e t I m a g e U n i t s                                     %
5385 %                                                                             %
5386 %                                                                             %
5387 %                                                                             %
5388 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5389 %
5390 %  MagickGetImageUnits() gets the image units of resolution.
5391 %
5392 %  The format of the MagickGetImageUnits method is:
5393 %
5394 %      ResolutionType MagickGetImageUnits(MagickWand *wand)
5395 %
5396 %  A description of each parameter follows:
5397 %
5398 %    o wand: the magick wand.
5399 %
5400 */
5401 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5402 {
5403   assert(wand != (MagickWand *) NULL);
5404   assert(wand->signature == WandSignature);
5405   if (wand->debug != MagickFalse)
5406     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5407   if (wand->images == (Image *) NULL)
5408     {
5409       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5410         "ContainsNoImages","`%s'",wand->name);
5411       return(UndefinedResolution);
5412     }
5413   return(wand->images->units);
5414 }
5415 \f
5416 /*
5417 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5418 %                                                                             %
5419 %                                                                             %
5420 %                                                                             %
5421 %   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           %
5422 %                                                                             %
5423 %                                                                             %
5424 %                                                                             %
5425 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5426 %
5427 %  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5428 %  sepcified image.
5429 %
5430 %  The format of the MagickGetImageVirtualPixelMethod method is:
5431 %
5432 %      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5433 %
5434 %  A description of each parameter follows:
5435 %
5436 %    o wand: the magick wand.
5437 %
5438 */
5439 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5440 {
5441   assert(wand != (MagickWand *) NULL);
5442   assert(wand->signature == WandSignature);
5443   if (wand->debug != MagickFalse)
5444     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5445   if (wand->images == (Image *) NULL)
5446     {
5447       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5448         "ContainsNoImages","`%s'",wand->name);
5449       return(UndefinedVirtualPixelMethod);
5450     }
5451   return(GetImageVirtualPixelMethod(wand->images));
5452 }
5453 \f
5454 /*
5455 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5456 %                                                                             %
5457 %                                                                             %
5458 %                                                                             %
5459 %   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5460 %                                                                             %
5461 %                                                                             %
5462 %                                                                             %
5463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5464 %
5465 %  MagickGetImageWhitePoint() returns the chromaticy white point.
5466 %
5467 %  The format of the MagickGetImageWhitePoint method is:
5468 %
5469 %      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5470 %        double *y)
5471 %
5472 %  A description of each parameter follows:
5473 %
5474 %    o wand: the magick wand.
5475 %
5476 %    o x: the chromaticity white x-point.
5477 %
5478 %    o y: the chromaticity white y-point.
5479 %
5480 */
5481 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5482   double *x,double *y)
5483 {
5484   assert(wand != (MagickWand *) NULL);
5485   assert(wand->signature == WandSignature);
5486   if (wand->debug != MagickFalse)
5487     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5488   if (wand->images == (Image *) NULL)
5489     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5490   *x=wand->images->chromaticity.white_point.x;
5491   *y=wand->images->chromaticity.white_point.y;
5492   return(MagickTrue);
5493 }
5494 \f
5495 /*
5496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5497 %                                                                             %
5498 %                                                                             %
5499 %                                                                             %
5500 %   M a g i c k G e t I m a g e W i d t h                                     %
5501 %                                                                             %
5502 %                                                                             %
5503 %                                                                             %
5504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5505 %
5506 %  MagickGetImageWidth() returns the image width.
5507 %
5508 %  The format of the MagickGetImageWidth method is:
5509 %
5510 %      size_t MagickGetImageWidth(MagickWand *wand)
5511 %
5512 %  A description of each parameter follows:
5513 %
5514 %    o wand: the magick wand.
5515 %
5516 */
5517 WandExport size_t MagickGetImageWidth(MagickWand *wand)
5518 {
5519   assert(wand != (MagickWand *) NULL);
5520   assert(wand->signature == WandSignature);
5521   if (wand->debug != MagickFalse)
5522     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5523   if (wand->images == (Image *) NULL)
5524     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5525   return(wand->images->columns);
5526 }
5527 \f
5528 /*
5529 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5530 %                                                                             %
5531 %                                                                             %
5532 %                                                                             %
5533 %   M a g i c k G e t N u m b e r I m a g e s                                 %
5534 %                                                                             %
5535 %                                                                             %
5536 %                                                                             %
5537 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5538 %
5539 %  MagickGetNumberImages() returns the number of images associated with a
5540 %  magick wand.
5541 %
5542 %  The format of the MagickGetNumberImages method is:
5543 %
5544 %      size_t MagickGetNumberImages(MagickWand *wand)
5545 %
5546 %  A description of each parameter follows:
5547 %
5548 %    o wand: the magick wand.
5549 %
5550 */
5551 WandExport size_t MagickGetNumberImages(MagickWand *wand)
5552 {
5553   assert(wand != (MagickWand *) NULL);
5554   assert(wand->signature == WandSignature);
5555   if (wand->debug != MagickFalse)
5556     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5557   return(GetImageListLength(wand->images));
5558 }
5559 \f
5560 /*
5561 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5562 %                                                                             %
5563 %                                                                             %
5564 %                                                                             %
5565 %   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                 %
5566 %                                                                             %
5567 %                                                                             %
5568 %                                                                             %
5569 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5570 %
5571 %  MagickGetImageTotalInkDensity() gets the image total ink density.
5572 %
5573 %  The format of the MagickGetImageTotalInkDensity method is:
5574 %
5575 %      double MagickGetImageTotalInkDensity(MagickWand *wand)
5576 %
5577 %  A description of each parameter follows:
5578 %
5579 %    o wand: the magick wand.
5580 %
5581 */
5582 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5583 {
5584   assert(wand != (MagickWand *) NULL);
5585   assert(wand->signature == WandSignature);
5586   if (wand->debug != MagickFalse)
5587     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5588   if (wand->images == (Image *) NULL)
5589     {
5590       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5591         "ContainsNoImages","`%s'",wand->name);
5592       return(0.0);
5593     }
5594   return(GetImageTotalInkDensity(wand->images));
5595 }
5596 \f
5597 /*
5598 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5599 %                                                                             %
5600 %                                                                             %
5601 %                                                                             %
5602 %   M a g i c k H a l d C l u t I m a g e                                     %
5603 %                                                                             %
5604 %                                                                             %
5605 %                                                                             %
5606 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5607 %
5608 %  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5609 %  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5610 %  dimensions.  Create it with the HALD coder.  You can apply any color
5611 %  transformation to the Hald image and then use this method to apply the
5612 %  transform to the image.
5613 %
5614 %  The format of the MagickHaldClutImage method is:
5615 %
5616 %      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5617 %        const MagickWand *hald_wand)
5618 %
5619 %  A description of each parameter follows:
5620 %
5621 %    o wand: the magick wand.
5622 %
5623 %    o hald_image: the hald CLUT image.
5624 %
5625 */
5626 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5627   const MagickWand *hald_wand)
5628 {
5629   MagickBooleanType
5630     status;
5631
5632   assert(wand != (MagickWand *) NULL);
5633   assert(wand->signature == WandSignature);
5634   if (wand->debug != MagickFalse)
5635     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5636   if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5637     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5638   status=HaldClutImage(wand->images,hald_wand->images);
5639   if (status == MagickFalse)
5640     InheritException(wand->exception,&wand->images->exception);
5641   return(status);
5642 }
5643 \f
5644 /*
5645 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5646 %                                                                             %
5647 %                                                                             %
5648 %                                                                             %
5649 %   M a g i c k H a s N e x t I m a g e                                       %
5650 %                                                                             %
5651 %                                                                             %
5652 %                                                                             %
5653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5654 %
5655 %  MagickHasNextImage() returns MagickTrue if the wand has more images when
5656 %  traversing the list in the forward direction
5657 %
5658 %  The format of the MagickHasNextImage method is:
5659 %
5660 %      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5661 %
5662 %  A description of each parameter follows:
5663 %
5664 %    o wand: the magick wand.
5665 %
5666 */
5667 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5668 {
5669   assert(wand != (MagickWand *) NULL);
5670   assert(wand->signature == WandSignature);
5671   if (wand->debug != MagickFalse)
5672     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5673   if (wand->images == (Image *) NULL)
5674     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5675   if (GetNextImageInList(wand->images) == (Image *) NULL)
5676     return(MagickFalse);
5677   return(MagickTrue);
5678 }
5679 \f
5680 /*
5681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5682 %                                                                             %
5683 %                                                                             %
5684 %                                                                             %
5685 %   M a g i c k H a s P r e v i o u s I m a g e                               %
5686 %                                                                             %
5687 %                                                                             %
5688 %                                                                             %
5689 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5690 %
5691 %  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5692 %  traversing the list in the reverse direction
5693 %
5694 %  The format of the MagickHasPreviousImage method is:
5695 %
5696 %      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5697 %
5698 %  A description of each parameter follows:
5699 %
5700 %    o wand: the magick wand.
5701 %
5702 */
5703 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5704 {
5705   assert(wand != (MagickWand *) NULL);
5706   assert(wand->signature == WandSignature);
5707   if (wand->debug != MagickFalse)
5708     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5709   if (wand->images == (Image *) NULL)
5710     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5711   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5712     return(MagickFalse);
5713   return(MagickTrue);
5714 }
5715 \f
5716 /*
5717 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5718 %                                                                             %
5719 %                                                                             %
5720 %                                                                             %
5721 %   M a g i c k I d e n t i f y I m a g e                                     %
5722 %                                                                             %
5723 %                                                                             %
5724 %                                                                             %
5725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5726 %
5727 %  MagickIdentifyImage() identifies an image by printing its attributes to the
5728 %  file.  Attributes include the image width, height, size, and others.
5729 %
5730 %  The format of the MagickIdentifyImage method is:
5731 %
5732 %      const char *MagickIdentifyImage(MagickWand *wand)
5733 %
5734 %  A description of each parameter follows:
5735 %
5736 %    o wand: the magick wand.
5737 %
5738 */
5739 WandExport char *MagickIdentifyImage(MagickWand *wand)
5740 {
5741   char
5742     *description,
5743     filename[MaxTextExtent];
5744
5745   FILE
5746     *file;
5747
5748   int
5749     unique_file;
5750
5751   assert(wand != (MagickWand *) NULL);
5752   assert(wand->signature == WandSignature);
5753   if (wand->debug != MagickFalse)
5754     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5755   if (wand->images == (Image *) NULL)
5756     {
5757       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5758         "ContainsNoImages","`%s'",wand->name);
5759       return((char *) NULL);
5760     }
5761   description=(char *) NULL;
5762   unique_file=AcquireUniqueFileResource(filename);
5763   file=(FILE *) NULL;
5764   if (unique_file != -1)
5765     file=fdopen(unique_file,"wb");
5766   if ((unique_file == -1) || (file == (FILE *) NULL))
5767     {
5768       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5769         "UnableToCreateTemporaryFile","`%s'",wand->name);
5770       return((char *) NULL);
5771     }
5772   (void) IdentifyImage(wand->images,file,MagickTrue);
5773   (void) fclose(file);
5774   description=FileToString(filename,~0,wand->exception);
5775   (void) RelinquishUniqueFileResource(filename);
5776   return(description);
5777 }
5778 \f
5779 /*
5780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5781 %                                                                             %
5782 %                                                                             %
5783 %                                                                             %
5784 %   M a g i c k I m p l o d e I m a g e                                       %
5785 %                                                                             %
5786 %                                                                             %
5787 %                                                                             %
5788 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5789 %
5790 %  MagickImplodeImage() creates a new image that is a copy of an existing
5791 %  one with the image pixels "implode" by the specified percentage.  It
5792 %  allocates the memory necessary for the new Image structure and returns a
5793 %  pointer to the new image.
5794 %
5795 %  The format of the MagickImplodeImage method is:
5796 %
5797 %      MagickBooleanType MagickImplodeImage(MagickWand *wand,
5798 %        const double radius)
5799 %
5800 %  A description of each parameter follows:
5801 %
5802 %    o wand: the magick wand.
5803 %
5804 %    o amount: Define the extent of the implosion.
5805 %
5806 */
5807 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
5808   const double amount)
5809 {
5810   Image
5811     *implode_image;
5812
5813   assert(wand != (MagickWand *) NULL);
5814   assert(wand->signature == WandSignature);
5815   if (wand->debug != MagickFalse)
5816     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5817   if (wand->images == (Image *) NULL)
5818     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5819   implode_image=ImplodeImage(wand->images,amount,wand->exception);
5820   if (implode_image == (Image *) NULL)
5821     return(MagickFalse);
5822   ReplaceImageInList(&wand->images,implode_image);
5823   return(MagickTrue);
5824 }
5825 \f
5826 /*
5827 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5828 %                                                                             %
5829 %                                                                             %
5830 %                                                                             %
5831 %   M a g i c k I m p o r t I m a g e P i x e l s                             %
5832 %                                                                             %
5833 %                                                                             %
5834 %                                                                             %
5835 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5836 %
5837 %  MagickImportImagePixels() accepts pixel datand stores it in the image at the
5838 %  location you specify.  The method returns MagickFalse on success otherwise
5839 %  MagickTrue if an error is encountered.  The pixel data can be either char,
5840 %  short int, int, ssize_t, float, or double in the order specified by map.
5841 %
5842 %  Suppose your want to upload the first scanline of a 640x480 image from
5843 %  character data in red-green-blue order:
5844 %
5845 %      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
5846 %
5847 %  The format of the MagickImportImagePixels method is:
5848 %
5849 %      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5850 %        const ssize_t x,const ssize_t y,const size_t columns,
5851 %        const size_t rows,const char *map,const StorageType storage,
5852 %        const void *pixels)
5853 %
5854 %  A description of each parameter follows:
5855 %
5856 %    o wand: the magick wand.
5857 %
5858 %    o x, y, columns, rows:  These values define the perimeter of a region
5859 %      of pixels you want to define.
5860 %
5861 %    o map:  This string reflects the expected ordering of the pixel array.
5862 %      It can be any combination or order of R = red, G = green, B = blue,
5863 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
5864 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
5865 %      P = pad.
5866 %
5867 %    o storage: Define the data type of the pixels.  Float and double types are
5868 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
5869 %      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
5870 %      or DoublePixel.
5871 %
5872 %    o pixels: This array of values contain the pixel components as defined by
5873 %      map and type.  You must preallocate this array where the expected
5874 %      length varies depending on the values of width, height, map, and type.
5875 %
5876 */
5877 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5878   const ssize_t x,const ssize_t y,const size_t columns,
5879   const size_t rows,const char *map,const StorageType storage,
5880   const void *pixels)
5881 {
5882   MagickBooleanType
5883     status;
5884
5885   assert(wand != (MagickWand *) NULL);
5886   assert(wand->signature == WandSignature);
5887   if (wand->debug != MagickFalse)
5888     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5889   if (wand->images == (Image *) NULL)
5890     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5891   status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels);
5892   if (status == MagickFalse)
5893     InheritException(wand->exception,&wand->images->exception);
5894   return(status);
5895 }
5896 \f
5897 /*
5898 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5899 %                                                                             %
5900 %                                                                             %
5901 %                                                                             %
5902 %   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       %
5903 %                                                                             %
5904 %                                                                             %
5905 %                                                                             %
5906 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5907 %
5908 %  MagickInverseFourierTransformImage() implements the inverse discrete
5909 %  Fourier transform (DFT) of the image either as a magnitude / phase or real /
5910 %  imaginary image pair.
5911 %
5912 %  The format of the MagickInverseFourierTransformImage method is:
5913 %
5914 %      MagickBooleanType MagickInverseFourierTransformImage(
5915 %        MagickWand *magnitude_wand,MagickWand *phase_wand,
5916 %        const MagickBooleanType magnitude)
5917 %
5918 %  A description of each parameter follows:
5919 %
5920 %    o magnitude_wand: the magnitude or real wand.
5921 %
5922 %    o phase_wand: the phase or imaginary wand.
5923 %
5924 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
5925 %      imaginary image pair.
5926 %
5927 */
5928 WandExport MagickBooleanType MagickInverseFourierTransformImage(
5929   MagickWand *magnitude_wand,MagickWand *phase_wand,
5930   const MagickBooleanType magnitude)
5931 {
5932   Image
5933     *inverse_image;
5934
5935   MagickWand
5936     *wand;
5937
5938   assert(magnitude_wand != (MagickWand *) NULL);
5939   assert(magnitude_wand->signature == WandSignature);
5940   if (magnitude_wand->debug != MagickFalse)
5941     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
5942       magnitude_wand->name);
5943   wand=magnitude_wand;
5944   if (magnitude_wand->images == (Image *) NULL)
5945     ThrowWandException(WandError,"ContainsNoImages",
5946       magnitude_wand->name);
5947   assert(phase_wand != (MagickWand *) NULL);
5948   assert(phase_wand->signature == WandSignature);
5949   inverse_image=InverseFourierTransformImage(magnitude_wand->images,
5950     phase_wand->images,magnitude,wand->exception);
5951   if (inverse_image == (Image *) NULL)
5952     return(MagickFalse);
5953   ReplaceImageInList(&wand->images,inverse_image);
5954   return(MagickTrue);
5955 }
5956 \f
5957 /*
5958 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5959 %                                                                             %
5960 %                                                                             %
5961 %                                                                             %
5962 %   M a g i c k L a b e l I m a g e                                           %
5963 %                                                                             %
5964 %                                                                             %
5965 %                                                                             %
5966 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5967 %
5968 %  MagickLabelImage() adds a label to your image.
5969 %
5970 %  The format of the MagickLabelImage method is:
5971 %
5972 %      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
5973 %
5974 %  A description of each parameter follows:
5975 %
5976 %    o wand: the magick wand.
5977 %
5978 %    o label: the image label.
5979 %
5980 */
5981 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
5982   const char *label)
5983 {
5984   MagickBooleanType
5985     status;
5986
5987   assert(wand != (MagickWand *) NULL);
5988   assert(wand->signature == WandSignature);
5989   if (wand->debug != MagickFalse)
5990     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5991   if (wand->images == (Image *) NULL)
5992     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5993   status=SetImageProperty(wand->images,"label",label);
5994   if (status == MagickFalse)
5995     InheritException(wand->exception,&wand->images->exception);
5996   return(status);
5997 }
5998 \f
5999 /*
6000 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6001 %                                                                             %
6002 %                                                                             %
6003 %                                                                             %
6004 %   M a g i c k L e v e l I m a g e                                           %
6005 %                                                                             %
6006 %                                                                             %
6007 %                                                                             %
6008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6009 %
6010 %  MagickLevelImage() adjusts the levels of an image by scaling the colors
6011 %  falling between specified white and black points to the full available
6012 %  quantum range. The parameters provided represent the black, mid, and white
6013 %  points. The black point specifies the darkest color in the image. Colors
6014 %  darker than the black point are set to zero. Mid point specifies a gamma
6015 %  correction to apply to the image.  White point specifies the lightest color
6016 %  in the image. Colors brighter than the white point are set to the maximum
6017 %  quantum value.
6018 %
6019 %  The format of the MagickLevelImage method is:
6020 %
6021 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6022 %        const double black_point,const double gamma,const double white_point)
6023 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6024 %        const ChannelType channel,const double black_point,const double gamma,
6025 %        const double white_point)
6026 %
6027 %  A description of each parameter follows:
6028 %
6029 %    o wand: the magick wand.
6030 %
6031 %    o channel: Identify which channel to level: RedChannel, GreenChannel,
6032 %
6033 %    o black_point: the black point.
6034 %
6035 %    o gamma: the gamma.
6036 %
6037 %    o white_point: the white point.
6038 %
6039 */
6040 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6041   const double black_point,const double gamma,const double white_point)
6042 {
6043   MagickBooleanType
6044     status;
6045
6046   assert(wand != (MagickWand *) NULL);
6047   assert(wand->signature == WandSignature);
6048   if (wand->debug != MagickFalse)
6049     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6050   if (wand->images == (Image *) NULL)
6051     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6052   status=LevelImage(wand->images,black_point,white_point,gamma,
6053     &wand->images->exception);
6054   return(status);
6055 }
6056 \f
6057 /*
6058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6059 %                                                                             %
6060 %                                                                             %
6061 %                                                                             %
6062 %   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6063 %                                                                             %
6064 %                                                                             %
6065 %                                                                             %
6066 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6067 %
6068 %  MagickLinearStretchImage() stretches with saturation the image intensity.
6069 %
6070 %  You can also reduce the influence of a particular channel with a gamma
6071 %  value of 0.
6072 %
6073 %  The format of the MagickLinearStretchImage method is:
6074 %
6075 %      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6076 %        const double black_point,const double white_point)
6077 %
6078 %  A description of each parameter follows:
6079 %
6080 %    o wand: the magick wand.
6081 %
6082 %    o black_point: the black point.
6083 %
6084 %    o white_point: the white point.
6085 %
6086 */
6087 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6088   const double black_point,const double white_point)
6089 {
6090   MagickBooleanType
6091     status;
6092
6093   assert(wand != (MagickWand *) NULL);
6094   assert(wand->signature == WandSignature);
6095   if (wand->debug != MagickFalse)
6096     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6097   if (wand->images == (Image *) NULL)
6098     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6099   status=LinearStretchImage(wand->images,black_point,white_point);
6100   if (status == MagickFalse)
6101     InheritException(wand->exception,&wand->images->exception);
6102   return(status);
6103 }
6104 \f
6105 /*
6106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6107 %                                                                             %
6108 %                                                                             %
6109 %                                                                             %
6110 %   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6111 %                                                                             %
6112 %                                                                             %
6113 %                                                                             %
6114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6115 %
6116 %  MagickLiquidRescaleImage() rescales image with seam carving.
6117 %
6118 %      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6119 %        const size_t columns,const size_t rows,
6120 %        const double delta_x,const double rigidity)
6121 %
6122 %  A description of each parameter follows:
6123 %
6124 %    o wand: the magick wand.
6125 %
6126 %    o columns: the number of columns in the scaled image.
6127 %
6128 %    o rows: the number of rows in the scaled image.
6129 %
6130 %    o delta_x: maximum seam transversal step (0 means straight seams).
6131 %
6132 %    o rigidity: introduce a bias for non-straight seams (typically 0).
6133 %
6134 */
6135 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6136   const size_t columns,const size_t rows,const double delta_x,
6137   const double rigidity)
6138 {
6139   Image
6140     *rescale_image;
6141
6142   assert(wand != (MagickWand *) NULL);
6143   assert(wand->signature == WandSignature);
6144   if (wand->debug != MagickFalse)
6145     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6146   if (wand->images == (Image *) NULL)
6147     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6148   rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6149     rigidity,wand->exception);
6150   if (rescale_image == (Image *) NULL)
6151     return(MagickFalse);
6152   ReplaceImageInList(&wand->images,rescale_image);
6153   return(MagickTrue);
6154 }
6155 \f
6156 /*
6157 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6158 %                                                                             %
6159 %                                                                             %
6160 %                                                                             %
6161 %   M a g i c k M a g n i f y I m a g e                                       %
6162 %                                                                             %
6163 %                                                                             %
6164 %                                                                             %
6165 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6166 %
6167 %  MagickMagnifyImage() is a convenience method that scales an image
6168 %  proportionally to twice its original size.
6169 %
6170 %  The format of the MagickMagnifyImage method is:
6171 %
6172 %      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6173 %
6174 %  A description of each parameter follows:
6175 %
6176 %    o wand: the magick wand.
6177 %
6178 */
6179 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6180 {
6181   Image
6182     *magnify_image;
6183
6184   assert(wand != (MagickWand *) NULL);
6185   assert(wand->signature == WandSignature);
6186   if (wand->debug != MagickFalse)
6187     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6188   if (wand->images == (Image *) NULL)
6189     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6190   magnify_image=MagnifyImage(wand->images,wand->exception);
6191   if (magnify_image == (Image *) NULL)
6192     return(MagickFalse);
6193   ReplaceImageInList(&wand->images,magnify_image);
6194   return(MagickTrue);
6195 }
6196 \f
6197 /*
6198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6199 %                                                                             %
6200 %                                                                             %
6201 %                                                                             %
6202 %   M a g i c k M e r g e I m a g e L a y e r s                               %
6203 %                                                                             %
6204 %                                                                             %
6205 %                                                                             %
6206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6207 %
6208 %  MagickMergeImageLayers() composes all the image layers from the current
6209 %  given image onward to produce a single image of the merged layers.
6210 %
6211 %  The inital canvas's size depends on the given ImageLayerMethod, and is
6212 %  initialized using the first images background color.  The images
6213 %  are then compositied onto that image in sequence using the given
6214 %  composition that has been assigned to each individual image.
6215 %
6216 %  The format of the MagickMergeImageLayers method is:
6217 %
6218 %      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6219 %        const ImageLayerMethod method)
6220 %
6221 %  A description of each parameter follows:
6222 %
6223 %    o wand: the magick wand.
6224 %
6225 %    o method: the method of selecting the size of the initial canvas.
6226 %
6227 %        MergeLayer: Merge all layers onto a canvas just large enough
6228 %           to hold all the actual images. The virtual canvas of the
6229 %           first image is preserved but otherwise ignored.
6230 %
6231 %        FlattenLayer: Use the virtual canvas size of first image.
6232 %           Images which fall outside this canvas is clipped.
6233 %           This can be used to 'fill out' a given virtual canvas.
6234 %
6235 %        MosaicLayer: Start with the virtual canvas of the first image,
6236 %           enlarging left and right edges to contain all images.
6237 %           Images with negative offsets will be clipped.
6238 %
6239 */
6240 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6241   const ImageLayerMethod method)
6242 {
6243   Image
6244     *mosaic_image;
6245
6246   assert(wand != (MagickWand *) NULL);
6247   assert(wand->signature == WandSignature);
6248   if (wand->debug != MagickFalse)
6249     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6250   if (wand->images == (Image *) NULL)
6251     return((MagickWand *) NULL);
6252   mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6253   if (mosaic_image == (Image *) NULL)
6254     return((MagickWand *) NULL);
6255   return(CloneMagickWandFromImages(wand,mosaic_image));
6256 }
6257 \f
6258 /*
6259 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6260 %                                                                             %
6261 %                                                                             %
6262 %                                                                             %
6263 %   M a g i c k M i n i f y I m a g e                                         %
6264 %                                                                             %
6265 %                                                                             %
6266 %                                                                             %
6267 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6268 %
6269 %  MagickMinifyImage() is a convenience method that scales an image
6270 %  proportionally to one-half its original size
6271 %
6272 %  The format of the MagickMinifyImage method is:
6273 %
6274 %      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6275 %
6276 %  A description of each parameter follows:
6277 %
6278 %    o wand: the magick wand.
6279 %
6280 */
6281 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6282 {
6283   Image
6284     *minify_image;
6285
6286   assert(wand != (MagickWand *) NULL);
6287   assert(wand->signature == WandSignature);
6288   if (wand->debug != MagickFalse)
6289     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6290   if (wand->images == (Image *) NULL)
6291     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6292   minify_image=MinifyImage(wand->images,wand->exception);
6293   if (minify_image == (Image *) NULL)
6294     return(MagickFalse);
6295   ReplaceImageInList(&wand->images,minify_image);
6296   return(MagickTrue);
6297 }
6298 \f
6299 /*
6300 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6301 %                                                                             %
6302 %                                                                             %
6303 %                                                                             %
6304 %   M a g i c k M o d u l a t e I m a g e                                     %
6305 %                                                                             %
6306 %                                                                             %
6307 %                                                                             %
6308 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6309 %
6310 %  MagickModulateImage() lets you control the brightness, saturation, and hue
6311 %  of an image.  Hue is the percentage of absolute rotation from the current
6312 %  position.  For example 50 results in a counter-clockwise rotation of 90
6313 %  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6314 %  both resulting in a rotation of 180 degrees.
6315 %
6316 %  To increase the color brightness by 20% and decrease the color saturation by
6317 %  10% and leave the hue unchanged, use: 120,90,100.
6318 %
6319 %  The format of the MagickModulateImage method is:
6320 %
6321 %      MagickBooleanType MagickModulateImage(MagickWand *wand,
6322 %        const double brightness,const double saturation,const double hue)
6323 %
6324 %  A description of each parameter follows:
6325 %
6326 %    o wand: the magick wand.
6327 %
6328 %    o brightness: the percent change in brighness.
6329 %
6330 %    o saturation: the percent change in saturation.
6331 %
6332 %    o hue: the percent change in hue.
6333 %
6334 */
6335 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6336   const double brightness,const double saturation,const double hue)
6337 {
6338   char
6339     modulate[MaxTextExtent];
6340
6341   MagickBooleanType
6342     status;
6343
6344   assert(wand != (MagickWand *) NULL);
6345   assert(wand->signature == WandSignature);
6346   if (wand->debug != MagickFalse)
6347     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6348   if (wand->images == (Image *) NULL)
6349     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6350   (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6351     brightness,saturation,hue);
6352   status=ModulateImage(wand->images,modulate);
6353   if (status == MagickFalse)
6354     InheritException(wand->exception,&wand->images->exception);
6355   return(status);
6356 }
6357 \f
6358 /*
6359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6360 %                                                                             %
6361 %                                                                             %
6362 %                                                                             %
6363 %   M a g i c k M o n t a g e I m a g e                                       %
6364 %                                                                             %
6365 %                                                                             %
6366 %                                                                             %
6367 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6368 %
6369 %  MagickMontageImage() creates a composite image by combining several
6370 %  separate images. The images are tiled on the composite image with the name
6371 %  of the image optionally appearing just below the individual tile.
6372 %
6373 %  The format of the MagickMontageImage method is:
6374 %
6375 %      MagickWand *MagickMontageImage(MagickWand *wand,
6376 %        const DrawingWand drawing_wand,const char *tile_geometry,
6377 %        const char *thumbnail_geometry,const MontageMode mode,
6378 %        const char *frame)
6379 %
6380 %  A description of each parameter follows:
6381 %
6382 %    o wand: the magick wand.
6383 %
6384 %    o drawing_wand: the drawing wand.  The font name, size, and color are
6385 %      obtained from this wand.
6386 %
6387 %    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6388 %
6389 %    o thumbnail_geometry: Preferred image size and border size of each
6390 %      thumbnail (e.g. 120x120+4+3>).
6391 %
6392 %    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6393 %
6394 %    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6395 %      The frame color is that of the thumbnail's matte color.
6396 %
6397 */
6398 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6399   const DrawingWand *drawing_wand,const char *tile_geometry,
6400   const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6401 {
6402   char
6403     *font;
6404
6405   Image
6406     *montage_image;
6407
6408   MontageInfo
6409     *montage_info;
6410
6411   PixelWand
6412     *pixel_wand;
6413
6414   assert(wand != (MagickWand *) NULL);
6415   assert(wand->signature == WandSignature);
6416   if (wand->debug != MagickFalse)
6417     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6418   if (wand->images == (Image *) NULL)
6419     return((MagickWand *) NULL);
6420   montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6421   switch (mode)
6422   {
6423     case FrameMode:
6424     {
6425       (void) CloneString(&montage_info->frame,"15x15+3+3");
6426       montage_info->shadow=MagickTrue;
6427       break;
6428     }
6429     case UnframeMode:
6430     {
6431       montage_info->frame=(char *) NULL;
6432       montage_info->shadow=MagickFalse;
6433       montage_info->border_width=0;
6434       break;
6435     }
6436     case ConcatenateMode:
6437     {
6438       montage_info->frame=(char *) NULL;
6439       montage_info->shadow=MagickFalse;
6440       (void) CloneString(&montage_info->geometry,"+0+0");
6441       montage_info->border_width=0;
6442       break;
6443     }
6444     default:
6445       break;
6446   }
6447   font=DrawGetFont(drawing_wand);
6448   if (font != (char *) NULL)
6449     (void) CloneString(&montage_info->font,font);
6450   if (frame != (char *) NULL)
6451     (void) CloneString(&montage_info->frame,frame);
6452   montage_info->pointsize=DrawGetFontSize(drawing_wand);
6453   pixel_wand=NewPixelWand();
6454   DrawGetFillColor(drawing_wand,pixel_wand);
6455   PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6456   DrawGetStrokeColor(drawing_wand,pixel_wand);
6457   PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6458   pixel_wand=DestroyPixelWand(pixel_wand);
6459   if (thumbnail_geometry != (char *) NULL)
6460     (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6461   if (tile_geometry != (char *) NULL)
6462     (void) CloneString(&montage_info->tile,tile_geometry);
6463   montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6464     wand->exception);
6465   montage_info=DestroyMontageInfo(montage_info);
6466   if (montage_image == (Image *) NULL)
6467     return((MagickWand *) NULL);
6468   return(CloneMagickWandFromImages(wand,montage_image));
6469 }
6470 \f
6471 /*
6472 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6473 %                                                                             %
6474 %                                                                             %
6475 %                                                                             %
6476 %   M a g i c k M o r p h I m a g e s                                         %
6477 %                                                                             %
6478 %                                                                             %
6479 %                                                                             %
6480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6481 %
6482 %  MagickMorphImages() method morphs a set of images.  Both the image pixels
6483 %  and size are linearly interpolated to give the appearance of a
6484 %  meta-morphosis from one image to the next.
6485 %
6486 %  The format of the MagickMorphImages method is:
6487 %
6488 %      MagickWand *MagickMorphImages(MagickWand *wand,
6489 %        const size_t number_frames)
6490 %
6491 %  A description of each parameter follows:
6492 %
6493 %    o wand: the magick wand.
6494 %
6495 %    o number_frames: the number of in-between images to generate.
6496 %
6497 */
6498 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6499   const size_t number_frames)
6500 {
6501   Image
6502     *morph_image;
6503
6504   assert(wand != (MagickWand *) NULL);
6505   assert(wand->signature == WandSignature);
6506   if (wand->debug != MagickFalse)
6507     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6508   if (wand->images == (Image *) NULL)
6509     return((MagickWand *) NULL);
6510   morph_image=MorphImages(wand->images,number_frames,wand->exception);
6511   if (morph_image == (Image *) NULL)
6512     return((MagickWand *) NULL);
6513   return(CloneMagickWandFromImages(wand,morph_image));
6514 }
6515 \f
6516 /*
6517 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6518 %                                                                             %
6519 %                                                                             %
6520 %                                                                             %
6521 %   M a g i c k M o r p h o l o g y I m a g e                                 %
6522 %                                                                             %
6523 %                                                                             %
6524 %                                                                             %
6525 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6526 %
6527 %  MagickMorphologyImage() applies a user supplied kernel to the image
6528 %  according to the given mophology method.
6529 %
6530 %  The format of the MagickMorphologyImage method is:
6531 %
6532 %      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6533 %        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6534 %
6535 %  A description of each parameter follows:
6536 %
6537 %    o wand: the magick wand.
6538 %
6539 %    o method: the morphology method to be applied.
6540 %
6541 %    o iterations: apply the operation this many times (or no change).
6542 %      A value of -1 means loop until no change found.  How this is applied
6543 %      may depend on the morphology method.  Typically this is a value of 1.
6544 %
6545 %    o kernel: An array of doubles representing the morphology kernel.
6546 %
6547 */
6548 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6549   MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6550 {
6551   Image
6552     *morphology_image;
6553
6554   assert(wand != (MagickWand *) NULL);
6555   assert(wand->signature == WandSignature);
6556   if (wand->debug != MagickFalse)
6557     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6558   if (kernel == (const KernelInfo *) NULL)
6559     return(MagickFalse);
6560   if (wand->images == (Image *) NULL)
6561     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6562   morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6563     wand->exception);
6564   if (morphology_image == (Image *) NULL)
6565     return(MagickFalse);
6566   ReplaceImageInList(&wand->images,morphology_image);
6567   return(MagickTrue);
6568 }
6569 \f
6570 /*
6571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6572 %                                                                             %
6573 %                                                                             %
6574 %                                                                             %
6575 %   M a g i c k M o t i o n B l u r I m a g e                                 %
6576 %                                                                             %
6577 %                                                                             %
6578 %                                                                             %
6579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6580 %
6581 %  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6582 %  Gaussian operator of the given radius and standard deviation (sigma).
6583 %  For reasonable results, radius should be larger than sigma.  Use a
6584 %  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6585 %  Angle gives the angle of the blurring motion.
6586 %
6587 %  The format of the MagickMotionBlurImage method is:
6588 %
6589 %      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6590 %        const double radius,const double sigma,const double angle)
6591 %
6592 %  A description of each parameter follows:
6593 %
6594 %    o wand: the magick wand.
6595 %
6596 %    o radius: the radius of the Gaussian, in pixels, not counting
6597 %      the center pixel.
6598 %
6599 %    o sigma: the standard deviation of the Gaussian, in pixels.
6600 %
6601 %    o angle: Apply the effect along this angle.
6602 %
6603 */
6604 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6605   const double radius,const double sigma,const double angle)
6606 {
6607   Image
6608     *blur_image;
6609
6610   assert(wand != (MagickWand *) NULL);
6611   assert(wand->signature == WandSignature);
6612   if (wand->debug != MagickFalse)
6613     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6614   if (wand->images == (Image *) NULL)
6615     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6616   blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
6617   if (blur_image == (Image *) NULL)
6618     return(MagickFalse);
6619   ReplaceImageInList(&wand->images,blur_image);
6620   return(MagickTrue);
6621 }
6622 \f
6623 /*
6624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6625 %                                                                             %
6626 %                                                                             %
6627 %                                                                             %
6628 %   M a g i c k N e g a t e I m a g e                                         %
6629 %                                                                             %
6630 %                                                                             %
6631 %                                                                             %
6632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6633 %
6634 %  MagickNegateImage() negates the colors in the reference image.  The
6635 %  Grayscale option means that only grayscale values within the image are
6636 %  negated.
6637 %
6638 %  You can also reduce the influence of a particular channel with a gamma
6639 %  value of 0.
6640 %
6641 %  The format of the MagickNegateImage method is:
6642 %
6643 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
6644 %        const MagickBooleanType gray)
6645 %
6646 %  A description of each parameter follows:
6647 %
6648 %    o wand: the magick wand.
6649 %
6650 %    o gray: If MagickTrue, only negate grayscale pixels within the image.
6651 %
6652 */
6653 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6654   const MagickBooleanType gray)
6655 {
6656   MagickBooleanType
6657     status;
6658
6659   assert(wand != (MagickWand *) NULL);
6660   assert(wand->signature == WandSignature);
6661   if (wand->debug != MagickFalse)
6662     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6663   if (wand->images == (Image *) NULL)
6664     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6665   status=NegateImage(wand->images,gray,wand->exception);
6666   return(status);
6667 }
6668 \f
6669 /*
6670 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6671 %                                                                             %
6672 %                                                                             %
6673 %                                                                             %
6674 %   M a g i c k N e w I m a g e                                               %
6675 %                                                                             %
6676 %                                                                             %
6677 %                                                                             %
6678 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6679 %
6680 %  MagickNewImage() adds a blank image canvas of the specified size and
6681 %  background color to the wand.
6682 %
6683 %  The format of the MagickNewImage method is:
6684 %
6685 %      MagickBooleanType MagickNewImage(MagickWand *wand,
6686 %        const size_t columns,const size_t rows,
6687 %        const PixelWand *background)
6688 %
6689 %  A description of each parameter follows:
6690 %
6691 %    o wand: the magick wand.
6692 %
6693 %    o width: the image width.
6694 %
6695 %    o height: the image height.
6696 %
6697 %    o background: the image color.
6698 %
6699 */
6700 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,
6701   const size_t width,const size_t height,
6702   const PixelWand *background)
6703 {
6704   Image
6705     *images;
6706
6707   PixelInfo
6708     pixel;
6709
6710   assert(wand != (MagickWand *) NULL);
6711   assert(wand->signature == WandSignature);
6712   if (wand->debug != MagickFalse)
6713     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6714   PixelGetMagickColor(background,&pixel);
6715   images=NewMagickImage(wand->image_info,width,height,&pixel);
6716   if (images == (Image *) NULL)
6717     return(MagickFalse);
6718   if (images->exception.severity != UndefinedException)
6719     InheritException(wand->exception,&images->exception);
6720   return(InsertImageInWand(wand,images));
6721 }
6722 \f
6723 /*
6724 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6725 %                                                                             %
6726 %                                                                             %
6727 %                                                                             %
6728 %   M a g i c k N e x t I m a g e                                             %
6729 %                                                                             %
6730 %                                                                             %
6731 %                                                                             %
6732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6733 %
6734 %  MagickNextImage() associates the next image in the image list with a magick
6735 %  wand.
6736 %
6737 %  The format of the MagickNextImage method is:
6738 %
6739 %      MagickBooleanType MagickNextImage(MagickWand *wand)
6740 %
6741 %  A description of each parameter follows:
6742 %
6743 %    o wand: the magick wand.
6744 %
6745 */
6746 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
6747 {
6748   assert(wand != (MagickWand *) NULL);
6749   assert(wand->signature == WandSignature);
6750   if (wand->debug != MagickFalse)
6751     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6752   if (wand->images == (Image *) NULL)
6753     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6754   if (wand->pend != MagickFalse)
6755     {
6756       wand->pend=MagickFalse;
6757       return(MagickTrue);
6758     }
6759   if (GetNextImageInList(wand->images) == (Image *) NULL)
6760     {
6761       wand->pend=MagickTrue;
6762       return(MagickFalse);
6763     }
6764   wand->images=GetNextImageInList(wand->images);
6765   return(MagickTrue);
6766 }
6767 \f
6768 /*
6769 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6770 %                                                                             %
6771 %                                                                             %
6772 %                                                                             %
6773 %   M a g i c k N o r m a l i z e I m a g e                                   %
6774 %                                                                             %
6775 %                                                                             %
6776 %                                                                             %
6777 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6778 %
6779 %  MagickNormalizeImage() enhances the contrast of a color image by adjusting
6780 %  the pixels color to span the entire range of colors available
6781 %
6782 %  You can also reduce the influence of a particular channel with a gamma
6783 %  value of 0.
6784 %
6785 %  The format of the MagickNormalizeImage method is:
6786 %
6787 %      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6788 %
6789 %  A description of each parameter follows:
6790 %
6791 %    o wand: the magick wand.
6792 %
6793 */
6794 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6795 {
6796   MagickBooleanType
6797     status;
6798
6799   assert(wand != (MagickWand *) NULL);
6800   assert(wand->signature == WandSignature);
6801   if (wand->debug != MagickFalse)
6802     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6803   if (wand->images == (Image *) NULL)
6804     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6805   status=NormalizeImage(wand->images);
6806   if (status == MagickFalse)
6807     InheritException(wand->exception,&wand->images->exception);
6808   return(status);
6809 }
6810 \f
6811 /*
6812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6813 %                                                                             %
6814 %                                                                             %
6815 %                                                                             %
6816 %   M a g i c k O i l P a i n t I m a g e                                     %
6817 %                                                                             %
6818 %                                                                             %
6819 %                                                                             %
6820 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6821 %
6822 %  MagickOilPaintImage() applies a special effect filter that simulates an oil
6823 %  painting.  Each pixel is replaced by the most frequent color occurring
6824 %  in a circular region defined by radius.
6825 %
6826 %  The format of the MagickOilPaintImage method is:
6827 %
6828 %      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6829 %        const double radius)
6830 %
6831 %  A description of each parameter follows:
6832 %
6833 %    o wand: the magick wand.
6834 %
6835 %    o radius: the radius of the circular neighborhood.
6836 %
6837 */
6838 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6839   const double radius)
6840 {
6841   Image
6842     *paint_image;
6843
6844   assert(wand != (MagickWand *) NULL);
6845   assert(wand->signature == WandSignature);
6846   if (wand->debug != MagickFalse)
6847     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6848   if (wand->images == (Image *) NULL)
6849     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6850   paint_image=OilPaintImage(wand->images,radius,wand->exception);
6851   if (paint_image == (Image *) NULL)
6852     return(MagickFalse);
6853   ReplaceImageInList(&wand->images,paint_image);
6854   return(MagickTrue);
6855 }
6856 \f
6857 /*
6858 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6859 %                                                                             %
6860 %                                                                             %
6861 %                                                                             %
6862 %   M a g i c k O p a q u e P a i n t I m a g e                               %
6863 %                                                                             %
6864 %                                                                             %
6865 %                                                                             %
6866 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6867 %
6868 %  MagickOpaquePaintImage() changes any pixel that matches color with the color
6869 %  defined by fill.
6870 %
6871 %  The format of the MagickOpaquePaintImage method is:
6872 %
6873 %      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6874 %        const PixelWand *target,const PixelWand *fill,const double fuzz,
6875 %        const MagickBooleanType invert)
6876 %
6877 %  A description of each parameter follows:
6878 %
6879 %    o wand: the magick wand.
6880 %
6881 %    o target: Change this target color to the fill color within the image.
6882 %
6883 %    o fill: the fill pixel wand.
6884 %
6885 %    o fuzz: By default target must match a particular pixel color
6886 %      exactly.  However, in many cases two colors may differ by a small amount.
6887 %      The fuzz member of image defines how much tolerance is acceptable to
6888 %      consider two colors as the same.  For example, set fuzz to 10 and the
6889 %      color red at intensities of 100 and 102 respectively are now interpreted
6890 %      as the same color for the purposes of the floodfill.
6891 %
6892 %    o invert: paint any pixel that does not match the target color.
6893 %
6894 */
6895 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6896   const PixelWand *target,const PixelWand *fill,const double fuzz,
6897   const MagickBooleanType invert)
6898 {
6899   MagickBooleanType
6900     status;
6901
6902   PixelInfo
6903     fill_pixel,
6904     target_pixel;
6905
6906   assert(wand != (MagickWand *) NULL);
6907   assert(wand->signature == WandSignature);
6908   if (wand->debug != MagickFalse)
6909     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6910   if (wand->images == (Image *) NULL)
6911     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6912   PixelGetMagickColor(target,&target_pixel);
6913   PixelGetMagickColor(fill,&fill_pixel);
6914   wand->images->fuzz=fuzz;
6915   status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert);
6916   if (status == MagickFalse)
6917     InheritException(wand->exception,&wand->images->exception);
6918   return(status);
6919 }
6920 \f
6921 /*
6922 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6923 %                                                                             %
6924 %                                                                             %
6925 %                                                                             %
6926 %   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                         %
6927 %                                                                             %
6928 %                                                                             %
6929 %                                                                             %
6930 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6931 %
6932 %  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
6933 %  previous image in the sequence.  From this it attempts to select the
6934 %  smallest cropped image to replace each frame, while preserving the results
6935 %  of the animation.
6936 %
6937 %  The format of the MagickOptimizeImageLayers method is:
6938 %
6939 %      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6940 %
6941 %  A description of each parameter follows:
6942 %
6943 %    o wand: the magick wand.
6944 %
6945 */
6946 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6947 {
6948   Image
6949     *optimize_image;
6950
6951   assert(wand != (MagickWand *) NULL);
6952   assert(wand->signature == WandSignature);
6953   if (wand->debug != MagickFalse)
6954     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6955   if (wand->images == (Image *) NULL)
6956     return((MagickWand *) NULL);
6957   optimize_image=OptimizeImageLayers(wand->images,wand->exception);
6958   if (optimize_image == (Image *) NULL)
6959     return((MagickWand *) NULL);
6960   return(CloneMagickWandFromImages(wand,optimize_image));
6961 }
6962 \f
6963 /*
6964 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6965 %                                                                             %
6966 %                                                                             %
6967 %                                                                             %
6968 %     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                   %
6969 %                                                                             %
6970 %                                                                             %
6971 %                                                                             %
6972 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6973 %
6974 %  MagickOrderedPosterizeImage() performs an ordered dither based on a number
6975 %  of pre-defined dithering threshold maps, but over multiple intensity levels,
6976 %  which can be different for different channels, according to the input
6977 %  arguments.
6978 %
6979 %  The format of the MagickOrderedPosterizeImage method is:
6980 %
6981 %      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
6982 %        const char *threshold_map)
6983 %
6984 %  A description of each parameter follows:
6985 %
6986 %    o image: the image.
6987 %
6988 %    o threshold_map: A string containing the name of the threshold dither
6989 %      map to use, followed by zero or more numbers representing the number of
6990 %      color levels tho dither between.
6991 %
6992 %      Any level number less than 2 is equivalent to 2, and means only binary
6993 %      dithering will be applied to each color channel.
6994 %
6995 %      No numbers also means a 2 level (bitmap) dither will be applied to all
6996 %      channels, while a single number is the number of levels applied to each
6997 %      channel in sequence.  More numbers will be applied in turn to each of
6998 %      the color channels.
6999 %
7000 %      For example: "o3x3,6" generates a 6 level posterization of the image
7001 %      with a ordered 3x3 diffused pixel dither being applied between each
7002 %      level. While checker,8,8,4 will produce a 332 colormaped image with
7003 %      only a single checkerboard hash pattern (50% grey) between each color
7004 %      level, to basically double the number of color levels with a bare
7005 %      minimim of dithering.
7006 %
7007 */
7008 WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7009   const char *threshold_map)
7010 {
7011   MagickBooleanType
7012     status;
7013
7014   assert(wand != (MagickWand *) NULL);
7015   assert(wand->signature == WandSignature);
7016   if (wand->debug != MagickFalse)
7017     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7018   if (wand->images == (Image *) NULL)
7019     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7020   status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7021   return(status);
7022 }
7023 \f
7024 /*
7025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7026 %                                                                             %
7027 %                                                                             %
7028 %                                                                             %
7029 %   M a g i c k P i n g I m a g e                                             %
7030 %                                                                             %
7031 %                                                                             %
7032 %                                                                             %
7033 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7034 %
7035 %  MagickPingImage() is like MagickReadImage() except the only valid
7036 %  information returned is the image width, height, size, and format.  It
7037 %  is designed to efficiently obtain this information from a file without
7038 %  reading the entire image sequence into memory.
7039 %
7040 %  The format of the MagickPingImage method is:
7041 %
7042 %      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7043 %
7044 %  A description of each parameter follows:
7045 %
7046 %    o wand: the magick wand.
7047 %
7048 %    o filename: the image filename.
7049 %
7050 */
7051 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7052   const char *filename)
7053 {
7054   Image
7055     *images;
7056
7057   ImageInfo
7058     *ping_info;
7059
7060   assert(wand != (MagickWand *) NULL);
7061   assert(wand->signature == WandSignature);
7062   if (wand->debug != MagickFalse)
7063     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7064   ping_info=CloneImageInfo(wand->image_info);
7065   if (filename != (const char *) NULL)
7066     (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7067   images=PingImage(ping_info,wand->exception);
7068   ping_info=DestroyImageInfo(ping_info);
7069   if (images == (Image *) NULL)
7070     return(MagickFalse);
7071   return(InsertImageInWand(wand,images));
7072 }
7073 \f
7074 /*
7075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7076 %                                                                             %
7077 %                                                                             %
7078 %                                                                             %
7079 %   M a g i c k P i n g I m a g e B l o b                                     %
7080 %                                                                             %
7081 %                                                                             %
7082 %                                                                             %
7083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7084 %
7085 %  MagickPingImageBlob() pings an image or image sequence from a blob.
7086 %
7087 %  The format of the MagickPingImageBlob method is:
7088 %
7089 %      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7090 %        const void *blob,const size_t length)
7091 %
7092 %  A description of each parameter follows:
7093 %
7094 %    o wand: the magick wand.
7095 %
7096 %    o blob: the blob.
7097 %
7098 %    o length: the blob length.
7099 %
7100 */
7101 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7102   const void *blob,const size_t length)
7103 {
7104   Image
7105     *images;
7106
7107   ImageInfo
7108     *read_info;
7109
7110   assert(wand != (MagickWand *) NULL);
7111   assert(wand->signature == WandSignature);
7112   if (wand->debug != MagickFalse)
7113     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7114   read_info=CloneImageInfo(wand->image_info);
7115   SetImageInfoBlob(read_info,blob,length);
7116   images=PingImage(read_info,wand->exception);
7117   read_info=DestroyImageInfo(read_info);
7118   if (images == (Image *) NULL)
7119     return(MagickFalse);
7120   return(InsertImageInWand(wand,images));
7121 }
7122 \f
7123 /*
7124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7125 %                                                                             %
7126 %                                                                             %
7127 %                                                                             %
7128 %   M a g i c k P i n g I m a g e F i l e                                     %
7129 %                                                                             %
7130 %                                                                             %
7131 %                                                                             %
7132 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7133 %
7134 %  MagickPingImageFile() pings an image or image sequence from an open file
7135 %  descriptor.
7136 %
7137 %  The format of the MagickPingImageFile method is:
7138 %
7139 %      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7140 %
7141 %  A description of each parameter follows:
7142 %
7143 %    o wand: the magick wand.
7144 %
7145 %    o file: the file descriptor.
7146 %
7147 */
7148 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7149 {
7150   Image
7151     *images;
7152
7153   ImageInfo
7154     *read_info;
7155
7156   assert(wand != (MagickWand *) NULL);
7157   assert(wand->signature == WandSignature);
7158   assert(file != (FILE *) NULL);
7159   if (wand->debug != MagickFalse)
7160     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7161   read_info=CloneImageInfo(wand->image_info);
7162   SetImageInfoFile(read_info,file);
7163   images=PingImage(read_info,wand->exception);
7164   read_info=DestroyImageInfo(read_info);
7165   if (images == (Image *) NULL)
7166     return(MagickFalse);
7167   return(InsertImageInWand(wand,images));
7168 }
7169 \f
7170 /*
7171 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7172 %                                                                             %
7173 %                                                                             %
7174 %                                                                             %
7175 %   M a g i c k P o l a r o i d I m a g e                                     %
7176 %                                                                             %
7177 %                                                                             %
7178 %                                                                             %
7179 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7180 %
7181 %  MagickPolaroidImage() simulates a Polaroid picture.
7182 %
7183 %  The format of the MagickPolaroidImage method is:
7184 %
7185 %      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7186 %        const DrawingWand *drawing_wand,const double angle)
7187 %
7188 %  A description of each parameter follows:
7189 %
7190 %    o wand: the magick wand.
7191 %
7192 %    o drawing_wand: the draw wand.
7193 %
7194 %    o angle: Apply the effect along this angle.
7195 %
7196 */
7197 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7198   const DrawingWand *drawing_wand,const double angle)
7199 {
7200   DrawInfo
7201     *draw_info;
7202
7203   Image
7204     *polaroid_image;
7205
7206   assert(wand != (MagickWand *) NULL);
7207   assert(wand->signature == WandSignature);
7208   if (wand->debug != MagickFalse)
7209     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7210   if (wand->images == (Image *) NULL)
7211     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7212   draw_info=PeekDrawingWand(drawing_wand);
7213   if (draw_info == (DrawInfo *) NULL)
7214     return(MagickFalse);
7215   polaroid_image=PolaroidImage(wand->images,draw_info,angle,wand->exception);
7216   if (polaroid_image == (Image *) NULL)
7217     return(MagickFalse);
7218   ReplaceImageInList(&wand->images,polaroid_image);
7219   return(MagickTrue);
7220 }
7221 \f
7222 /*
7223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7224 %                                                                             %
7225 %                                                                             %
7226 %                                                                             %
7227 %   M a g i c k P o s t e r i z e I m a g e                                   %
7228 %                                                                             %
7229 %                                                                             %
7230 %                                                                             %
7231 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7232 %
7233 %  MagickPosterizeImage() reduces the image to a limited number of color level.
7234 %
7235 %  The format of the MagickPosterizeImage method is:
7236 %
7237 %      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7238 %        const unsigned levels,const MagickBooleanType dither)
7239 %
7240 %  A description of each parameter follows:
7241 %
7242 %    o wand: the magick wand.
7243 %
7244 %    o levels: Number of color levels allowed in each channel.  Very low values
7245 %      (2, 3, or 4) have the most visible effect.
7246 %
7247 %    o dither: Set this integer value to something other than zero to dither
7248 %      the mapped image.
7249 %
7250 */
7251 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7252   const size_t levels,const MagickBooleanType dither)
7253 {
7254   MagickBooleanType
7255     status;
7256
7257   assert(wand != (MagickWand *) NULL);
7258   assert(wand->signature == WandSignature);
7259   if (wand->debug != MagickFalse)
7260     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7261   if (wand->images == (Image *) NULL)
7262     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7263   status=PosterizeImage(wand->images,levels,dither);
7264   if (status == MagickFalse)
7265     InheritException(wand->exception,&wand->images->exception);
7266   return(status);
7267 }
7268 \f
7269 /*
7270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7271 %                                                                             %
7272 %                                                                             %
7273 %                                                                             %
7274 %   M a g i c k P r e v i e w I m a g e s                                     %
7275 %                                                                             %
7276 %                                                                             %
7277 %                                                                             %
7278 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7279 %
7280 %  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7281 %  image processing operation applied at varying strengths.  This helpful
7282 %  to quickly pin-point an appropriate parameter for an image processing
7283 %  operation.
7284 %
7285 %  The format of the MagickPreviewImages method is:
7286 %
7287 %      MagickWand *MagickPreviewImages(MagickWand *wand,
7288 %        const PreviewType preview)
7289 %
7290 %  A description of each parameter follows:
7291 %
7292 %    o wand: the magick wand.
7293 %
7294 %    o preview: the preview type.
7295 %
7296 */
7297 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7298   const PreviewType preview)
7299 {
7300   Image
7301     *preview_image;
7302
7303   assert(wand != (MagickWand *) NULL);
7304   assert(wand->signature == WandSignature);
7305   if (wand->debug != MagickFalse)
7306     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7307   if (wand->images == (Image *) NULL)
7308     return((MagickWand *) NULL);
7309   preview_image=PreviewImage(wand->images,preview,wand->exception);
7310   if (preview_image == (Image *) NULL)
7311     return((MagickWand *) NULL);
7312   return(CloneMagickWandFromImages(wand,preview_image));
7313 }
7314 \f
7315 /*
7316 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7317 %                                                                             %
7318 %                                                                             %
7319 %                                                                             %
7320 %   M a g i c k P r e v i o u s I m a g e                                     %
7321 %                                                                             %
7322 %                                                                             %
7323 %                                                                             %
7324 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7325 %
7326 %  MagickPreviousImage() assocates the previous image in an image list with
7327 %  the magick wand.
7328 %
7329 %  The format of the MagickPreviousImage method is:
7330 %
7331 %      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7332 %
7333 %  A description of each parameter follows:
7334 %
7335 %    o wand: the magick wand.
7336 %
7337 */
7338 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7339 {
7340   assert(wand != (MagickWand *) NULL);
7341   assert(wand->signature == WandSignature);
7342   if (wand->debug != MagickFalse)
7343     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7344   if (wand->images == (Image *) NULL)
7345     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7346   if (wand->pend != MagickFalse)
7347     {
7348       wand->pend=MagickFalse;
7349       return(MagickTrue);
7350     }
7351   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7352     {
7353       wand->pend=MagickTrue;
7354       return(MagickFalse);
7355     }
7356   wand->images=GetPreviousImageInList(wand->images);
7357   return(MagickTrue);
7358 }
7359 \f
7360 /*
7361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7362 %                                                                             %
7363 %                                                                             %
7364 %                                                                             %
7365 %   M a g i c k Q u a n t i z e I m a g e                                     %
7366 %                                                                             %
7367 %                                                                             %
7368 %                                                                             %
7369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7370 %
7371 %  MagickQuantizeImage() analyzes the colors within a reference image and
7372 %  chooses a fixed number of colors to represent the image.  The goal of the
7373 %  algorithm is to minimize the color difference between the input and output
7374 %  image while minimizing the processing time.
7375 %
7376 %  The format of the MagickQuantizeImage method is:
7377 %
7378 %      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7379 %        const size_t number_colors,const ColorspaceType colorspace,
7380 %        const size_t treedepth,const MagickBooleanType dither,
7381 %        const MagickBooleanType measure_error)
7382 %
7383 %  A description of each parameter follows:
7384 %
7385 %    o wand: the magick wand.
7386 %
7387 %    o number_colors: the number of colors.
7388 %
7389 %    o colorspace: Perform color reduction in this colorspace, typically
7390 %      RGBColorspace.
7391 %
7392 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7393 %      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
7394 %      reference image with the least amount of memory and the fastest
7395 %      computational speed.  In some cases, such as an image with low color
7396 %      dispersion (a few number of colors), a value other than
7397 %      Log4(number_colors) is required.  To expand the color tree completely,
7398 %      use a value of 8.
7399 %
7400 %    o dither: A value other than zero distributes the difference between an
7401 %      original image and the corresponding color reduced image to
7402 %      neighboring pixels along a Hilbert curve.
7403 %
7404 %    o measure_error: A value other than zero measures the difference between
7405 %      the original and quantized images.  This difference is the total
7406 %      quantization error.  The error is computed by summing over all pixels
7407 %      in an image the distance squared in RGB space between each reference
7408 %      pixel value and its quantized value.
7409 %
7410 */
7411 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7412   const size_t number_colors,const ColorspaceType colorspace,
7413   const size_t treedepth,const MagickBooleanType dither,
7414   const MagickBooleanType measure_error)
7415 {
7416   MagickBooleanType
7417     status;
7418
7419   QuantizeInfo
7420     *quantize_info;
7421
7422   assert(wand != (MagickWand *) NULL);
7423   assert(wand->signature == WandSignature);
7424   if (wand->debug != MagickFalse)
7425     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7426   if (wand->images == (Image *) NULL)
7427     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7428   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7429   quantize_info->number_colors=number_colors;
7430   quantize_info->dither=dither;
7431   quantize_info->tree_depth=treedepth;
7432   quantize_info->colorspace=colorspace;
7433   quantize_info->measure_error=measure_error;
7434   status=QuantizeImage(quantize_info,wand->images);
7435   if (status == MagickFalse)
7436     InheritException(wand->exception,&wand->images->exception);
7437   quantize_info=DestroyQuantizeInfo(quantize_info);
7438   return(status);
7439 }
7440 \f
7441 /*
7442 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7443 %                                                                             %
7444 %                                                                             %
7445 %                                                                             %
7446 %   M a g i c k Q u a n t i z e I m a g e s                                   %
7447 %                                                                             %
7448 %                                                                             %
7449 %                                                                             %
7450 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7451 %
7452 %  MagickQuantizeImages() analyzes the colors within a sequence of images and
7453 %  chooses a fixed number of colors to represent the image.  The goal of the
7454 %  algorithm is to minimize the color difference between the input and output
7455 %  image while minimizing the processing time.
7456 %
7457 %  The format of the MagickQuantizeImages method is:
7458 %
7459 %      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7460 %        const size_t number_colors,const ColorspaceType colorspace,
7461 %        const size_t treedepth,const MagickBooleanType dither,
7462 %        const MagickBooleanType measure_error)
7463 %
7464 %  A description of each parameter follows:
7465 %
7466 %    o wand: the magick wand.
7467 %
7468 %    o number_colors: the number of colors.
7469 %
7470 %    o colorspace: Perform color reduction in this colorspace, typically
7471 %      RGBColorspace.
7472 %
7473 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7474 %      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
7475 %      reference image with the least amount of memory and the fastest
7476 %      computational speed.  In some cases, such as an image with low color
7477 %      dispersion (a few number of colors), a value other than
7478 %      Log4(number_colors) is required.  To expand the color tree completely,
7479 %      use a value of 8.
7480 %
7481 %    o dither: A value other than zero distributes the difference between an
7482 %      original image and the corresponding color reduced algorithm to
7483 %      neighboring pixels along a Hilbert curve.
7484 %
7485 %    o measure_error: A value other than zero measures the difference between
7486 %      the original and quantized images.  This difference is the total
7487 %      quantization error.  The error is computed by summing over all pixels
7488 %      in an image the distance squared in RGB space between each reference
7489 %      pixel value and its quantized value.
7490 %
7491 */
7492 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7493   const size_t number_colors,const ColorspaceType colorspace,
7494   const size_t treedepth,const MagickBooleanType dither,
7495   const MagickBooleanType measure_error)
7496 {
7497   MagickBooleanType
7498     status;
7499
7500   QuantizeInfo
7501     *quantize_info;
7502
7503   assert(wand != (MagickWand *) NULL);
7504   assert(wand->signature == WandSignature);
7505   if (wand->debug != MagickFalse)
7506     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7507   if (wand->images == (Image *) NULL)
7508     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7509   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7510   quantize_info->number_colors=number_colors;
7511   quantize_info->dither=dither;
7512   quantize_info->tree_depth=treedepth;
7513   quantize_info->colorspace=colorspace;
7514   quantize_info->measure_error=measure_error;
7515   status=QuantizeImages(quantize_info,wand->images);
7516   if (status == MagickFalse)
7517     InheritException(wand->exception,&wand->images->exception);
7518   quantize_info=DestroyQuantizeInfo(quantize_info);
7519   return(status);
7520 }
7521 \f
7522 /*
7523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7524 %                                                                             %
7525 %                                                                             %
7526 %                                                                             %
7527 %   M a g i c k R a d i a l B l u r I m a g e                                 %
7528 %                                                                             %
7529 %                                                                             %
7530 %                                                                             %
7531 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7532 %
7533 %  MagickRadialBlurImage() radial blurs an image.
7534 %
7535 %  The format of the MagickRadialBlurImage method is:
7536 %
7537 %      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7538 %        const double angle)
7539 %
7540 %  A description of each parameter follows:
7541 %
7542 %    o wand: the magick wand.
7543 %
7544 %    o angle: the angle of the blur in degrees.
7545 %
7546 */
7547 WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7548   const double angle)
7549 {
7550   Image
7551     *blur_image;
7552
7553   assert(wand != (MagickWand *) NULL);
7554   assert(wand->signature == WandSignature);
7555   if (wand->debug != MagickFalse)
7556     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7557   if (wand->images == (Image *) NULL)
7558     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7559   blur_image=RadialBlurImage(wand->images,angle,wand->exception);
7560   if (blur_image == (Image *) NULL)
7561     return(MagickFalse);
7562   ReplaceImageInList(&wand->images,blur_image);
7563   return(MagickTrue);
7564 }
7565 \f
7566 /*
7567 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7568 %                                                                             %
7569 %                                                                             %
7570 %                                                                             %
7571 %   M a g i c k R a i s e I m a g e                                           %
7572 %                                                                             %
7573 %                                                                             %
7574 %                                                                             %
7575 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7576 %
7577 %  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7578 %  by lightening and darkening the edges of the image.  Members width and
7579 %  height of raise_info define the width of the vertical and horizontal
7580 %  edge of the effect.
7581 %
7582 %  The format of the MagickRaiseImage method is:
7583 %
7584 %      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7585 %        const size_t width,const size_t height,const ssize_t x,
7586 %        const ssize_t y,const MagickBooleanType raise)
7587 %
7588 %  A description of each parameter follows:
7589 %
7590 %    o wand: the magick wand.
7591 %
7592 %    o width,height,x,y:  Define the dimensions of the area to raise.
7593 %
7594 %    o raise: A value other than zero creates a 3-D raise effect,
7595 %      otherwise it has a lowered effect.
7596 %
7597 */
7598 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7599   const size_t width,const size_t height,const ssize_t x,
7600   const ssize_t y,const MagickBooleanType raise)
7601 {
7602   MagickBooleanType
7603     status;
7604
7605   RectangleInfo
7606     raise_info;
7607
7608   assert(wand != (MagickWand *) NULL);
7609   assert(wand->signature == WandSignature);
7610   if (wand->debug != MagickFalse)
7611     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7612   if (wand->images == (Image *) NULL)
7613     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7614   raise_info.width=width;
7615   raise_info.height=height;
7616   raise_info.x=x;
7617   raise_info.y=y;
7618   status=RaiseImage(wand->images,&raise_info,raise);
7619   if (status == MagickFalse)
7620     InheritException(wand->exception,&wand->images->exception);
7621   return(status);
7622 }
7623 \f
7624 /*
7625 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7626 %                                                                             %
7627 %                                                                             %
7628 %                                                                             %
7629 %   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                       %
7630 %                                                                             %
7631 %                                                                             %
7632 %                                                                             %
7633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7634 %
7635 %  MagickRandomThresholdImage() changes the value of individual pixels based on
7636 %  the intensity of each pixel compared to threshold.  The result is a
7637 %  high-contrast, two color image.
7638 %
7639 %  The format of the MagickRandomThresholdImage method is:
7640 %
7641 %      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7642 %        const double low,const double high)
7643 %
7644 %  A description of each parameter follows:
7645 %
7646 %    o wand: the magick wand.
7647 %
7648 %    o low,high: Specify the high and low thresholds.  These values range from
7649 %      0 to QuantumRange.
7650 %
7651 */
7652 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7653   const double low,const double high)
7654 {
7655   char
7656     threshold[MaxTextExtent];
7657
7658   MagickBooleanType
7659     status;
7660
7661   assert(wand != (MagickWand *) NULL);
7662   assert(wand->signature == WandSignature);
7663   if (wand->debug != MagickFalse)
7664     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7665   if (wand->images == (Image *) NULL)
7666     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7667   (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
7668   status=RandomThresholdImage(wand->images,threshold,wand->exception);
7669   if (status == MagickFalse)
7670     InheritException(wand->exception,&wand->images->exception);
7671   return(status);
7672 }
7673 \f
7674 /*
7675 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7676 %                                                                             %
7677 %                                                                             %
7678 %                                                                             %
7679 %   M a g i c k R e a d I m a g e                                             %
7680 %                                                                             %
7681 %                                                                             %
7682 %                                                                             %
7683 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7684 %
7685 %  MagickReadImage() reads an image or image sequence.  The images are inserted
7686 %  at the current image pointer position.   Use MagickSetFirstIterator(),
7687 %  MagickSetLastIterator, or MagickSetImageIndex() to specify the current
7688 %  image pointer position at the beginning of the image list, the end, or
7689 %  anywhere in-between respectively.
7690 %
7691 %  The format of the MagickReadImage method is:
7692 %
7693 %      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
7694 %
7695 %  A description of each parameter follows:
7696 %
7697 %    o wand: the magick wand.
7698 %
7699 %    o filename: the image filename.
7700 %
7701 */
7702 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
7703   const char *filename)
7704 {
7705   Image
7706     *images;
7707
7708   ImageInfo
7709     *read_info;
7710
7711   assert(wand != (MagickWand *) NULL);
7712   assert(wand->signature == WandSignature);
7713   if (wand->debug != MagickFalse)
7714     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7715   read_info=CloneImageInfo(wand->image_info);
7716   if (filename != (const char *) NULL)
7717     (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
7718   images=ReadImage(read_info,wand->exception);
7719   read_info=DestroyImageInfo(read_info);
7720   if (images == (Image *) NULL)
7721     return(MagickFalse);
7722   return(InsertImageInWand(wand,images));
7723 }
7724 \f
7725 /*
7726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7727 %                                                                             %
7728 %                                                                             %
7729 %                                                                             %
7730 %   M a g i c k R e a d I m a g e B l o b                                     %
7731 %                                                                             %
7732 %                                                                             %
7733 %                                                                             %
7734 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7735 %
7736 %  MagickReadImageBlob() reads an image or image sequence from a blob.
7737 %
7738 %  The format of the MagickReadImageBlob method is:
7739 %
7740 %      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7741 %        const void *blob,const size_t length)
7742 %
7743 %  A description of each parameter follows:
7744 %
7745 %    o wand: the magick wand.
7746 %
7747 %    o blob: the blob.
7748 %
7749 %    o length: the blob length.
7750 %
7751 */
7752 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7753   const void *blob,const size_t length)
7754 {
7755   Image
7756     *images;
7757
7758   assert(wand != (MagickWand *) NULL);
7759   assert(wand->signature == WandSignature);
7760   if (wand->debug != MagickFalse)
7761     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7762   images=BlobToImage(wand->image_info,blob,length,wand->exception);
7763   if (images == (Image *) NULL)
7764     return(MagickFalse);
7765   return(InsertImageInWand(wand,images));
7766 }
7767 \f
7768 /*
7769 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7770 %                                                                             %
7771 %                                                                             %
7772 %                                                                             %
7773 %   M a g i c k R e a d I m a g e F i l e                                     %
7774 %                                                                             %
7775 %                                                                             %
7776 %                                                                             %
7777 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7778 %
7779 %  MagickReadImageFile() reads an image or image sequence from an open file
7780 %  descriptor.
7781 %
7782 %  The format of the MagickReadImageFile method is:
7783 %
7784 %      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7785 %
7786 %  A description of each parameter follows:
7787 %
7788 %    o wand: the magick wand.
7789 %
7790 %    o file: the file descriptor.
7791 %
7792 */
7793 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7794 {
7795   Image
7796     *images;
7797
7798   ImageInfo
7799     *read_info;
7800
7801   assert(wand != (MagickWand *) NULL);
7802   assert(wand->signature == WandSignature);
7803   assert(file != (FILE *) NULL);
7804   if (wand->debug != MagickFalse)
7805     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7806   read_info=CloneImageInfo(wand->image_info);
7807   SetImageInfoFile(read_info,file);
7808   images=ReadImage(read_info,wand->exception);
7809   read_info=DestroyImageInfo(read_info);
7810   if (images == (Image *) NULL)
7811     return(MagickFalse);
7812   return(InsertImageInWand(wand,images));
7813 }
7814 \f
7815 /*
7816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7817 %                                                                             %
7818 %                                                                             %
7819 %                                                                             %
7820 %   M a g i c k R e m a p I m a g e                                           %
7821 %                                                                             %
7822 %                                                                             %
7823 %                                                                             %
7824 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7825 %
7826 %  MagickRemapImage() replaces the colors of an image with the closest color
7827 %  from a reference image.
7828 %
7829 %  The format of the MagickRemapImage method is:
7830 %
7831 %      MagickBooleanType MagickRemapImage(MagickWand *wand,
7832 %        const MagickWand *remap_wand,const DitherMethod method)
7833 %
7834 %  A description of each parameter follows:
7835 %
7836 %    o wand: the magick wand.
7837 %
7838 %    o affinity: the affinity wand.
7839 %
7840 %    o method: choose from these dither methods: NoDitherMethod,
7841 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7842 %
7843 */
7844 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
7845   const MagickWand *remap_wand,const DitherMethod method)
7846 {
7847   MagickBooleanType
7848     status;
7849
7850   QuantizeInfo
7851     *quantize_info;
7852
7853   assert(wand != (MagickWand *) NULL);
7854   assert(wand->signature == WandSignature);
7855   if (wand->debug != MagickFalse)
7856     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7857   if ((wand->images == (Image *) NULL) ||
7858       (remap_wand->images == (Image *) NULL))
7859     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7860   quantize_info=AcquireQuantizeInfo(wand->image_info);
7861   quantize_info->dither_method=method;
7862   if (method == NoDitherMethod)
7863     quantize_info->dither=MagickFalse;
7864   status=RemapImage(quantize_info,wand->images,remap_wand->images);
7865   quantize_info=DestroyQuantizeInfo(quantize_info);
7866   if (status == MagickFalse)
7867     InheritException(wand->exception,&wand->images->exception);
7868   return(status);
7869 }
7870 \f
7871 /*
7872 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7873 %                                                                             %
7874 %                                                                             %
7875 %                                                                             %
7876 %   M a g i c k R e m o v e I m a g e                                         %
7877 %                                                                             %
7878 %                                                                             %
7879 %                                                                             %
7880 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7881 %
7882 %  MagickRemoveImage() removes an image from the image list.
7883 %
7884 %  The format of the MagickRemoveImage method is:
7885 %
7886 %      MagickBooleanType MagickRemoveImage(MagickWand *wand)
7887 %
7888 %  A description of each parameter follows:
7889 %
7890 %    o wand: the magick wand.
7891 %
7892 %    o insert: the splice wand.
7893 %
7894 */
7895 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
7896 {
7897   assert(wand != (MagickWand *) NULL);
7898   assert(wand->signature == WandSignature);
7899   if (wand->debug != MagickFalse)
7900     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7901   if (wand->images == (Image *) NULL)
7902     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7903   DeleteImageFromList(&wand->images);
7904   return(MagickTrue);
7905 }
7906 \f
7907 /*
7908 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7909 %                                                                             %
7910 %                                                                             %
7911 %                                                                             %
7912 %   M a g i c k R e s a m p l e I m a g e                                     %
7913 %                                                                             %
7914 %                                                                             %
7915 %                                                                             %
7916 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7917 %
7918 %  MagickResampleImage() resample image to desired resolution.
7919 %
7920 %    Bessel   Blackman   Box
7921 %    Catrom   Cubic      Gaussian
7922 %    Hanning  Hermite    Lanczos
7923 %    Mitchell Point      Quandratic
7924 %    Sinc     Triangle
7925 %
7926 %  Most of the filters are FIR (finite impulse response), however, Bessel,
7927 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
7928 %  are windowed (brought down to zero) with the Blackman filter.
7929 %
7930 %  The format of the MagickResampleImage method is:
7931 %
7932 %      MagickBooleanType MagickResampleImage(MagickWand *wand,
7933 %        const double x_resolution,const double y_resolution,
7934 %        const FilterTypes filter,const double blur)
7935 %
7936 %  A description of each parameter follows:
7937 %
7938 %    o wand: the magick wand.
7939 %
7940 %    o x_resolution: the new image x resolution.
7941 %
7942 %    o y_resolution: the new image y resolution.
7943 %
7944 %    o filter: Image filter to use.
7945 %
7946 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
7947 %
7948 */
7949 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
7950   const double x_resolution,const double y_resolution,const FilterTypes filter,
7951   const double blur)
7952 {
7953   Image
7954     *resample_image;
7955
7956   assert(wand != (MagickWand *) NULL);
7957   assert(wand->signature == WandSignature);
7958   if (wand->debug != MagickFalse)
7959     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7960   if (wand->images == (Image *) NULL)
7961     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7962   resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
7963     blur,wand->exception);
7964   if (resample_image == (Image *) NULL)
7965     return(MagickFalse);
7966   ReplaceImageInList(&wand->images,resample_image);
7967   return(MagickTrue);
7968 }
7969 \f
7970 /*
7971 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7972 %                                                                             %
7973 %                                                                             %
7974 %                                                                             %
7975 %   M a g i c k R e s e t I m a g e P a g e                                   %
7976 %                                                                             %
7977 %                                                                             %
7978 %                                                                             %
7979 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7980 %
7981 %  MagickResetImagePage() resets the Wand page canvas and position.
7982 %
7983 %  The format of the MagickResetImagePage method is:
7984 %
7985 %      MagickBooleanType MagickResetImagePage(MagickWand *wand,
7986 %        const char *page)
7987 %
7988 %  A description of each parameter follows:
7989 %
7990 %    o wand: the magick wand.
7991 %
7992 %    o page: the relative page specification.
7993 %
7994 */
7995 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
7996   const char *page)
7997 {
7998   assert(wand != (MagickWand *) NULL);
7999   assert(wand->signature == WandSignature);
8000   if (wand->debug != MagickFalse)
8001     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8002   if (wand->images == (Image *) NULL)
8003     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8004   if ((page == (char *) NULL) || (*page == '\0'))
8005     {
8006       (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8007       return(MagickTrue);
8008     }
8009   return(ResetImagePage(wand->images,page));
8010 }
8011 \f
8012 /*
8013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8014 %                                                                             %
8015 %                                                                             %
8016 %                                                                             %
8017 %   M a g i c k R e s i z e I m a g e                                         %
8018 %                                                                             %
8019 %                                                                             %
8020 %                                                                             %
8021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8022 %
8023 %  MagickResizeImage() scales an image to the desired dimensions with one of
8024 %  these filters:
8025 %
8026 %    Bessel   Blackman   Box
8027 %    Catrom   Cubic      Gaussian
8028 %    Hanning  Hermite    Lanczos
8029 %    Mitchell Point      Quandratic
8030 %    Sinc     Triangle
8031 %
8032 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8033 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8034 %  are windowed (brought down to zero) with the Blackman filter.
8035 %
8036 %  The format of the MagickResizeImage method is:
8037 %
8038 %      MagickBooleanType MagickResizeImage(MagickWand *wand,
8039 %        const size_t columns,const size_t rows,
8040 %        const FilterTypes filter,const double blur)
8041 %
8042 %  A description of each parameter follows:
8043 %
8044 %    o wand: the magick wand.
8045 %
8046 %    o columns: the number of columns in the scaled image.
8047 %
8048 %    o rows: the number of rows in the scaled image.
8049 %
8050 %    o filter: Image filter to use.
8051 %
8052 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8053 %
8054 */
8055 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8056   const size_t columns,const size_t rows,const FilterTypes filter,
8057   const double blur)
8058 {
8059   Image
8060     *resize_image;
8061
8062   assert(wand != (MagickWand *) NULL);
8063   assert(wand->signature == WandSignature);
8064   if (wand->debug != MagickFalse)
8065     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8066   if (wand->images == (Image *) NULL)
8067     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8068   resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8069     wand->exception);
8070   if (resize_image == (Image *) NULL)
8071     return(MagickFalse);
8072   ReplaceImageInList(&wand->images,resize_image);
8073   return(MagickTrue);
8074 }
8075 \f
8076 /*
8077 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8078 %                                                                             %
8079 %                                                                             %
8080 %                                                                             %
8081 %   M a g i c k R o l l I m a g e                                             %
8082 %                                                                             %
8083 %                                                                             %
8084 %                                                                             %
8085 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8086 %
8087 %  MagickRollImage() offsets an image as defined by x and y.
8088 %
8089 %  The format of the MagickRollImage method is:
8090 %
8091 %      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8092 %        const size_t y)
8093 %
8094 %  A description of each parameter follows:
8095 %
8096 %    o wand: the magick wand.
8097 %
8098 %    o x: the x offset.
8099 %
8100 %    o y: the y offset.
8101 %
8102 %
8103 */
8104 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8105   const ssize_t x,const ssize_t y)
8106 {
8107   Image
8108     *roll_image;
8109
8110   assert(wand != (MagickWand *) NULL);
8111   assert(wand->signature == WandSignature);
8112   if (wand->debug != MagickFalse)
8113     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8114   if (wand->images == (Image *) NULL)
8115     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8116   roll_image=RollImage(wand->images,x,y,wand->exception);
8117   if (roll_image == (Image *) NULL)
8118     return(MagickFalse);
8119   ReplaceImageInList(&wand->images,roll_image);
8120   return(MagickTrue);
8121 }
8122 \f
8123 /*
8124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8125 %                                                                             %
8126 %                                                                             %
8127 %                                                                             %
8128 %   M a g i c k R o t a t e I m a g e                                         %
8129 %                                                                             %
8130 %                                                                             %
8131 %                                                                             %
8132 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8133 %
8134 %  MagickRotateImage() rotates an image the specified number of degrees. Empty
8135 %  triangles left over from rotating the image are filled with the
8136 %  background color.
8137 %
8138 %  The format of the MagickRotateImage method is:
8139 %
8140 %      MagickBooleanType MagickRotateImage(MagickWand *wand,
8141 %        const PixelWand *background,const double degrees)
8142 %
8143 %  A description of each parameter follows:
8144 %
8145 %    o wand: the magick wand.
8146 %
8147 %    o background: the background pixel wand.
8148 %
8149 %    o degrees: the number of degrees to rotate the image.
8150 %
8151 %
8152 */
8153 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8154   const PixelWand *background,const double degrees)
8155 {
8156   Image
8157     *rotate_image;
8158
8159   assert(wand != (MagickWand *) NULL);
8160   assert(wand->signature == WandSignature);
8161   if (wand->debug != MagickFalse)
8162     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8163   if (wand->images == (Image *) NULL)
8164     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8165   PixelGetQuantumPacket(background,&wand->images->background_color);
8166   rotate_image=RotateImage(wand->images,degrees,wand->exception);
8167   if (rotate_image == (Image *) NULL)
8168     return(MagickFalse);
8169   ReplaceImageInList(&wand->images,rotate_image);
8170   return(MagickTrue);
8171 }
8172 \f
8173 /*
8174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8175 %                                                                             %
8176 %                                                                             %
8177 %                                                                             %
8178 %   M a g i c k S a m p l e I m a g e                                         %
8179 %                                                                             %
8180 %                                                                             %
8181 %                                                                             %
8182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8183 %
8184 %  MagickSampleImage() scales an image to the desired dimensions with pixel
8185 %  sampling.  Unlike other scaling methods, this method does not introduce
8186 %  any additional color into the scaled image.
8187 %
8188 %  The format of the MagickSampleImage method is:
8189 %
8190 %      MagickBooleanType MagickSampleImage(MagickWand *wand,
8191 %        const size_t columns,const size_t rows)
8192 %
8193 %  A description of each parameter follows:
8194 %
8195 %    o wand: the magick wand.
8196 %
8197 %    o columns: the number of columns in the scaled image.
8198 %
8199 %    o rows: the number of rows in the scaled image.
8200 %
8201 %
8202 */
8203 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8204   const size_t columns,const size_t rows)
8205 {
8206   Image
8207     *sample_image;
8208
8209   assert(wand != (MagickWand *) NULL);
8210   assert(wand->signature == WandSignature);
8211   if (wand->debug != MagickFalse)
8212     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8213   if (wand->images == (Image *) NULL)
8214     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8215   sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8216   if (sample_image == (Image *) NULL)
8217     return(MagickFalse);
8218   ReplaceImageInList(&wand->images,sample_image);
8219   return(MagickTrue);
8220 }
8221 \f
8222 /*
8223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8224 %                                                                             %
8225 %                                                                             %
8226 %                                                                             %
8227 %   M a g i c k S c a l e I m a g e                                           %
8228 %                                                                             %
8229 %                                                                             %
8230 %                                                                             %
8231 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8232 %
8233 %  MagickScaleImage() scales the size of an image to the given dimensions.
8234 %
8235 %  The format of the MagickScaleImage method is:
8236 %
8237 %      MagickBooleanType MagickScaleImage(MagickWand *wand,
8238 %        const size_t columns,const size_t rows)
8239 %
8240 %  A description of each parameter follows:
8241 %
8242 %    o wand: the magick wand.
8243 %
8244 %    o columns: the number of columns in the scaled image.
8245 %
8246 %    o rows: the number of rows in the scaled image.
8247 %
8248 %
8249 */
8250 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8251   const size_t columns,const size_t rows)
8252 {
8253   Image
8254     *scale_image;
8255
8256   assert(wand != (MagickWand *) NULL);
8257   assert(wand->signature == WandSignature);
8258   if (wand->debug != MagickFalse)
8259     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8260   if (wand->images == (Image *) NULL)
8261     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8262   scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8263   if (scale_image == (Image *) NULL)
8264     return(MagickFalse);
8265   ReplaceImageInList(&wand->images,scale_image);
8266   return(MagickTrue);
8267 }
8268 \f
8269 /*
8270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8271 %                                                                             %
8272 %                                                                             %
8273 %                                                                             %
8274 %   M a g i c k S e g m e n t I m a g e                                       %
8275 %                                                                             %
8276 %                                                                             %
8277 %                                                                             %
8278 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8279 %
8280 %  MagickSegmentImage() segments an image by analyzing the histograms of the
8281 %  color components and identifying units that are homogeneous with the fuzzy
8282 %  C-means technique.
8283 %
8284 %  The format of the SegmentImage method is:
8285 %
8286 %      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8287 %        const ColorspaceType colorspace,const MagickBooleanType verbose,
8288 %        const double cluster_threshold,const double smooth_threshold)
8289 %
8290 %  A description of each parameter follows.
8291 %
8292 %    o wand: the wand.
8293 %
8294 %    o colorspace: the image colorspace.
8295 %
8296 %    o verbose:  Set to MagickTrue to print detailed information about the
8297 %      identified classes.
8298 %
8299 %    o cluster_threshold:  This represents the minimum number of pixels
8300 %      contained in a hexahedra before it can be considered valid (expressed as
8301 %      a percentage).
8302 %
8303 %    o smooth_threshold: the smoothing threshold eliminates noise in the second
8304 %      derivative of the histogram.  As the value is increased, you can expect a
8305 %      smoother second derivative.
8306 %
8307 */
8308 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8309   const ColorspaceType colorspace,const MagickBooleanType verbose,
8310   const double cluster_threshold,const double smooth_threshold)
8311 {
8312   MagickBooleanType
8313     status;
8314
8315   assert(wand != (MagickWand *) NULL);
8316   assert(wand->signature == WandSignature);
8317   if (wand->debug != MagickFalse)
8318     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8319   if (wand->images == (Image *) NULL)
8320     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8321   status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8322     smooth_threshold);
8323   if (status == MagickFalse)
8324     InheritException(wand->exception,&wand->images->exception);
8325   return(status);
8326 }
8327 \f
8328 /*
8329 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8330 %                                                                             %
8331 %                                                                             %
8332 %                                                                             %
8333 %   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8334 %                                                                             %
8335 %                                                                             %
8336 %                                                                             %
8337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8338 %
8339 %  MagickSelectiveBlurImage() selectively blur an image within a contrast
8340 %  threshold. It is similar to the unsharpen mask that sharpens everything with
8341 %  contrast above a certain threshold.
8342 %
8343 %  The format of the MagickSelectiveBlurImage method is:
8344 %
8345 %      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8346 %        const double radius,const double sigma,const double threshold)
8347 %
8348 %  A description of each parameter follows:
8349 %
8350 %    o wand: the magick wand.
8351 %
8352 %    o radius: the radius of the gaussian, in pixels, not counting the center
8353 %      pixel.
8354 %
8355 %    o sigma: the standard deviation of the gaussian, in pixels.
8356 %
8357 %    o threshold: only pixels within this contrast threshold are included
8358 %      in the blur operation.
8359 %
8360 */
8361 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8362   const double radius,const double sigma,const double threshold)
8363 {
8364   Image
8365     *blur_image;
8366
8367   assert(wand != (MagickWand *) NULL);
8368   assert(wand->signature == WandSignature);
8369   if (wand->debug != MagickFalse)
8370     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8371   if (wand->images == (Image *) NULL)
8372     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8373   blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
8374     wand->exception);
8375   if (blur_image == (Image *) NULL)
8376     return(MagickFalse);
8377   ReplaceImageInList(&wand->images,blur_image);
8378   return(MagickTrue);
8379 }
8380 \f
8381 /*
8382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8383 %                                                                             %
8384 %                                                                             %
8385 %                                                                             %
8386 %   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                       %
8387 %                                                                             %
8388 %                                                                             %
8389 %                                                                             %
8390 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8391 %
8392 %  MagickSeparateImage() separates a channel from the image and returns a
8393 %  grayscale image.  A channel is a particular color component of each pixel
8394 %  in the image.
8395 %
8396 %  The format of the MagickSeparateImage method is:
8397 %
8398 %      MagickBooleanType MagickSeparateImage(MagickWand *wand)
8399 %
8400 %  A description of each parameter follows:
8401 %
8402 %    o wand: the magick wand.
8403 %
8404 */
8405 WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand)
8406 {
8407   MagickBooleanType
8408     status;
8409
8410   assert(wand != (MagickWand *) NULL);
8411   assert(wand->signature == WandSignature);
8412   if (wand->debug != MagickFalse)
8413     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8414   if (wand->images == (Image *) NULL)
8415     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8416   status=SeparateImage(wand->images);
8417   if (status == MagickFalse)
8418     InheritException(wand->exception,&wand->images->exception);
8419   return(status);
8420 }
8421 \f
8422 /*
8423 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8424 %                                                                             %
8425 %                                                                             %
8426 %                                                                             %
8427 %     M a g i c k S e p i a T o n e I m a g e                                 %
8428 %                                                                             %
8429 %                                                                             %
8430 %                                                                             %
8431 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8432 %
8433 %  MagickSepiaToneImage() applies a special effect to the image, similar to the
8434 %  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8435 %  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8436 %  threshold of 80% is a good starting point for a reasonable tone.
8437 %
8438 %  The format of the MagickSepiaToneImage method is:
8439 %
8440 %      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8441 %        const double threshold)
8442 %
8443 %  A description of each parameter follows:
8444 %
8445 %    o wand: the magick wand.
8446 %
8447 %    o threshold:  Define the extent of the sepia toning.
8448 %
8449 */
8450 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8451   const double threshold)
8452 {
8453   Image
8454     *sepia_image;
8455
8456   assert(wand != (MagickWand *) NULL);
8457   assert(wand->signature == WandSignature);
8458   if (wand->debug != MagickFalse)
8459     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8460   if (wand->images == (Image *) NULL)
8461     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8462   sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8463   if (sepia_image == (Image *) NULL)
8464     return(MagickFalse);
8465   ReplaceImageInList(&wand->images,sepia_image);
8466   return(MagickTrue);
8467 }
8468 \f
8469 /*
8470 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8471 %                                                                             %
8472 %                                                                             %
8473 %                                                                             %
8474 %   M a g i c k S e t I m a g e                                               %
8475 %                                                                             %
8476 %                                                                             %
8477 %                                                                             %
8478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8479 %
8480 %  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8481 %  MagickNextImage(), MagickPreviousImage() with the images from the specified
8482 %  wand.
8483 %
8484 %  The format of the MagickSetImage method is:
8485 %
8486 %      MagickBooleanType MagickSetImage(MagickWand *wand,
8487 %        const MagickWand *set_wand)
8488 %
8489 %  A description of each parameter follows:
8490 %
8491 %    o wand: the magick wand.
8492 %
8493 %    o set_wand: the set_wand wand.
8494 %
8495 */
8496 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8497   const MagickWand *set_wand)
8498 {
8499   Image
8500     *images;
8501
8502   assert(wand != (MagickWand *) NULL);
8503   assert(wand->signature == WandSignature);
8504   if (wand->debug != MagickFalse)
8505     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8506   assert(set_wand != (MagickWand *) NULL);
8507   assert(set_wand->signature == WandSignature);
8508   if (wand->debug != MagickFalse)
8509     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8510   if (set_wand->images == (Image *) NULL)
8511     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8512   images=CloneImageList(set_wand->images,wand->exception);
8513   if (images == (Image *) NULL)
8514     return(MagickFalse);
8515   ReplaceImageInList(&wand->images,images);
8516   return(MagickTrue);
8517 }
8518 \f
8519 /*
8520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8521 %                                                                             %
8522 %                                                                             %
8523 %                                                                             %
8524 %   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                       %
8525 %                                                                             %
8526 %                                                                             %
8527 %                                                                             %
8528 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8529 %
8530 %  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8531 %  alpha channel.
8532 %
8533 %  The format of the MagickSetImageAlphaChannel method is:
8534 %
8535 %      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8536 %        const AlphaChannelType alpha_type)
8537 %
8538 %  A description of each parameter follows:
8539 %
8540 %    o wand: the magick wand.
8541 %
8542 %    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8543 %      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8544 %
8545 */
8546 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8547   const AlphaChannelType alpha_type)
8548 {
8549   assert(wand != (MagickWand *) NULL);
8550   assert(wand->signature == WandSignature);
8551   if (wand->debug != MagickFalse)
8552     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8553   if (wand->images == (Image *) NULL)
8554     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8555   return(SetImageAlphaChannel(wand->images,alpha_type,&wand->images->exception));
8556 }
8557 \f
8558 /*
8559 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8560 %                                                                             %
8561 %                                                                             %
8562 %                                                                             %
8563 %   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                 %
8564 %                                                                             %
8565 %                                                                             %
8566 %                                                                             %
8567 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8568 %
8569 %  MagickSetImageBackgroundColor() sets the image background color.
8570 %
8571 %  The format of the MagickSetImageBackgroundColor method is:
8572 %
8573 %      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8574 %        const PixelWand *background)
8575 %
8576 %  A description of each parameter follows:
8577 %
8578 %    o wand: the magick wand.
8579 %
8580 %    o background: the background pixel wand.
8581 %
8582 */
8583 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8584   const PixelWand *background)
8585 {
8586   assert(wand != (MagickWand *) NULL);
8587   assert(wand->signature == WandSignature);
8588   if (wand->debug != MagickFalse)
8589     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8590   if (wand->images == (Image *) NULL)
8591     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8592   PixelGetQuantumPacket(background,&wand->images->background_color);
8593   return(MagickTrue);
8594 }
8595 \f
8596 /*
8597 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8598 %                                                                             %
8599 %                                                                             %
8600 %                                                                             %
8601 %   M a g i c k S e t I m a g e B i a s                                       %
8602 %                                                                             %
8603 %                                                                             %
8604 %                                                                             %
8605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8606 %
8607 %  MagickSetImageBias() sets the image bias for any method that convolves an
8608 %  image (e.g. MagickConvolveImage()).
8609 %
8610 %  The format of the MagickSetImageBias method is:
8611 %
8612 %      MagickBooleanType MagickSetImageBias(MagickWand *wand,
8613 %        const double bias)
8614 %
8615 %  A description of each parameter follows:
8616 %
8617 %    o wand: the magick wand.
8618 %
8619 %    o bias: the image bias.
8620 %
8621 */
8622 WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
8623   const double bias)
8624 {
8625   assert(wand != (MagickWand *) NULL);
8626   assert(wand->signature == WandSignature);
8627   if (wand->debug != MagickFalse)
8628     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8629   if (wand->images == (Image *) NULL)
8630     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8631   wand->images->bias=bias;
8632   return(MagickTrue);
8633 }
8634 \f
8635 /*
8636 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8637 %                                                                             %
8638 %                                                                             %
8639 %                                                                             %
8640 %   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                         %
8641 %                                                                             %
8642 %                                                                             %
8643 %                                                                             %
8644 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8645 %
8646 %  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8647 %
8648 %  The format of the MagickSetImageBluePrimary method is:
8649 %
8650 %      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8651 %        const double x,const double y)
8652 %
8653 %  A description of each parameter follows:
8654 %
8655 %    o wand: the magick wand.
8656 %
8657 %    o x: the blue primary x-point.
8658 %
8659 %    o y: the blue primary y-point.
8660 %
8661 */
8662 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8663   const double x,const double y)
8664 {
8665   assert(wand != (MagickWand *) NULL);
8666   assert(wand->signature == WandSignature);
8667   if (wand->debug != MagickFalse)
8668     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8669   if (wand->images == (Image *) NULL)
8670     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8671   wand->images->chromaticity.blue_primary.x=x;
8672   wand->images->chromaticity.blue_primary.y=y;
8673   return(MagickTrue);
8674 }
8675 \f
8676 /*
8677 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8678 %                                                                             %
8679 %                                                                             %
8680 %                                                                             %
8681 %   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                         %
8682 %                                                                             %
8683 %                                                                             %
8684 %                                                                             %
8685 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8686 %
8687 %  MagickSetImageBorderColor() sets the image border color.
8688 %
8689 %  The format of the MagickSetImageBorderColor method is:
8690 %
8691 %      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8692 %        const PixelWand *border)
8693 %
8694 %  A description of each parameter follows:
8695 %
8696 %    o wand: the magick wand.
8697 %
8698 %    o border: the border pixel wand.
8699 %
8700 */
8701 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8702   const PixelWand *border)
8703 {
8704   assert(wand != (MagickWand *) NULL);
8705   assert(wand->signature == WandSignature);
8706   if (wand->debug != MagickFalse)
8707     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8708   if (wand->images == (Image *) NULL)
8709     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8710   PixelGetQuantumPacket(border,&wand->images->border_color);
8711   return(MagickTrue);
8712 }
8713 \f
8714 /*
8715 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8716 %                                                                             %
8717 %                                                                             %
8718 %                                                                             %
8719 %   M a g i c k S e t I m a g e C l i p M a s k                               %
8720 %                                                                             %
8721 %                                                                             %
8722 %                                                                             %
8723 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8724 %
8725 %  MagickSetImageClipMask() sets image clip mask.
8726 %
8727 %  The format of the MagickSetImageClipMask method is:
8728 %
8729 %      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8730 %        const MagickWand *clip_mask)
8731 %
8732 %  A description of each parameter follows:
8733 %
8734 %    o wand: the magick wand.
8735 %
8736 %    o clip_mask: the clip_mask wand.
8737 %
8738 */
8739 WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8740   const MagickWand *clip_mask)
8741 {
8742   assert(wand != (MagickWand *) NULL);
8743   assert(wand->signature == WandSignature);
8744   if (wand->debug != MagickFalse)
8745     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8746   assert(clip_mask != (MagickWand *) NULL);
8747   assert(clip_mask->signature == WandSignature);
8748   if (wand->debug != MagickFalse)
8749     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
8750   if (clip_mask->images == (Image *) NULL)
8751     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8752   return(SetImageClipMask(wand->images,clip_mask->images));
8753 }
8754 \f
8755 /*
8756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8757 %                                                                             %
8758 %                                                                             %
8759 %                                                                             %
8760 %   M a g i c k S e t I m a g e C o l o r                                     %
8761 %                                                                             %
8762 %                                                                             %
8763 %                                                                             %
8764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8765 %
8766 %  MagickSetImageColor() set the entire wand canvas to the specified color.
8767 %
8768 %  The format of the MagickSetImageColor method is:
8769 %
8770 %      MagickBooleanType MagickSetImageColor(MagickWand *wand,
8771 %        const PixelWand *color)
8772 %
8773 %  A description of each parameter follows:
8774 %
8775 %    o wand: the magick wand.
8776 %
8777 %    o background: the image color.
8778 %
8779 */
8780 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
8781   const PixelWand *color)
8782 {
8783   MagickBooleanType
8784     status;
8785
8786   PixelInfo
8787     pixel;
8788
8789   assert(wand != (MagickWand *) NULL);
8790   assert(wand->signature == WandSignature);
8791   if (wand->debug != MagickFalse)
8792     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8793   PixelGetMagickColor(color,&pixel);
8794   status=SetImageColor(wand->images,&pixel);
8795   if (status == MagickFalse)
8796     InheritException(wand->exception,&wand->images->exception);
8797   return(status);
8798 }
8799 \f
8800 /*
8801 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8802 %                                                                             %
8803 %                                                                             %
8804 %                                                                             %
8805 %   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                     %
8806 %                                                                             %
8807 %                                                                             %
8808 %                                                                             %
8809 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8810 %
8811 %  MagickSetImageColormapColor() sets the color of the specified colormap
8812 %  index.
8813 %
8814 %  The format of the MagickSetImageColormapColor method is:
8815 %
8816 %      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8817 %        const size_t index,const PixelWand *color)
8818 %
8819 %  A description of each parameter follows:
8820 %
8821 %    o wand: the magick wand.
8822 %
8823 %    o index: the offset into the image colormap.
8824 %
8825 %    o color: Return the colormap color in this wand.
8826 %
8827 */
8828 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8829   const size_t index,const PixelWand *color)
8830 {
8831   assert(wand != (MagickWand *) NULL);
8832   assert(wand->signature == WandSignature);
8833   if (wand->debug != MagickFalse)
8834     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8835   if (wand->images == (Image *) NULL)
8836     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8837   if ((wand->images->colormap == (PixelPacket *) NULL) ||
8838       (index >= wand->images->colors))
8839     ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
8840   PixelGetQuantumPacket(color,wand->images->colormap+index);
8841   return(SyncImage(wand->images));
8842 }
8843 \f
8844 /*
8845 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8846 %                                                                             %
8847 %                                                                             %
8848 %                                                                             %
8849 %   M a g i c k S e t I m a g e C o l o r s p a c e                           %
8850 %                                                                             %
8851 %                                                                             %
8852 %                                                                             %
8853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8854 %
8855 %  MagickSetImageColorspace() sets the image colorspace.
8856 %
8857 %  The format of the MagickSetImageColorspace method is:
8858 %
8859 %      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8860 %        const ColorspaceType colorspace)
8861 %
8862 %  A description of each parameter follows:
8863 %
8864 %    o wand: the magick wand.
8865 %
8866 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
8867 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
8868 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
8869 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
8870 %      HSLColorspace, or HWBColorspace.
8871 %
8872 */
8873 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8874   const ColorspaceType colorspace)
8875 {
8876   assert(wand != (MagickWand *) NULL);
8877   assert(wand->signature == WandSignature);
8878   if (wand->debug != MagickFalse)
8879     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8880   if (wand->images == (Image *) NULL)
8881     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8882   return(SetImageColorspace(wand->images,colorspace,&wand->images->exception));
8883 }
8884 \f
8885 /*
8886 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8887 %                                                                             %
8888 %                                                                             %
8889 %                                                                             %
8890 %   M a g i c k S e t I m a g e C o m p o s e                                 %
8891 %                                                                             %
8892 %                                                                             %
8893 %                                                                             %
8894 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8895 %
8896 %  MagickSetImageCompose() sets the image composite operator, useful for
8897 %  specifying how to composite the image thumbnail when using the
8898 %  MagickMontageImage() method.
8899 %
8900 %  The format of the MagickSetImageCompose method is:
8901 %
8902 %      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8903 %        const CompositeOperator compose)
8904 %
8905 %  A description of each parameter follows:
8906 %
8907 %    o wand: the magick wand.
8908 %
8909 %    o compose: the image composite operator.
8910 %
8911 */
8912 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8913   const CompositeOperator compose)
8914 {
8915   assert(wand != (MagickWand *) NULL);
8916   assert(wand->signature == WandSignature);
8917   if (wand->debug != MagickFalse)
8918     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8919   if (wand->images == (Image *) NULL)
8920     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8921   wand->images->compose=compose;
8922   return(MagickTrue);
8923 }
8924 \f
8925 /*
8926 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8927 %                                                                             %
8928 %                                                                             %
8929 %                                                                             %
8930 %   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                         %
8931 %                                                                             %
8932 %                                                                             %
8933 %                                                                             %
8934 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8935 %
8936 %  MagickSetImageCompression() sets the image compression.
8937 %
8938 %  The format of the MagickSetImageCompression method is:
8939 %
8940 %      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8941 %        const CompressionType compression)
8942 %
8943 %  A description of each parameter follows:
8944 %
8945 %    o wand: the magick wand.
8946 %
8947 %    o compression: the image compression type.
8948 %
8949 */
8950 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8951   const CompressionType compression)
8952 {
8953   assert(wand != (MagickWand *) NULL);
8954   assert(wand->signature == WandSignature);
8955   if (wand->debug != MagickFalse)
8956     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8957   if (wand->images == (Image *) NULL)
8958     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8959   wand->images->compression=compression;
8960   return(MagickTrue);
8961 }
8962 \f
8963 /*
8964 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8965 %                                                                             %
8966 %                                                                             %
8967 %                                                                             %
8968 %   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           %
8969 %                                                                             %
8970 %                                                                             %
8971 %                                                                             %
8972 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8973 %
8974 %  MagickSetImageCompressionQuality() sets the image compression quality.
8975 %
8976 %  The format of the MagickSetImageCompressionQuality method is:
8977 %
8978 %      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
8979 %        const size_t quality)
8980 %
8981 %  A description of each parameter follows:
8982 %
8983 %    o wand: the magick wand.
8984 %
8985 %    o quality: the image compression tlityype.
8986 %
8987 */
8988 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
8989   const size_t quality)
8990 {
8991   assert(wand != (MagickWand *) NULL);
8992   assert(wand->signature == WandSignature);
8993   if (wand->debug != MagickFalse)
8994     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8995   if (wand->images == (Image *) NULL)
8996     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8997   wand->images->quality=quality;
8998   return(MagickTrue);
8999 }
9000 \f
9001 /*
9002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9003 %                                                                             %
9004 %                                                                             %
9005 %                                                                             %
9006 %   M a g i c k S e t I m a g e D e l a y                                     %
9007 %                                                                             %
9008 %                                                                             %
9009 %                                                                             %
9010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9011 %
9012 %  MagickSetImageDelay() sets the image delay.
9013 %
9014 %  The format of the MagickSetImageDelay method is:
9015 %
9016 %      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9017 %        const size_t delay)
9018 %
9019 %  A description of each parameter follows:
9020 %
9021 %    o wand: the magick wand.
9022 %
9023 %    o delay: the image delay in ticks-per-second units.
9024 %
9025 */
9026 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9027   const size_t delay)
9028 {
9029   assert(wand != (MagickWand *) NULL);
9030   assert(wand->signature == WandSignature);
9031   if (wand->debug != MagickFalse)
9032     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9033   if (wand->images == (Image *) NULL)
9034     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9035   wand->images->delay=delay;
9036   return(MagickTrue);
9037 }
9038 \f
9039 /*
9040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9041 %                                                                             %
9042 %                                                                             %
9043 %                                                                             %
9044 %   M a g i c k S e t I m a g e D e p t h                                     %
9045 %                                                                             %
9046 %                                                                             %
9047 %                                                                             %
9048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9049 %
9050 %  MagickSetImageDepth() sets the image depth.
9051 %
9052 %  The format of the MagickSetImageDepth method is:
9053 %
9054 %      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9055 %        const size_t depth)
9056 %
9057 %  A description of each parameter follows:
9058 %
9059 %    o wand: the magick wand.
9060 %
9061 %    o depth: the image depth in bits: 8, 16, or 32.
9062 %
9063 */
9064 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9065   const size_t depth)
9066 {
9067   assert(wand != (MagickWand *) NULL);
9068   assert(wand->signature == WandSignature);
9069   if (wand->debug != MagickFalse)
9070     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9071   if (wand->images == (Image *) NULL)
9072     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9073   return(SetImageDepth(wand->images,depth));
9074 }
9075 \f
9076 /*
9077 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9078 %                                                                             %
9079 %                                                                             %
9080 %                                                                             %
9081 %   M a g i c k S e t I m a g e D i s p o s e                                 %
9082 %                                                                             %
9083 %                                                                             %
9084 %                                                                             %
9085 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9086 %
9087 %  MagickSetImageDispose() sets the image disposal method.
9088 %
9089 %  The format of the MagickSetImageDispose method is:
9090 %
9091 %      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9092 %        const DisposeType dispose)
9093 %
9094 %  A description of each parameter follows:
9095 %
9096 %    o wand: the magick wand.
9097 %
9098 %    o dispose: the image disposeal type.
9099 %
9100 */
9101 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9102   const DisposeType dispose)
9103 {
9104   assert(wand != (MagickWand *) NULL);
9105   assert(wand->signature == WandSignature);
9106   if (wand->debug != MagickFalse)
9107     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9108   if (wand->images == (Image *) NULL)
9109     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9110   wand->images->dispose=dispose;
9111   return(MagickTrue);
9112 }
9113 \f
9114 /*
9115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9116 %                                                                             %
9117 %                                                                             %
9118 %                                                                             %
9119 %   M a g i c k S e t I m a g e E x t e n t                                   %
9120 %                                                                             %
9121 %                                                                             %
9122 %                                                                             %
9123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9124 %
9125 %  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9126 %
9127 %  The format of the MagickSetImageExtent method is:
9128 %
9129 %      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9130 %        const size_t columns,const unsigned rows)
9131 %
9132 %  A description of each parameter follows:
9133 %
9134 %    o wand: the magick wand.
9135 %
9136 %    o columns:  The image width in pixels.
9137 %
9138 %    o rows:  The image height in pixels.
9139 %
9140 */
9141 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9142   const size_t columns,const size_t rows)
9143 {
9144   assert(wand != (MagickWand *) NULL);
9145   assert(wand->signature == WandSignature);
9146   if (wand->debug != MagickFalse)
9147     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9148   if (wand->images == (Image *) NULL)
9149     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9150   return(SetImageExtent(wand->images,columns,rows,&wand->images->exception));
9151 }
9152 \f
9153 /*
9154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9155 %                                                                             %
9156 %                                                                             %
9157 %                                                                             %
9158 %   M a g i c k S e t I m a g e F i l e n a m e                               %
9159 %                                                                             %
9160 %                                                                             %
9161 %                                                                             %
9162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9163 %
9164 %  MagickSetImageFilename() sets the filename of a particular image in a
9165 %  sequence.
9166 %
9167 %  The format of the MagickSetImageFilename method is:
9168 %
9169 %      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9170 %        const char *filename)
9171 %
9172 %  A description of each parameter follows:
9173 %
9174 %    o wand: the magick wand.
9175 %
9176 %    o filename: the image filename.
9177 %
9178 */
9179 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9180   const char *filename)
9181 {
9182   assert(wand != (MagickWand *) NULL);
9183   assert(wand->signature == WandSignature);
9184   if (wand->debug != MagickFalse)
9185     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9186   if (wand->images == (Image *) NULL)
9187     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9188   if (filename != (const char *) NULL)
9189     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9190   return(MagickTrue);
9191 }
9192 \f
9193 /*
9194 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9195 %                                                                             %
9196 %                                                                             %
9197 %                                                                             %
9198 %   M a g i c k S e t I m a g e F o r m a t                                   %
9199 %                                                                             %
9200 %                                                                             %
9201 %                                                                             %
9202 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9203 %
9204 %  MagickSetImageFormat() sets the format of a particular image in a
9205 %  sequence.
9206 %
9207 %  The format of the MagickSetImageFormat method is:
9208 %
9209 %      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9210 %        const char *format)
9211 %
9212 %  A description of each parameter follows:
9213 %
9214 %    o wand: the magick wand.
9215 %
9216 %    o format: the image format.
9217 %
9218 */
9219 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9220   const char *format)
9221 {
9222   const MagickInfo
9223     *magick_info;
9224
9225   assert(wand != (MagickWand *) NULL);
9226   assert(wand->signature == WandSignature);
9227   if (wand->debug != MagickFalse)
9228     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9229   if (wand->images == (Image *) NULL)
9230     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9231   if ((format == (char *) NULL) || (*format == '\0'))
9232     {
9233       *wand->images->magick='\0';
9234       return(MagickTrue);
9235     }
9236   magick_info=GetMagickInfo(format,wand->exception);
9237   if (magick_info == (const MagickInfo *) NULL)
9238     return(MagickFalse);
9239   ClearMagickException(wand->exception);
9240   (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9241   return(MagickTrue);
9242 }
9243 \f
9244 /*
9245 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9246 %                                                                             %
9247 %                                                                             %
9248 %                                                                             %
9249 %   M a g i c k S e t I m a g e F u z z                                       %
9250 %                                                                             %
9251 %                                                                             %
9252 %                                                                             %
9253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9254 %
9255 %  MagickSetImageFuzz() sets the image fuzz.
9256 %
9257 %  The format of the MagickSetImageFuzz method is:
9258 %
9259 %      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9260 %        const double fuzz)
9261 %
9262 %  A description of each parameter follows:
9263 %
9264 %    o wand: the magick wand.
9265 %
9266 %    o fuzz: the image fuzz.
9267 %
9268 */
9269 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9270   const double fuzz)
9271 {
9272   assert(wand != (MagickWand *) NULL);
9273   assert(wand->signature == WandSignature);
9274   if (wand->debug != MagickFalse)
9275     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9276   if (wand->images == (Image *) NULL)
9277     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9278   wand->images->fuzz=fuzz;
9279   return(MagickTrue);
9280 }
9281 \f
9282 /*
9283 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9284 %                                                                             %
9285 %                                                                             %
9286 %                                                                             %
9287 %   M a g i c k S e t I m a g e G a m m a                                     %
9288 %                                                                             %
9289 %                                                                             %
9290 %                                                                             %
9291 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9292 %
9293 %  MagickSetImageGamma() sets the image gamma.
9294 %
9295 %  The format of the MagickSetImageGamma method is:
9296 %
9297 %      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9298 %        const double gamma)
9299 %
9300 %  A description of each parameter follows:
9301 %
9302 %    o wand: the magick wand.
9303 %
9304 %    o gamma: the image gamma.
9305 %
9306 */
9307 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9308   const double gamma)
9309 {
9310   assert(wand != (MagickWand *) NULL);
9311   assert(wand->signature == WandSignature);
9312   if (wand->debug != MagickFalse)
9313     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9314   if (wand->images == (Image *) NULL)
9315     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9316   wand->images->gamma=gamma;
9317   return(MagickTrue);
9318 }
9319 \f
9320 /*
9321 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9322 %                                                                             %
9323 %                                                                             %
9324 %                                                                             %
9325 %   M a g i c k S e t I m a g e G r a v i t y                                 %
9326 %                                                                             %
9327 %                                                                             %
9328 %                                                                             %
9329 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9330 %
9331 %  MagickSetImageGravity() sets the image gravity type.
9332 %
9333 %  The format of the MagickSetImageGravity method is:
9334 %
9335 %      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9336 %        const GravityType gravity)
9337 %
9338 %  A description of each parameter follows:
9339 %
9340 %    o wand: the magick wand.
9341 %
9342 %    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9343 %      PlaneInterlace, PartitionInterlace.
9344 %
9345 */
9346 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9347   const GravityType gravity)
9348 {
9349   assert(wand != (MagickWand *) NULL);
9350   assert(wand->signature == WandSignature);
9351   if (wand->debug != MagickFalse)
9352     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9353   if (wand->images == (Image *) NULL)
9354     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9355   wand->images->gravity=gravity;
9356   return(MagickTrue);
9357 }
9358 \f
9359 /*
9360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9361 %                                                                             %
9362 %                                                                             %
9363 %                                                                             %
9364 %   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                       %
9365 %                                                                             %
9366 %                                                                             %
9367 %                                                                             %
9368 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9369 %
9370 %  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9371 %  point.
9372 %
9373 %  The format of the MagickSetImageGreenPrimary method is:
9374 %
9375 %      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9376 %        const double x,const double y)
9377 %
9378 %  A description of each parameter follows:
9379 %
9380 %    o wand: the magick wand.
9381 %
9382 %    o x: the green primary x-point.
9383 %
9384 %    o y: the green primary y-point.
9385 %
9386 %
9387 */
9388 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9389   const double x,const double y)
9390 {
9391   assert(wand != (MagickWand *) NULL);
9392   assert(wand->signature == WandSignature);
9393   if (wand->debug != MagickFalse)
9394     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9395   if (wand->images == (Image *) NULL)
9396     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9397   wand->images->chromaticity.green_primary.x=x;
9398   wand->images->chromaticity.green_primary.y=y;
9399   return(MagickTrue);
9400 }
9401 \f
9402 /*
9403 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9404 %                                                                             %
9405 %                                                                             %
9406 %                                                                             %
9407 %   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                 %
9408 %                                                                             %
9409 %                                                                             %
9410 %                                                                             %
9411 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9412 %
9413 %  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9414 %
9415 %  The format of the MagickSetImageInterlaceScheme method is:
9416 %
9417 %      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9418 %        const InterlaceType interlace)
9419 %
9420 %  A description of each parameter follows:
9421 %
9422 %    o wand: the magick wand.
9423 %
9424 %    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9425 %      PlaneInterlace, PartitionInterlace.
9426 %
9427 */
9428 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9429   const InterlaceType interlace)
9430 {
9431   assert(wand != (MagickWand *) NULL);
9432   assert(wand->signature == WandSignature);
9433   if (wand->debug != MagickFalse)
9434     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9435   if (wand->images == (Image *) NULL)
9436     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9437   wand->images->interlace=interlace;
9438   return(MagickTrue);
9439 }
9440 \f
9441 /*
9442 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9443 %                                                                             %
9444 %                                                                             %
9445 %                                                                             %
9446 %   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             %
9447 %                                                                             %
9448 %                                                                             %
9449 %                                                                             %
9450 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9451 %
9452 %  MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
9453 %
9454 %  The format of the MagickSetImageInterpolateMethod method is:
9455 %
9456 %      MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
9457 %        const InterpolatePixelMethod method)
9458 %
9459 %  A description of each parameter follows:
9460 %
9461 %    o wand: the magick wand.
9462 %
9463 %    o method: the image interpole pixel methods: choose from Undefined,
9464 %      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9465 %
9466 */
9467 WandExport MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
9468   const InterpolatePixelMethod method)
9469 {
9470   assert(wand != (MagickWand *) NULL);
9471   assert(wand->signature == WandSignature);
9472   if (wand->debug != MagickFalse)
9473     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9474   if (wand->images == (Image *) NULL)
9475     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9476   wand->images->interpolate=method;
9477   return(MagickTrue);
9478 }
9479 \f
9480 /*
9481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9482 %                                                                             %
9483 %                                                                             %
9484 %                                                                             %
9485 %   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9486 %                                                                             %
9487 %                                                                             %
9488 %                                                                             %
9489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9490 %
9491 %  MagickSetImageIterations() sets the image iterations.
9492 %
9493 %  The format of the MagickSetImageIterations method is:
9494 %
9495 %      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9496 %        const size_t iterations)
9497 %
9498 %  A description of each parameter follows:
9499 %
9500 %    o wand: the magick wand.
9501 %
9502 %    o delay: the image delay in 1/100th of a second.
9503 %
9504 */
9505 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9506   const size_t iterations)
9507 {
9508   assert(wand != (MagickWand *) NULL);
9509   assert(wand->signature == WandSignature);
9510   if (wand->debug != MagickFalse)
9511     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9512   if (wand->images == (Image *) NULL)
9513     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9514   wand->images->iterations=iterations;
9515   return(MagickTrue);
9516 }
9517 \f
9518 /*
9519 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9520 %                                                                             %
9521 %                                                                             %
9522 %                                                                             %
9523 %   M a g i c k S e t I m a g e M a t t e                                     %
9524 %                                                                             %
9525 %                                                                             %
9526 %                                                                             %
9527 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9528 %
9529 %  MagickSetImageMatte() sets the image matte channel.
9530 %
9531 %  The format of the MagickSetImageMatteColor method is:
9532 %
9533 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9534 %        const MagickBooleanType *matte)
9535 %
9536 %  A description of each parameter follows:
9537 %
9538 %    o wand: the magick wand.
9539 %
9540 %    o matte: Set to MagickTrue to enable the image matte channel otherwise
9541 %      MagickFalse.
9542 %
9543 */
9544 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9545   const MagickBooleanType matte)
9546 {
9547   assert(wand != (MagickWand *) NULL);
9548   assert(wand->signature == WandSignature);
9549   if (wand->debug != MagickFalse)
9550     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9551   if (wand->images == (Image *) NULL)
9552     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9553   if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
9554     (void) SetImageOpacity(wand->images,OpaqueAlpha);
9555   wand->images->matte=matte;
9556   return(MagickTrue);
9557 }
9558 \f
9559 /*
9560 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9561 %                                                                             %
9562 %                                                                             %
9563 %                                                                             %
9564 %   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9565 %                                                                             %
9566 %                                                                             %
9567 %                                                                             %
9568 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9569 %
9570 %  MagickSetImageMatteColor() sets the image matte color.
9571 %
9572 %  The format of the MagickSetImageMatteColor method is:
9573 %
9574 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9575 %        const PixelWand *matte)
9576 %
9577 %  A description of each parameter follows:
9578 %
9579 %    o wand: the magick wand.
9580 %
9581 %    o matte: the matte pixel wand.
9582 %
9583 */
9584 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9585   const PixelWand *matte)
9586 {
9587   assert(wand != (MagickWand *) NULL);
9588   assert(wand->signature == WandSignature);
9589   if (wand->debug != MagickFalse)
9590     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9591   if (wand->images == (Image *) NULL)
9592     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9593   PixelGetQuantumPacket(matte,&wand->images->matte_color);
9594   return(MagickTrue);
9595 }
9596 \f
9597 /*
9598 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9599 %                                                                             %
9600 %                                                                             %
9601 %                                                                             %
9602 %   M a g i c k S e t I m a g e O p a c i t y                                 %
9603 %                                                                             %
9604 %                                                                             %
9605 %                                                                             %
9606 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9607 %
9608 %  MagickSetImageOpacity() sets the image to the specified opacity level.
9609 %
9610 %  The format of the MagickSetImageOpacity method is:
9611 %
9612 %      MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
9613 %        const double alpha)
9614 %
9615 %  A description of each parameter follows:
9616 %
9617 %    o wand: the magick wand.
9618 %
9619 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9620 %      transparent.
9621 %
9622 */
9623 WandExport MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
9624   const double alpha)
9625 {
9626   MagickBooleanType
9627     status;
9628
9629   assert(wand != (MagickWand *) NULL);
9630   assert(wand->signature == WandSignature);
9631   if (wand->debug != MagickFalse)
9632     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9633   if (wand->images == (Image *) NULL)
9634     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9635   status=SetImageOpacity(wand->images,ClampToQuantum(QuantumRange*alpha));
9636   if (status == MagickFalse)
9637     InheritException(wand->exception,&wand->images->exception);
9638   return(status);
9639 }
9640 \f
9641 /*
9642 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9643 %                                                                             %
9644 %                                                                             %
9645 %                                                                             %
9646 %   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                         %
9647 %                                                                             %
9648 %                                                                             %
9649 %                                                                             %
9650 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9651 %
9652 %  MagickSetImageOrientation() sets the image orientation.
9653 %
9654 %  The format of the MagickSetImageOrientation method is:
9655 %
9656 %      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9657 %        const OrientationType orientation)
9658 %
9659 %  A description of each parameter follows:
9660 %
9661 %    o wand: the magick wand.
9662 %
9663 %    o orientation: the image orientation type.
9664 %
9665 */
9666 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9667   const OrientationType orientation)
9668 {
9669   assert(wand != (MagickWand *) NULL);
9670   assert(wand->signature == WandSignature);
9671   if (wand->debug != MagickFalse)
9672     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9673   if (wand->images == (Image *) NULL)
9674     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9675   wand->images->orientation=orientation;
9676   return(MagickTrue);
9677 }
9678 \f
9679 /*
9680 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9681 %                                                                             %
9682 %                                                                             %
9683 %                                                                             %
9684 %   M a g i c k S e t I m a g e P a g e                                       %
9685 %                                                                             %
9686 %                                                                             %
9687 %                                                                             %
9688 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9689 %
9690 %  MagickSetImagePage() sets the page geometry of the image.
9691 %
9692 %  The format of the MagickSetImagePage method is:
9693 %
9694 %      MagickBooleanType MagickSetImagePage(MagickWand *wand,
9695 %        const size_t width,const size_t height,const ssize_t x,
9696 %        const ssize_t y)
9697 %
9698 %  A description of each parameter follows:
9699 %
9700 %    o wand: the magick wand.
9701 %
9702 %    o width: the page width.
9703 %
9704 %    o height: the page height.
9705 %
9706 %    o x: the page x-offset.
9707 %
9708 %    o y: the page y-offset.
9709 %
9710 */
9711 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
9712   const size_t width,const size_t height,const ssize_t x,
9713   const ssize_t y)
9714 {
9715   assert(wand != (MagickWand *) NULL);
9716   assert(wand->signature == WandSignature);
9717   if (wand->debug != MagickFalse)
9718     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9719   if (wand->images == (Image *) NULL)
9720     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9721   wand->images->page.width=width;
9722   wand->images->page.height=height;
9723   wand->images->page.x=x;
9724   wand->images->page.y=y;
9725   return(MagickTrue);
9726 }
9727 \f
9728 /*
9729 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9730 %                                                                             %
9731 %                                                                             %
9732 %                                                                             %
9733 %   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                 %
9734 %                                                                             %
9735 %                                                                             %
9736 %                                                                             %
9737 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9738 %
9739 %  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
9740 %  specified method and returns the previous progress monitor if any.  The
9741 %  progress monitor method looks like this:
9742 %
9743 %    MagickBooleanType MagickProgressMonitor(const char *text,
9744 %      const MagickOffsetType offset,const MagickSizeType span,
9745 %      void *client_data)
9746 %
9747 %  If the progress monitor returns MagickFalse, the current operation is
9748 %  interrupted.
9749 %
9750 %  The format of the MagickSetImageProgressMonitor method is:
9751 %
9752 %      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
9753 %        const MagickProgressMonitor progress_monitor,void *client_data)
9754 %
9755 %  A description of each parameter follows:
9756 %
9757 %    o wand: the magick wand.
9758 %
9759 %    o progress_monitor: Specifies a pointer to a method to monitor progress
9760 %      of an image operation.
9761 %
9762 %    o client_data: Specifies a pointer to any client data.
9763 %
9764 */
9765 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
9766   const MagickProgressMonitor progress_monitor,void *client_data)
9767 {
9768   MagickProgressMonitor
9769     previous_monitor;
9770
9771   assert(wand != (MagickWand *) NULL);
9772   assert(wand->signature == WandSignature);
9773   if (wand->debug != MagickFalse)
9774     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9775   if (wand->images == (Image *) NULL)
9776     {
9777       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
9778         "ContainsNoImages","`%s'",wand->name);
9779       return((MagickProgressMonitor) NULL);
9780     }
9781   previous_monitor=SetImageProgressMonitor(wand->images,
9782     progress_monitor,client_data);
9783   return(previous_monitor);
9784 }
9785 \f
9786 /*
9787 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9788 %                                                                             %
9789 %                                                                             %
9790 %                                                                             %
9791 %   M a g i c k S e t I m a g e R e d P r i m a r y                           %
9792 %                                                                             %
9793 %                                                                             %
9794 %                                                                             %
9795 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9796 %
9797 %  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
9798 %
9799 %  The format of the MagickSetImageRedPrimary method is:
9800 %
9801 %      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9802 %        const double x,const double y)
9803 %
9804 %  A description of each parameter follows:
9805 %
9806 %    o wand: the magick wand.
9807 %
9808 %    o x: the red primary x-point.
9809 %
9810 %    o y: the red primary y-point.
9811 %
9812 */
9813 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9814   const double x,const double y)
9815 {
9816   assert(wand != (MagickWand *) NULL);
9817   assert(wand->signature == WandSignature);
9818   if (wand->debug != MagickFalse)
9819     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9820   if (wand->images == (Image *) NULL)
9821     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9822   wand->images->chromaticity.red_primary.x=x;
9823   wand->images->chromaticity.red_primary.y=y;
9824   return(MagickTrue);
9825 }
9826 \f
9827 /*
9828 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9829 %                                                                             %
9830 %                                                                             %
9831 %                                                                             %
9832 %   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                 %
9833 %                                                                             %
9834 %                                                                             %
9835 %                                                                             %
9836 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9837 %
9838 %  MagickSetImageRenderingIntent() sets the image rendering intent.
9839 %
9840 %  The format of the MagickSetImageRenderingIntent method is:
9841 %
9842 %      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9843 %        const RenderingIntent rendering_intent)
9844 %
9845 %  A description of each parameter follows:
9846 %
9847 %    o wand: the magick wand.
9848 %
9849 %    o rendering_intent: the image rendering intent: UndefinedIntent,
9850 %      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
9851 %
9852 */
9853 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9854   const RenderingIntent rendering_intent)
9855 {
9856   assert(wand != (MagickWand *) NULL);
9857   assert(wand->signature == WandSignature);
9858   if (wand->debug != MagickFalse)
9859     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9860   if (wand->images == (Image *) NULL)
9861     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9862   wand->images->rendering_intent=rendering_intent;
9863   return(MagickTrue);
9864 }
9865 \f
9866 /*
9867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9868 %                                                                             %
9869 %                                                                             %
9870 %                                                                             %
9871 %   M a g i c k S e t I m a g e R e s o l u t i o n                           %
9872 %                                                                             %
9873 %                                                                             %
9874 %                                                                             %
9875 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9876 %
9877 %  MagickSetImageResolution() sets the image resolution.
9878 %
9879 %  The format of the MagickSetImageResolution method is:
9880 %
9881 %      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9882 %        const double x_resolution,const doubtl y_resolution)
9883 %
9884 %  A description of each parameter follows:
9885 %
9886 %    o wand: the magick wand.
9887 %
9888 %    o x_resolution: the image x resolution.
9889 %
9890 %    o y_resolution: the image y resolution.
9891 %
9892 */
9893 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9894   const double x_resolution,const double y_resolution)
9895 {
9896   assert(wand != (MagickWand *) NULL);
9897   assert(wand->signature == WandSignature);
9898   if (wand->debug != MagickFalse)
9899     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9900   if (wand->images == (Image *) NULL)
9901     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9902   wand->images->x_resolution=x_resolution;
9903   wand->images->y_resolution=y_resolution;
9904   return(MagickTrue);
9905 }
9906 \f
9907 /*
9908 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9909 %                                                                             %
9910 %                                                                             %
9911 %                                                                             %
9912 %   M a g i c k S e t I m a g e S c e n e                                     %
9913 %                                                                             %
9914 %                                                                             %
9915 %                                                                             %
9916 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9917 %
9918 %  MagickSetImageScene() sets the image scene.
9919 %
9920 %  The format of the MagickSetImageScene method is:
9921 %
9922 %      MagickBooleanType MagickSetImageScene(MagickWand *wand,
9923 %        const size_t scene)
9924 %
9925 %  A description of each parameter follows:
9926 %
9927 %    o wand: the magick wand.
9928 %
9929 %    o delay: the image scene number.
9930 %
9931 */
9932 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
9933   const size_t scene)
9934 {
9935   assert(wand != (MagickWand *) NULL);
9936   assert(wand->signature == WandSignature);
9937   if (wand->debug != MagickFalse)
9938     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9939   if (wand->images == (Image *) NULL)
9940     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9941   wand->images->scene=scene;
9942   return(MagickTrue);
9943 }
9944 \f
9945 /*
9946 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9947 %                                                                             %
9948 %                                                                             %
9949 %                                                                             %
9950 %   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                   %
9951 %                                                                             %
9952 %                                                                             %
9953 %                                                                             %
9954 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9955 %
9956 %  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
9957 %
9958 %  The format of the MagickSetImageTicksPerSecond method is:
9959 %
9960 %      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9961 %        const ssize_t ticks_per-second)
9962 %
9963 %  A description of each parameter follows:
9964 %
9965 %    o wand: the magick wand.
9966 %
9967 %    o ticks_per_second: the units to use for the image delay.
9968 %
9969 */
9970 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9971   const ssize_t ticks_per_second)
9972 {
9973   assert(wand != (MagickWand *) NULL);
9974   assert(wand->signature == WandSignature);
9975   if (wand->debug != MagickFalse)
9976     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9977   if (wand->images == (Image *) NULL)
9978     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9979   wand->images->ticks_per_second=ticks_per_second;
9980   return(MagickTrue);
9981 }
9982 \f
9983 /*
9984 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9985 %                                                                             %
9986 %                                                                             %
9987 %                                                                             %
9988 %   M a g i c k S e t I m a g e T y p e                                       %
9989 %                                                                             %
9990 %                                                                             %
9991 %                                                                             %
9992 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9993 %
9994 %  MagickSetImageType() sets the image type.
9995 %
9996 %  The format of the MagickSetImageType method is:
9997 %
9998 %      MagickBooleanType MagickSetImageType(MagickWand *wand,
9999 %        const ImageType image_type)
10000 %
10001 %  A description of each parameter follows:
10002 %
10003 %    o wand: the magick wand.
10004 %
10005 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10006 %      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10007 %      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10008 %      or OptimizeType.
10009 %
10010 */
10011 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10012   const ImageType image_type)
10013 {
10014   assert(wand != (MagickWand *) NULL);
10015   assert(wand->signature == WandSignature);
10016   if (wand->debug != MagickFalse)
10017     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10018   if (wand->images == (Image *) NULL)
10019     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10020   return(SetImageType(wand->images,image_type));
10021 }
10022 \f
10023 /*
10024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10025 %                                                                             %
10026 %                                                                             %
10027 %                                                                             %
10028 %   M a g i c k S e t I m a g e U n i t s                                     %
10029 %                                                                             %
10030 %                                                                             %
10031 %                                                                             %
10032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10033 %
10034 %  MagickSetImageUnits() sets the image units of resolution.
10035 %
10036 %  The format of the MagickSetImageUnits method is:
10037 %
10038 %      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10039 %        const ResolutionType units)
10040 %
10041 %  A description of each parameter follows:
10042 %
10043 %    o wand: the magick wand.
10044 %
10045 %    o units: the image units of resolution : UndefinedResolution,
10046 %      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10047 %
10048 */
10049 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10050   const ResolutionType units)
10051 {
10052   assert(wand != (MagickWand *) NULL);
10053   assert(wand->signature == WandSignature);
10054   if (wand->debug != MagickFalse)
10055     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10056   if (wand->images == (Image *) NULL)
10057     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10058   wand->images->units=units;
10059   return(MagickTrue);
10060 }
10061 \f
10062 /*
10063 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10064 %                                                                             %
10065 %                                                                             %
10066 %                                                                             %
10067 %   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           %
10068 %                                                                             %
10069 %                                                                             %
10070 %                                                                             %
10071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10072 %
10073 %  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10074 %
10075 %  The format of the MagickSetImageVirtualPixelMethod method is:
10076 %
10077 %      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10078 %        const VirtualPixelMethod method)
10079 %
10080 %  A description of each parameter follows:
10081 %
10082 %    o wand: the magick wand.
10083 %
10084 %    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10085 %      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10086 %      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10087 %
10088 */
10089 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10090   const VirtualPixelMethod method)
10091 {
10092   assert(wand != (MagickWand *) NULL);
10093   assert(wand->signature == WandSignature);
10094   if (wand->debug != MagickFalse)
10095     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10096   if (wand->images == (Image *) NULL)
10097     return(UndefinedVirtualPixelMethod);
10098   return(SetImageVirtualPixelMethod(wand->images,method));
10099 }
10100 \f
10101 /*
10102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10103 %                                                                             %
10104 %                                                                             %
10105 %                                                                             %
10106 %   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10107 %                                                                             %
10108 %                                                                             %
10109 %                                                                             %
10110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10111 %
10112 %  MagickSetImageWhitePoint() sets the image chromaticity white point.
10113 %
10114 %  The format of the MagickSetImageWhitePoint method is:
10115 %
10116 %      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10117 %        const double x,const double y)
10118 %
10119 %  A description of each parameter follows:
10120 %
10121 %    o wand: the magick wand.
10122 %
10123 %    o x: the white x-point.
10124 %
10125 %    o y: the white y-point.
10126 %
10127 */
10128 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10129   const double x,const double y)
10130 {
10131   assert(wand != (MagickWand *) NULL);
10132   assert(wand->signature == WandSignature);
10133   if (wand->debug != MagickFalse)
10134     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10135   if (wand->images == (Image *) NULL)
10136     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10137   wand->images->chromaticity.white_point.x=x;
10138   wand->images->chromaticity.white_point.y=y;
10139   return(MagickTrue);
10140 }
10141 \f
10142 /*
10143 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10144 %                                                                             %
10145 %                                                                             %
10146 %                                                                             %
10147 %   M a g i c k S h a d e I m a g e C h a n n e l                             %
10148 %                                                                             %
10149 %                                                                             %
10150 %                                                                             %
10151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10152 %
10153 %  MagickShadeImage() shines a distant light on an image to create a
10154 %  three-dimensional effect. You control the positioning of the light with
10155 %  azimuth and elevation; azimuth is measured in degrees off the x axis
10156 %  and elevation is measured in pixels above the Z axis.
10157 %
10158 %  The format of the MagickShadeImage method is:
10159 %
10160 %      MagickBooleanType MagickShadeImage(MagickWand *wand,
10161 %        const MagickBooleanType gray,const double azimuth,
10162 %        const double elevation)
10163 %
10164 %  A description of each parameter follows:
10165 %
10166 %    o wand: the magick wand.
10167 %
10168 %    o gray: A value other than zero shades the intensity of each pixel.
10169 %
10170 %    o azimuth, elevation:  Define the light source direction.
10171 %
10172 */
10173 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10174   const MagickBooleanType gray,const double asimuth,const double elevation)
10175 {
10176   Image
10177     *shade_image;
10178
10179   assert(wand != (MagickWand *) NULL);
10180   assert(wand->signature == WandSignature);
10181   if (wand->debug != MagickFalse)
10182     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10183   if (wand->images == (Image *) NULL)
10184     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10185   shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10186   if (shade_image == (Image *) NULL)
10187     return(MagickFalse);
10188   ReplaceImageInList(&wand->images,shade_image);
10189   return(MagickTrue);
10190 }
10191 \f
10192 /*
10193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10194 %                                                                             %
10195 %                                                                             %
10196 %                                                                             %
10197 %   M a g i c k S h a d o w I m a g e                                         %
10198 %                                                                             %
10199 %                                                                             %
10200 %                                                                             %
10201 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10202 %
10203 %  MagickShadowImage() simulates an image shadow.
10204 %
10205 %  The format of the MagickShadowImage method is:
10206 %
10207 %      MagickBooleanType MagickShadowImage(MagickWand *wand,
10208 %        const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10209 %
10210 %  A description of each parameter follows:
10211 %
10212 %    o wand: the magick wand.
10213 %
10214 %    o opacity: percentage transparency.
10215 %
10216 %    o sigma: the standard deviation of the Gaussian, in pixels.
10217 %
10218 %    o x: the shadow x-offset.
10219 %
10220 %    o y: the shadow y-offset.
10221 %
10222 */
10223 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10224   const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10225 {
10226   Image
10227     *shadow_image;
10228
10229   assert(wand != (MagickWand *) NULL);
10230   assert(wand->signature == WandSignature);
10231   if (wand->debug != MagickFalse)
10232     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10233   if (wand->images == (Image *) NULL)
10234     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10235   shadow_image=ShadowImage(wand->images,opacity,sigma,x,y,wand->exception);
10236   if (shadow_image == (Image *) NULL)
10237     return(MagickFalse);
10238   ReplaceImageInList(&wand->images,shadow_image);
10239   return(MagickTrue);
10240 }
10241 \f
10242 /*
10243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10244 %                                                                             %
10245 %                                                                             %
10246 %                                                                             %
10247 %   M a g i c k S h a r p e n I m a g e                                       %
10248 %                                                                             %
10249 %                                                                             %
10250 %                                                                             %
10251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10252 %
10253 %  MagickSharpenImage() sharpens an image.  We convolve the image with a
10254 %  Gaussian operator of the given radius and standard deviation (sigma).
10255 %  For reasonable results, the radius should be larger than sigma.  Use a
10256 %  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10257 %
10258 %  The format of the MagickSharpenImage method is:
10259 %
10260 %      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10261 %        const double radius,const double sigma)
10262 %
10263 %  A description of each parameter follows:
10264 %
10265 %    o wand: the magick wand.
10266 %
10267 %    o radius: the radius of the Gaussian, in pixels, not counting the center
10268 %      pixel.
10269 %
10270 %    o sigma: the standard deviation of the Gaussian, in pixels.
10271 %
10272 */
10273 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10274   const double radius,const double sigma)
10275 {
10276   Image
10277     *sharp_image;
10278
10279   assert(wand != (MagickWand *) NULL);
10280   assert(wand->signature == WandSignature);
10281   if (wand->debug != MagickFalse)
10282     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10283   if (wand->images == (Image *) NULL)
10284     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10285   sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
10286   if (sharp_image == (Image *) NULL)
10287     return(MagickFalse);
10288   ReplaceImageInList(&wand->images,sharp_image);
10289   return(MagickTrue);
10290 }
10291 \f
10292 /*
10293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10294 %                                                                             %
10295 %                                                                             %
10296 %                                                                             %
10297 %   M a g i c k S h a v e I m a g e                                           %
10298 %                                                                             %
10299 %                                                                             %
10300 %                                                                             %
10301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10302 %
10303 %  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10304 %  memory necessary for the new Image structure and returns a pointer to the
10305 %  new image.
10306 %
10307 %  The format of the MagickShaveImage method is:
10308 %
10309 %      MagickBooleanType MagickShaveImage(MagickWand *wand,
10310 %        const size_t columns,const size_t rows)
10311 %
10312 %  A description of each parameter follows:
10313 %
10314 %    o wand: the magick wand.
10315 %
10316 %    o columns: the number of columns in the scaled image.
10317 %
10318 %    o rows: the number of rows in the scaled image.
10319 %
10320 %
10321 */
10322 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10323   const size_t columns,const size_t rows)
10324 {
10325   Image
10326     *shave_image;
10327
10328   RectangleInfo
10329     shave_info;
10330
10331   assert(wand != (MagickWand *) NULL);
10332   assert(wand->signature == WandSignature);
10333   if (wand->debug != MagickFalse)
10334     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10335   if (wand->images == (Image *) NULL)
10336     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10337   shave_info.width=columns;
10338   shave_info.height=rows;
10339   shave_info.x=0;
10340   shave_info.y=0;
10341   shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10342   if (shave_image == (Image *) NULL)
10343     return(MagickFalse);
10344   ReplaceImageInList(&wand->images,shave_image);
10345   return(MagickTrue);
10346 }
10347 \f
10348 /*
10349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10350 %                                                                             %
10351 %                                                                             %
10352 %                                                                             %
10353 %   M a g i c k S h e a r I m a g e                                           %
10354 %                                                                             %
10355 %                                                                             %
10356 %                                                                             %
10357 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10358 %
10359 %  MagickShearImage() slides one edge of an image along the X or Y axis,
10360 %  creating a parallelogram.  An X direction shear slides an edge along the X
10361 %  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10362 %  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10363 %  is measured relative to the Y axis, and similarly, for Y direction shears
10364 %  y_shear is measured relative to the X axis.  Empty triangles left over from
10365 %  shearing the image are filled with the background color.
10366 %
10367 %  The format of the MagickShearImage method is:
10368 %
10369 %      MagickBooleanType MagickShearImage(MagickWand *wand,
10370 %        const PixelWand *background,const double x_shear,onst double y_shear)
10371 %
10372 %  A description of each parameter follows:
10373 %
10374 %    o wand: the magick wand.
10375 %
10376 %    o background: the background pixel wand.
10377 %
10378 %    o x_shear: the number of degrees to shear the image.
10379 %
10380 %    o y_shear: the number of degrees to shear the image.
10381 %
10382 */
10383 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10384   const PixelWand *background,const double x_shear,const double y_shear)
10385 {
10386   Image
10387     *shear_image;
10388
10389   assert(wand != (MagickWand *) NULL);
10390   assert(wand->signature == WandSignature);
10391   if (wand->debug != MagickFalse)
10392     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10393   if (wand->images == (Image *) NULL)
10394     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10395   PixelGetQuantumPacket(background,&wand->images->background_color);
10396   shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10397   if (shear_image == (Image *) NULL)
10398     return(MagickFalse);
10399   ReplaceImageInList(&wand->images,shear_image);
10400   return(MagickTrue);
10401 }
10402 \f
10403 /*
10404 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10405 %                                                                             %
10406 %                                                                             %
10407 %                                                                             %
10408 %   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                   %
10409 %                                                                             %
10410 %                                                                             %
10411 %                                                                             %
10412 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10413 %
10414 %  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10415 %  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10416 %  image using a sigmoidal transfer function without saturating highlights or
10417 %  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10418 %  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10419 %  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10420 %  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10421 %  is reduced.
10422 %
10423 %  The format of the MagickSigmoidalContrastImage method is:
10424 %
10425 %      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10426 %        const MagickBooleanType sharpen,const double alpha,const double beta)
10427 %
10428 %  A description of each parameter follows:
10429 %
10430 %    o wand: the magick wand.
10431 %
10432 %    o sharpen: Increase or decrease image contrast.
10433 %
10434 %    o alpha: strength of the contrast, the larger the number the more
10435 %      'threshold-like' it becomes.
10436 %
10437 %    o beta: midpoint of the function as a color value 0 to QuantumRange.
10438 %
10439 */
10440 WandExport MagickBooleanType MagickSigmoidalContrastImage(
10441   MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10442   const double beta)
10443 {
10444   MagickBooleanType
10445     status;
10446
10447   assert(wand != (MagickWand *) NULL);
10448   assert(wand->signature == WandSignature);
10449   if (wand->debug != MagickFalse)
10450     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10451   if (wand->images == (Image *) NULL)
10452     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10453   status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta);
10454   if (status == MagickFalse)
10455     InheritException(wand->exception,&wand->images->exception);
10456   return(status);
10457 }
10458 \f
10459 /*
10460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10461 %                                                                             %
10462 %                                                                             %
10463 %                                                                             %
10464 %   M a g i c k S i m i l a r i t y I m a g e                                 %
10465 %                                                                             %
10466 %                                                                             %
10467 %                                                                             %
10468 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10469 %
10470 %  MagickSimilarityImage() compares the reference image of the image and
10471 %  returns the best match offset.  In addition, it returns a similarity image
10472 %  such that an exact match location is completely white and if none of the
10473 %  pixels match, black, otherwise some gray level in-between.
10474 %
10475 %  The format of the MagickSimilarityImage method is:
10476 %
10477 %      MagickWand *MagickSimilarityImage(MagickWand *wand,
10478 %        const MagickWand *reference,RectangeInfo *offset,double *similarity)
10479 %
10480 %  A description of each parameter follows:
10481 %
10482 %    o wand: the magick wand.
10483 %
10484 %    o reference: the reference wand.
10485 %
10486 %    o offset: the best match offset of the reference image within the image.
10487 %
10488 %    o similarity: the computed similarity between the images.
10489 %
10490 */
10491 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10492   const MagickWand *reference,RectangleInfo *offset,double *similarity)
10493 {
10494   Image
10495     *similarity_image;
10496
10497   assert(wand != (MagickWand *) NULL);
10498   assert(wand->signature == WandSignature);
10499   if (wand->debug != MagickFalse)
10500     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10501   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10502     {
10503       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10504         "ContainsNoImages","`%s'",wand->name);
10505       return((MagickWand *) NULL);
10506     }
10507   similarity_image=SimilarityImage(wand->images,reference->images,offset,
10508     similarity,&wand->images->exception);
10509   if (similarity_image == (Image *) NULL)
10510     return((MagickWand *) NULL);
10511   return(CloneMagickWandFromImages(wand,similarity_image));
10512 }
10513 \f
10514 /*
10515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10516 %                                                                             %
10517 %                                                                             %
10518 %                                                                             %
10519 %   M a g i c k S k e t c h I m a g e                                         %
10520 %                                                                             %
10521 %                                                                             %
10522 %                                                                             %
10523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10524 %
10525 %  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10526 %  a Gaussian operator of the given radius and standard deviation (sigma).
10527 %  For reasonable results, radius should be larger than sigma.  Use a
10528 %  radius of 0 and SketchImage() selects a suitable radius for you.
10529 %  Angle gives the angle of the blurring motion.
10530 %
10531 %  The format of the MagickSketchImage method is:
10532 %
10533 %      MagickBooleanType MagickSketchImage(MagickWand *wand,
10534 %        const double radius,const double sigma,const double angle)
10535 %
10536 %  A description of each parameter follows:
10537 %
10538 %    o wand: the magick wand.
10539 %
10540 %    o radius: the radius of the Gaussian, in pixels, not counting
10541 %      the center pixel.
10542 %
10543 %    o sigma: the standard deviation of the Gaussian, in pixels.
10544 %
10545 %    o angle: Apply the effect along this angle.
10546 %
10547 */
10548 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10549   const double radius,const double sigma,const double angle)
10550 {
10551   Image
10552     *sketch_image;
10553
10554   assert(wand != (MagickWand *) NULL);
10555   assert(wand->signature == WandSignature);
10556   if (wand->debug != MagickFalse)
10557     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10558   if (wand->images == (Image *) NULL)
10559     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10560   sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
10561   if (sketch_image == (Image *) NULL)
10562     return(MagickFalse);
10563   ReplaceImageInList(&wand->images,sketch_image);
10564   return(MagickTrue);
10565 }
10566 \f
10567 /*
10568 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10569 %                                                                             %
10570 %                                                                             %
10571 %                                                                             %
10572 %   M a g i c k S m u s h I m a g e s                                         %
10573 %                                                                             %
10574 %                                                                             %
10575 %                                                                             %
10576 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10577 %
10578 %  MagickSmushImages() takes all images from the current image pointer to the
10579 %  end of the image list and smushs them to each other top-to-bottom if the
10580 %  stack parameter is true, otherwise left-to-right.
10581 %
10582 %  The format of the MagickSmushImages method is:
10583 %
10584 %      MagickWand *MagickSmushImages(MagickWand *wand,
10585 %        const MagickBooleanType stack,const ssize_t offset)
10586 %
10587 %  A description of each parameter follows:
10588 %
10589 %    o wand: the magick wand.
10590 %
10591 %    o stack: By default, images are stacked left-to-right. Set stack to
10592 %      MagickTrue to stack them top-to-bottom.
10593 %
10594 %    o offset: minimum distance in pixels between images.
10595 %
10596 */
10597 WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10598   const MagickBooleanType stack,const ssize_t offset)
10599 {
10600   Image
10601     *smush_image;
10602
10603   assert(wand != (MagickWand *) NULL);
10604   assert(wand->signature == WandSignature);
10605   if (wand->debug != MagickFalse)
10606     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10607   if (wand->images == (Image *) NULL)
10608     return((MagickWand *) NULL);
10609   smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10610   if (smush_image == (Image *) NULL)
10611     return((MagickWand *) NULL);
10612   return(CloneMagickWandFromImages(wand,smush_image));
10613 }
10614 \f
10615 /*
10616 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10617 %                                                                             %
10618 %                                                                             %
10619 %                                                                             %
10620 %     M a g i c k S o l a r i z e I m a g e                                   %
10621 %                                                                             %
10622 %                                                                             %
10623 %                                                                             %
10624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10625 %
10626 %  MagickSolarizeImage() applies a special effect to the image, similar to the
10627 %  effect achieved in a photo darkroom by selectively exposing areas of photo
10628 %  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
10629 %  measure of the extent of the solarization.
10630 %
10631 %  The format of the MagickSolarizeImage method is:
10632 %
10633 %      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10634 %        const double threshold)
10635 %
10636 %  A description of each parameter follows:
10637 %
10638 %    o wand: the magick wand.
10639 %
10640 %    o threshold:  Define the extent of the solarization.
10641 %
10642 */
10643 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10644   const double threshold)
10645 {
10646   MagickBooleanType
10647     status;
10648
10649   assert(wand != (MagickWand *) NULL);
10650   assert(wand->signature == WandSignature);
10651   if (wand->debug != MagickFalse)
10652     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10653   if (wand->images == (Image *) NULL)
10654     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10655   status=SolarizeImage(wand->images,threshold);
10656   if (status == MagickFalse)
10657     InheritException(wand->exception,&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 %
10810 %  A description of each parameter follows:
10811 %
10812 %    o wand: the magick wand.
10813 %
10814 %    o radius:  Choose a random pixel in a neighborhood of this extent.
10815 %
10816 */
10817 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
10818   const double radius)
10819 {
10820   Image
10821     *spread_image;
10822
10823   assert(wand != (MagickWand *) NULL);
10824   assert(wand->signature == WandSignature);
10825   if (wand->debug != MagickFalse)
10826     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10827   if (wand->images == (Image *) NULL)
10828     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10829   spread_image=SpreadImage(wand->images,radius,wand->exception);
10830   if (spread_image == (Image *) NULL)
10831     return(MagickFalse);
10832   ReplaceImageInList(&wand->images,spread_image);
10833   return(MagickTrue);
10834 }
10835 \f
10836 /*
10837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10838 %                                                                             %
10839 %                                                                             %
10840 %                                                                             %
10841 %   M a g i c k S t a t i s t i c I m a g e                                   %
10842 %                                                                             %
10843 %                                                                             %
10844 %                                                                             %
10845 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10846 %
10847 %  MagickStatisticImage() replace each pixel with corresponding statistic from
10848 %  the neighborhood of the specified width and height.
10849 %
10850 %  The format of the MagickStatisticImage method is:
10851 %
10852 %      MagickBooleanType MagickStatisticImage(MagickWand *wand,
10853 %        const StatisticType type,const double width,const size_t height)
10854 %
10855 %  A description of each parameter follows:
10856 %
10857 %    o wand: the magick wand.
10858 %
10859 %    o type: the statistic type (e.g. median, mode, etc.).
10860 %
10861 %    o width: the width of the pixel neighborhood.
10862 %
10863 %    o height: the height of the pixel neighborhood.
10864 %
10865 */
10866 WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
10867   const StatisticType type,const size_t width,const size_t height)
10868 {
10869   Image
10870     *statistic_image;
10871
10872   assert(wand != (MagickWand *) NULL);
10873   assert(wand->signature == WandSignature);
10874   if (wand->debug != MagickFalse)
10875     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10876   if (wand->images == (Image *) NULL)
10877     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10878   statistic_image=StatisticImage(wand->images,type,width,height,
10879     wand->exception);
10880   if (statistic_image == (Image *) NULL)
10881     return(MagickFalse);
10882   ReplaceImageInList(&wand->images,statistic_image);
10883   return(MagickTrue);
10884 }
10885 \f
10886 /*
10887 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10888 %                                                                             %
10889 %                                                                             %
10890 %                                                                             %
10891 %   M a g i c k S t e g a n o I m a g e                                       %
10892 %                                                                             %
10893 %                                                                             %
10894 %                                                                             %
10895 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10896 %
10897 %  MagickSteganoImage() hides a digital watermark within the image.
10898 %  Recover the hidden watermark later to prove that the authenticity of
10899 %  an image.  Offset defines the start position within the image to hide
10900 %  the watermark.
10901 %
10902 %  The format of the MagickSteganoImage method is:
10903 %
10904 %      MagickWand *MagickSteganoImage(MagickWand *wand,
10905 %        const MagickWand *watermark_wand,const ssize_t offset)
10906 %
10907 %  A description of each parameter follows:
10908 %
10909 %    o wand: the magick wand.
10910 %
10911 %    o watermark_wand: the watermark wand.
10912 %
10913 %    o offset: Start hiding at this offset into the image.
10914 %
10915 */
10916 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
10917   const MagickWand *watermark_wand,const ssize_t offset)
10918 {
10919   Image
10920     *stegano_image;
10921
10922   assert(wand != (MagickWand *) NULL);
10923   assert(wand->signature == WandSignature);
10924   if (wand->debug != MagickFalse)
10925     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10926   if ((wand->images == (Image *) NULL) ||
10927       (watermark_wand->images == (Image *) NULL))
10928     {
10929       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10930         "ContainsNoImages","`%s'",wand->name);
10931       return((MagickWand *) NULL);
10932     }
10933   wand->images->offset=offset;
10934   stegano_image=SteganoImage(wand->images,watermark_wand->images,
10935     wand->exception);
10936   if (stegano_image == (Image *) NULL)
10937     return((MagickWand *) NULL);
10938   return(CloneMagickWandFromImages(wand,stegano_image));
10939 }
10940 \f
10941 /*
10942 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10943 %                                                                             %
10944 %                                                                             %
10945 %                                                                             %
10946 %   M a g i c k S t e r e o I m a g e                                         %
10947 %                                                                             %
10948 %                                                                             %
10949 %                                                                             %
10950 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10951 %
10952 %  MagickStereoImage() composites two images and produces a single image that
10953 %  is the composite of a left and right image of a stereo pair
10954 %
10955 %  The format of the MagickStereoImage method is:
10956 %
10957 %      MagickWand *MagickStereoImage(MagickWand *wand,
10958 %        const MagickWand *offset_wand)
10959 %
10960 %  A description of each parameter follows:
10961 %
10962 %    o wand: the magick wand.
10963 %
10964 %    o offset_wand: Another image wand.
10965 %
10966 */
10967 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
10968   const MagickWand *offset_wand)
10969 {
10970   Image
10971     *stereo_image;
10972
10973   assert(wand != (MagickWand *) NULL);
10974   assert(wand->signature == WandSignature);
10975   if (wand->debug != MagickFalse)
10976     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10977   if ((wand->images == (Image *) NULL) ||
10978       (offset_wand->images == (Image *) NULL))
10979     {
10980       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10981         "ContainsNoImages","`%s'",wand->name);
10982       return((MagickWand *) NULL);
10983     }
10984   stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
10985   if (stereo_image == (Image *) NULL)
10986     return((MagickWand *) NULL);
10987   return(CloneMagickWandFromImages(wand,stereo_image));
10988 }
10989 \f
10990 /*
10991 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10992 %                                                                             %
10993 %                                                                             %
10994 %                                                                             %
10995 %   M a g i c k S t r i p I m a g e                                           %
10996 %                                                                             %
10997 %                                                                             %
10998 %                                                                             %
10999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11000 %
11001 %  MagickStripImage() strips an image of all profiles and comments.
11002 %
11003 %  The format of the MagickStripImage method is:
11004 %
11005 %      MagickBooleanType MagickStripImage(MagickWand *wand)
11006 %
11007 %  A description of each parameter follows:
11008 %
11009 %    o wand: the magick wand.
11010 %
11011 */
11012 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11013 {
11014   MagickBooleanType
11015     status;
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   status=StripImage(wand->images);
11024   if (status == MagickFalse)
11025     InheritException(wand->exception,&wand->images->exception);
11026   return(status);
11027 }
11028 \f
11029 /*
11030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11031 %                                                                             %
11032 %                                                                             %
11033 %                                                                             %
11034 %   M a g i c k S w i r l I m a g e                                           %
11035 %                                                                             %
11036 %                                                                             %
11037 %                                                                             %
11038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11039 %
11040 %  MagickSwirlImage() swirls the pixels about the center of the image, where
11041 %  degrees indicates the sweep of the arc through which each pixel is moved.
11042 %  You get a more dramatic effect as the degrees move from 1 to 360.
11043 %
11044 %  The format of the MagickSwirlImage method is:
11045 %
11046 %      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees)
11047 %
11048 %  A description of each parameter follows:
11049 %
11050 %    o wand: the magick wand.
11051 %
11052 %    o degrees: Define the tightness of the swirling effect.
11053 %
11054 */
11055 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11056   const double degrees)
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,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);
11124   if (status == MagickFalse)
11125     {
11126       InheritException(wand->exception,&texture_image->exception);
11127       texture_image=DestroyImage(texture_image);
11128       return((MagickWand *) NULL);
11129     }
11130   return(CloneMagickWandFromImages(wand,texture_image));
11131 }
11132 \f
11133 /*
11134 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11135 %                                                                             %
11136 %                                                                             %
11137 %                                                                             %
11138 %   M a g i c k T h r e s h o l d I m a g e                                   %
11139 %                                                                             %
11140 %                                                                             %
11141 %                                                                             %
11142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11143 %
11144 %  MagickThresholdImage() changes the value of individual pixels based on
11145 %  the intensity of each pixel compared to threshold.  The result is a
11146 %  high-contrast, two color image.
11147 %
11148 %  The format of the MagickThresholdImage method is:
11149 %
11150 %      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11151 %        const double threshold)
11152 %      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11153 %        const ChannelType channel,const double threshold)
11154 %
11155 %  A description of each parameter follows:
11156 %
11157 %    o wand: the magick wand.
11158 %
11159 %    o channel: the image channel(s).
11160 %
11161 %    o threshold: Define the threshold value.
11162 %
11163 */
11164 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11165   const double threshold)
11166 {
11167   MagickBooleanType
11168     status;
11169
11170   status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11171   return(status);
11172 }
11173
11174 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11175   const ChannelType channel,const double threshold)
11176 {
11177   MagickBooleanType
11178     status;
11179
11180   assert(wand != (MagickWand *) NULL);
11181   assert(wand->signature == WandSignature);
11182   if (wand->debug != MagickFalse)
11183     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11184   if (wand->images == (Image *) NULL)
11185     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11186   status=BilevelImage(wand->images,threshold);
11187   if (status == MagickFalse)
11188     InheritException(wand->exception,&wand->images->exception);
11189   return(status);
11190 }
11191 \f
11192 /*
11193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11194 %                                                                             %
11195 %                                                                             %
11196 %                                                                             %
11197 %   M a g i c k T h u m b n a i l I m a g e                                   %
11198 %                                                                             %
11199 %                                                                             %
11200 %                                                                             %
11201 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11202 %
11203 %  MagickThumbnailImage()  changes the size of an image to the given dimensions
11204 %  and removes any associated profiles.  The goal is to produce small low cost
11205 %  thumbnail images suited for display on the Web.
11206 %
11207 %  The format of the MagickThumbnailImage method is:
11208 %
11209 %      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11210 %        const size_t columns,const size_t rows)
11211 %
11212 %  A description of each parameter follows:
11213 %
11214 %    o wand: the magick wand.
11215 %
11216 %    o columns: the number of columns in the scaled image.
11217 %
11218 %    o rows: the number of rows in the scaled image.
11219 %
11220 */
11221 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11222   const size_t columns,const size_t rows)
11223 {
11224   Image
11225     *thumbnail_image;
11226
11227   assert(wand != (MagickWand *) NULL);
11228   assert(wand->signature == WandSignature);
11229   if (wand->debug != MagickFalse)
11230     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11231   if (wand->images == (Image *) NULL)
11232     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11233   thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11234   if (thumbnail_image == (Image *) NULL)
11235     return(MagickFalse);
11236   ReplaceImageInList(&wand->images,thumbnail_image);
11237   return(MagickTrue);
11238 }
11239 \f
11240 /*
11241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11242 %                                                                             %
11243 %                                                                             %
11244 %                                                                             %
11245 %   M a g i c k T i n t I m a g e                                             %
11246 %                                                                             %
11247 %                                                                             %
11248 %                                                                             %
11249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11250 %
11251 %  MagickTintImage() applies a color vector to each pixel in the image.  The
11252 %  length of the vector is 0 for black and white and at its maximum for the
11253 %  midtones.  The vector weighting function is
11254 %  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11255 %
11256 %  The format of the MagickTintImage method is:
11257 %
11258 %      MagickBooleanType MagickTintImage(MagickWand *wand,
11259 %        const PixelWand *tint,const PixelWand *opacity)
11260 %
11261 %  A description of each parameter follows:
11262 %
11263 %    o wand: the magick wand.
11264 %
11265 %    o tint: the tint pixel wand.
11266 %
11267 %    o opacity: the opacity pixel wand.
11268 %
11269 */
11270 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11271   const PixelWand *tint,const PixelWand *opacity)
11272 {
11273   char
11274     percent_opaque[MaxTextExtent];
11275
11276   Image
11277     *tint_image;
11278
11279   PixelPacket
11280     target;
11281
11282   assert(wand != (MagickWand *) NULL);
11283   assert(wand->signature == WandSignature);
11284   if (wand->debug != MagickFalse)
11285     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11286   if (wand->images == (Image *) NULL)
11287     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11288   (void) FormatLocaleString(percent_opaque,MaxTextExtent,
11289     "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11290     PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
11291     PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
11292     PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
11293     PixelGetOpacityQuantum(opacity)));
11294   PixelGetQuantumPacket(tint,&target);
11295   tint_image=TintImage(wand->images,percent_opaque,target,wand->exception);
11296   if (tint_image == (Image *) NULL)
11297     return(MagickFalse);
11298   ReplaceImageInList(&wand->images,tint_image);
11299   return(MagickTrue);
11300 }
11301 \f
11302 /*
11303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11304 %                                                                             %
11305 %                                                                             %
11306 %                                                                             %
11307 %   M a g i c k T r a n s f o r m I m a g e                                   %
11308 %                                                                             %
11309 %                                                                             %
11310 %                                                                             %
11311 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11312 %
11313 %  MagickTransformImage() is a convenience method that behaves like
11314 %  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11315 %  information as a region geometry specification.  If the operation fails,
11316 %  a NULL image handle is returned.
11317 %
11318 %  The format of the MagickTransformImage method is:
11319 %
11320 %      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11321 %        const char *geometry)
11322 %
11323 %  A description of each parameter follows:
11324 %
11325 %    o wand: the magick wand.
11326 %
11327 %    o crop: A crop geometry string.  This geometry defines a subregion of the
11328 %      image to crop.
11329 %
11330 %    o geometry: An image geometry string.  This geometry defines the final
11331 %      size of the image.
11332 %
11333 */
11334 WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11335   const char *crop,const char *geometry)
11336 {
11337   Image
11338     *transform_image;
11339
11340   MagickBooleanType
11341     status;
11342
11343   assert(wand != (MagickWand *) NULL);
11344   assert(wand->signature == WandSignature);
11345   if (wand->debug != MagickFalse)
11346     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11347   if (wand->images == (Image *) NULL)
11348     return((MagickWand *) NULL);
11349   transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11350   if (transform_image == (Image *) NULL)
11351     return((MagickWand *) NULL);
11352   status=TransformImage(&transform_image,crop,geometry);
11353   if (status == MagickFalse)
11354     {
11355       InheritException(wand->exception,&transform_image->exception);
11356       transform_image=DestroyImage(transform_image);
11357       return((MagickWand *) NULL);
11358     }
11359   return(CloneMagickWandFromImages(wand,transform_image));
11360 }
11361 \f
11362 /*
11363 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11364 %                                                                             %
11365 %                                                                             %
11366 %                                                                             %
11367 %   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               %
11368 %                                                                             %
11369 %                                                                             %
11370 %                                                                             %
11371 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11372 %
11373 %  MagickTransformImageColorspace() transform the image colorspace.
11374 %
11375 %  The format of the MagickTransformImageColorspace method is:
11376 %
11377 %      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11378 %        const ColorspaceType colorspace)
11379 %
11380 %  A description of each parameter follows:
11381 %
11382 %    o wand: the magick wand.
11383 %
11384 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
11385 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
11386 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
11387 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
11388 %      HSLColorspace, or HWBColorspace.
11389 %
11390 */
11391 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11392   const ColorspaceType colorspace)
11393 {
11394   assert(wand != (MagickWand *) NULL);
11395   assert(wand->signature == WandSignature);
11396   if (wand->debug != MagickFalse)
11397     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11398   if (wand->images == (Image *) NULL)
11399     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11400   return(TransformImageColorspace(wand->images,colorspace));
11401 }
11402 \f
11403 /*
11404 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11405 %                                                                             %
11406 %                                                                             %
11407 %                                                                             %
11408 %   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                     %
11409 %                                                                             %
11410 %                                                                             %
11411 %                                                                             %
11412 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11413 %
11414 %  MagickTransparentPaintImage() changes any pixel that matches color with the
11415 %  color defined by fill.
11416 %
11417 %  The format of the MagickTransparentPaintImage method is:
11418 %
11419 %      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11420 %        const PixelWand *target,const double alpha,const double fuzz,
11421 %        const MagickBooleanType invert)
11422 %
11423 %  A description of each parameter follows:
11424 %
11425 %    o wand: the magick wand.
11426 %
11427 %    o target: Change this target color to specified opacity value within
11428 %      the image.
11429 %
11430 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11431 %      transparent.
11432 %
11433 %    o fuzz: By default target must match a particular pixel color
11434 %      exactly.  However, in many cases two colors may differ by a small amount.
11435 %      The fuzz member of image defines how much tolerance is acceptable to
11436 %      consider two colors as the same.  For example, set fuzz to 10 and the
11437 %      color red at intensities of 100 and 102 respectively are now interpreted
11438 %      as the same color for the purposes of the floodfill.
11439 %
11440 %    o invert: paint any pixel that does not match the target color.
11441 %
11442 */
11443 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11444   const PixelWand *target,const double alpha,const double fuzz,
11445   const MagickBooleanType invert)
11446 {
11447   MagickBooleanType
11448     status;
11449
11450   PixelInfo
11451     target_pixel;
11452
11453   assert(wand != (MagickWand *) NULL);
11454   assert(wand->signature == WandSignature);
11455   if (wand->debug != MagickFalse)
11456     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11457   if (wand->images == (Image *) NULL)
11458     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11459   PixelGetMagickColor(target,&target_pixel);
11460   wand->images->fuzz=fuzz;
11461   status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11462     QuantumRange*alpha),invert);
11463   if (status == MagickFalse)
11464     InheritException(wand->exception,&wand->images->exception);
11465   return(status);
11466 }
11467 \f
11468 /*
11469 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11470 %                                                                             %
11471 %                                                                             %
11472 %                                                                             %
11473 %   M a g i c k T r a n s p o s e I m a g e                                   %
11474 %                                                                             %
11475 %                                                                             %
11476 %                                                                             %
11477 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11478 %
11479 %  MagickTransposeImage() creates a vertical mirror image by reflecting the
11480 %  pixels around the central x-axis while rotating them 90-degrees.
11481 %
11482 %  The format of the MagickTransposeImage method is:
11483 %
11484 %      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11485 %
11486 %  A description of each parameter follows:
11487 %
11488 %    o wand: the magick wand.
11489 %
11490 */
11491 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11492 {
11493   Image
11494     *transpose_image;
11495
11496   assert(wand != (MagickWand *) NULL);
11497   assert(wand->signature == WandSignature);
11498   if (wand->debug != MagickFalse)
11499     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11500   if (wand->images == (Image *) NULL)
11501     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11502   transpose_image=TransposeImage(wand->images,wand->exception);
11503   if (transpose_image == (Image *) NULL)
11504     return(MagickFalse);
11505   ReplaceImageInList(&wand->images,transpose_image);
11506   return(MagickTrue);
11507 }
11508 \f
11509 /*
11510 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11511 %                                                                             %
11512 %                                                                             %
11513 %                                                                             %
11514 %   M a g i c k T r a n s v e r s e I m a g e                                 %
11515 %                                                                             %
11516 %                                                                             %
11517 %                                                                             %
11518 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11519 %
11520 %  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11521 %  pixels around the central y-axis while rotating them 270-degrees.
11522 %
11523 %  The format of the MagickTransverseImage method is:
11524 %
11525 %      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11526 %
11527 %  A description of each parameter follows:
11528 %
11529 %    o wand: the magick wand.
11530 %
11531 */
11532 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11533 {
11534   Image
11535     *transverse_image;
11536
11537   assert(wand != (MagickWand *) NULL);
11538   assert(wand->signature == WandSignature);
11539   if (wand->debug != MagickFalse)
11540     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11541   if (wand->images == (Image *) NULL)
11542     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11543   transverse_image=TransverseImage(wand->images,wand->exception);
11544   if (transverse_image == (Image *) NULL)
11545     return(MagickFalse);
11546   ReplaceImageInList(&wand->images,transverse_image);
11547   return(MagickTrue);
11548 }
11549 \f
11550 /*
11551 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11552 %                                                                             %
11553 %                                                                             %
11554 %                                                                             %
11555 %   M a g i c k T r i m I m a g e                                             %
11556 %                                                                             %
11557 %                                                                             %
11558 %                                                                             %
11559 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11560 %
11561 %  MagickTrimImage() remove edges that are the background color from the image.
11562 %
11563 %  The format of the MagickTrimImage method is:
11564 %
11565 %      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11566 %
11567 %  A description of each parameter follows:
11568 %
11569 %    o wand: the magick wand.
11570 %
11571 %    o fuzz: By default target must match a particular pixel color
11572 %      exactly.  However, in many cases two colors may differ by a small amount.
11573 %      The fuzz member of image defines how much tolerance is acceptable to
11574 %      consider two colors as the same.  For example, set fuzz to 10 and the
11575 %      color red at intensities of 100 and 102 respectively are now interpreted
11576 %      as the same color for the purposes of the floodfill.
11577 %
11578 */
11579 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11580 {
11581   Image
11582     *trim_image;
11583
11584   assert(wand != (MagickWand *) NULL);
11585   assert(wand->signature == WandSignature);
11586   if (wand->debug != MagickFalse)
11587     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11588   if (wand->images == (Image *) NULL)
11589     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11590   wand->images->fuzz=fuzz;
11591   trim_image=TrimImage(wand->images,wand->exception);
11592   if (trim_image == (Image *) NULL)
11593     return(MagickFalse);
11594   ReplaceImageInList(&wand->images,trim_image);
11595   return(MagickTrue);
11596 }
11597 \f
11598 /*
11599 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11600 %                                                                             %
11601 %                                                                             %
11602 %                                                                             %
11603 %   M a g i c k U n i q u e I m a g e C o l o r s                             %
11604 %                                                                             %
11605 %                                                                             %
11606 %                                                                             %
11607 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11608 %
11609 %  MagickUniqueImageColors() discards all but one of any pixel color.
11610 %
11611 %  The format of the MagickUniqueImageColors method is:
11612 %
11613 %      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11614 %
11615 %  A description of each parameter follows:
11616 %
11617 %    o wand: the magick wand.
11618 %
11619 */
11620 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11621 {
11622   Image
11623     *unique_image;
11624
11625   assert(wand != (MagickWand *) NULL);
11626   assert(wand->signature == WandSignature);
11627   if (wand->debug != MagickFalse)
11628     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11629   if (wand->images == (Image *) NULL)
11630     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11631   unique_image=UniqueImageColors(wand->images,wand->exception);
11632   if (unique_image == (Image *) NULL)
11633     return(MagickFalse);
11634   ReplaceImageInList(&wand->images,unique_image);
11635   return(MagickTrue);
11636 }
11637 \f
11638 /*
11639 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11640 %                                                                             %
11641 %                                                                             %
11642 %                                                                             %
11643 %   M a g i c k U n s h a r p M a s k I m a g e                               %
11644 %                                                                             %
11645 %                                                                             %
11646 %                                                                             %
11647 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11648 %
11649 %  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
11650 %  Gaussian operator of the given radius and standard deviation (sigma).
11651 %  For reasonable results, radius should be larger than sigma.  Use a radius
11652 %  of 0 and UnsharpMaskImage() selects a suitable radius for you.
11653 %
11654 %  The format of the MagickUnsharpMaskImage method is:
11655 %
11656 %      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11657 %        const double radius,const double sigma,const double amount,
11658 %        const double threshold)
11659 %
11660 %  A description of each parameter follows:
11661 %
11662 %    o wand: the magick wand.
11663 %
11664 %    o radius: the radius of the Gaussian, in pixels, not counting the center
11665 %      pixel.
11666 %
11667 %    o sigma: the standard deviation of the Gaussian, in pixels.
11668 %
11669 %    o amount: the percentage of the difference between the original and the
11670 %      blur image that is added back into the original.
11671 %
11672 %    o threshold: the threshold in pixels needed to apply the diffence amount.
11673 %
11674 */
11675 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11676   const double radius,const double sigma,const double amount,
11677   const double threshold)
11678 {
11679   Image
11680     *unsharp_image;
11681
11682   assert(wand != (MagickWand *) NULL);
11683   assert(wand->signature == WandSignature);
11684   if (wand->debug != MagickFalse)
11685     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11686   if (wand->images == (Image *) NULL)
11687     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11688   unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
11689     wand->exception);
11690   if (unsharp_image == (Image *) NULL)
11691     return(MagickFalse);
11692   ReplaceImageInList(&wand->images,unsharp_image);
11693   return(MagickTrue);
11694 }
11695 \f
11696 /*
11697 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11698 %                                                                             %
11699 %                                                                             %
11700 %                                                                             %
11701 %   M a g i c k V i g n e t t e I m a g e                                     %
11702 %                                                                             %
11703 %                                                                             %
11704 %                                                                             %
11705 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11706 %
11707 %  MagickVignetteImage() softens the edges of the image in vignette style.
11708 %
11709 %  The format of the MagickVignetteImage method is:
11710 %
11711 %      MagickBooleanType MagickVignetteImage(MagickWand *wand,
11712 %        const double black_point,const double white_point,const ssize_t x,
11713 %        const ssize_t y)
11714 %
11715 %  A description of each parameter follows:
11716 %
11717 %    o wand: the magick wand.
11718 %
11719 %    o black_point: the black point.
11720 %
11721 %    o white_point: the white point.
11722 %
11723 %    o x, y:  Define the x and y ellipse offset.
11724 %
11725 */
11726 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
11727   const double black_point,const double white_point,const ssize_t x,const ssize_t y)
11728 {
11729   Image
11730     *vignette_image;
11731
11732   assert(wand != (MagickWand *) NULL);
11733   assert(wand->signature == WandSignature);
11734   if (wand->debug != MagickFalse)
11735     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11736   if (wand->images == (Image *) NULL)
11737     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11738   vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
11739     wand->exception);
11740   if (vignette_image == (Image *) NULL)
11741     return(MagickFalse);
11742   ReplaceImageInList(&wand->images,vignette_image);
11743   return(MagickTrue);
11744 }
11745 \f
11746 /*
11747 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11748 %                                                                             %
11749 %                                                                             %
11750 %                                                                             %
11751 %   M a g i c k W a v e I m a g e                                             %
11752 %                                                                             %
11753 %                                                                             %
11754 %                                                                             %
11755 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11756 %
11757 %  MagickWaveImage()  creates a "ripple" effect in the image by shifting
11758 %  the pixels vertically along a sine wave whose amplitude and wavelength
11759 %  is specified by the given parameters.
11760 %
11761 %  The format of the MagickWaveImage method is:
11762 %
11763 %      MagickBooleanType MagickWaveImage(MagickWand *wand,const double amplitude,
11764 %        const double wave_length)
11765 %
11766 %  A description of each parameter follows:
11767 %
11768 %    o wand: the magick wand.
11769 %
11770 %    o amplitude, wave_length:  Define the amplitude and wave length of the
11771 %      sine wave.
11772 %
11773 */
11774 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
11775   const double amplitude,const double wave_length)
11776 {
11777   Image
11778     *wave_image;
11779
11780   assert(wand != (MagickWand *) NULL);
11781   assert(wand->signature == WandSignature);
11782   if (wand->debug != MagickFalse)
11783     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11784   if (wand->images == (Image *) NULL)
11785     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11786   wave_image=WaveImage(wand->images,amplitude,wave_length,wand->exception);
11787   if (wave_image == (Image *) NULL)
11788     return(MagickFalse);
11789   ReplaceImageInList(&wand->images,wave_image);
11790   return(MagickTrue);
11791 }
11792 \f
11793 /*
11794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11795 %                                                                             %
11796 %                                                                             %
11797 %                                                                             %
11798 %   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                         %
11799 %                                                                             %
11800 %                                                                             %
11801 %                                                                             %
11802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11803 %
11804 %  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
11805 %  above the threshold into white while leaving all pixels below the threshold
11806 %  unchanged.
11807 %
11808 %  The format of the MagickWhiteThresholdImage method is:
11809 %
11810 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11811 %        const PixelWand *threshold)
11812 %
11813 %  A description of each parameter follows:
11814 %
11815 %    o wand: the magick wand.
11816 %
11817 %    o threshold: the pixel wand.
11818 %
11819 */
11820 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11821   const PixelWand *threshold)
11822 {
11823   char
11824     thresholds[MaxTextExtent];
11825
11826   MagickBooleanType
11827     status;
11828
11829   assert(wand != (MagickWand *) NULL);
11830   assert(wand->signature == WandSignature);
11831   if (wand->debug != MagickFalse)
11832     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11833   if (wand->images == (Image *) NULL)
11834     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11835   (void) FormatLocaleString(thresholds,MaxTextExtent,
11836     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
11837     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
11838     PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
11839   status=WhiteThresholdImage(wand->images,thresholds,&wand->images->exception);
11840   if (status == MagickFalse)
11841     InheritException(wand->exception,&wand->images->exception);
11842   return(status);
11843 }
11844 \f
11845 /*
11846 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11847 %                                                                             %
11848 %                                                                             %
11849 %                                                                             %
11850 %   M a g i c k W r i t e I m a g e                                           %
11851 %                                                                             %
11852 %                                                                             %
11853 %                                                                             %
11854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11855 %
11856 %  MagickWriteImage() writes an image to the specified filename.  If the
11857 %  filename parameter is NULL, the image is written to the filename set
11858 %  by MagickReadImage() or MagickSetImageFilename().
11859 %
11860 %  The format of the MagickWriteImage method is:
11861 %
11862 %      MagickBooleanType MagickWriteImage(MagickWand *wand,
11863 %        const char *filename)
11864 %
11865 %  A description of each parameter follows:
11866 %
11867 %    o wand: the magick wand.
11868 %
11869 %    o filename: the image filename.
11870 %
11871 %
11872 */
11873 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
11874   const char *filename)
11875 {
11876   Image
11877     *image;
11878
11879   ImageInfo
11880     *write_info;
11881
11882   MagickBooleanType
11883     status;
11884
11885   assert(wand != (MagickWand *) NULL);
11886   assert(wand->signature == WandSignature);
11887   if (wand->debug != MagickFalse)
11888     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11889   if (wand->images == (Image *) NULL)
11890     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11891   if (filename != (const char *) NULL)
11892     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
11893   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11894   if (image == (Image *) NULL)
11895     return(MagickFalse);
11896   write_info=CloneImageInfo(wand->image_info);
11897   write_info->adjoin=MagickTrue;
11898   status=WriteImage(write_info,image);
11899   if (status == MagickFalse)
11900     InheritException(wand->exception,&image->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);
11955   write_info=DestroyImageInfo(write_info);
11956   if (status == MagickFalse)
11957     InheritException(wand->exception,&image->exception);
11958   image=DestroyImage(image);
11959   return(status);
11960 }
11961 \f
11962 /*
11963 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11964 %                                                                             %
11965 %                                                                             %
11966 %                                                                             %
11967 %   M a g i c k W r i t e I m a g e s                                         %
11968 %                                                                             %
11969 %                                                                             %
11970 %                                                                             %
11971 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11972 %
11973 %  MagickWriteImages() writes an image or image sequence.
11974 %
11975 %  The format of the MagickWriteImages method is:
11976 %
11977 %      MagickBooleanType MagickWriteImages(MagickWand *wand,
11978 %        const char *filename,const MagickBooleanType adjoin)
11979 %
11980 %  A description of each parameter follows:
11981 %
11982 %    o wand: the magick wand.
11983 %
11984 %    o filename: the image filename.
11985 %
11986 %    o adjoin: join images into a single multi-image file.
11987 %
11988 */
11989 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
11990   const char *filename,const MagickBooleanType adjoin)
11991 {
11992   ImageInfo
11993     *write_info;
11994
11995   MagickBooleanType
11996     status;
11997
11998   assert(wand != (MagickWand *) NULL);
11999   assert(wand->signature == WandSignature);
12000   if (wand->debug != MagickFalse)
12001     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12002   if (wand->images == (Image *) NULL)
12003     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12004   write_info=CloneImageInfo(wand->image_info);
12005   write_info->adjoin=adjoin;
12006   status=WriteImages(write_info,wand->images,filename,wand->exception);
12007   if (status == MagickFalse)
12008     InheritException(wand->exception,&wand->images->exception);
12009   write_info=DestroyImageInfo(write_info);
12010   return(status);
12011 }
12012 \f
12013 /*
12014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12015 %                                                                             %
12016 %                                                                             %
12017 %                                                                             %
12018 %   M a g i c k W r i t e I m a g e s F i l e                                 %
12019 %                                                                             %
12020 %                                                                             %
12021 %                                                                             %
12022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12023 %
12024 %  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12025 %
12026 %  The format of the MagickWriteImagesFile method is:
12027 %
12028 %      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12029 %
12030 %  A description of each parameter follows:
12031 %
12032 %    o wand: the magick wand.
12033 %
12034 %    o file: the file descriptor.
12035 %
12036 */
12037 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12038 {
12039   ImageInfo
12040     *write_info;
12041
12042   MagickBooleanType
12043     status;
12044
12045   assert(wand != (MagickWand *) NULL);
12046   assert(wand->signature == WandSignature);
12047   if (wand->debug != MagickFalse)
12048     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12049   if (wand->images == (Image *) NULL)
12050     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12051   write_info=CloneImageInfo(wand->image_info);
12052   SetImageInfoFile(write_info,file);
12053   write_info->adjoin=MagickTrue;
12054   status=WriteImages(write_info,wand->images,(const char *) NULL,
12055     wand->exception);
12056   write_info=DestroyImageInfo(write_info);
12057   if (status == MagickFalse)
12058     InheritException(wand->exception,&wand->images->exception);
12059   return(status);
12060 }