]> 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,&wand->images->exception);
607   draw_info=DestroyDrawInfo(draw_info);
608   return(status);
609 }
610 \f
611 /*
612 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
613 %                                                                             %
614 %                                                                             %
615 %                                                                             %
616 %   M a g i c k A n i m a t e I m a g e s                                     %
617 %                                                                             %
618 %                                                                             %
619 %                                                                             %
620 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
621 %
622 %  MagickAnimateImages() animates an image or image sequence.
623 %
624 %  The format of the MagickAnimateImages method is:
625 %
626 %      MagickBooleanType MagickAnimateImages(MagickWand *wand,
627 %        const char *server_name)
628 %
629 %  A description of each parameter follows:
630 %
631 %    o wand: the magick wand.
632 %
633 %    o server_name: the X server name.
634 %
635 */
636 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
637   const char *server_name)
638 {
639   MagickBooleanType
640     status;
641
642   assert(wand != (MagickWand *) NULL);
643   assert(wand->signature == WandSignature);
644   if (wand->debug != MagickFalse)
645     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
646   (void) CloneString(&wand->image_info->server_name,server_name);
647   status=AnimateImages(wand->image_info,wand->images,&wand->images->exception);
648   return(status);
649 }
650 \f
651 /*
652 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
653 %                                                                             %
654 %                                                                             %
655 %                                                                             %
656 %   M a g i c k A p p e n d I m a g e s                                       %
657 %                                                                             %
658 %                                                                             %
659 %                                                                             %
660 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
661 %
662 %  MagickAppendImages() append a set of images.
663 %
664 %  The format of the MagickAppendImages method is:
665 %
666 %      MagickWand *MagickAppendImages(MagickWand *wand,
667 %        const MagickBooleanType stack)
668 %
669 %  A description of each parameter follows:
670 %
671 %    o wand: the magick wand.
672 %
673 %    o stack: By default, images are stacked left-to-right. Set stack to
674 %      MagickTrue to stack them top-to-bottom.
675 %
676 */
677 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
678   const MagickBooleanType stack)
679 {
680   Image
681     *append_image;
682
683   assert(wand != (MagickWand *) NULL);
684   assert(wand->signature == WandSignature);
685   if (wand->debug != MagickFalse)
686     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
687   if (wand->images == (Image *) NULL)
688     return((MagickWand *) NULL);
689   append_image=AppendImages(wand->images,stack,wand->exception);
690   if (append_image == (Image *) NULL)
691     return((MagickWand *) NULL);
692   return(CloneMagickWandFromImages(wand,append_image));
693 }
694 \f
695 /*
696 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
697 %                                                                             %
698 %                                                                             %
699 %                                                                             %
700 %   M a g i c k A u t o G a m m a I m a g e                                   %
701 %                                                                             %
702 %                                                                             %
703 %                                                                             %
704 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
705 %
706 %  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
707 %  image to try make set its gamma appropriatally.
708 %
709 %  The format of the MagickAutoGammaImage method is:
710 %
711 %      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
712 %
713 %  A description of each parameter follows:
714 %
715 %    o wand: the magick wand.
716 %
717 */
718 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
719 {
720   MagickBooleanType
721     status;
722
723   assert(wand != (MagickWand *) NULL);
724   assert(wand->signature == WandSignature);
725   if (wand->debug != MagickFalse)
726     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
727   if (wand->images == (Image *) NULL)
728     ThrowWandException(WandError,"ContainsNoImages",wand->name);
729   status=AutoGammaImage(wand->images,&wand->images->exception);
730   return(status);
731 }
732 \f
733 /*
734 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
735 %                                                                             %
736 %                                                                             %
737 %                                                                             %
738 %   M a g i c k A u t o L e v e l I m a g e                                   %
739 %                                                                             %
740 %                                                                             %
741 %                                                                             %
742 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
743 %
744 %  MagickAutoLevelImage() adjusts the levels of a particular image channel by
745 %  scaling the minimum and maximum values to the full quantum range.
746 %
747 %  The format of the MagickAutoLevelImage method is:
748 %
749 %      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
750 %
751 %  A description of each parameter follows:
752 %
753 %    o wand: the magick wand.
754 %
755 */
756 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
757 {
758   MagickBooleanType
759     status;
760
761   assert(wand != (MagickWand *) NULL);
762   assert(wand->signature == WandSignature);
763   if (wand->debug != MagickFalse)
764     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
765   if (wand->images == (Image *) NULL)
766     ThrowWandException(WandError,"ContainsNoImages",wand->name);
767   status=AutoLevelImage(wand->images,&wand->images->exception);
768   return(status);
769 }
770 \f
771 /*
772 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
773 %                                                                             %
774 %                                                                             %
775 %                                                                             %
776 %   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                         %
777 %                                                                             %
778 %                                                                             %
779 %                                                                             %
780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
781 %
782 %  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
783 %  pixels below the threshold into black while leaving all pixels above the
784 %  threshold unchanged.
785 %
786 %  The format of the MagickBlackThresholdImage method is:
787 %
788 %      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
789 %        const PixelWand *threshold)
790 %
791 %  A description of each parameter follows:
792 %
793 %    o wand: the magick wand.
794 %
795 %    o threshold: the pixel wand.
796 %
797 */
798 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
799   const PixelWand *threshold)
800 {
801   char
802     thresholds[MaxTextExtent];
803
804   MagickBooleanType
805     status;
806
807   assert(wand != (MagickWand *) NULL);
808   assert(wand->signature == WandSignature);
809   if (wand->debug != MagickFalse)
810     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
811   if (wand->images == (Image *) NULL)
812     ThrowWandException(WandError,"ContainsNoImages",wand->name);
813   (void) FormatLocaleString(thresholds,MaxTextExtent,
814     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
815     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
816     PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
817   status=BlackThresholdImage(wand->images,thresholds,&wand->images->exception);
818   if (status == MagickFalse)
819     InheritException(wand->exception,&wand->images->exception);
820   return(status);
821 }
822 \f
823 /*
824 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
825 %                                                                             %
826 %                                                                             %
827 %                                                                             %
828 %   M a g i c k B l u e S h i f t I m a g e                                   %
829 %                                                                             %
830 %                                                                             %
831 %                                                                             %
832 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
833 %
834 %  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
835 %  nighttime in the moonlight.
836 %
837 %  The format of the MagickBlueShiftImage method is:
838 %
839 %      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
840 %        const double factor)
841 %
842 %  A description of each parameter follows:
843 %
844 %    o wand: the magick wand.
845 %
846 %    o factor: the blue shift factor (default 1.5)
847 %
848 */
849 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
850   const double factor)
851 {
852   Image
853     *shift_image;
854
855   assert(wand != (MagickWand *) NULL);
856   assert(wand->signature == WandSignature);
857   if (wand->debug != MagickFalse)
858     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
859   if (wand->images == (Image *) NULL)
860     ThrowWandException(WandError,"ContainsNoImages",wand->name);
861   shift_image=BlueShiftImage(wand->images,factor,wand->exception);
862   if (shift_image == (Image *) NULL)
863     return(MagickFalse);
864   ReplaceImageInList(&wand->images,shift_image);
865   return(MagickTrue);
866 }
867 \f
868 /*
869 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
870 %                                                                             %
871 %                                                                             %
872 %                                                                             %
873 %   M a g i c k B l u r I m a g e                                             %
874 %                                                                             %
875 %                                                                             %
876 %                                                                             %
877 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
878 %
879 %  MagickBlurImage() blurs an image.  We convolve the image with a
880 %  gaussian operator of the given radius and standard deviation (sigma).
881 %  For reasonable results, the radius should be larger than sigma.  Use a
882 %  radius of 0 and BlurImage() selects a suitable radius for you.
883 %
884 %  The format of the MagickBlurImage method is:
885 %
886 %      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
887 %        const double sigma)
888 %
889 %  A description of each parameter follows:
890 %
891 %    o wand: the magick wand.
892 %
893 %    o radius: the radius of the , in pixels, not counting the center
894 %      pixel.
895 %
896 %    o sigma: the standard deviation of the , in pixels.
897 %
898 */
899 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
900   const double radius,const double sigma)
901 {
902   Image
903     *blur_image;
904
905   assert(wand != (MagickWand *) NULL);
906   assert(wand->signature == WandSignature);
907   if (wand->debug != MagickFalse)
908     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
909   if (wand->images == (Image *) NULL)
910     ThrowWandException(WandError,"ContainsNoImages",wand->name);
911   blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
912   if (blur_image == (Image *) NULL)
913     return(MagickFalse);
914   ReplaceImageInList(&wand->images,blur_image);
915   return(MagickTrue);
916 }
917 \f
918 /*
919 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
920 %                                                                             %
921 %                                                                             %
922 %                                                                             %
923 %   M a g i c k B o r d e r I m a g e                                         %
924 %                                                                             %
925 %                                                                             %
926 %                                                                             %
927 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
928 %
929 %  MagickBorderImage() surrounds the image with a border of the color defined
930 %  by the bordercolor pixel wand.
931 %
932 %  The format of the MagickBorderImage method is:
933 %
934 %      MagickBooleanType MagickBorderImage(MagickWand *wand,
935 %        const PixelWand *bordercolor,const size_t width,
936 %        const size_t height)
937 %
938 %  A description of each parameter follows:
939 %
940 %    o wand: the magick wand.
941 %
942 %    o bordercolor: the border color pixel wand.
943 %
944 %    o width: the border width.
945 %
946 %    o height: the border height.
947 %
948 */
949 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
950   const PixelWand *bordercolor,const size_t width,
951   const size_t height)
952 {
953   Image
954     *border_image;
955
956   RectangleInfo
957     border_info;
958
959   assert(wand != (MagickWand *) NULL);
960   assert(wand->signature == WandSignature);
961   if (wand->debug != MagickFalse)
962     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
963   if (wand->images == (Image *) NULL)
964     ThrowWandException(WandError,"ContainsNoImages",wand->name);
965   border_info.width=width;
966   border_info.height=height;
967   border_info.x=0;
968   border_info.y=0;
969   PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
970   border_image=BorderImage(wand->images,&border_info,wand->exception);
971   if (border_image == (Image *) NULL)
972     return(MagickFalse);
973   ReplaceImageInList(&wand->images,border_image);
974   return(MagickTrue);
975 }
976 \f
977 /*
978 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
979 %                                                                             %
980 %                                                                             %
981 %                                                                             %
982 %   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   %
983 %                                                                             %
984 %                                                                             %
985 %                                                                             %
986 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
987 %
988 %  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
989 %  of an image.  It converts the brightness and contrast parameters into slope
990 %  and intercept and calls a polynomical function to apply to the image.
991
992 %
993 %  The format of the MagickBrightnessContrastImage method is:
994 %
995 %      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
996 %        const double brightness,const double contrast)
997 %
998 %  A description of each parameter follows:
999 %
1000 %    o wand: the magick wand.
1001 %
1002 %    o brightness: the brightness percent (-100 .. 100).
1003 %
1004 %    o contrast: the contrast percent (-100 .. 100).
1005 %
1006 */
1007 WandExport MagickBooleanType MagickBrightnessContrastImage(
1008   MagickWand *wand,const double brightness,const double contrast)
1009 {
1010   MagickBooleanType
1011     status;
1012
1013   assert(wand != (MagickWand *) NULL);
1014   assert(wand->signature == WandSignature);
1015   if (wand->debug != MagickFalse)
1016     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1017   if (wand->images == (Image *) NULL)
1018     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1019   status=BrightnessContrastImage(wand->images,brightness,contrast,
1020     &wand->images->exception);
1021   return(status);
1022 }
1023 \f
1024 /*
1025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1026 %                                                                             %
1027 %                                                                             %
1028 %                                                                             %
1029 %   M a g i c k C h a r c o a l I m a g e                                     %
1030 %                                                                             %
1031 %                                                                             %
1032 %                                                                             %
1033 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1034 %
1035 %  MagickCharcoalImage() simulates a charcoal drawing.
1036 %
1037 %  The format of the MagickCharcoalImage method is:
1038 %
1039 %      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1040 %        const double radius,const double sigma)
1041 %
1042 %  A description of each parameter follows:
1043 %
1044 %    o wand: the magick wand.
1045 %
1046 %    o radius: the radius of the Gaussian, in pixels, not counting the center
1047 %      pixel.
1048 %
1049 %    o sigma: the standard deviation of the Gaussian, in pixels.
1050 %
1051 */
1052 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1053   const double radius,const double sigma)
1054 {
1055   Image
1056     *charcoal_image;
1057
1058   assert(wand != (MagickWand *) NULL);
1059   assert(wand->signature == WandSignature);
1060   if (wand->debug != MagickFalse)
1061     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1062   if (wand->images == (Image *) NULL)
1063     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1064   charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1065   if (charcoal_image == (Image *) NULL)
1066     return(MagickFalse);
1067   ReplaceImageInList(&wand->images,charcoal_image);
1068   return(MagickTrue);
1069 }
1070 \f
1071 /*
1072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1073 %                                                                             %
1074 %                                                                             %
1075 %                                                                             %
1076 %   M a g i c k C h o p I m a g e                                             %
1077 %                                                                             %
1078 %                                                                             %
1079 %                                                                             %
1080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1081 %
1082 %  MagickChopImage() removes a region of an image and collapses the image to
1083 %  occupy the removed portion
1084 %
1085 %  The format of the MagickChopImage method is:
1086 %
1087 %      MagickBooleanType MagickChopImage(MagickWand *wand,
1088 %        const size_t width,const size_t height,const ssize_t x,
1089 %        const ssize_t y)
1090 %
1091 %  A description of each parameter follows:
1092 %
1093 %    o wand: the magick wand.
1094 %
1095 %    o width: the region width.
1096 %
1097 %    o height: the region height.
1098 %
1099 %    o x: the region x offset.
1100 %
1101 %    o y: the region y offset.
1102 %
1103 %
1104 */
1105 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1106   const size_t width,const size_t height,const ssize_t x,
1107   const ssize_t y)
1108 {
1109   Image
1110     *chop_image;
1111
1112   RectangleInfo
1113     chop;
1114
1115   assert(wand != (MagickWand *) NULL);
1116   assert(wand->signature == WandSignature);
1117   if (wand->debug != MagickFalse)
1118     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1119   if (wand->images == (Image *) NULL)
1120     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1121   chop.width=width;
1122   chop.height=height;
1123   chop.x=x;
1124   chop.y=y;
1125   chop_image=ChopImage(wand->images,&chop,wand->exception);
1126   if (chop_image == (Image *) NULL)
1127     return(MagickFalse);
1128   ReplaceImageInList(&wand->images,chop_image);
1129   return(MagickTrue);
1130 }
1131 \f
1132 /*
1133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1134 %                                                                             %
1135 %                                                                             %
1136 %                                                                             %
1137 %   M a g i c k C l a m p I m a g e                                           %
1138 %                                                                             %
1139 %                                                                             %
1140 %                                                                             %
1141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1142 %
1143 %  MagickClampImage() restricts the color range from 0 to the quantum depth.
1144 %
1145 %  The format of the MagickClampImage method is:
1146 %
1147 %      MagickBooleanType MagickClampImage(MagickWand *wand)
1148 %
1149 %  A description of each parameter follows:
1150 %
1151 %    o wand: the magick wand.
1152 %
1153 %    o channel: the channel.
1154 %
1155 */
1156 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1157 {
1158   MagickBooleanType
1159     status;
1160
1161   assert(wand != (MagickWand *) NULL);
1162   assert(wand->signature == WandSignature);
1163   if (wand->debug != MagickFalse)
1164     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1165   if (wand->images == (Image *) NULL)
1166     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1167   status=ClampImage(wand->images);
1168   if (status == MagickFalse)
1169     InheritException(wand->exception,&wand->images->exception);
1170   return(status);
1171 }
1172 \f
1173 /*
1174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1175 %                                                                             %
1176 %                                                                             %
1177 %                                                                             %
1178 %   M a g i c k C l i p I m a g e                                             %
1179 %                                                                             %
1180 %                                                                             %
1181 %                                                                             %
1182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1183 %
1184 %  MagickClipImage() clips along the first path from the 8BIM profile, if
1185 %  present.
1186 %
1187 %  The format of the MagickClipImage method is:
1188 %
1189 %      MagickBooleanType MagickClipImage(MagickWand *wand)
1190 %
1191 %  A description of each parameter follows:
1192 %
1193 %    o wand: the magick wand.
1194 %
1195 */
1196 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1197 {
1198   MagickBooleanType
1199     status;
1200
1201   assert(wand != (MagickWand *) NULL);
1202   assert(wand->signature == WandSignature);
1203   if (wand->debug != MagickFalse)
1204     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1205   if (wand->images == (Image *) NULL)
1206     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1207   status=ClipImage(wand->images);
1208   if (status == MagickFalse)
1209     InheritException(wand->exception,&wand->images->exception);
1210   return(status);
1211 }
1212 \f
1213 /*
1214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1215 %                                                                             %
1216 %                                                                             %
1217 %                                                                             %
1218 %   M a g i c k C l i p I m a g e P a t h                                     %
1219 %                                                                             %
1220 %                                                                             %
1221 %                                                                             %
1222 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1223 %
1224 %  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1225 %  present. Later operations take effect inside the path.  Id may be a number
1226 %  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1227 %  path.
1228 %
1229 %  The format of the MagickClipImagePath method is:
1230 %
1231 %      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1232 %        const char *pathname,const MagickBooleanType inside)
1233 %
1234 %  A description of each parameter follows:
1235 %
1236 %    o wand: the magick wand.
1237 %
1238 %    o pathname: name of clipping path resource. If name is preceded by #, use
1239 %      clipping path numbered by name.
1240 %
1241 %    o inside: if non-zero, later operations take effect inside clipping path.
1242 %      Otherwise later operations take effect outside clipping path.
1243 %
1244 */
1245 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1246   const char *pathname,const MagickBooleanType inside)
1247 {
1248   MagickBooleanType
1249     status;
1250
1251   assert(wand != (MagickWand *) NULL);
1252   assert(wand->signature == WandSignature);
1253   if (wand->debug != MagickFalse)
1254     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1255   if (wand->images == (Image *) NULL)
1256     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1257   status=ClipImagePath(wand->images,pathname,inside);
1258   if (status == MagickFalse)
1259     InheritException(wand->exception,&wand->images->exception);
1260   return(status);
1261 }
1262 \f
1263 /*
1264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1265 %                                                                             %
1266 %                                                                             %
1267 %                                                                             %
1268 %   M a g i c k C l u t I m a g e                                             %
1269 %                                                                             %
1270 %                                                                             %
1271 %                                                                             %
1272 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1273 %
1274 %  MagickClutImage() replaces colors in the image from a color lookup table.
1275 %
1276 %  The format of the MagickClutImage method is:
1277 %
1278 %      MagickBooleanType MagickClutImage(MagickWand *wand,
1279 %        const MagickWand *clut_wand)
1280 %
1281 %  A description of each parameter follows:
1282 %
1283 %    o wand: the magick wand.
1284 %
1285 %    o clut_image: the clut image.
1286 %
1287 */
1288 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1289   const MagickWand *clut_wand)
1290 {
1291   MagickBooleanType
1292     status;
1293
1294   assert(wand != (MagickWand *) NULL);
1295   assert(wand->signature == WandSignature);
1296   if (wand->debug != MagickFalse)
1297     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1298   if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1299     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1300   status=ClutImage(wand->images,clut_wand->images,&wand->images->exception);
1301   return(status);
1302 }
1303 \f
1304 /*
1305 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1306 %                                                                             %
1307 %                                                                             %
1308 %                                                                             %
1309 %   M a g i c k C o a l e s c e I m a g e s                                   %
1310 %                                                                             %
1311 %                                                                             %
1312 %                                                                             %
1313 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1314 %
1315 %  MagickCoalesceImages() composites a set of images while respecting any page
1316 %  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1317 %  typically start with an image background and each subsequent image
1318 %  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1319 %  where each image in the sequence is the same size as the first and
1320 %  composited with the next image in the sequence.
1321 %
1322 %  The format of the MagickCoalesceImages method is:
1323 %
1324 %      MagickWand *MagickCoalesceImages(MagickWand *wand)
1325 %
1326 %  A description of each parameter follows:
1327 %
1328 %    o wand: the magick wand.
1329 %
1330 */
1331 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1332 {
1333   Image
1334     *coalesce_image;
1335
1336   assert(wand != (MagickWand *) NULL);
1337   assert(wand->signature == WandSignature);
1338   if (wand->debug != MagickFalse)
1339     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1340   if (wand->images == (Image *) NULL)
1341     return((MagickWand *) NULL);
1342   coalesce_image=CoalesceImages(wand->images,wand->exception);
1343   if (coalesce_image == (Image *) NULL)
1344     return((MagickWand *) NULL);
1345   return(CloneMagickWandFromImages(wand,coalesce_image));
1346 }
1347 \f
1348 /*
1349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1350 %                                                                             %
1351 %                                                                             %
1352 %                                                                             %
1353 %   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1354 %                                                                             %
1355 %                                                                             %
1356 %                                                                             %
1357 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1358 %
1359 %  MagickColorDecisionListImage() accepts a lightweight Color Correction
1360 %  Collection (CCC) file which solely contains one or more color corrections
1361 %  and applies the color correction to the image.  Here is a sample CCC file:
1362 %
1363 %    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1364 %          <ColorCorrection id="cc03345">
1365 %                <SOPNode>
1366 %                     <Slope> 0.9 1.2 0.5 </Slope>
1367 %                     <Offset> 0.4 -0.5 0.6 </Offset>
1368 %                     <Power> 1.0 0.8 1.5 </Power>
1369 %                </SOPNode>
1370 %                <SATNode>
1371 %                     <Saturation> 0.85 </Saturation>
1372 %                </SATNode>
1373 %          </ColorCorrection>
1374 %    </ColorCorrectionCollection>
1375 %
1376 %  which includes the offset, slope, and power for each of the RGB channels
1377 %  as well as the saturation.
1378 %
1379 %  The format of the MagickColorDecisionListImage method is:
1380 %
1381 %      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1382 %        const double gamma)
1383 %
1384 %  A description of each parameter follows:
1385 %
1386 %    o wand: the magick wand.
1387 %
1388 %    o color_correction_collection: the color correction collection in XML.
1389 %
1390 */
1391 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1392   const char *color_correction_collection)
1393 {
1394   MagickBooleanType
1395     status;
1396
1397   assert(wand != (MagickWand *) NULL);
1398   assert(wand->signature == WandSignature);
1399   if (wand->debug != MagickFalse)
1400     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1401   if (wand->images == (Image *) NULL)
1402     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1403   status=ColorDecisionListImage(wand->images,color_correction_collection,
1404     &wand->images->exception);
1405   return(status);
1406 }
1407 \f
1408 /*
1409 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1410 %                                                                             %
1411 %                                                                             %
1412 %                                                                             %
1413 %   M a g i c k C o l o r i z e I m a g e                                     %
1414 %                                                                             %
1415 %                                                                             %
1416 %                                                                             %
1417 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1418 %
1419 %  MagickColorizeImage() blends the fill color with each pixel in the image.
1420 %
1421 %  The format of the MagickColorizeImage method is:
1422 %
1423 %      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1424 %        const PixelWand *colorize,const PixelWand *opacity)
1425 %
1426 %  A description of each parameter follows:
1427 %
1428 %    o wand: the magick wand.
1429 %
1430 %    o colorize: the colorize pixel wand.
1431 %
1432 %    o opacity: the opacity pixel wand.
1433 %
1434 */
1435 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1436   const PixelWand *colorize,const PixelWand *opacity)
1437 {
1438   char
1439     percent_opaque[MaxTextExtent];
1440
1441   Image
1442     *colorize_image;
1443
1444   PixelPacket
1445     target;
1446
1447   assert(wand != (MagickWand *) NULL);
1448   assert(wand->signature == WandSignature);
1449   if (wand->debug != MagickFalse)
1450     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1451   if (wand->images == (Image *) NULL)
1452     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1453   (void) FormatLocaleString(percent_opaque,MaxTextExtent,
1454     "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1455     PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
1456     PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
1457     PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
1458     PixelGetOpacityQuantum(opacity)));
1459   PixelGetQuantumPacket(colorize,&target);
1460   colorize_image=ColorizeImage(wand->images,percent_opaque,target,
1461     wand->exception);
1462   if (colorize_image == (Image *) NULL)
1463     return(MagickFalse);
1464   ReplaceImageInList(&wand->images,colorize_image);
1465   return(MagickTrue);
1466 }
1467 \f
1468 /*
1469 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1470 %                                                                             %
1471 %                                                                             %
1472 %                                                                             %
1473 %   M a g i c k C o l o r M a t r i x I m a g e                               %
1474 %                                                                             %
1475 %                                                                             %
1476 %                                                                             %
1477 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1478 %
1479 %  MagickColorMatrixImage() apply color transformation to an image. The method
1480 %  permits saturation changes, hue rotation, luminance to alpha, and various
1481 %  other effects.  Although variable-sized transformation matrices can be used,
1482 %  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1483 %  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1484 %  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1485 %  and offsets are normalized (divide Flash offset by 255).
1486 %
1487 %  The format of the MagickColorMatrixImage method is:
1488 %
1489 %      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1490 %        const KernelInfo *color_matrix)
1491 %
1492 %  A description of each parameter follows:
1493 %
1494 %    o wand: the magick wand.
1495 %
1496 %    o color_matrix:  the color matrix.
1497 %
1498 */
1499 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1500   const KernelInfo *color_matrix)
1501 {
1502   Image
1503     *color_image;
1504
1505   assert(wand != (MagickWand *) NULL);
1506   assert(wand->signature == WandSignature);
1507   if (wand->debug != MagickFalse)
1508     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1509   if (color_matrix == (const KernelInfo *) NULL)
1510     return(MagickFalse);
1511   if (wand->images == (Image *) NULL)
1512     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1513   color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1514   if (color_image == (Image *) NULL)
1515     return(MagickFalse);
1516   ReplaceImageInList(&wand->images,color_image);
1517   return(MagickTrue);
1518 }
1519 \f
1520 /*
1521 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1522 %                                                                             %
1523 %                                                                             %
1524 %                                                                             %
1525 %   M a g i c k C o m b i n e I m a g e s                                     %
1526 %                                                                             %
1527 %                                                                             %
1528 %                                                                             %
1529 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1530 %
1531 %  MagickCombineImages() combines one or more images into a single image.  The
1532 %  grayscale value of the pixels of each image in the sequence is assigned in
1533 %  order to the specified  hannels of the combined image.   The typical
1534 %  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1535 %
1536 %  The format of the MagickCombineImages method is:
1537 %
1538 %      MagickWand *MagickCombineImages(MagickWand *wand)
1539 %
1540 %  A description of each parameter follows:
1541 %
1542 %    o wand: the magick wand.
1543 %
1544 */
1545 WandExport MagickWand *MagickCombineImages(MagickWand *wand)
1546 {
1547   Image
1548     *combine_image;
1549
1550   assert(wand != (MagickWand *) NULL);
1551   assert(wand->signature == WandSignature);
1552   if (wand->debug != MagickFalse)
1553     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1554   if (wand->images == (Image *) NULL)
1555     return((MagickWand *) NULL);
1556   combine_image=CombineImages(wand->images,wand->exception);
1557   if (combine_image == (Image *) NULL)
1558     return((MagickWand *) NULL);
1559   return(CloneMagickWandFromImages(wand,combine_image));
1560 }
1561 \f
1562 /*
1563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1564 %                                                                             %
1565 %                                                                             %
1566 %                                                                             %
1567 %   M a g i c k C o m m e n t I m a g e                                       %
1568 %                                                                             %
1569 %                                                                             %
1570 %                                                                             %
1571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1572 %
1573 %  MagickCommentImage() adds a comment to your image.
1574 %
1575 %  The format of the MagickCommentImage method is:
1576 %
1577 %      MagickBooleanType MagickCommentImage(MagickWand *wand,
1578 %        const char *comment)
1579 %
1580 %  A description of each parameter follows:
1581 %
1582 %    o wand: the magick wand.
1583 %
1584 %    o comment: the image comment.
1585 %
1586 */
1587 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1588   const char *comment)
1589 {
1590   MagickBooleanType
1591     status;
1592
1593   assert(wand != (MagickWand *) NULL);
1594   assert(wand->signature == WandSignature);
1595   if (wand->debug != MagickFalse)
1596     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1597   if (wand->images == (Image *) NULL)
1598     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1599   status=SetImageProperty(wand->images,"comment",comment);
1600   if (status == MagickFalse)
1601     InheritException(wand->exception,&wand->images->exception);
1602   return(status);
1603 }
1604 \f
1605 /*
1606 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1607 %                                                                             %
1608 %                                                                             %
1609 %                                                                             %
1610 %   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1611 %                                                                             %
1612 %                                                                             %
1613 %                                                                             %
1614 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1615 %
1616 %  MagickCompareImagesLayers() compares each image with the next in a sequence
1617 %  and returns the maximum bounding region of any pixel differences it
1618 %  discovers.
1619 %
1620 %  The format of the MagickCompareImagesLayers method is:
1621 %
1622 %      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1623 %        const ImageLayerMethod method)
1624 %
1625 %  A description of each parameter follows:
1626 %
1627 %    o wand: the magick wand.
1628 %
1629 %    o method: the compare method.
1630 %
1631 */
1632 WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1633   const ImageLayerMethod method)
1634 {
1635   Image
1636     *layers_image;
1637
1638   assert(wand != (MagickWand *) NULL);
1639   assert(wand->signature == WandSignature);
1640   if (wand->debug != MagickFalse)
1641     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1642   if (wand->images == (Image *) NULL)
1643     return((MagickWand *) NULL);
1644   layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1645   if (layers_image == (Image *) NULL)
1646     return((MagickWand *) NULL);
1647   return(CloneMagickWandFromImages(wand,layers_image));
1648 }
1649 \f
1650 /*
1651 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1652 %                                                                             %
1653 %                                                                             %
1654 %                                                                             %
1655 %   M a g i c k C o m p a r e I m a g e s                                     %
1656 %                                                                             %
1657 %                                                                             %
1658 %                                                                             %
1659 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1660 %
1661 %  MagickCompareImages() compares an image to a reconstructed image and returns
1662 %  the specified difference image.
1663 %
1664 %  The format of the MagickCompareImages method is:
1665 %
1666 %      MagickWand *MagickCompareImages(MagickWand *wand,
1667 %        const MagickWand *reference,const MetricType metric,
1668 %        double *distortion)
1669 %
1670 %  A description of each parameter follows:
1671 %
1672 %    o wand: the magick wand.
1673 %
1674 %    o reference: the reference wand.
1675 %
1676 %    o metric: the metric.
1677 %
1678 %    o distortion: the computed distortion between the images.
1679 %
1680 */
1681 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1682   const MagickWand *reference,const MetricType metric,double *distortion)
1683 {
1684   Image
1685     *compare_image;
1686
1687
1688   assert(wand != (MagickWand *) NULL);
1689   assert(wand->signature == WandSignature);
1690   if (wand->debug != MagickFalse)
1691     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1692   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1693     {
1694       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1695         "ContainsNoImages","`%s'",wand->name);
1696       return((MagickWand *) NULL);
1697     }
1698   compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1699     &wand->images->exception);
1700   if (compare_image == (Image *) NULL)
1701     return((MagickWand *) NULL);
1702   return(CloneMagickWandFromImages(wand,compare_image));
1703 }
1704 \f
1705 /*
1706 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1707 %                                                                             %
1708 %                                                                             %
1709 %                                                                             %
1710 %   M a g i c k C o m p o s i t e I m a g e                                   %
1711 %                                                                             %
1712 %                                                                             %
1713 %                                                                             %
1714 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1715 %
1716 %  MagickCompositeImage() composite one image onto another at the specified
1717 %  offset.
1718 %
1719 %  The format of the MagickCompositeImage method is:
1720 %
1721 %      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1722 %        const MagickWand *composite_wand,const CompositeOperator compose,
1723 %        const ssize_t x,const ssize_t y)
1724 %
1725 %  A description of each parameter follows:
1726 %
1727 %    o wand: the magick wand.
1728 %
1729 %    o composite_image: the composite image.
1730 %
1731 %    o compose: This operator affects how the composite is applied to the
1732 %      image.  The default is Over.  Choose from these operators:
1733 %
1734 %        OverCompositeOp       InCompositeOp         OutCompositeOp
1735 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1736 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1737 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1738 %        DisplaceCompositeOp
1739 %
1740 %    o x: the column offset of the composited image.
1741 %
1742 %    o y: the row offset of the composited image.
1743 %
1744 */
1745 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1746   const MagickWand *composite_wand,const CompositeOperator compose,
1747   const ssize_t x,const ssize_t y)
1748 {
1749   MagickBooleanType
1750     status;
1751
1752   assert(wand != (MagickWand *) NULL);
1753   assert(wand->signature == WandSignature);
1754   if (wand->debug != MagickFalse)
1755     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1756   if ((wand->images == (Image *) NULL) ||
1757       (composite_wand->images == (Image *) NULL))
1758     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1759   status=CompositeImage(wand->images,compose,composite_wand->images,x,y);
1760   if (status == MagickFalse)
1761     InheritException(wand->exception,&wand->images->exception);
1762   return(status);
1763 }
1764 \f
1765 /*
1766 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1767 %                                                                             %
1768 %                                                                             %
1769 %                                                                             %
1770 %   M a g i c k C o n t r a s t I m a g e                                     %
1771 %                                                                             %
1772 %                                                                             %
1773 %                                                                             %
1774 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1775 %
1776 %  MagickContrastImage() enhances the intensity differences between the lighter
1777 %  and darker elements of the image.  Set sharpen to a value other than 0 to
1778 %  increase the image contrast otherwise the contrast is reduced.
1779 %
1780 %  The format of the MagickContrastImage method is:
1781 %
1782 %      MagickBooleanType MagickContrastImage(MagickWand *wand,
1783 %        const MagickBooleanType sharpen)
1784 %
1785 %  A description of each parameter follows:
1786 %
1787 %    o wand: the magick wand.
1788 %
1789 %    o sharpen: Increase or decrease image contrast.
1790 %
1791 %
1792 */
1793 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1794   const MagickBooleanType sharpen)
1795 {
1796   MagickBooleanType
1797     status;
1798
1799   assert(wand != (MagickWand *) NULL);
1800   assert(wand->signature == WandSignature);
1801   if (wand->debug != MagickFalse)
1802     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1803   if (wand->images == (Image *) NULL)
1804     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1805   status=ContrastImage(wand->images,sharpen,&wand->images->exception);
1806   return(status);
1807 }
1808 \f
1809 /*
1810 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1811 %                                                                             %
1812 %                                                                             %
1813 %                                                                             %
1814 %   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                       %
1815 %                                                                             %
1816 %                                                                             %
1817 %                                                                             %
1818 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1819 %
1820 %  MagickContrastStretchImage() enhances the contrast of a color image by
1821 %  adjusting the pixels color to span the entire range of colors available.
1822 %  You can also reduce the influence of a particular channel with a gamma
1823 %  value of 0.
1824 %
1825 %  The format of the MagickContrastStretchImage method is:
1826 %
1827 %      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1828 %        const double black_point,const double white_point)
1829 %
1830 %  A description of each parameter follows:
1831 %
1832 %    o wand: the magick wand.
1833 %
1834 %    o black_point: the black point.
1835 %
1836 %    o white_point: the white point.
1837 %
1838 */
1839 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1840   const double black_point,const double white_point)
1841 {
1842   MagickBooleanType
1843     status;
1844
1845   assert(wand != (MagickWand *) NULL);
1846   assert(wand->signature == WandSignature);
1847   if (wand->debug != MagickFalse)
1848     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1849   if (wand->images == (Image *) NULL)
1850     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1851   status=ContrastStretchImage(wand->images,black_point,white_point,
1852     &wand->images->exception);
1853   return(status);
1854 }
1855 \f
1856 /*
1857 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1858 %                                                                             %
1859 %                                                                             %
1860 %                                                                             %
1861 %   M a g i c k C o n v o l v e I m a g e                                     %
1862 %                                                                             %
1863 %                                                                             %
1864 %                                                                             %
1865 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1866 %
1867 %  MagickConvolveImage() applies a custom convolution kernel to the image.
1868 %
1869 %  The format of the MagickConvolveImage method is:
1870 %
1871 %      MagickBooleanType MagickConvolveImage(MagickWand *wand,
1872 %        const KernelInfo *kernel)
1873 %
1874 %  A description of each parameter follows:
1875 %
1876 %    o wand: the magick wand.
1877 %
1878 %    o kernel: An array of doubles representing the convolution kernel.
1879 %
1880 */
1881 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
1882   const KernelInfo *kernel)
1883 {
1884   Image
1885     *filter_image;
1886
1887   assert(wand != (MagickWand *) NULL);
1888   assert(wand->signature == WandSignature);
1889   if (wand->debug != MagickFalse)
1890     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1891   if (kernel == (const KernelInfo *) NULL)
1892     return(MagickFalse);
1893   if (wand->images == (Image *) NULL)
1894     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1895   filter_image=ConvolveImage(wand->images,kernel,wand->exception);
1896   if (filter_image == (Image *) NULL)
1897     return(MagickFalse);
1898   ReplaceImageInList(&wand->images,filter_image);
1899   return(MagickTrue);
1900 }
1901 \f
1902 /*
1903 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1904 %                                                                             %
1905 %                                                                             %
1906 %                                                                             %
1907 %   M a g i c k C r o p I m a g e                                             %
1908 %                                                                             %
1909 %                                                                             %
1910 %                                                                             %
1911 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1912 %
1913 %  MagickCropImage() extracts a region of the image.
1914 %
1915 %  The format of the MagickCropImage method is:
1916 %
1917 %      MagickBooleanType MagickCropImage(MagickWand *wand,
1918 %        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1919 %
1920 %  A description of each parameter follows:
1921 %
1922 %    o wand: the magick wand.
1923 %
1924 %    o width: the region width.
1925 %
1926 %    o height: the region height.
1927 %
1928 %    o x: the region x-offset.
1929 %
1930 %    o y: the region y-offset.
1931 %
1932 */
1933 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
1934   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1935 {
1936   Image
1937     *crop_image;
1938
1939   RectangleInfo
1940     crop;
1941
1942   assert(wand != (MagickWand *) NULL);
1943   assert(wand->signature == WandSignature);
1944   if (wand->debug != MagickFalse)
1945     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1946   if (wand->images == (Image *) NULL)
1947     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1948   crop.width=width;
1949   crop.height=height;
1950   crop.x=x;
1951   crop.y=y;
1952   crop_image=CropImage(wand->images,&crop,wand->exception);
1953   if (crop_image == (Image *) NULL)
1954     return(MagickFalse);
1955   ReplaceImageInList(&wand->images,crop_image);
1956   return(MagickTrue);
1957 }
1958 \f
1959 /*
1960 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1961 %                                                                             %
1962 %                                                                             %
1963 %                                                                             %
1964 %   M a g i c k C y c l e C o l o r m a p I m a g e                           %
1965 %                                                                             %
1966 %                                                                             %
1967 %                                                                             %
1968 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1969 %
1970 %  MagickCycleColormapImage() displaces an image's colormap by a given number
1971 %  of positions.  If you cycle the colormap a number of times you can produce
1972 %  a psychodelic effect.
1973 %
1974 %  The format of the MagickCycleColormapImage method is:
1975 %
1976 %      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
1977 %        const ssize_t displace)
1978 %
1979 %  A description of each parameter follows:
1980 %
1981 %    o wand: the magick wand.
1982 %
1983 %    o pixel_wand: the pixel wand.
1984 %
1985 */
1986 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
1987   const ssize_t displace)
1988 {
1989   MagickBooleanType
1990     status;
1991
1992   assert(wand != (MagickWand *) NULL);
1993   assert(wand->signature == WandSignature);
1994   if (wand->debug != MagickFalse)
1995     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1996   if (wand->images == (Image *) NULL)
1997     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1998   status=CycleColormapImage(wand->images,displace);
1999   if (status == MagickFalse)
2000     InheritException(wand->exception,&wand->images->exception);
2001   return(status);
2002 }
2003 \f
2004 /*
2005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2006 %                                                                             %
2007 %                                                                             %
2008 %                                                                             %
2009 %   M a g i c k C o n s t i t u t e I m a g e                                 %
2010 %                                                                             %
2011 %                                                                             %
2012 %                                                                             %
2013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2014 %
2015 %  MagickConstituteImage() adds an image to the wand comprised of the pixel
2016 %  data you supply.  The pixel data must be in scanline order top-to-bottom.
2017 %  The data can be char, short int, int, float, or double.  Float and double
2018 %  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2019 %  is the maximum value the type can accomodate (e.g. 255 for char).  For
2020 %  example, to create a 640x480 image from unsigned red-green-blue character
2021 %  data, use
2022 %
2023 %      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2024 %
2025 %  The format of the MagickConstituteImage method is:
2026 %
2027 %      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2028 %        const size_t columns,const size_t rows,const char *map,
2029 %        const StorageType storage,void *pixels)
2030 %
2031 %  A description of each parameter follows:
2032 %
2033 %    o wand: the magick wand.
2034 %
2035 %    o columns: width in pixels of the image.
2036 %
2037 %    o rows: height in pixels of the image.
2038 %
2039 %    o map:  This string reflects the expected ordering of the pixel array.
2040 %      It can be any combination or order of R = red, G = green, B = blue,
2041 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2042 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2043 %      P = pad.
2044 %
2045 %    o storage: Define the data type of the pixels.  Float and double types are
2046 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2047 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2048 %      LongPixel, QuantumPixel, or ShortPixel.
2049 %
2050 %    o pixels: This array of values contain the pixel components as defined by
2051 %      map and type.  You must preallocate this array where the expected
2052 %      length varies depending on the values of width, height, map, and type.
2053 %
2054 %
2055 */
2056 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2057   const size_t columns,const size_t rows,const char *map,
2058   const StorageType storage,const void *pixels)
2059 {
2060   Image
2061     *images;
2062
2063   assert(wand != (MagickWand *) NULL);
2064   assert(wand->signature == WandSignature);
2065   if (wand->debug != MagickFalse)
2066     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2067   images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2068   if (images == (Image *) NULL)
2069     return(MagickFalse);
2070   return(InsertImageInWand(wand,images));
2071 }
2072 \f
2073 /*
2074 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2075 %                                                                             %
2076 %                                                                             %
2077 %                                                                             %
2078 %   M a g i c k D e c i p h e r I m a g e                                     %
2079 %                                                                             %
2080 %                                                                             %
2081 %                                                                             %
2082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2083 %
2084 %  MagickDecipherImage() converts cipher pixels to plain pixels.
2085 %
2086 %  The format of the MagickDecipherImage method is:
2087 %
2088 %      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2089 %        const char *passphrase)
2090 %
2091 %  A description of each parameter follows:
2092 %
2093 %    o wand: the magick wand.
2094 %
2095 %    o passphrase: the passphrase.
2096 %
2097 */
2098 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2099   const char *passphrase)
2100 {
2101   assert(wand != (MagickWand *) NULL);
2102   assert(wand->signature == WandSignature);
2103   if (wand->debug != MagickFalse)
2104     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2105   if (wand->images == (Image *) NULL)
2106     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2107   return(DecipherImage(wand->images,passphrase,&wand->images->exception));
2108 }
2109 \f
2110 /*
2111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2112 %                                                                             %
2113 %                                                                             %
2114 %                                                                             %
2115 %   M a g i c k D e c o n s t r u c t I m a g e s                             %
2116 %                                                                             %
2117 %                                                                             %
2118 %                                                                             %
2119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2120 %
2121 %  MagickDeconstructImages() compares each image with the next in a sequence
2122 %  and returns the maximum bounding region of any pixel differences it
2123 %  discovers.
2124 %
2125 %  The format of the MagickDeconstructImages method is:
2126 %
2127 %      MagickWand *MagickDeconstructImages(MagickWand *wand)
2128 %
2129 %  A description of each parameter follows:
2130 %
2131 %    o wand: the magick wand.
2132 %
2133 */
2134 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2135 {
2136   Image
2137     *deconstruct_image;
2138
2139   assert(wand != (MagickWand *) NULL);
2140   assert(wand->signature == WandSignature);
2141   if (wand->debug != MagickFalse)
2142     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2143   if (wand->images == (Image *) NULL)
2144     return((MagickWand *) NULL);
2145   deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2146     wand->exception);
2147   if (deconstruct_image == (Image *) NULL)
2148     return((MagickWand *) NULL);
2149   return(CloneMagickWandFromImages(wand,deconstruct_image));
2150 }
2151 \f
2152 /*
2153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2154 %                                                                             %
2155 %                                                                             %
2156 %                                                                             %
2157 %     M a g i c k D e s k e w I m a g e                                       %
2158 %                                                                             %
2159 %                                                                             %
2160 %                                                                             %
2161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2162 %
2163 %  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2164 %  occurs in scanned images because of the camera being misaligned,
2165 %  imperfections in the scanning or surface, or simply because the paper was
2166 %  not placed completely flat when scanned.
2167 %
2168 %  The format of the MagickDeskewImage method is:
2169 %
2170 %      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2171 %        const double threshold)
2172 %
2173 %  A description of each parameter follows:
2174 %
2175 %    o wand: the magick wand.
2176 %
2177 %    o threshold: separate background from foreground.
2178 %
2179 */
2180 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2181   const double threshold)
2182 {
2183   Image
2184     *sepia_image;
2185
2186   assert(wand != (MagickWand *) NULL);
2187   assert(wand->signature == WandSignature);
2188   if (wand->debug != MagickFalse)
2189     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2190   if (wand->images == (Image *) NULL)
2191     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2192   sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2193   if (sepia_image == (Image *) NULL)
2194     return(MagickFalse);
2195   ReplaceImageInList(&wand->images,sepia_image);
2196   return(MagickTrue);
2197 }
2198 \f
2199 /*
2200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2201 %                                                                             %
2202 %                                                                             %
2203 %                                                                             %
2204 %     M a g i c k D e s p e c k l e I m a g e                                 %
2205 %                                                                             %
2206 %                                                                             %
2207 %                                                                             %
2208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2209 %
2210 %  MagickDespeckleImage() reduces the speckle noise in an image while
2211 %  perserving the edges of the original image.
2212 %
2213 %  The format of the MagickDespeckleImage method is:
2214 %
2215 %      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2216 %
2217 %  A description of each parameter follows:
2218 %
2219 %    o wand: the magick wand.
2220 %
2221 */
2222 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2223 {
2224   Image
2225     *despeckle_image;
2226
2227   assert(wand != (MagickWand *) NULL);
2228   assert(wand->signature == WandSignature);
2229   if (wand->debug != MagickFalse)
2230     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2231   if (wand->images == (Image *) NULL)
2232     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2233   despeckle_image=DespeckleImage(wand->images,wand->exception);
2234   if (despeckle_image == (Image *) NULL)
2235     return(MagickFalse);
2236   ReplaceImageInList(&wand->images,despeckle_image);
2237   return(MagickTrue);
2238 }
2239 \f
2240 /*
2241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2242 %                                                                             %
2243 %                                                                             %
2244 %                                                                             %
2245 %   M a g i c k D e s t r o y I m a g e                                       %
2246 %                                                                             %
2247 %                                                                             %
2248 %                                                                             %
2249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2250 %
2251 %  MagickDestroyImage() dereferences an image, deallocating memory associated
2252 %  with the image if the reference count becomes zero.
2253 %
2254 %  The format of the MagickDestroyImage method is:
2255 %
2256 %      Image *MagickDestroyImage(Image *image)
2257 %
2258 %  A description of each parameter follows:
2259 %
2260 %    o image: the image.
2261 %
2262 */
2263 WandExport Image *MagickDestroyImage(Image *image)
2264 {
2265   return(DestroyImage(image));
2266 }
2267 \f
2268 /*
2269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2270 %                                                                             %
2271 %                                                                             %
2272 %                                                                             %
2273 %   M a g i c k D i s p l a y I m a g e                                       %
2274 %                                                                             %
2275 %                                                                             %
2276 %                                                                             %
2277 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2278 %
2279 %  MagickDisplayImage() displays an image.
2280 %
2281 %  The format of the MagickDisplayImage method is:
2282 %
2283 %      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2284 %        const char *server_name)
2285 %
2286 %  A description of each parameter follows:
2287 %
2288 %    o wand: the magick wand.
2289 %
2290 %    o server_name: the X server name.
2291 %
2292 */
2293 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2294   const char *server_name)
2295 {
2296   Image
2297     *image;
2298
2299   MagickBooleanType
2300     status;
2301
2302   assert(wand != (MagickWand *) NULL);
2303   assert(wand->signature == WandSignature);
2304   if (wand->debug != MagickFalse)
2305     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2306   if (wand->images == (Image *) NULL)
2307     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2308   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2309   if (image == (Image *) NULL)
2310     return(MagickFalse);
2311   (void) CloneString(&wand->image_info->server_name,server_name);
2312   status=DisplayImages(wand->image_info,image,&image->exception);
2313   image=DestroyImage(image);
2314   return(status);
2315 }
2316 \f
2317 /*
2318 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2319 %                                                                             %
2320 %                                                                             %
2321 %                                                                             %
2322 %   M a g i c k D i s p l a y I m a g e s                                     %
2323 %                                                                             %
2324 %                                                                             %
2325 %                                                                             %
2326 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2327 %
2328 %  MagickDisplayImages() displays an image or image sequence.
2329 %
2330 %  The format of the MagickDisplayImages method is:
2331 %
2332 %      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2333 %        const char *server_name)
2334 %
2335 %  A description of each parameter follows:
2336 %
2337 %    o wand: the magick wand.
2338 %
2339 %    o server_name: the X server name.
2340 %
2341 */
2342 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2343   const char *server_name)
2344 {
2345   MagickBooleanType
2346     status;
2347
2348   assert(wand != (MagickWand *) NULL);
2349   assert(wand->signature == WandSignature);
2350   if (wand->debug != MagickFalse)
2351     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2352   (void) CloneString(&wand->image_info->server_name,server_name);
2353   status=DisplayImages(wand->image_info,wand->images,&wand->images->exception);
2354   return(status);
2355 }
2356 \f
2357 /*
2358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2359 %                                                                             %
2360 %                                                                             %
2361 %                                                                             %
2362 %   M a g i c k D i s t o r t I m a g e                                       %
2363 %                                                                             %
2364 %                                                                             %
2365 %                                                                             %
2366 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2367 %
2368 %  MagickDistortImage() distorts an image using various distortion methods, by
2369 %  mapping color lookups of the source image to a new destination image
2370 %  usally of the same size as the source image, unless 'bestfit' is set to
2371 %  true.
2372 %
2373 %  If 'bestfit' is enabled, and distortion allows it, the destination image is
2374 %  adjusted to ensure the whole source 'image' will just fit within the final
2375 %  destination image, which will be sized and offset accordingly.  Also in
2376 %  many cases the virtual offset of the source image will be taken into
2377 %  account in the mapping.
2378 %
2379 %  The format of the MagickDistortImage method is:
2380 %
2381 %      MagickBooleanType MagickDistortImage(MagickWand *wand,
2382 %        const DistortImageMethod method,const size_t number_arguments,
2383 %        const double *arguments,const MagickBooleanType bestfit)
2384 %
2385 %  A description of each parameter follows:
2386 %
2387 %    o image: the image to be distorted.
2388 %
2389 %    o method: the method of image distortion.
2390 %
2391 %        ArcDistortion always ignores the source image offset, and always
2392 %        'bestfit' the destination image with the top left corner offset
2393 %        relative to the polar mapping center.
2394 %
2395 %        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2396 %        style of image distortion.
2397 %
2398 %        Affine, Perspective, and Bilinear, do least squares fitting of the
2399 %        distortion when more than the minimum number of control point pairs
2400 %        are provided.
2401 %
2402 %        Perspective, and Bilinear, falls back to a Affine distortion when less
2403 %        that 4 control point pairs are provided. While Affine distortions let
2404 %        you use any number of control point pairs, that is Zero pairs is a
2405 %        no-Op (viewport only) distrotion, one pair is a translation and two
2406 %        pairs of control points do a scale-rotate-translate, without any
2407 %        shearing.
2408 %
2409 %    o number_arguments: the number of arguments given for this distortion
2410 %      method.
2411 %
2412 %    o arguments: the arguments for this distortion method.
2413 %
2414 %    o bestfit: Attempt to resize destination to fit distorted source.
2415 %
2416 */
2417 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2418   const DistortImageMethod method,const size_t number_arguments,
2419   const double *arguments,const MagickBooleanType bestfit)
2420 {
2421   Image
2422     *distort_image;
2423
2424   assert(wand != (MagickWand *) NULL);
2425   assert(wand->signature == WandSignature);
2426   if (wand->debug != MagickFalse)
2427     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2428   if (wand->images == (Image *) NULL)
2429     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2430   distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2431     bestfit,wand->exception);
2432   if (distort_image == (Image *) NULL)
2433     return(MagickFalse);
2434   ReplaceImageInList(&wand->images,distort_image);
2435   return(MagickTrue);
2436 }
2437 \f
2438 /*
2439 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2440 %                                                                             %
2441 %                                                                             %
2442 %                                                                             %
2443 %   M a g i c k D r a w I m a g e                                             %
2444 %                                                                             %
2445 %                                                                             %
2446 %                                                                             %
2447 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2448 %
2449 %  MagickDrawImage() renders the drawing wand on the current image.
2450 %
2451 %  The format of the MagickDrawImage method is:
2452 %
2453 %      MagickBooleanType MagickDrawImage(MagickWand *wand,
2454 %        const DrawingWand *drawing_wand)
2455 %
2456 %  A description of each parameter follows:
2457 %
2458 %    o wand: the magick wand.
2459 %
2460 %    o drawing_wand: the draw wand.
2461 %
2462 */
2463 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2464   const DrawingWand *drawing_wand)
2465 {
2466   char
2467     *primitive;
2468
2469   DrawInfo
2470     *draw_info;
2471
2472   MagickBooleanType
2473     status;
2474
2475   assert(wand != (MagickWand *) NULL);
2476   assert(wand->signature == WandSignature);
2477   if (wand->debug != MagickFalse)
2478     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2479   if (wand->images == (Image *) NULL)
2480     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2481   draw_info=PeekDrawingWand(drawing_wand);
2482   if ((draw_info == (DrawInfo *) NULL) ||
2483       (draw_info->primitive == (char *) NULL))
2484     return(MagickFalse);
2485   primitive=AcquireString(draw_info->primitive);
2486   draw_info=DestroyDrawInfo(draw_info);
2487   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2488   draw_info->primitive=primitive;
2489   status=DrawImage(wand->images,draw_info);
2490   if (status == MagickFalse)
2491     InheritException(wand->exception,&wand->images->exception);
2492   draw_info=DestroyDrawInfo(draw_info);
2493   return(status);
2494 }
2495 \f
2496 /*
2497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2498 %                                                                             %
2499 %                                                                             %
2500 %                                                                             %
2501 %   M a g i c k E d g e I m a g e                                             %
2502 %                                                                             %
2503 %                                                                             %
2504 %                                                                             %
2505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2506 %
2507 %  MagickEdgeImage() enhance edges within the image with a convolution filter
2508 %  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2509 %  radius for you.
2510 %
2511 %  The format of the MagickEdgeImage method is:
2512 %
2513 %      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2514 %
2515 %  A description of each parameter follows:
2516 %
2517 %    o wand: the magick wand.
2518 %
2519 %    o radius: the radius of the pixel neighborhood.
2520 %
2521 */
2522 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2523   const double radius)
2524 {
2525   Image
2526     *edge_image;
2527
2528   assert(wand != (MagickWand *) NULL);
2529   assert(wand->signature == WandSignature);
2530   if (wand->debug != MagickFalse)
2531     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2532   if (wand->images == (Image *) NULL)
2533     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2534   edge_image=EdgeImage(wand->images,radius,wand->exception);
2535   if (edge_image == (Image *) NULL)
2536     return(MagickFalse);
2537   ReplaceImageInList(&wand->images,edge_image);
2538   return(MagickTrue);
2539 }
2540 \f
2541 /*
2542 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2543 %                                                                             %
2544 %                                                                             %
2545 %                                                                             %
2546 %   M a g i c k E m b o s s I m a g e                                         %
2547 %                                                                             %
2548 %                                                                             %
2549 %                                                                             %
2550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2551 %
2552 %  MagickEmbossImage() returns a grayscale image with a three-dimensional
2553 %  effect.  We convolve the image with a Gaussian operator of the given radius
2554 %  and standard deviation (sigma).  For reasonable results, radius should be
2555 %  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2556 %  radius for you.
2557 %
2558 %  The format of the MagickEmbossImage method is:
2559 %
2560 %      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2561 %        const double sigma)
2562 %
2563 %  A description of each parameter follows:
2564 %
2565 %    o wand: the magick wand.
2566 %
2567 %    o radius: the radius of the Gaussian, in pixels, not counting the center
2568 %      pixel.
2569 %
2570 %    o sigma: the standard deviation of the Gaussian, in pixels.
2571 %
2572 */
2573 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2574   const double radius,const double sigma)
2575 {
2576   Image
2577     *emboss_image;
2578
2579   assert(wand != (MagickWand *) NULL);
2580   assert(wand->signature == WandSignature);
2581   if (wand->debug != MagickFalse)
2582     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2583   if (wand->images == (Image *) NULL)
2584     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2585   emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2586   if (emboss_image == (Image *) NULL)
2587     return(MagickFalse);
2588   ReplaceImageInList(&wand->images,emboss_image);
2589   return(MagickTrue);
2590 }
2591 \f
2592 /*
2593 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2594 %                                                                             %
2595 %                                                                             %
2596 %                                                                             %
2597 %   M a g i c k E n c i p h e r I m a g e                                     %
2598 %                                                                             %
2599 %                                                                             %
2600 %                                                                             %
2601 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2602 %
2603 %  MagickEncipherImage() converts plaint pixels to cipher pixels.
2604 %
2605 %  The format of the MagickEncipherImage method is:
2606 %
2607 %      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2608 %        const char *passphrase)
2609 %
2610 %  A description of each parameter follows:
2611 %
2612 %    o wand: the magick wand.
2613 %
2614 %    o passphrase: the passphrase.
2615 %
2616 */
2617 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2618   const char *passphrase)
2619 {
2620   assert(wand != (MagickWand *) NULL);
2621   assert(wand->signature == WandSignature);
2622   if (wand->debug != MagickFalse)
2623     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2624   if (wand->images == (Image *) NULL)
2625     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2626   return(EncipherImage(wand->images,passphrase,&wand->images->exception));
2627 }
2628 \f
2629 /*
2630 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2631 %                                                                             %
2632 %                                                                             %
2633 %                                                                             %
2634 %   M a g i c k E n h a n c e I m a g e                                       %
2635 %                                                                             %
2636 %                                                                             %
2637 %                                                                             %
2638 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2639 %
2640 %  MagickEnhanceImage() applies a digital filter that improves the quality of a
2641 %  noisy image.
2642 %
2643 %  The format of the MagickEnhanceImage method is:
2644 %
2645 %      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2646 %
2647 %  A description of each parameter follows:
2648 %
2649 %    o wand: the magick wand.
2650 %
2651 */
2652 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2653 {
2654   Image
2655     *enhance_image;
2656
2657   assert(wand != (MagickWand *) NULL);
2658   assert(wand->signature == WandSignature);
2659   if (wand->debug != MagickFalse)
2660     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2661   if (wand->images == (Image *) NULL)
2662     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2663   enhance_image=EnhanceImage(wand->images,wand->exception);
2664   if (enhance_image == (Image *) NULL)
2665     return(MagickFalse);
2666   ReplaceImageInList(&wand->images,enhance_image);
2667   return(MagickTrue);
2668 }
2669 \f
2670 /*
2671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2672 %                                                                             %
2673 %                                                                             %
2674 %                                                                             %
2675 %   M a g i c k E q u a l i z e I m a g e                                     %
2676 %                                                                             %
2677 %                                                                             %
2678 %                                                                             %
2679 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2680 %
2681 %  MagickEqualizeImage() equalizes the image histogram.
2682 %
2683 %  The format of the MagickEqualizeImage method is:
2684 %
2685 %      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2686 %
2687 %  A description of each parameter follows:
2688 %
2689 %    o wand: the magick wand.
2690 %
2691 %    o channel: the image channel(s).
2692 %
2693 */
2694 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2695 {
2696   MagickBooleanType
2697     status;
2698
2699   assert(wand != (MagickWand *) NULL);
2700   assert(wand->signature == WandSignature);
2701   if (wand->debug != MagickFalse)
2702     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2703   if (wand->images == (Image *) NULL)
2704     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2705   status=EqualizeImage(wand->images,&wand->images->exception);
2706   return(status);
2707 }
2708 \f
2709 /*
2710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2711 %                                                                             %
2712 %                                                                             %
2713 %                                                                             %
2714 %   M a g i c k E v a l u a t e I m a g e                                     %
2715 %                                                                             %
2716 %                                                                             %
2717 %                                                                             %
2718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2719 %
2720 %  MagickEvaluateImage() applys an arithmetic, relational, or logical
2721 %  expression to an image.  Use these operators to lighten or darken an image,
2722 %  to increase or decrease contrast in an image, or to produce the "negative"
2723 %  of an image.
2724 %
2725 %  The format of the MagickEvaluateImage method is:
2726 %
2727 %      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2728 %        const MagickEvaluateOperator operator,const double value)
2729 %      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2730 %        const MagickEvaluateOperator operator)
2731 %
2732 %  A description of each parameter follows:
2733 %
2734 %    o wand: the magick wand.
2735 %
2736 %    o op: A channel operator.
2737 %
2738 %    o value: A value value.
2739 %
2740 */
2741
2742 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2743   const MagickEvaluateOperator op)
2744 {
2745   Image
2746     *evaluate_image;
2747
2748   assert(wand != (MagickWand *) NULL);
2749   assert(wand->signature == WandSignature);
2750   if (wand->debug != MagickFalse)
2751     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2752   if (wand->images == (Image *) NULL)
2753     return((MagickWand *) NULL);
2754   evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2755   if (evaluate_image == (Image *) NULL)
2756     return((MagickWand *) NULL);
2757   return(CloneMagickWandFromImages(wand,evaluate_image));
2758 }
2759
2760 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2761   const MagickEvaluateOperator op,const double value)
2762 {
2763   MagickBooleanType
2764     status;
2765
2766   assert(wand != (MagickWand *) NULL);
2767   assert(wand->signature == WandSignature);
2768   if (wand->debug != MagickFalse)
2769     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2770   if (wand->images == (Image *) NULL)
2771     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2772   status=EvaluateImage(wand->images,op,value,&wand->images->exception);
2773   return(status);
2774 }
2775 \f
2776 /*
2777 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2778 %                                                                             %
2779 %                                                                             %
2780 %                                                                             %
2781 %   M a g i c k E x p o r t I m a g e P i x e l s                             %
2782 %                                                                             %
2783 %                                                                             %
2784 %                                                                             %
2785 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2786 %
2787 %  MagickExportImagePixels() extracts pixel data from an image and returns it
2788 %  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2789 %  an error is encountered.  The data is returned as char, short int, int,
2790 %  ssize_t, float, or double in the order specified by map.
2791 %
2792 %  Suppose you want to extract the first scanline of a 640x480 image as
2793 %  character data in red-green-blue order:
2794 %
2795 %      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
2796 %
2797 %  The format of the MagickExportImagePixels method is:
2798 %
2799 %      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2800 %        const ssize_t x,const ssize_t y,const size_t columns,
2801 %        const size_t rows,const char *map,const StorageType storage,
2802 %        void *pixels)
2803 %
2804 %  A description of each parameter follows:
2805 %
2806 %    o wand: the magick wand.
2807 %
2808 %    o x, y, columns, rows:  These values define the perimeter
2809 %      of a region of pixels you want to extract.
2810 %
2811 %    o map:  This string reflects the expected ordering of the pixel array.
2812 %      It can be any combination or order of R = red, G = green, B = blue,
2813 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2814 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2815 %      P = pad.
2816 %
2817 %    o storage: Define the data type of the pixels.  Float and double types are
2818 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2819 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2820 %      LongPixel, QuantumPixel, or ShortPixel.
2821 %
2822 %    o pixels: This array of values contain the pixel components as defined by
2823 %      map and type.  You must preallocate this array where the expected
2824 %      length varies depending on the values of width, height, map, and type.
2825 %
2826 */
2827 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2828   const ssize_t x,const ssize_t y,const size_t columns,
2829   const size_t rows,const char *map,const StorageType storage,
2830   void *pixels)
2831 {
2832   MagickBooleanType
2833     status;
2834
2835   assert(wand != (MagickWand *) NULL);
2836   assert(wand->signature == WandSignature);
2837   if (wand->debug != MagickFalse)
2838     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2839   if (wand->images == (Image *) NULL)
2840     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2841   status=ExportImagePixels(wand->images,x,y,columns,rows,map,
2842     storage,pixels,wand->exception);
2843   if (status == MagickFalse)
2844     InheritException(wand->exception,&wand->images->exception);
2845   return(status);
2846 }
2847 \f
2848 /*
2849 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2850 %                                                                             %
2851 %                                                                             %
2852 %                                                                             %
2853 %   M a g i c k E x t e n t I m a g e                                         %
2854 %                                                                             %
2855 %                                                                             %
2856 %                                                                             %
2857 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2858 %
2859 %  MagickExtentImage() extends the image as defined by the geometry, gravity,
2860 %  and wand background color.  Set the (x,y) offset of the geometry to move
2861 %  the original wand relative to the extended wand.
2862 %
2863 %  The format of the MagickExtentImage method is:
2864 %
2865 %      MagickBooleanType MagickExtentImage(MagickWand *wand,
2866 %        const size_t width,const size_t height,const ssize_t x,
2867 %        const ssize_t y)
2868 %
2869 %  A description of each parameter follows:
2870 %
2871 %    o wand: the magick wand.
2872 %
2873 %    o width: the region width.
2874 %
2875 %    o height: the region height.
2876 %
2877 %    o x: the region x offset.
2878 %
2879 %    o y: the region y offset.
2880 %
2881 */
2882 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
2883   const size_t width,const size_t height,const ssize_t x,
2884   const ssize_t y)
2885 {
2886   Image
2887     *extent_image;
2888
2889   RectangleInfo
2890     extent;
2891
2892   assert(wand != (MagickWand *) NULL);
2893   assert(wand->signature == WandSignature);
2894   if (wand->debug != MagickFalse)
2895     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2896   if (wand->images == (Image *) NULL)
2897     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2898   extent.width=width;
2899   extent.height=height;
2900   extent.x=x;
2901   extent.y=y;
2902   extent_image=ExtentImage(wand->images,&extent,wand->exception);
2903   if (extent_image == (Image *) NULL)
2904     return(MagickFalse);
2905   ReplaceImageInList(&wand->images,extent_image);
2906   return(MagickTrue);
2907 }
2908 \f
2909 /*
2910 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2911 %                                                                             %
2912 %                                                                             %
2913 %                                                                             %
2914 %   M a g i c k F l i p I m a g e                                             %
2915 %                                                                             %
2916 %                                                                             %
2917 %                                                                             %
2918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2919 %
2920 %  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
2921 %  around the central x-axis.
2922 %
2923 %  The format of the MagickFlipImage method is:
2924 %
2925 %      MagickBooleanType MagickFlipImage(MagickWand *wand)
2926 %
2927 %  A description of each parameter follows:
2928 %
2929 %    o wand: the magick wand.
2930 %
2931 */
2932 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
2933 {
2934   Image
2935     *flip_image;
2936
2937   assert(wand != (MagickWand *) NULL);
2938   assert(wand->signature == WandSignature);
2939   if (wand->debug != MagickFalse)
2940     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2941   if (wand->images == (Image *) NULL)
2942     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2943   flip_image=FlipImage(wand->images,wand->exception);
2944   if (flip_image == (Image *) NULL)
2945     return(MagickFalse);
2946   ReplaceImageInList(&wand->images,flip_image);
2947   return(MagickTrue);
2948 }
2949 \f
2950 /*
2951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2952 %                                                                             %
2953 %                                                                             %
2954 %                                                                             %
2955 %   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                         %
2956 %                                                                             %
2957 %                                                                             %
2958 %                                                                             %
2959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2960 %
2961 %  MagickFloodfillPaintImage() changes the color value of any pixel that matches
2962 %  target and is an immediate neighbor.  If the method FillToBorderMethod is
2963 %  specified, the color value is changed for any neighbor pixel that does not
2964 %  match the bordercolor member of image.
2965 %
2966 %  The format of the MagickFloodfillPaintImage method is:
2967 %
2968 %      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
2969 %        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
2970 %        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
2971 %
2972 %  A description of each parameter follows:
2973 %
2974 %    o wand: the magick wand.
2975 %
2976 %    o fill: the floodfill color pixel wand.
2977 %
2978 %    o fuzz: By default target must match a particular pixel color
2979 %      exactly.  However, in many cases two colors may differ by a small amount.
2980 %      The fuzz member of image defines how much tolerance is acceptable to
2981 %      consider two colors as the same.  For example, set fuzz to 10 and the
2982 %      color red at intensities of 100 and 102 respectively are now interpreted
2983 %      as the same color for the purposes of the floodfill.
2984 %
2985 %    o bordercolor: the border color pixel wand.
2986 %
2987 %    o x,y: the starting location of the operation.
2988 %
2989 %    o invert: paint any pixel that does not match the target color.
2990 %
2991 */
2992 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
2993   const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
2994   const ssize_t x,const ssize_t y,const MagickBooleanType invert)
2995 {
2996   DrawInfo
2997     *draw_info;
2998
2999   MagickBooleanType
3000     status;
3001
3002   PixelInfo
3003     target;
3004
3005   assert(wand != (MagickWand *) NULL);
3006   assert(wand->signature == WandSignature);
3007   if (wand->debug != MagickFalse)
3008     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3009   if (wand->images == (Image *) NULL)
3010     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3011   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3012   PixelGetQuantumPacket(fill,&draw_info->fill);
3013   (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
3014     y % wand->images->rows,&target,wand->exception);
3015   if (bordercolor != (PixelWand *) NULL)
3016     PixelGetMagickColor(bordercolor,&target);
3017   wand->images->fuzz=fuzz;
3018   status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3019     &wand->images->exception);
3020   draw_info=DestroyDrawInfo(draw_info);
3021   return(status);
3022 }
3023 \f
3024 /*
3025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3026 %                                                                             %
3027 %                                                                             %
3028 %                                                                             %
3029 %   M a g i c k F l o p I m a g e                                             %
3030 %                                                                             %
3031 %                                                                             %
3032 %                                                                             %
3033 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3034 %
3035 %  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3036 %  around the central y-axis.
3037 %
3038 %  The format of the MagickFlopImage method is:
3039 %
3040 %      MagickBooleanType MagickFlopImage(MagickWand *wand)
3041 %
3042 %  A description of each parameter follows:
3043 %
3044 %    o wand: the magick wand.
3045 %
3046 */
3047 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3048 {
3049   Image
3050     *flop_image;
3051
3052   assert(wand != (MagickWand *) NULL);
3053   assert(wand->signature == WandSignature);
3054   if (wand->debug != MagickFalse)
3055     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3056   if (wand->images == (Image *) NULL)
3057     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3058   flop_image=FlopImage(wand->images,wand->exception);
3059   if (flop_image == (Image *) NULL)
3060     return(MagickFalse);
3061   ReplaceImageInList(&wand->images,flop_image);
3062   return(MagickTrue);
3063 }
3064 \f
3065 /*
3066 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3067 %                                                                             %
3068 %                                                                             %
3069 %                                                                             %
3070 %   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                     %
3071 %                                                                             %
3072 %                                                                             %
3073 %                                                                             %
3074 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3075 %
3076 %  MagickForwardFourierTransformImage() implements the discrete Fourier
3077 %  transform (DFT) of the image either as a magnitude / phase or real /
3078 %  imaginary image pair.
3079 %
3080 %  The format of the MagickForwardFourierTransformImage method is:
3081 %
3082 %      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3083 %        const MagickBooleanType magnitude)
3084 %
3085 %  A description of each parameter follows:
3086 %
3087 %    o wand: the magick wand.
3088 %
3089 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3090 %      imaginary image pair.
3091 %
3092 */
3093 WandExport MagickBooleanType MagickForwardFourierTransformImage(
3094   MagickWand *wand,const MagickBooleanType magnitude)
3095 {
3096   Image
3097     *forward_image;
3098
3099   assert(wand != (MagickWand *) NULL);
3100   assert(wand->signature == WandSignature);
3101   if (wand->debug != MagickFalse)
3102     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3103   if (wand->images == (Image *) NULL)
3104     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3105   forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3106     wand->exception);
3107   if (forward_image == (Image *) NULL)
3108     return(MagickFalse);
3109   ReplaceImageInList(&wand->images,forward_image);
3110   return(MagickTrue);
3111 }
3112 \f
3113 /*
3114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3115 %                                                                             %
3116 %                                                                             %
3117 %                                                                             %
3118 %   M a g i c k F r a m e I m a g e                                           %
3119 %                                                                             %
3120 %                                                                             %
3121 %                                                                             %
3122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3123 %
3124 %  MagickFrameImage() adds a simulated three-dimensional border around the
3125 %  image.  The width and height specify the border width of the vertical and
3126 %  horizontal sides of the frame.  The inner and outer bevels indicate the
3127 %  width of the inner and outer shadows of the frame.
3128 %
3129 %  The format of the MagickFrameImage method is:
3130 %
3131 %      MagickBooleanType MagickFrameImage(MagickWand *wand,
3132 %        const PixelWand *matte_color,const size_t width,
3133 %        const size_t height,const ssize_t inner_bevel,
3134 %        const ssize_t outer_bevel)
3135 %
3136 %  A description of each parameter follows:
3137 %
3138 %    o wand: the magick wand.
3139 %
3140 %    o matte_color: the frame color pixel wand.
3141 %
3142 %    o width: the border width.
3143 %
3144 %    o height: the border height.
3145 %
3146 %    o inner_bevel: the inner bevel width.
3147 %
3148 %    o outer_bevel: the outer bevel width.
3149 %
3150 */
3151 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3152   const PixelWand *matte_color,const size_t width,
3153   const size_t height,const ssize_t inner_bevel,const ssize_t outer_bevel)
3154 {
3155   Image
3156     *frame_image;
3157
3158   FrameInfo
3159     frame_info;
3160
3161   assert(wand != (MagickWand *) NULL);
3162   assert(wand->signature == WandSignature);
3163   if (wand->debug != MagickFalse)
3164     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3165   if (wand->images == (Image *) NULL)
3166     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3167   (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3168   frame_info.width=wand->images->columns+2*width;
3169   frame_info.height=wand->images->rows+2*height;
3170   frame_info.x=(ssize_t) width;
3171   frame_info.y=(ssize_t) height;
3172   frame_info.inner_bevel=inner_bevel;
3173   frame_info.outer_bevel=outer_bevel;
3174   PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3175   frame_image=FrameImage(wand->images,&frame_info,wand->exception);
3176   if (frame_image == (Image *) NULL)
3177     return(MagickFalse);
3178   ReplaceImageInList(&wand->images,frame_image);
3179   return(MagickTrue);
3180 }
3181 \f
3182 /*
3183 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3184 %                                                                             %
3185 %                                                                             %
3186 %                                                                             %
3187 %   M a g i c k F u n c t i o n I m a g e                                     %
3188 %                                                                             %
3189 %                                                                             %
3190 %                                                                             %
3191 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3192 %
3193 %  MagickFunctionImage() applys an arithmetic, relational, or logical
3194 %  expression to an image.  Use these operators to lighten or darken an image,
3195 %  to increase or decrease contrast in an image, or to produce the "negative"
3196 %  of an image.
3197 %
3198 %  The format of the MagickFunctionImage method is:
3199 %
3200 %      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3201 %        const MagickFunction function,const size_t number_arguments,
3202 %        const double *arguments)
3203 %
3204 %  A description of each parameter follows:
3205 %
3206 %    o wand: the magick wand.
3207 %
3208 %    o function: the image function.
3209 %
3210 %    o number_arguments: the number of function arguments.
3211 %
3212 %    o arguments: the function arguments.
3213 %
3214 */
3215 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3216   const MagickFunction function,const size_t number_arguments,
3217   const double *arguments)
3218 {
3219   MagickBooleanType
3220     status;
3221
3222   assert(wand != (MagickWand *) NULL);
3223   assert(wand->signature == WandSignature);
3224   if (wand->debug != MagickFalse)
3225     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3226   if (wand->images == (Image *) NULL)
3227     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3228   status=FunctionImage(wand->images,function,number_arguments,arguments,
3229     &wand->images->exception);
3230   return(status);
3231 }
3232 \f
3233 /*
3234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3235 %                                                                             %
3236 %                                                                             %
3237 %                                                                             %
3238 %   M a g i c k F x I m a g e                                                 %
3239 %                                                                             %
3240 %                                                                             %
3241 %                                                                             %
3242 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3243 %
3244 %  MagickFxImage() evaluate expression for each pixel in the image.
3245 %
3246 %  The format of the MagickFxImage method is:
3247 %
3248 %      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3249 %
3250 %  A description of each parameter follows:
3251 %
3252 %    o wand: the magick wand.
3253 %
3254 %    o expression: the expression.
3255 %
3256 */
3257 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3258 {
3259   Image
3260     *fx_image;
3261
3262   assert(wand != (MagickWand *) NULL);
3263   assert(wand->signature == WandSignature);
3264   if (wand->debug != MagickFalse)
3265     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3266   if (wand->images == (Image *) NULL)
3267     return((MagickWand *) NULL);
3268   fx_image=FxImage(wand->images,expression,wand->exception);
3269   if (fx_image == (Image *) NULL)
3270     return((MagickWand *) NULL);
3271   return(CloneMagickWandFromImages(wand,fx_image));
3272 }
3273 \f
3274 /*
3275 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3276 %                                                                             %
3277 %                                                                             %
3278 %                                                                             %
3279 %   M a g i c k G a m m a I m a g e                                           %
3280 %                                                                             %
3281 %                                                                             %
3282 %                                                                             %
3283 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3284 %
3285 %  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3286 %  different devices will have perceptual differences in the way the image's
3287 %  intensities are represented on the screen.  Specify individual gamma levels
3288 %  for the red, green, and blue channels, or adjust all three with the gamma
3289 %  parameter.  Values typically range from 0.8 to 2.3.
3290 %
3291 %  You can also reduce the influence of a particular channel with a gamma
3292 %  value of 0.
3293 %
3294 %  The format of the MagickGammaImage method is:
3295 %
3296 %      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3297 %
3298 %  A description of each parameter follows:
3299 %
3300 %    o wand: the magick wand.
3301 %
3302 %    o level: Define the level of gamma correction.
3303 %
3304 */
3305 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3306   const double gamma)
3307 {
3308   MagickBooleanType
3309     status;
3310
3311   assert(wand != (MagickWand *) NULL);
3312   assert(wand->signature == WandSignature);
3313   if (wand->debug != MagickFalse)
3314     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3315   if (wand->images == (Image *) NULL)
3316     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3317   status=GammaImage(wand->images,gamma,wand->exception);
3318   return(status);
3319 }
3320 \f
3321 /*
3322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3323 %                                                                             %
3324 %                                                                             %
3325 %                                                                             %
3326 %   M a g i c k G a u s s i a n B l u r I m a g e                             %
3327 %                                                                             %
3328 %                                                                             %
3329 %                                                                             %
3330 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3331 %
3332 %  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3333 %  Gaussian operator of the given radius and standard deviation (sigma).
3334 %  For reasonable results, the radius should be larger than sigma.  Use a
3335 %  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3336 %
3337 %  The format of the MagickGaussianBlurImage method is:
3338 %
3339 %      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3340 %        const double radius,const double sigma)
3341 %
3342 %  A description of each parameter follows:
3343 %
3344 %    o wand: the magick wand.
3345 %
3346 %    o radius: the radius of the Gaussian, in pixels, not counting the center
3347 %      pixel.
3348 %
3349 %    o sigma: the standard deviation of the Gaussian, in pixels.
3350 %
3351 */
3352 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3353   const double radius,const double sigma)
3354 {
3355   Image
3356     *blur_image;
3357
3358   assert(wand != (MagickWand *) NULL);
3359   assert(wand->signature == WandSignature);
3360   if (wand->debug != MagickFalse)
3361     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3362   if (wand->images == (Image *) NULL)
3363     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3364   blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3365   if (blur_image == (Image *) NULL)
3366     return(MagickFalse);
3367   ReplaceImageInList(&wand->images,blur_image);
3368   return(MagickTrue);
3369 }
3370 \f
3371 /*
3372 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3373 %                                                                             %
3374 %                                                                             %
3375 %                                                                             %
3376 %   M a g i c k G e t I m a g e                                               %
3377 %                                                                             %
3378 %                                                                             %
3379 %                                                                             %
3380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3381 %
3382 %  MagickGetImage() gets the image at the current image index.
3383 %
3384 %  The format of the MagickGetImage method is:
3385 %
3386 %      MagickWand *MagickGetImage(MagickWand *wand)
3387 %
3388 %  A description of each parameter follows:
3389 %
3390 %    o wand: the magick wand.
3391 %
3392 */
3393 WandExport MagickWand *MagickGetImage(MagickWand *wand)
3394 {
3395   Image
3396     *image;
3397
3398   assert(wand != (MagickWand *) NULL);
3399   assert(wand->signature == WandSignature);
3400   if (wand->debug != MagickFalse)
3401     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3402   if (wand->images == (Image *) NULL)
3403     {
3404       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3405         "ContainsNoImages","`%s'",wand->name);
3406       return((MagickWand *) NULL);
3407     }
3408   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3409   if (image == (Image *) NULL)
3410     return((MagickWand *) NULL);
3411   return(CloneMagickWandFromImages(wand,image));
3412 }
3413 \f
3414 /*
3415 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3416 %                                                                             %
3417 %                                                                             %
3418 %                                                                             %
3419 %   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                       %
3420 %                                                                             %
3421 %                                                                             %
3422 %                                                                             %
3423 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3424 %
3425 %  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3426 %  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3427 %  than CMYKA.
3428 %
3429 %  The format of the MagickGetImageAlphaChannel method is:
3430 %
3431 %      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3432 %
3433 %  A description of each parameter follows:
3434 %
3435 %    o wand: the magick wand.
3436 %
3437 */
3438 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3439 {
3440   assert(wand != (MagickWand *) NULL);
3441   assert(wand->signature == WandSignature);
3442   if (wand->debug != MagickFalse)
3443     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3444   if (wand->images == (Image *) NULL)
3445     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3446   return(GetImageAlphaChannel(wand->images));
3447 }
3448 \f
3449 /*
3450 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3451 %                                                                             %
3452 %                                                                             %
3453 %                                                                             %
3454 %   M a g i c k G e t I m a g e C l i p M a s k                               %
3455 %                                                                             %
3456 %                                                                             %
3457 %                                                                             %
3458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3459 %
3460 %  MagickGetImageClipMask() gets the image clip mask at the current image index.
3461 %
3462 %  The format of the MagickGetImageClipMask method is:
3463 %
3464 %      MagickWand *MagickGetImageClipMask(MagickWand *wand)
3465 %
3466 %  A description of each parameter follows:
3467 %
3468 %    o wand: the magick wand.
3469 %
3470 */
3471 WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
3472 {
3473   Image
3474     *image;
3475
3476   assert(wand != (MagickWand *) NULL);
3477   assert(wand->signature == WandSignature);
3478   if (wand->debug != MagickFalse)
3479     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3480   if (wand->images == (Image *) NULL)
3481     {
3482       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3483         "ContainsNoImages","`%s'",wand->name);
3484       return((MagickWand *) NULL);
3485     }
3486   image=GetImageClipMask(wand->images,wand->exception);
3487   if (image == (Image *) NULL)
3488     return((MagickWand *) NULL);
3489   return(CloneMagickWandFromImages(wand,image));
3490 }
3491 \f
3492 /*
3493 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3494 %                                                                             %
3495 %                                                                             %
3496 %                                                                             %
3497 %   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                 %
3498 %                                                                             %
3499 %                                                                             %
3500 %                                                                             %
3501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3502 %
3503 %  MagickGetImageBackgroundColor() returns the image background color.
3504 %
3505 %  The format of the MagickGetImageBackgroundColor method is:
3506 %
3507 %      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3508 %        PixelWand *background_color)
3509 %
3510 %  A description of each parameter follows:
3511 %
3512 %    o wand: the magick wand.
3513 %
3514 %    o background_color: Return the background color.
3515 %
3516 */
3517 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3518   PixelWand *background_color)
3519 {
3520   assert(wand != (MagickWand *) NULL);
3521   assert(wand->signature == WandSignature);
3522   if (wand->debug != MagickFalse)
3523     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3524   if (wand->images == (Image *) NULL)
3525     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3526   PixelSetQuantumPacket(background_color,&wand->images->background_color);
3527   return(MagickTrue);
3528 }
3529 \f
3530 /*
3531 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3532 %                                                                             %
3533 %                                                                             %
3534 %                                                                             %
3535 %   M a g i c k G e t I m a g e B l o b                                       %
3536 %                                                                             %
3537 %                                                                             %
3538 %                                                                             %
3539 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3540 %
3541 %  MagickGetImageBlob() implements direct to memory image formats.  It returns
3542 %  the image as a blob (a formatted "file" in memory) and its length, starting
3543 %  from the current position in the image sequence.  Use MagickSetImageFormat() 
3544 %  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3545 %
3546 %  Utilize MagickResetIterator() to ensure the write is from the beginning of
3547 %  the image sequence.
3548 %
3549 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
3550 %
3551 %  The format of the MagickGetImageBlob method is:
3552 %
3553 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3554 %
3555 %  A description of each parameter follows:
3556 %
3557 %    o wand: the magick wand.
3558 %
3559 %    o length: the length of the blob.
3560 %
3561 */
3562 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3563 {
3564   assert(wand != (MagickWand *) NULL);
3565   assert(wand->signature == WandSignature);
3566   if (wand->debug != MagickFalse)
3567     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3568   if (wand->images == (Image *) NULL)
3569     {
3570       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3571         "ContainsNoImages","`%s'",wand->name);
3572       return((unsigned char *) NULL);
3573     }
3574   return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3575 }
3576 \f
3577 /*
3578 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3579 %                                                                             %
3580 %                                                                             %
3581 %                                                                             %
3582 %   M a g i c k G e t I m a g e s B l o b                                     %
3583 %                                                                             %
3584 %                                                                             %
3585 %                                                                             %
3586 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3587 %
3588 %  MagickGetImageBlob() implements direct to memory image formats.  It
3589 %  returns the image sequence as a blob and its length.  The format of the image
3590 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3591 %  return a different image format, use MagickSetImageFormat().
3592 %
3593 %  Note, some image formats do not permit multiple images to the same image
3594 %  stream (e.g. JPEG).  in this instance, just the first image of the
3595 %  sequence is returned as a blob.
3596 %
3597 %  The format of the MagickGetImagesBlob method is:
3598 %
3599 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3600 %
3601 %  A description of each parameter follows:
3602 %
3603 %    o wand: the magick wand.
3604 %
3605 %    o length: the length of the blob.
3606 %
3607 */
3608 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3609 {
3610   unsigned char
3611     *blob;
3612
3613   assert(wand != (MagickWand *) NULL);
3614   assert(wand->signature == WandSignature);
3615   if (wand->debug != MagickFalse)
3616     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3617   if (wand->images == (Image *) NULL)
3618     {
3619       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3620         "ContainsNoImages","`%s'",wand->name);
3621       return((unsigned char *) NULL);
3622     }
3623   blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3624     wand->exception);
3625   return(blob);
3626 }
3627 \f
3628 /*
3629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3630 %                                                                             %
3631 %                                                                             %
3632 %                                                                             %
3633 %   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                         %
3634 %                                                                             %
3635 %                                                                             %
3636 %                                                                             %
3637 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3638 %
3639 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3640 %  image.
3641 %
3642 %  The format of the MagickGetImageBluePrimary method is:
3643 %
3644 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3645 %        double *y)
3646 %
3647 %  A description of each parameter follows:
3648 %
3649 %    o wand: the magick wand.
3650 %
3651 %    o x: the chromaticity blue primary x-point.
3652 %
3653 %    o y: the chromaticity blue primary y-point.
3654 %
3655 */
3656 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3657   double *x,double *y)
3658 {
3659   assert(wand != (MagickWand *) NULL);
3660   assert(wand->signature == WandSignature);
3661   if (wand->debug != MagickFalse)
3662     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3663   if (wand->images == (Image *) NULL)
3664     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3665   *x=wand->images->chromaticity.blue_primary.x;
3666   *y=wand->images->chromaticity.blue_primary.y;
3667   return(MagickTrue);
3668 }
3669 \f
3670 /*
3671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3672 %                                                                             %
3673 %                                                                             %
3674 %                                                                             %
3675 %   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                         %
3676 %                                                                             %
3677 %                                                                             %
3678 %                                                                             %
3679 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3680 %
3681 %  MagickGetImageBorderColor() returns the image border color.
3682 %
3683 %  The format of the MagickGetImageBorderColor method is:
3684 %
3685 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3686 %        PixelWand *border_color)
3687 %
3688 %  A description of each parameter follows:
3689 %
3690 %    o wand: the magick wand.
3691 %
3692 %    o border_color: Return the border color.
3693 %
3694 */
3695 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3696   PixelWand *border_color)
3697 {
3698   assert(wand != (MagickWand *) NULL);
3699   assert(wand->signature == WandSignature);
3700   if (wand->debug != MagickFalse)
3701     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3702   if (wand->images == (Image *) NULL)
3703     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3704   PixelSetQuantumPacket(border_color,&wand->images->border_color);
3705   return(MagickTrue);
3706 }
3707 \f
3708 /*
3709 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3710 %                                                                             %
3711 %                                                                             %
3712 %                                                                             %
3713 %   M a g i c k G e t I m a g e F e a t u r e s                               %
3714 %                                                                             %
3715 %                                                                             %
3716 %                                                                             %
3717 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3718 %
3719 %  MagickGetImageFeatures() returns features for each channel in the
3720 %  image in each of four directions (horizontal, vertical, left and right
3721 %  diagonals) for the specified distance.  The features include the angular
3722 %  second moment, contrast, correlation, sum of squares: variance, inverse
3723 %  difference moment, sum average, sum varience, sum entropy, entropy,
3724 %  difference variance, difference entropy, information measures of
3725 %  correlation 1, information measures of correlation 2, and maximum
3726 %  correlation coefficient.  You can access the red channel contrast, for
3727 %  example, like this:
3728 %
3729 %      channel_features=MagickGetImageFeatures(wand,1);
3730 %      contrast=channel_features[RedChannel].contrast[0];
3731 %
3732 %  Use MagickRelinquishMemory() to free the statistics buffer.
3733 %
3734 %  The format of the MagickGetImageFeatures method is:
3735 %
3736 %      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3737 %        const size_t distance)
3738 %
3739 %  A description of each parameter follows:
3740 %
3741 %    o wand: the magick wand.
3742 %
3743 %    o distance: the distance.
3744 %
3745 */
3746 WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3747   const size_t distance)
3748 {
3749   assert(wand != (MagickWand *) NULL);
3750   assert(wand->signature == WandSignature);
3751   if (wand->debug != MagickFalse)
3752     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3753   if (wand->images == (Image *) NULL)
3754     {
3755       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3756         "ContainsNoImages","`%s'",wand->name);
3757       return((ChannelFeatures *) NULL);
3758     }
3759   return(GetImageFeatures(wand->images,distance,wand->exception));
3760 }
3761 \f
3762 /*
3763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3764 %                                                                             %
3765 %                                                                             %
3766 %                                                                             %
3767 %   M a g i c k G e t I m a g e K u r t o s i s                               %
3768 %                                                                             %
3769 %                                                                             %
3770 %                                                                             %
3771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3772 %
3773 %  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
3774 %  more image channels.
3775 %
3776 %  The format of the MagickGetImageKurtosis method is:
3777 %
3778 %      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3779 %        double *kurtosis,double *skewness)
3780 %
3781 %  A description of each parameter follows:
3782 %
3783 %    o wand: the magick wand.
3784 %
3785 %    o kurtosis:  The kurtosis for the specified channel(s).
3786 %
3787 %    o skewness:  The skewness for the specified channel(s).
3788 %
3789 */
3790 WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3791   double *kurtosis,double *skewness)
3792 {
3793   MagickBooleanType
3794     status;
3795
3796   assert(wand != (MagickWand *) NULL);
3797   assert(wand->signature == WandSignature);
3798   if (wand->debug != MagickFalse)
3799     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3800   if (wand->images == (Image *) NULL)
3801     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3802   status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
3803   return(status);
3804 }
3805 \f
3806 /*
3807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3808 %                                                                             %
3809 %                                                                             %
3810 %                                                                             %
3811 %   M a g i c k G e t I m a g e M e a n                                       %
3812 %                                                                             %
3813 %                                                                             %
3814 %                                                                             %
3815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3816 %
3817 %  MagickGetImageMean() gets the mean and standard deviation of one or more
3818 %  image channels.
3819 %
3820 %  The format of the MagickGetImageMean method is:
3821 %
3822 %      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3823 %        double *standard_deviation)
3824 %
3825 %  A description of each parameter follows:
3826 %
3827 %    o wand: the magick wand.
3828 %
3829 %    o channel: the image channel(s).
3830 %
3831 %    o mean:  The mean pixel value for the specified channel(s).
3832 %
3833 %    o standard_deviation:  The standard deviation for the specified channel(s).
3834 %
3835 */
3836 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3837   double *standard_deviation)
3838 {
3839   MagickBooleanType
3840     status;
3841
3842   assert(wand != (MagickWand *) NULL);
3843   assert(wand->signature == WandSignature);
3844   if (wand->debug != MagickFalse)
3845     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3846   if (wand->images == (Image *) NULL)
3847     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3848   status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
3849   return(status);
3850 }
3851 \f
3852 /*
3853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3854 %                                                                             %
3855 %                                                                             %
3856 %                                                                             %
3857 %   M a g i c k G e t I m a g e R a n g e                                     %
3858 %                                                                             %
3859 %                                                                             %
3860 %                                                                             %
3861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3862 %
3863 %  MagickGetImageRange() gets the range for one or more image channels.
3864 %
3865 %  The format of the MagickGetImageRange method is:
3866 %
3867 %      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
3868 %        double *maxima)
3869 %
3870 %  A description of each parameter follows:
3871 %
3872 %    o wand: the magick wand.
3873 %
3874 %    o minima:  The minimum pixel value for the specified channel(s).
3875 %
3876 %    o maxima:  The maximum pixel value for the specified channel(s).
3877 %
3878 */
3879 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
3880   double *minima,double *maxima)
3881 {
3882   MagickBooleanType
3883     status;
3884
3885   assert(wand != (MagickWand *) NULL);
3886   assert(wand->signature == WandSignature);
3887   if (wand->debug != MagickFalse)
3888     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3889   if (wand->images == (Image *) NULL)
3890     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3891   status=GetImageRange(wand->images,minima,maxima,wand->exception);
3892   return(status);
3893 }
3894 \f
3895 /*
3896 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3897 %                                                                             %
3898 %                                                                             %
3899 %                                                                             %
3900 %   M a g i c k G e t I m a g e S t a t i s t i c s                           %
3901 %                                                                             %
3902 %                                                                             %
3903 %                                                                             %
3904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3905 %
3906 %  MagickGetImageStatistics() returns statistics for each channel in the
3907 %  image.  The statistics include the channel depth, its minima and
3908 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
3909 %  You can access the red channel mean, for example, like this:
3910 %
3911 %      channel_statistics=MagickGetImageStatistics(wand);
3912 %      red_mean=channel_statistics[RedChannel].mean;
3913 %
3914 %  Use MagickRelinquishMemory() to free the statistics buffer.
3915 %
3916 %  The format of the MagickGetImageStatistics method is:
3917 %
3918 %      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3919 %
3920 %  A description of each parameter follows:
3921 %
3922 %    o wand: the magick wand.
3923 %
3924 */
3925 WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3926 {
3927   assert(wand != (MagickWand *) NULL);
3928   assert(wand->signature == WandSignature);
3929   if (wand->debug != MagickFalse)
3930     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3931   if (wand->images == (Image *) NULL)
3932     {
3933       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3934         "ContainsNoImages","`%s'",wand->name);
3935       return((ChannelStatistics *) NULL);
3936     }
3937   return(GetImageStatistics(wand->images,wand->exception));
3938 }
3939 \f
3940 /*
3941 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3942 %                                                                             %
3943 %                                                                             %
3944 %                                                                             %
3945 %   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                     %
3946 %                                                                             %
3947 %                                                                             %
3948 %                                                                             %
3949 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3950 %
3951 %  MagickGetImageColormapColor() returns the color of the specified colormap
3952 %  index.
3953 %
3954 %  The format of the MagickGetImageColormapColor method is:
3955 %
3956 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
3957 %        const size_t index,PixelWand *color)
3958 %
3959 %  A description of each parameter follows:
3960 %
3961 %    o wand: the magick wand.
3962 %
3963 %    o index: the offset into the image colormap.
3964 %
3965 %    o color: Return the colormap color in this wand.
3966 %
3967 */
3968 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
3969   const size_t index,PixelWand *color)
3970 {
3971   assert(wand != (MagickWand *) NULL);
3972   assert(wand->signature == WandSignature);
3973   if (wand->debug != MagickFalse)
3974     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3975   if (wand->images == (Image *) NULL)
3976     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3977   if ((wand->images->colormap == (PixelPacket *) NULL) ||
3978       (index >= wand->images->colors))
3979     {
3980       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3981         "InvalidColormapIndex","`%s'",wand->name);
3982       return(MagickFalse);
3983     }
3984   PixelSetQuantumPacket(color,wand->images->colormap+index);
3985   return(MagickTrue);
3986 }
3987 \f
3988 /*
3989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3990 %                                                                             %
3991 %                                                                             %
3992 %                                                                             %
3993 %   M a g i c k G e t I m a g e C o l o r s                                   %
3994 %                                                                             %
3995 %                                                                             %
3996 %                                                                             %
3997 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3998 %
3999 %  MagickGetImageColors() gets the number of unique colors in the image.
4000 %
4001 %  The format of the MagickGetImageColors method is:
4002 %
4003 %      size_t MagickGetImageColors(MagickWand *wand)
4004 %
4005 %  A description of each parameter follows:
4006 %
4007 %    o wand: the magick wand.
4008 %
4009 */
4010 WandExport size_t MagickGetImageColors(MagickWand *wand)
4011 {
4012   assert(wand != (MagickWand *) NULL);
4013   assert(wand->signature == WandSignature);
4014   if (wand->debug != MagickFalse)
4015     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4016   if (wand->images == (Image *) NULL)
4017     {
4018       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4019         "ContainsNoImages","`%s'",wand->name);
4020       return(0);
4021     }
4022   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4023 }
4024 \f
4025 /*
4026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4027 %                                                                             %
4028 %                                                                             %
4029 %                                                                             %
4030 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4031 %                                                                             %
4032 %                                                                             %
4033 %                                                                             %
4034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4035 %
4036 %  MagickGetImageColorspace() gets the image colorspace.
4037 %
4038 %  The format of the MagickGetImageColorspace method is:
4039 %
4040 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4041 %
4042 %  A description of each parameter follows:
4043 %
4044 %    o wand: the magick wand.
4045 %
4046 */
4047 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4048 {
4049   assert(wand != (MagickWand *) NULL);
4050   assert(wand->signature == WandSignature);
4051   if (wand->debug != MagickFalse)
4052     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4053   if (wand->images == (Image *) NULL)
4054     {
4055       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4056         "ContainsNoImages","`%s'",wand->name);
4057       return(UndefinedColorspace);
4058     }
4059   return(wand->images->colorspace);
4060 }
4061 \f
4062 /*
4063 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4064 %                                                                             %
4065 %                                                                             %
4066 %                                                                             %
4067 %   M a g i c k G e t I m a g e C o m p o s e                                 %
4068 %                                                                             %
4069 %                                                                             %
4070 %                                                                             %
4071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4072 %
4073 %  MagickGetImageCompose() returns the composite operator associated with the
4074 %  image.
4075 %
4076 %  The format of the MagickGetImageCompose method is:
4077 %
4078 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4079 %
4080 %  A description of each parameter follows:
4081 %
4082 %    o wand: the magick wand.
4083 %
4084 */
4085 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4086 {
4087   assert(wand != (MagickWand *) NULL);
4088   assert(wand->signature == WandSignature);
4089   if (wand->debug != MagickFalse)
4090     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4091   if (wand->images == (Image *) NULL)
4092     {
4093       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4094         "ContainsNoImages","`%s'",wand->name);
4095       return(UndefinedCompositeOp);
4096     }
4097   return(wand->images->compose);
4098 }
4099 \f
4100 /*
4101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4102 %                                                                             %
4103 %                                                                             %
4104 %                                                                             %
4105 %   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                         %
4106 %                                                                             %
4107 %                                                                             %
4108 %                                                                             %
4109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4110 %
4111 %  MagickGetImageCompression() gets the image compression.
4112 %
4113 %  The format of the MagickGetImageCompression method is:
4114 %
4115 %      CompressionType MagickGetImageCompression(MagickWand *wand)
4116 %
4117 %  A description of each parameter follows:
4118 %
4119 %    o wand: the magick wand.
4120 %
4121 */
4122 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4123 {
4124   assert(wand != (MagickWand *) NULL);
4125   assert(wand->signature == WandSignature);
4126   if (wand->debug != MagickFalse)
4127     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4128   if (wand->images == (Image *) NULL)
4129     {
4130       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4131         "ContainsNoImages","`%s'",wand->name);
4132       return(UndefinedCompression);
4133     }
4134   return(wand->images->compression);
4135 }
4136 \f
4137 /*
4138 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4139 %                                                                             %
4140 %                                                                             %
4141 %                                                                             %
4142 %   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           %
4143 %                                                                             %
4144 %                                                                             %
4145 %                                                                             %
4146 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4147 %
4148 %  MagickGetImageCompression() gets the image compression quality.
4149 %
4150 %  The format of the MagickGetImageCompression method is:
4151 %
4152 %      size_t MagickGetImageCompression(MagickWand *wand)
4153 %
4154 %  A description of each parameter follows:
4155 %
4156 %    o wand: the magick wand.
4157 %
4158 */
4159 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4160 {
4161   assert(wand != (MagickWand *) NULL);
4162   assert(wand->signature == WandSignature);
4163   if (wand->debug != MagickFalse)
4164     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4165   if (wand->images == (Image *) NULL)
4166     {
4167       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4168         "ContainsNoImages","`%s'",wand->name);
4169       return(0UL);
4170     }
4171   return(wand->images->quality);
4172 }
4173 \f
4174 /*
4175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4176 %                                                                             %
4177 %                                                                             %
4178 %                                                                             %
4179 %   M a g i c k G e t I m a g e D e l a y                                     %
4180 %                                                                             %
4181 %                                                                             %
4182 %                                                                             %
4183 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4184 %
4185 %  MagickGetImageDelay() gets the image delay.
4186 %
4187 %  The format of the MagickGetImageDelay method is:
4188 %
4189 %      size_t MagickGetImageDelay(MagickWand *wand)
4190 %
4191 %  A description of each parameter follows:
4192 %
4193 %    o wand: the magick wand.
4194 %
4195 */
4196 WandExport size_t MagickGetImageDelay(MagickWand *wand)
4197 {
4198   assert(wand != (MagickWand *) NULL);
4199   assert(wand->signature == WandSignature);
4200   if (wand->debug != MagickFalse)
4201     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4202   if (wand->images == (Image *) NULL)
4203     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4204   return(wand->images->delay);
4205 }
4206 \f
4207 /*
4208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4209 %                                                                             %
4210 %                                                                             %
4211 %                                                                             %
4212 %   M a g i c k G e t I m a g e D e p t h                                     %
4213 %                                                                             %
4214 %                                                                             %
4215 %                                                                             %
4216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4217 %
4218 %  MagickGetImageDepth() gets the image depth.
4219 %
4220 %  The format of the MagickGetImageDepth method is:
4221 %
4222 %      size_t MagickGetImageDepth(MagickWand *wand)
4223 %
4224 %  A description of each parameter follows:
4225 %
4226 %    o wand: the magick wand.
4227 %
4228 */
4229 WandExport size_t MagickGetImageDepth(MagickWand *wand)
4230 {
4231   assert(wand != (MagickWand *) NULL);
4232   assert(wand->signature == WandSignature);
4233   if (wand->debug != MagickFalse)
4234     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4235   if (wand->images == (Image *) NULL)
4236     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4237   return(GetImageDepth(wand->images,wand->exception));
4238 }
4239 \f
4240 /*
4241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4242 %                                                                             %
4243 %                                                                             %
4244 %                                                                             %
4245 %   M a g i c k G e t I m a g e D i s p o s e                                 %
4246 %                                                                             %
4247 %                                                                             %
4248 %                                                                             %
4249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4250 %
4251 %  MagickGetImageDispose() gets the image disposal method.
4252 %
4253 %  The format of the MagickGetImageDispose method is:
4254 %
4255 %      DisposeType MagickGetImageDispose(MagickWand *wand)
4256 %
4257 %  A description of each parameter follows:
4258 %
4259 %    o wand: the magick wand.
4260 %
4261 */
4262 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4263 {
4264   assert(wand != (MagickWand *) NULL);
4265   assert(wand->signature == WandSignature);
4266   if (wand->debug != MagickFalse)
4267     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4268   if (wand->images == (Image *) NULL)
4269     {
4270       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4271         "ContainsNoImages","`%s'",wand->name);
4272       return(UndefinedDispose);
4273     }
4274   return((DisposeType) wand->images->dispose);
4275 }
4276 \f
4277 /*
4278 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4279 %                                                                             %
4280 %                                                                             %
4281 %                                                                             %
4282 %   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4283 %                                                                             %
4284 %                                                                             %
4285 %                                                                             %
4286 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4287 %
4288 %  MagickGetImageDistortion() compares an image to a reconstructed image and
4289 %  returns the specified distortion metric.
4290 %
4291 %  The format of the MagickGetImageDistortion method is:
4292 %
4293 %      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4294 %        const MagickWand *reference,const MetricType metric,
4295 %        double *distortion)
4296 %
4297 %  A description of each parameter follows:
4298 %
4299 %    o wand: the magick wand.
4300 %
4301 %    o reference: the reference wand.
4302 %
4303 %    o metric: the metric.
4304 %
4305 %    o distortion: the computed distortion between the images.
4306 %
4307 */
4308 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4309   const MagickWand *reference,const MetricType metric,double *distortion)
4310 {
4311   MagickBooleanType
4312     status;
4313
4314   assert(wand != (MagickWand *) NULL);
4315   assert(wand->signature == WandSignature);
4316   if (wand->debug != MagickFalse)
4317     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4318   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4319     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4320   status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4321     &wand->images->exception);
4322   return(status);
4323 }
4324 \f
4325 /*
4326 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4327 %                                                                             %
4328 %                                                                             %
4329 %                                                                             %
4330 %   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                         %
4331 %                                                                             %
4332 %                                                                             %
4333 %                                                                             %
4334 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4335 %
4336 %  MagickGetImageDistortions() compares one or more pixel channels of an
4337 %  image to a reconstructed image and returns the specified distortion metrics.
4338 %
4339 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4340 %
4341 %  The format of the MagickGetImageDistortion method is:
4342 %
4343 %      double *MagickGetImageDistortion(MagickWand *wand,
4344 %        const MagickWand *reference,const MetricType metric)
4345 %
4346 %  A description of each parameter follows:
4347 %
4348 %    o wand: the magick wand.
4349 %
4350 %    o reference: the reference wand.
4351 %
4352 %    o metric: the metric.
4353 %
4354 */
4355 WandExport double *MagickGetImageDistortions(MagickWand *wand,
4356   const MagickWand *reference,const MetricType metric)
4357 {
4358   double
4359     *channel_distortion;
4360
4361   assert(wand != (MagickWand *) NULL);
4362   assert(wand->signature == WandSignature);
4363   if (wand->debug != MagickFalse)
4364     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4365   assert(reference != (MagickWand *) NULL);
4366   assert(reference->signature == WandSignature);
4367   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4368     {
4369       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4370         "ContainsNoImages","`%s'",wand->name);
4371       return((double *) NULL);
4372     }
4373   channel_distortion=GetImageDistortions(wand->images,reference->images,
4374     metric,&wand->images->exception);
4375   return(channel_distortion);
4376 }
4377 \f
4378 /*
4379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4380 %                                                                             %
4381 %                                                                             %
4382 %                                                                             %
4383 %   M a g i c k G e t I m a g e F i l e n a m e                               %
4384 %                                                                             %
4385 %                                                                             %
4386 %                                                                             %
4387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4388 %
4389 %  MagickGetImageFilename() returns the filename of a particular image in a
4390 %  sequence.
4391 %
4392 %  The format of the MagickGetImageFilename method is:
4393 %
4394 %      char *MagickGetImageFilename(MagickWand *wand)
4395 %
4396 %  A description of each parameter follows:
4397 %
4398 %    o wand: the magick wand.
4399 %
4400 */
4401 WandExport char *MagickGetImageFilename(MagickWand *wand)
4402 {
4403   assert(wand != (MagickWand *) NULL);
4404   assert(wand->signature == WandSignature);
4405   if (wand->debug != MagickFalse)
4406     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4407   if (wand->images == (Image *) NULL)
4408     {
4409       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4410         "ContainsNoImages","`%s'",wand->name);
4411       return((char *) NULL);
4412     }
4413   return(AcquireString(wand->images->filename));
4414 }
4415 \f
4416 /*
4417 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4418 %                                                                             %
4419 %                                                                             %
4420 %                                                                             %
4421 %   M a g i c k G e t I m a g e F o r m a t                                   %
4422 %                                                                             %
4423 %                                                                             %
4424 %                                                                             %
4425 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4426 %
4427 %  MagickGetImageFormat() returns the format of a particular image in a
4428 %  sequence.
4429 %
4430 %  The format of the MagickGetImageFormat method is:
4431 %
4432 %      const char *MagickGetImageFormat(MagickWand *wand)
4433 %
4434 %  A description of each parameter follows:
4435 %
4436 %    o wand: the magick wand.
4437 %
4438 */
4439 WandExport char *MagickGetImageFormat(MagickWand *wand)
4440 {
4441   assert(wand != (MagickWand *) NULL);
4442   assert(wand->signature == WandSignature);
4443   if (wand->debug != MagickFalse)
4444     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4445   if (wand->images == (Image *) NULL)
4446     {
4447       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4448         "ContainsNoImages","`%s'",wand->name);
4449       return((char *) NULL);
4450     }
4451   return(AcquireString(wand->images->magick));
4452 }
4453 \f
4454 /*
4455 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4456 %                                                                             %
4457 %                                                                             %
4458 %                                                                             %
4459 %   M a g i c k G e t I m a g e F u z z                                       %
4460 %                                                                             %
4461 %                                                                             %
4462 %                                                                             %
4463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4464 %
4465 %  MagickGetImageFuzz() gets the image fuzz.
4466 %
4467 %  The format of the MagickGetImageFuzz method is:
4468 %
4469 %      double MagickGetImageFuzz(MagickWand *wand)
4470 %
4471 %  A description of each parameter follows:
4472 %
4473 %    o wand: the magick wand.
4474 %
4475 */
4476 WandExport double MagickGetImageFuzz(MagickWand *wand)
4477 {
4478   assert(wand != (MagickWand *) NULL);
4479   assert(wand->signature == WandSignature);
4480   if (wand->debug != MagickFalse)
4481     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4482   if (wand->images == (Image *) NULL)
4483     {
4484       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4485         "ContainsNoImages","`%s'",wand->name);
4486       return(0.0);
4487     }
4488   return(wand->images->fuzz);
4489 }
4490 \f
4491 /*
4492 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4493 %                                                                             %
4494 %                                                                             %
4495 %                                                                             %
4496 %   M a g i c k G e t I m a g e G a m m a                                     %
4497 %                                                                             %
4498 %                                                                             %
4499 %                                                                             %
4500 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4501 %
4502 %  MagickGetImageGamma() gets the image gamma.
4503 %
4504 %  The format of the MagickGetImageGamma method is:
4505 %
4506 %      double MagickGetImageGamma(MagickWand *wand)
4507 %
4508 %  A description of each parameter follows:
4509 %
4510 %    o wand: the magick wand.
4511 %
4512 */
4513 WandExport double MagickGetImageGamma(MagickWand *wand)
4514 {
4515   assert(wand != (MagickWand *) NULL);
4516   assert(wand->signature == WandSignature);
4517   if (wand->debug != MagickFalse)
4518     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4519   if (wand->images == (Image *) NULL)
4520     {
4521       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4522         "ContainsNoImages","`%s'",wand->name);
4523       return(0.0);
4524     }
4525   return(wand->images->gamma);
4526 }
4527 \f
4528 /*
4529 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4530 %                                                                             %
4531 %                                                                             %
4532 %                                                                             %
4533 %   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                 %
4534 %                                                                             %
4535 %                                                                             %
4536 %                                                                             %
4537 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4538 %
4539 %  MagickGetImageGravity() gets the image gravity.
4540 %
4541 %  The format of the MagickGetImageGravity method is:
4542 %
4543 %      GravityType MagickGetImageGravity(MagickWand *wand)
4544 %
4545 %  A description of each parameter follows:
4546 %
4547 %    o wand: the magick wand.
4548 %
4549 */
4550 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4551 {
4552   assert(wand != (MagickWand *) NULL);
4553   assert(wand->signature == WandSignature);
4554   if (wand->debug != MagickFalse)
4555     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4556   if (wand->images == (Image *) NULL)
4557     {
4558       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4559         "ContainsNoImages","`%s'",wand->name);
4560       return(UndefinedGravity);
4561     }
4562   return(wand->images->gravity);
4563 }
4564 \f
4565 /*
4566 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4567 %                                                                             %
4568 %                                                                             %
4569 %                                                                             %
4570 %   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                       %
4571 %                                                                             %
4572 %                                                                             %
4573 %                                                                             %
4574 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4575 %
4576 %  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4577 %
4578 %  The format of the MagickGetImageGreenPrimary method is:
4579 %
4580 %      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4581 %        double *y)
4582 %
4583 %  A description of each parameter follows:
4584 %
4585 %    o wand: the magick wand.
4586 %
4587 %    o x: the chromaticity green primary x-point.
4588 %
4589 %    o y: the chromaticity green primary y-point.
4590 %
4591 */
4592 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4593   double *x,double *y)
4594 {
4595   assert(wand != (MagickWand *) NULL);
4596   assert(wand->signature == WandSignature);
4597   if (wand->debug != MagickFalse)
4598     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4599   if (wand->images == (Image *) NULL)
4600     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4601   *x=wand->images->chromaticity.green_primary.x;
4602   *y=wand->images->chromaticity.green_primary.y;
4603   return(MagickTrue);
4604 }
4605 \f
4606 /*
4607 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4608 %                                                                             %
4609 %                                                                             %
4610 %                                                                             %
4611 %   M a g i c k G e t I m a g e H e i g h t                                   %
4612 %                                                                             %
4613 %                                                                             %
4614 %                                                                             %
4615 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4616 %
4617 %  MagickGetImageHeight() returns the image height.
4618 %
4619 %  The format of the MagickGetImageHeight method is:
4620 %
4621 %      size_t MagickGetImageHeight(MagickWand *wand)
4622 %
4623 %  A description of each parameter follows:
4624 %
4625 %    o wand: the magick wand.
4626 %
4627 */
4628 WandExport size_t MagickGetImageHeight(MagickWand *wand)
4629 {
4630   assert(wand != (MagickWand *) NULL);
4631   assert(wand->signature == WandSignature);
4632   if (wand->debug != MagickFalse)
4633     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4634   if (wand->images == (Image *) NULL)
4635     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4636   return(wand->images->rows);
4637 }
4638 \f
4639 /*
4640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4641 %                                                                             %
4642 %                                                                             %
4643 %                                                                             %
4644 %   M a g i c k G e t I m a g e H i s t o g r a m                             %
4645 %                                                                             %
4646 %                                                                             %
4647 %                                                                             %
4648 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4649 %
4650 %  MagickGetImageHistogram() returns the image histogram as an array of
4651 %  PixelWand wands.
4652 %
4653 %  The format of the MagickGetImageHistogram method is:
4654 %
4655 %      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4656 %        size_t *number_colors)
4657 %
4658 %  A description of each parameter follows:
4659 %
4660 %    o wand: the magick wand.
4661 %
4662 %    o number_colors: the number of unique colors in the image and the number
4663 %      of pixel wands returned.
4664 %
4665 */
4666 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4667   size_t *number_colors)
4668 {
4669   PixelPacket
4670     *histogram;
4671
4672   PixelWand
4673     **pixel_wands;
4674
4675   register ssize_t
4676     i;
4677
4678   assert(wand != (MagickWand *) NULL);
4679   assert(wand->signature == WandSignature);
4680   if (wand->debug != MagickFalse)
4681     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4682   if (wand->images == (Image *) NULL)
4683     {
4684       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4685         "ContainsNoImages","`%s'",wand->name);
4686       return((PixelWand **) NULL);
4687     }
4688   histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4689   if (histogram == (PixelPacket *) NULL)
4690     return((PixelWand **) NULL);
4691   pixel_wands=NewPixelWands(*number_colors);
4692   for (i=0; i < (ssize_t) *number_colors; i++)
4693   {
4694     PixelSetQuantumPacket(pixel_wands[i],&histogram[i]);
4695     PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4696   }
4697   histogram=(PixelPacket *) RelinquishMagickMemory(histogram);
4698   return(pixel_wands);
4699 }
4700 \f
4701 /*
4702 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4703 %                                                                             %
4704 %                                                                             %
4705 %                                                                             %
4706 %   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                 %
4707 %                                                                             %
4708 %                                                                             %
4709 %                                                                             %
4710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4711 %
4712 %  MagickGetImageInterlaceScheme() gets the image interlace scheme.
4713 %
4714 %  The format of the MagickGetImageInterlaceScheme method is:
4715 %
4716 %      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4717 %
4718 %  A description of each parameter follows:
4719 %
4720 %    o wand: the magick wand.
4721 %
4722 */
4723 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4724 {
4725   assert(wand != (MagickWand *) NULL);
4726   assert(wand->signature == WandSignature);
4727   if (wand->debug != MagickFalse)
4728     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4729   if (wand->images == (Image *) NULL)
4730     {
4731       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4732         "ContainsNoImages","`%s'",wand->name);
4733       return(UndefinedInterlace);
4734     }
4735   return(wand->images->interlace);
4736 }
4737 \f
4738 /*
4739 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4740 %                                                                             %
4741 %                                                                             %
4742 %                                                                             %
4743 %   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             %
4744 %                                                                             %
4745 %                                                                             %
4746 %                                                                             %
4747 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4748 %
4749 %  MagickGetImageInterpolateMethod() returns the interpolation method for the
4750 %  sepcified image.
4751 %
4752 %  The format of the MagickGetImageInterpolateMethod method is:
4753 %
4754 %      InterpolatePixelMethod MagickGetImageInterpolateMethod(MagickWand *wand)
4755 %
4756 %  A description of each parameter follows:
4757 %
4758 %    o wand: the magick wand.
4759 %
4760 */
4761 WandExport InterpolatePixelMethod MagickGetImageInterpolateMethod(
4762   MagickWand *wand)
4763 {
4764   assert(wand != (MagickWand *) NULL);
4765   assert(wand->signature == WandSignature);
4766   if (wand->debug != MagickFalse)
4767     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4768   if (wand->images == (Image *) NULL)
4769     {
4770       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4771         "ContainsNoImages","`%s'",wand->name);
4772       return(UndefinedInterpolatePixel);
4773     }
4774   return(wand->images->interpolate);
4775 }
4776 \f
4777 /*
4778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4779 %                                                                             %
4780 %                                                                             %
4781 %                                                                             %
4782 %   M a g i c k G e t I m a g e I t e r a t i o n s                           %
4783 %                                                                             %
4784 %                                                                             %
4785 %                                                                             %
4786 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4787 %
4788 %  MagickGetImageIterations() gets the image iterations.
4789 %
4790 %  The format of the MagickGetImageIterations method is:
4791 %
4792 %      size_t MagickGetImageIterations(MagickWand *wand)
4793 %
4794 %  A description of each parameter follows:
4795 %
4796 %    o wand: the magick wand.
4797 %
4798 */
4799 WandExport size_t MagickGetImageIterations(MagickWand *wand)
4800 {
4801   assert(wand != (MagickWand *) NULL);
4802   assert(wand->signature == WandSignature);
4803   if (wand->debug != MagickFalse)
4804     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4805   if (wand->images == (Image *) NULL)
4806     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4807   return(wand->images->iterations);
4808 }
4809 \f
4810 /*
4811 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4812 %                                                                             %
4813 %                                                                             %
4814 %                                                                             %
4815 %   M a g i c k G e t I m a g e L e n g t h                                   %
4816 %                                                                             %
4817 %                                                                             %
4818 %                                                                             %
4819 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4820 %
4821 %  MagickGetImageLength() returns the image length in bytes.
4822 %
4823 %  The format of the MagickGetImageLength method is:
4824 %
4825 %      MagickBooleanType MagickGetImageLength(MagickWand *wand,
4826 %        MagickSizeType *length)
4827 %
4828 %  A description of each parameter follows:
4829 %
4830 %    o wand: the magick wand.
4831 %
4832 %    o length: the image length in bytes.
4833 %
4834 */
4835 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
4836   MagickSizeType *length)
4837 {
4838   assert(wand != (MagickWand *) NULL);
4839   assert(wand->signature == WandSignature);
4840   if (wand->debug != MagickFalse)
4841     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4842   if (wand->images == (Image *) NULL)
4843     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4844   *length=GetBlobSize(wand->images);
4845   return(MagickTrue);
4846 }
4847 \f
4848 /*
4849 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4850 %                                                                             %
4851 %                                                                             %
4852 %                                                                             %
4853 %   M a g i c k G e t I m a g e M a t t e C o l o r                           %
4854 %                                                                             %
4855 %                                                                             %
4856 %                                                                             %
4857 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4858 %
4859 %  MagickGetImageMatteColor() returns the image matte color.
4860 %
4861 %  The format of the MagickGetImageMatteColor method is:
4862 %
4863 %      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
4864 %        PixelWand *matte_color)
4865 %
4866 %  A description of each parameter follows:
4867 %
4868 %    o wand: the magick wand.
4869 %
4870 %    o matte_color: Return the matte color.
4871 %
4872 */
4873 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
4874   PixelWand *matte_color)
4875 {
4876   assert(wand != (MagickWand *) NULL);
4877   assert(wand->signature == WandSignature);
4878   if (wand->debug != MagickFalse)
4879     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4880   if (wand->images == (Image *) NULL)
4881     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4882   PixelSetQuantumPacket(matte_color,&wand->images->matte_color);
4883   return(MagickTrue);
4884 }
4885 \f
4886 /*
4887 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4888 %                                                                             %
4889 %                                                                             %
4890 %                                                                             %
4891 %   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                         %
4892 %                                                                             %
4893 %                                                                             %
4894 %                                                                             %
4895 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4896 %
4897 %  MagickGetImageOrientation() returns the image orientation.
4898 %
4899 %  The format of the MagickGetImageOrientation method is:
4900 %
4901 %      OrientationType MagickGetImageOrientation(MagickWand *wand)
4902 %
4903 %  A description of each parameter follows:
4904 %
4905 %    o wand: the magick wand.
4906 %
4907 */
4908 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
4909 {
4910   assert(wand != (MagickWand *) NULL);
4911   assert(wand->signature == WandSignature);
4912   if (wand->debug != MagickFalse)
4913     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4914   if (wand->images == (Image *) NULL)
4915     {
4916       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4917         "ContainsNoImages","`%s'",wand->name);
4918       return(UndefinedOrientation);
4919     }
4920   return(wand->images->orientation);
4921 }
4922 \f
4923 /*
4924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4925 %                                                                             %
4926 %                                                                             %
4927 %                                                                             %
4928 %   M a g i c k G e t I m a g e P a g e                                       %
4929 %                                                                             %
4930 %                                                                             %
4931 %                                                                             %
4932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4933 %
4934 %  MagickGetImagePage() returns the page geometry associated with the image.
4935 %
4936 %  The format of the MagickGetImagePage method is:
4937 %
4938 %      MagickBooleanType MagickGetImagePage(MagickWand *wand,
4939 %        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4940 %
4941 %  A description of each parameter follows:
4942 %
4943 %    o wand: the magick wand.
4944 %
4945 %    o width: the page width.
4946 %
4947 %    o height: the page height.
4948 %
4949 %    o x: the page x-offset.
4950 %
4951 %    o y: the page y-offset.
4952 %
4953 */
4954 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
4955   size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4956 {
4957   assert(wand != (const MagickWand *) NULL);
4958   assert(wand->signature == WandSignature);
4959   if (wand->debug != MagickFalse)
4960     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4961   if (wand->images == (Image *) NULL)
4962     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4963   *width=wand->images->page.width;
4964   *height=wand->images->page.height;
4965   *x=wand->images->page.x;
4966   *y=wand->images->page.y;
4967   return(MagickTrue);
4968 }
4969 \f
4970 /*
4971 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4972 %                                                                             %
4973 %                                                                             %
4974 %                                                                             %
4975 %   M a g i c k G e t I m a g e P i x e l C o l o r                           %
4976 %                                                                             %
4977 %                                                                             %
4978 %                                                                             %
4979 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4980 %
4981 %  MagickGetImagePixelColor() returns the color of the specified pixel.
4982 %
4983 %  The format of the MagickGetImagePixelColor method is:
4984 %
4985 %      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
4986 %        const ssize_t x,const ssize_t y,PixelWand *color)
4987 %
4988 %  A description of each parameter follows:
4989 %
4990 %    o wand: the magick wand.
4991 %
4992 %    o x,y: the pixel offset into the image.
4993 %
4994 %    o color: Return the colormap color in this wand.
4995 %
4996 */
4997 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
4998   const ssize_t x,const ssize_t y,PixelWand *color)
4999 {
5000   register const Quantum
5001     *p;
5002
5003   CacheView
5004     *image_view;
5005
5006   assert(wand != (MagickWand *) NULL);
5007   assert(wand->signature == WandSignature);
5008   if (wand->debug != MagickFalse)
5009     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5010   if (wand->images == (Image *) NULL)
5011     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5012   image_view=AcquireCacheView(wand->images);
5013   p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5014   if (p == (const Quantum *) NULL)
5015     {
5016       image_view=DestroyCacheView(image_view);
5017       return(MagickFalse);
5018     }
5019   PixelSetQuantumPixel(wand->images,p,color);
5020   image_view=DestroyCacheView(image_view);
5021   return(MagickTrue);
5022 }
5023 \f
5024 /*
5025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5026 %                                                                             %
5027 %                                                                             %
5028 %                                                                             %
5029 %   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5030 %                                                                             %
5031 %                                                                             %
5032 %                                                                             %
5033 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5034 %
5035 %  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5036 %
5037 %  The format of the MagickGetImageRedPrimary method is:
5038 %
5039 %      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5040 %        double *y)
5041 %
5042 %  A description of each parameter follows:
5043 %
5044 %    o wand: the magick wand.
5045 %
5046 %    o x: the chromaticity red primary x-point.
5047 %
5048 %    o y: the chromaticity red primary y-point.
5049 %
5050 */
5051 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5052   double *x,double *y)
5053 {
5054   assert(wand != (MagickWand *) NULL);
5055   assert(wand->signature == WandSignature);
5056   if (wand->debug != MagickFalse)
5057     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5058   if (wand->images == (Image *) NULL)
5059     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5060   *x=wand->images->chromaticity.red_primary.x;
5061   *y=wand->images->chromaticity.red_primary.y;
5062   return(MagickTrue);
5063 }
5064 \f
5065 /*
5066 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5067 %                                                                             %
5068 %                                                                             %
5069 %                                                                             %
5070 %   M a g i c k G e t I m a g e R e g i o n                                   %
5071 %                                                                             %
5072 %                                                                             %
5073 %                                                                             %
5074 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5075 %
5076 %  MagickGetImageRegion() extracts a region of the image and returns it as a
5077 %  a new wand.
5078 %
5079 %  The format of the MagickGetImageRegion method is:
5080 %
5081 %      MagickWand *MagickGetImageRegion(MagickWand *wand,
5082 %        const size_t width,const size_t height,const ssize_t x,
5083 %        const ssize_t y)
5084 %
5085 %  A description of each parameter follows:
5086 %
5087 %    o wand: the magick wand.
5088 %
5089 %    o width: the region width.
5090 %
5091 %    o height: the region height.
5092 %
5093 %    o x: the region x offset.
5094 %
5095 %    o y: the region y offset.
5096 %
5097 */
5098 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5099   const size_t width,const size_t height,const ssize_t x,
5100   const ssize_t y)
5101 {
5102   Image
5103     *region_image;
5104
5105   RectangleInfo
5106     region;
5107
5108   assert(wand != (MagickWand *) NULL);
5109   assert(wand->signature == WandSignature);
5110   if (wand->debug != MagickFalse)
5111     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5112   if (wand->images == (Image *) NULL)
5113     return((MagickWand *) NULL);
5114   region.width=width;
5115   region.height=height;
5116   region.x=x;
5117   region.y=y;
5118   region_image=CropImage(wand->images,&region,wand->exception);
5119   if (region_image == (Image *) NULL)
5120     return((MagickWand *) NULL);
5121   return(CloneMagickWandFromImages(wand,region_image));
5122 }
5123 \f
5124 /*
5125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5126 %                                                                             %
5127 %                                                                             %
5128 %                                                                             %
5129 %   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                 %
5130 %                                                                             %
5131 %                                                                             %
5132 %                                                                             %
5133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5134 %
5135 %  MagickGetImageRenderingIntent() gets the image rendering intent.
5136 %
5137 %  The format of the MagickGetImageRenderingIntent method is:
5138 %
5139 %      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5140 %
5141 %  A description of each parameter follows:
5142 %
5143 %    o wand: the magick wand.
5144 %
5145 */
5146 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5147 {
5148   assert(wand != (MagickWand *) NULL);
5149   assert(wand->signature == WandSignature);
5150   if (wand->debug != MagickFalse)
5151     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5152   if (wand->images == (Image *) NULL)
5153     {
5154       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5155         "ContainsNoImages","`%s'",wand->name);
5156       return(UndefinedIntent);
5157     }
5158   return((RenderingIntent) wand->images->rendering_intent);
5159 }
5160 \f
5161 /*
5162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5163 %                                                                             %
5164 %                                                                             %
5165 %                                                                             %
5166 %   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5167 %                                                                             %
5168 %                                                                             %
5169 %                                                                             %
5170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5171 %
5172 %  MagickGetImageResolution() gets the image X and Y resolution.
5173 %
5174 %  The format of the MagickGetImageResolution method is:
5175 %
5176 %      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5177 %        double *y)
5178 %
5179 %  A description of each parameter follows:
5180 %
5181 %    o wand: the magick wand.
5182 %
5183 %    o x: the image x-resolution.
5184 %
5185 %    o y: the image y-resolution.
5186 %
5187 */
5188 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5189   double *x,double *y)
5190 {
5191   assert(wand != (MagickWand *) NULL);
5192   assert(wand->signature == WandSignature);
5193   if (wand->debug != MagickFalse)
5194     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5195   if (wand->images == (Image *) NULL)
5196     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5197   *x=wand->images->x_resolution;
5198   *y=wand->images->y_resolution;
5199   return(MagickTrue);
5200 }
5201 \f
5202 /*
5203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5204 %                                                                             %
5205 %                                                                             %
5206 %                                                                             %
5207 %   M a g i c k G e t I m a g e S c e n e                                     %
5208 %                                                                             %
5209 %                                                                             %
5210 %                                                                             %
5211 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5212 %
5213 %  MagickGetImageScene() gets the image scene.
5214 %
5215 %  The format of the MagickGetImageScene method is:
5216 %
5217 %      size_t MagickGetImageScene(MagickWand *wand)
5218 %
5219 %  A description of each parameter follows:
5220 %
5221 %    o wand: the magick wand.
5222 %
5223 */
5224 WandExport size_t MagickGetImageScene(MagickWand *wand)
5225 {
5226   assert(wand != (MagickWand *) NULL);
5227   assert(wand->signature == WandSignature);
5228   if (wand->debug != MagickFalse)
5229     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5230   if (wand->images == (Image *) NULL)
5231     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5232   return(wand->images->scene);
5233 }
5234 \f
5235 /*
5236 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5237 %                                                                             %
5238 %                                                                             %
5239 %                                                                             %
5240 %   M a g i c k G e t I m a g e S i g n a t u r e                             %
5241 %                                                                             %
5242 %                                                                             %
5243 %                                                                             %
5244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5245 %
5246 %  MagickGetImageSignature() generates an SHA-256 message digest for the image
5247 %  pixel stream.
5248 %
5249 %  The format of the MagickGetImageSignature method is:
5250 %
5251 %      const char MagickGetImageSignature(MagickWand *wand)
5252 %
5253 %  A description of each parameter follows:
5254 %
5255 %    o wand: the magick wand.
5256 %
5257 */
5258 WandExport char *MagickGetImageSignature(MagickWand *wand)
5259 {
5260   const char
5261     *value;
5262
5263   MagickBooleanType
5264     status;
5265
5266   assert(wand != (MagickWand *) NULL);
5267   assert(wand->signature == WandSignature);
5268   if (wand->debug != MagickFalse)
5269     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5270   if (wand->images == (Image *) NULL)
5271     {
5272       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5273         "ContainsNoImages","`%s'",wand->name);
5274       return((char *) NULL);
5275     }
5276   status=SignatureImage(wand->images);
5277   if (status == MagickFalse)
5278     InheritException(wand->exception,&wand->images->exception);
5279   value=GetImageProperty(wand->images,"signature");
5280   if (value != (const char *) NULL)
5281     return(AcquireString(value));
5282   InheritException(wand->exception,&wand->images->exception);
5283   return((char *) NULL);
5284 }
5285 \f
5286 /*
5287 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5288 %                                                                             %
5289 %                                                                             %
5290 %                                                                             %
5291 %   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                   %
5292 %                                                                             %
5293 %                                                                             %
5294 %                                                                             %
5295 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5296 %
5297 %  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5298 %
5299 %  The format of the MagickGetImageTicksPerSecond method is:
5300 %
5301 %      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5302 %
5303 %  A description of each parameter follows:
5304 %
5305 %    o wand: the magick wand.
5306 %
5307 */
5308 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5309 {
5310   assert(wand != (MagickWand *) NULL);
5311   assert(wand->signature == WandSignature);
5312   if (wand->debug != MagickFalse)
5313     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5314   if (wand->images == (Image *) NULL)
5315     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5316   return((size_t) wand->images->ticks_per_second);
5317 }
5318 \f
5319 /*
5320 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5321 %                                                                             %
5322 %                                                                             %
5323 %                                                                             %
5324 %   M a g i c k G e t I m a g e T y p e                                       %
5325 %                                                                             %
5326 %                                                                             %
5327 %                                                                             %
5328 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5329 %
5330 %  MagickGetImageType() gets the potential image type:
5331 %
5332 %        Bilevel        Grayscale       GrayscaleMatte
5333 %        Palette        PaletteMatte    TrueColor
5334 %        TrueColorMatte ColorSeparation ColorSeparationMatte
5335 %
5336 %  To ensure the image type matches its potential, use MagickSetImageType():
5337 %
5338 %    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5339 %
5340 %  The format of the MagickGetImageType method is:
5341 %
5342 %      ImageType MagickGetImageType(MagickWand *wand)
5343 %
5344 %  A description of each parameter follows:
5345 %
5346 %    o wand: the magick wand.
5347 %
5348 */
5349 WandExport ImageType MagickGetImageType(MagickWand *wand)
5350 {
5351   assert(wand != (MagickWand *) NULL);
5352   assert(wand->signature == WandSignature);
5353   if (wand->debug != MagickFalse)
5354     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5355   if (wand->images == (Image *) NULL)
5356     {
5357       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5358         "ContainsNoImages","`%s'",wand->name);
5359       return(UndefinedType);
5360     }
5361   return(GetImageType(wand->images,wand->exception));
5362 }
5363 \f
5364 /*
5365 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5366 %                                                                             %
5367 %                                                                             %
5368 %                                                                             %
5369 %   M a g i c k G e t I m a g e U n i t s                                     %
5370 %                                                                             %
5371 %                                                                             %
5372 %                                                                             %
5373 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5374 %
5375 %  MagickGetImageUnits() gets the image units of resolution.
5376 %
5377 %  The format of the MagickGetImageUnits method is:
5378 %
5379 %      ResolutionType MagickGetImageUnits(MagickWand *wand)
5380 %
5381 %  A description of each parameter follows:
5382 %
5383 %    o wand: the magick wand.
5384 %
5385 */
5386 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5387 {
5388   assert(wand != (MagickWand *) NULL);
5389   assert(wand->signature == WandSignature);
5390   if (wand->debug != MagickFalse)
5391     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5392   if (wand->images == (Image *) NULL)
5393     {
5394       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5395         "ContainsNoImages","`%s'",wand->name);
5396       return(UndefinedResolution);
5397     }
5398   return(wand->images->units);
5399 }
5400 \f
5401 /*
5402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5403 %                                                                             %
5404 %                                                                             %
5405 %                                                                             %
5406 %   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           %
5407 %                                                                             %
5408 %                                                                             %
5409 %                                                                             %
5410 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5411 %
5412 %  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5413 %  sepcified image.
5414 %
5415 %  The format of the MagickGetImageVirtualPixelMethod method is:
5416 %
5417 %      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5418 %
5419 %  A description of each parameter follows:
5420 %
5421 %    o wand: the magick wand.
5422 %
5423 */
5424 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5425 {
5426   assert(wand != (MagickWand *) NULL);
5427   assert(wand->signature == WandSignature);
5428   if (wand->debug != MagickFalse)
5429     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5430   if (wand->images == (Image *) NULL)
5431     {
5432       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5433         "ContainsNoImages","`%s'",wand->name);
5434       return(UndefinedVirtualPixelMethod);
5435     }
5436   return(GetImageVirtualPixelMethod(wand->images));
5437 }
5438 \f
5439 /*
5440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5441 %                                                                             %
5442 %                                                                             %
5443 %                                                                             %
5444 %   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5445 %                                                                             %
5446 %                                                                             %
5447 %                                                                             %
5448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5449 %
5450 %  MagickGetImageWhitePoint() returns the chromaticy white point.
5451 %
5452 %  The format of the MagickGetImageWhitePoint method is:
5453 %
5454 %      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5455 %        double *y)
5456 %
5457 %  A description of each parameter follows:
5458 %
5459 %    o wand: the magick wand.
5460 %
5461 %    o x: the chromaticity white x-point.
5462 %
5463 %    o y: the chromaticity white y-point.
5464 %
5465 */
5466 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5467   double *x,double *y)
5468 {
5469   assert(wand != (MagickWand *) NULL);
5470   assert(wand->signature == WandSignature);
5471   if (wand->debug != MagickFalse)
5472     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5473   if (wand->images == (Image *) NULL)
5474     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5475   *x=wand->images->chromaticity.white_point.x;
5476   *y=wand->images->chromaticity.white_point.y;
5477   return(MagickTrue);
5478 }
5479 \f
5480 /*
5481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5482 %                                                                             %
5483 %                                                                             %
5484 %                                                                             %
5485 %   M a g i c k G e t I m a g e W i d t h                                     %
5486 %                                                                             %
5487 %                                                                             %
5488 %                                                                             %
5489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5490 %
5491 %  MagickGetImageWidth() returns the image width.
5492 %
5493 %  The format of the MagickGetImageWidth method is:
5494 %
5495 %      size_t MagickGetImageWidth(MagickWand *wand)
5496 %
5497 %  A description of each parameter follows:
5498 %
5499 %    o wand: the magick wand.
5500 %
5501 */
5502 WandExport size_t MagickGetImageWidth(MagickWand *wand)
5503 {
5504   assert(wand != (MagickWand *) NULL);
5505   assert(wand->signature == WandSignature);
5506   if (wand->debug != MagickFalse)
5507     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5508   if (wand->images == (Image *) NULL)
5509     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5510   return(wand->images->columns);
5511 }
5512 \f
5513 /*
5514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5515 %                                                                             %
5516 %                                                                             %
5517 %                                                                             %
5518 %   M a g i c k G e t N u m b e r I m a g e s                                 %
5519 %                                                                             %
5520 %                                                                             %
5521 %                                                                             %
5522 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5523 %
5524 %  MagickGetNumberImages() returns the number of images associated with a
5525 %  magick wand.
5526 %
5527 %  The format of the MagickGetNumberImages method is:
5528 %
5529 %      size_t MagickGetNumberImages(MagickWand *wand)
5530 %
5531 %  A description of each parameter follows:
5532 %
5533 %    o wand: the magick wand.
5534 %
5535 */
5536 WandExport size_t MagickGetNumberImages(MagickWand *wand)
5537 {
5538   assert(wand != (MagickWand *) NULL);
5539   assert(wand->signature == WandSignature);
5540   if (wand->debug != MagickFalse)
5541     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5542   return(GetImageListLength(wand->images));
5543 }
5544 \f
5545 /*
5546 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5547 %                                                                             %
5548 %                                                                             %
5549 %                                                                             %
5550 %   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                 %
5551 %                                                                             %
5552 %                                                                             %
5553 %                                                                             %
5554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5555 %
5556 %  MagickGetImageTotalInkDensity() gets the image total ink density.
5557 %
5558 %  The format of the MagickGetImageTotalInkDensity method is:
5559 %
5560 %      double MagickGetImageTotalInkDensity(MagickWand *wand)
5561 %
5562 %  A description of each parameter follows:
5563 %
5564 %    o wand: the magick wand.
5565 %
5566 */
5567 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5568 {
5569   assert(wand != (MagickWand *) NULL);
5570   assert(wand->signature == WandSignature);
5571   if (wand->debug != MagickFalse)
5572     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5573   if (wand->images == (Image *) NULL)
5574     {
5575       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5576         "ContainsNoImages","`%s'",wand->name);
5577       return(0.0);
5578     }
5579   return(GetImageTotalInkDensity(wand->images));
5580 }
5581 \f
5582 /*
5583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5584 %                                                                             %
5585 %                                                                             %
5586 %                                                                             %
5587 %   M a g i c k H a l d C l u t I m a g e                                     %
5588 %                                                                             %
5589 %                                                                             %
5590 %                                                                             %
5591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5592 %
5593 %  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5594 %  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5595 %  dimensions.  Create it with the HALD coder.  You can apply any color
5596 %  transformation to the Hald image and then use this method to apply the
5597 %  transform to the image.
5598 %
5599 %  The format of the MagickHaldClutImage method is:
5600 %
5601 %      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5602 %        const MagickWand *hald_wand)
5603 %
5604 %  A description of each parameter follows:
5605 %
5606 %    o wand: the magick wand.
5607 %
5608 %    o hald_image: the hald CLUT image.
5609 %
5610 */
5611 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5612   const MagickWand *hald_wand)
5613 {
5614   MagickBooleanType
5615     status;
5616
5617   assert(wand != (MagickWand *) NULL);
5618   assert(wand->signature == WandSignature);
5619   if (wand->debug != MagickFalse)
5620     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5621   if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5622     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5623   status=HaldClutImage(wand->images,hald_wand->images,&wand->images->exception);
5624   return(status);
5625 }
5626 \f
5627 /*
5628 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5629 %                                                                             %
5630 %                                                                             %
5631 %                                                                             %
5632 %   M a g i c k H a s N e x t I m a g e                                       %
5633 %                                                                             %
5634 %                                                                             %
5635 %                                                                             %
5636 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5637 %
5638 %  MagickHasNextImage() returns MagickTrue if the wand has more images when
5639 %  traversing the list in the forward direction
5640 %
5641 %  The format of the MagickHasNextImage method is:
5642 %
5643 %      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5644 %
5645 %  A description of each parameter follows:
5646 %
5647 %    o wand: the magick wand.
5648 %
5649 */
5650 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5651 {
5652   assert(wand != (MagickWand *) NULL);
5653   assert(wand->signature == WandSignature);
5654   if (wand->debug != MagickFalse)
5655     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5656   if (wand->images == (Image *) NULL)
5657     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5658   if (GetNextImageInList(wand->images) == (Image *) NULL)
5659     return(MagickFalse);
5660   return(MagickTrue);
5661 }
5662 \f
5663 /*
5664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5665 %                                                                             %
5666 %                                                                             %
5667 %                                                                             %
5668 %   M a g i c k H a s P r e v i o u s I m a g e                               %
5669 %                                                                             %
5670 %                                                                             %
5671 %                                                                             %
5672 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5673 %
5674 %  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5675 %  traversing the list in the reverse direction
5676 %
5677 %  The format of the MagickHasPreviousImage method is:
5678 %
5679 %      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5680 %
5681 %  A description of each parameter follows:
5682 %
5683 %    o wand: the magick wand.
5684 %
5685 */
5686 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5687 {
5688   assert(wand != (MagickWand *) NULL);
5689   assert(wand->signature == WandSignature);
5690   if (wand->debug != MagickFalse)
5691     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5692   if (wand->images == (Image *) NULL)
5693     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5694   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5695     return(MagickFalse);
5696   return(MagickTrue);
5697 }
5698 \f
5699 /*
5700 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5701 %                                                                             %
5702 %                                                                             %
5703 %                                                                             %
5704 %   M a g i c k I d e n t i f y I m a g e                                     %
5705 %                                                                             %
5706 %                                                                             %
5707 %                                                                             %
5708 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5709 %
5710 %  MagickIdentifyImage() identifies an image by printing its attributes to the
5711 %  file.  Attributes include the image width, height, size, and others.
5712 %
5713 %  The format of the MagickIdentifyImage method is:
5714 %
5715 %      const char *MagickIdentifyImage(MagickWand *wand)
5716 %
5717 %  A description of each parameter follows:
5718 %
5719 %    o wand: the magick wand.
5720 %
5721 */
5722 WandExport char *MagickIdentifyImage(MagickWand *wand)
5723 {
5724   char
5725     *description,
5726     filename[MaxTextExtent];
5727
5728   FILE
5729     *file;
5730
5731   int
5732     unique_file;
5733
5734   assert(wand != (MagickWand *) NULL);
5735   assert(wand->signature == WandSignature);
5736   if (wand->debug != MagickFalse)
5737     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5738   if (wand->images == (Image *) NULL)
5739     {
5740       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5741         "ContainsNoImages","`%s'",wand->name);
5742       return((char *) NULL);
5743     }
5744   description=(char *) NULL;
5745   unique_file=AcquireUniqueFileResource(filename);
5746   file=(FILE *) NULL;
5747   if (unique_file != -1)
5748     file=fdopen(unique_file,"wb");
5749   if ((unique_file == -1) || (file == (FILE *) NULL))
5750     {
5751       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5752         "UnableToCreateTemporaryFile","`%s'",wand->name);
5753       return((char *) NULL);
5754     }
5755   (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
5756   (void) fclose(file);
5757   description=FileToString(filename,~0,wand->exception);
5758   (void) RelinquishUniqueFileResource(filename);
5759   return(description);
5760 }
5761 \f
5762 /*
5763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5764 %                                                                             %
5765 %                                                                             %
5766 %                                                                             %
5767 %   M a g i c k I m p l o d e I m a g e                                       %
5768 %                                                                             %
5769 %                                                                             %
5770 %                                                                             %
5771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5772 %
5773 %  MagickImplodeImage() creates a new image that is a copy of an existing
5774 %  one with the image pixels "implode" by the specified percentage.  It
5775 %  allocates the memory necessary for the new Image structure and returns a
5776 %  pointer to the new image.
5777 %
5778 %  The format of the MagickImplodeImage method is:
5779 %
5780 %      MagickBooleanType MagickImplodeImage(MagickWand *wand,
5781 %        const double radius)
5782 %
5783 %  A description of each parameter follows:
5784 %
5785 %    o wand: the magick wand.
5786 %
5787 %    o amount: Define the extent of the implosion.
5788 %
5789 */
5790 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
5791   const double amount)
5792 {
5793   Image
5794     *implode_image;
5795
5796   assert(wand != (MagickWand *) NULL);
5797   assert(wand->signature == WandSignature);
5798   if (wand->debug != MagickFalse)
5799     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5800   if (wand->images == (Image *) NULL)
5801     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5802   implode_image=ImplodeImage(wand->images,amount,wand->exception);
5803   if (implode_image == (Image *) NULL)
5804     return(MagickFalse);
5805   ReplaceImageInList(&wand->images,implode_image);
5806   return(MagickTrue);
5807 }
5808 \f
5809 /*
5810 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5811 %                                                                             %
5812 %                                                                             %
5813 %                                                                             %
5814 %   M a g i c k I m p o r t I m a g e P i x e l s                             %
5815 %                                                                             %
5816 %                                                                             %
5817 %                                                                             %
5818 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5819 %
5820 %  MagickImportImagePixels() accepts pixel datand stores it in the image at the
5821 %  location you specify.  The method returns MagickFalse on success otherwise
5822 %  MagickTrue if an error is encountered.  The pixel data can be either char,
5823 %  short int, int, ssize_t, float, or double in the order specified by map.
5824 %
5825 %  Suppose your want to upload the first scanline of a 640x480 image from
5826 %  character data in red-green-blue order:
5827 %
5828 %      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
5829 %
5830 %  The format of the MagickImportImagePixels method is:
5831 %
5832 %      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5833 %        const ssize_t x,const ssize_t y,const size_t columns,
5834 %        const size_t rows,const char *map,const StorageType storage,
5835 %        const void *pixels)
5836 %
5837 %  A description of each parameter follows:
5838 %
5839 %    o wand: the magick wand.
5840 %
5841 %    o x, y, columns, rows:  These values define the perimeter of a region
5842 %      of pixels you want to define.
5843 %
5844 %    o map:  This string reflects the expected ordering of the pixel array.
5845 %      It can be any combination or order of R = red, G = green, B = blue,
5846 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
5847 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
5848 %      P = pad.
5849 %
5850 %    o storage: Define the data type of the pixels.  Float and double types are
5851 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
5852 %      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
5853 %      or DoublePixel.
5854 %
5855 %    o pixels: This array of values contain the pixel components as defined by
5856 %      map and type.  You must preallocate this array where the expected
5857 %      length varies depending on the values of width, height, map, and type.
5858 %
5859 */
5860 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5861   const ssize_t x,const ssize_t y,const size_t columns,
5862   const size_t rows,const char *map,const StorageType storage,
5863   const void *pixels)
5864 {
5865   MagickBooleanType
5866     status;
5867
5868   assert(wand != (MagickWand *) NULL);
5869   assert(wand->signature == WandSignature);
5870   if (wand->debug != MagickFalse)
5871     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5872   if (wand->images == (Image *) NULL)
5873     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5874   status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels);
5875   if (status == MagickFalse)
5876     InheritException(wand->exception,&wand->images->exception);
5877   return(status);
5878 }
5879 \f
5880 /*
5881 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5882 %                                                                             %
5883 %                                                                             %
5884 %                                                                             %
5885 %   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       %
5886 %                                                                             %
5887 %                                                                             %
5888 %                                                                             %
5889 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5890 %
5891 %  MagickInverseFourierTransformImage() implements the inverse discrete
5892 %  Fourier transform (DFT) of the image either as a magnitude / phase or real /
5893 %  imaginary image pair.
5894 %
5895 %  The format of the MagickInverseFourierTransformImage method is:
5896 %
5897 %      MagickBooleanType MagickInverseFourierTransformImage(
5898 %        MagickWand *magnitude_wand,MagickWand *phase_wand,
5899 %        const MagickBooleanType magnitude)
5900 %
5901 %  A description of each parameter follows:
5902 %
5903 %    o magnitude_wand: the magnitude or real wand.
5904 %
5905 %    o phase_wand: the phase or imaginary wand.
5906 %
5907 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
5908 %      imaginary image pair.
5909 %
5910 */
5911 WandExport MagickBooleanType MagickInverseFourierTransformImage(
5912   MagickWand *magnitude_wand,MagickWand *phase_wand,
5913   const MagickBooleanType magnitude)
5914 {
5915   Image
5916     *inverse_image;
5917
5918   MagickWand
5919     *wand;
5920
5921   assert(magnitude_wand != (MagickWand *) NULL);
5922   assert(magnitude_wand->signature == WandSignature);
5923   if (magnitude_wand->debug != MagickFalse)
5924     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
5925       magnitude_wand->name);
5926   wand=magnitude_wand;
5927   if (magnitude_wand->images == (Image *) NULL)
5928     ThrowWandException(WandError,"ContainsNoImages",
5929       magnitude_wand->name);
5930   assert(phase_wand != (MagickWand *) NULL);
5931   assert(phase_wand->signature == WandSignature);
5932   inverse_image=InverseFourierTransformImage(magnitude_wand->images,
5933     phase_wand->images,magnitude,wand->exception);
5934   if (inverse_image == (Image *) NULL)
5935     return(MagickFalse);
5936   ReplaceImageInList(&wand->images,inverse_image);
5937   return(MagickTrue);
5938 }
5939 \f
5940 /*
5941 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5942 %                                                                             %
5943 %                                                                             %
5944 %                                                                             %
5945 %   M a g i c k L a b e l I m a g e                                           %
5946 %                                                                             %
5947 %                                                                             %
5948 %                                                                             %
5949 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5950 %
5951 %  MagickLabelImage() adds a label to your image.
5952 %
5953 %  The format of the MagickLabelImage method is:
5954 %
5955 %      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
5956 %
5957 %  A description of each parameter follows:
5958 %
5959 %    o wand: the magick wand.
5960 %
5961 %    o label: the image label.
5962 %
5963 */
5964 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
5965   const char *label)
5966 {
5967   MagickBooleanType
5968     status;
5969
5970   assert(wand != (MagickWand *) NULL);
5971   assert(wand->signature == WandSignature);
5972   if (wand->debug != MagickFalse)
5973     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5974   if (wand->images == (Image *) NULL)
5975     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5976   status=SetImageProperty(wand->images,"label",label);
5977   if (status == MagickFalse)
5978     InheritException(wand->exception,&wand->images->exception);
5979   return(status);
5980 }
5981 \f
5982 /*
5983 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5984 %                                                                             %
5985 %                                                                             %
5986 %                                                                             %
5987 %   M a g i c k L e v e l I m a g e                                           %
5988 %                                                                             %
5989 %                                                                             %
5990 %                                                                             %
5991 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5992 %
5993 %  MagickLevelImage() adjusts the levels of an image by scaling the colors
5994 %  falling between specified white and black points to the full available
5995 %  quantum range. The parameters provided represent the black, mid, and white
5996 %  points. The black point specifies the darkest color in the image. Colors
5997 %  darker than the black point are set to zero. Mid point specifies a gamma
5998 %  correction to apply to the image.  White point specifies the lightest color
5999 %  in the image. Colors brighter than the white point are set to the maximum
6000 %  quantum value.
6001 %
6002 %  The format of the MagickLevelImage method is:
6003 %
6004 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6005 %        const double black_point,const double gamma,const double white_point)
6006 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6007 %        const ChannelType channel,const double black_point,const double gamma,
6008 %        const double white_point)
6009 %
6010 %  A description of each parameter follows:
6011 %
6012 %    o wand: the magick wand.
6013 %
6014 %    o channel: Identify which channel to level: RedChannel, GreenChannel,
6015 %
6016 %    o black_point: the black point.
6017 %
6018 %    o gamma: the gamma.
6019 %
6020 %    o white_point: the white point.
6021 %
6022 */
6023 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6024   const double black_point,const double gamma,const double white_point)
6025 {
6026   MagickBooleanType
6027     status;
6028
6029   assert(wand != (MagickWand *) NULL);
6030   assert(wand->signature == WandSignature);
6031   if (wand->debug != MagickFalse)
6032     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6033   if (wand->images == (Image *) NULL)
6034     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6035   status=LevelImage(wand->images,black_point,white_point,gamma,
6036     &wand->images->exception);
6037   return(status);
6038 }
6039 \f
6040 /*
6041 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6042 %                                                                             %
6043 %                                                                             %
6044 %                                                                             %
6045 %   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6046 %                                                                             %
6047 %                                                                             %
6048 %                                                                             %
6049 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6050 %
6051 %  MagickLinearStretchImage() stretches with saturation the image intensity.
6052 %
6053 %  You can also reduce the influence of a particular channel with a gamma
6054 %  value of 0.
6055 %
6056 %  The format of the MagickLinearStretchImage method is:
6057 %
6058 %      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6059 %        const double black_point,const double white_point)
6060 %
6061 %  A description of each parameter follows:
6062 %
6063 %    o wand: the magick wand.
6064 %
6065 %    o black_point: the black point.
6066 %
6067 %    o white_point: the white point.
6068 %
6069 */
6070 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6071   const double black_point,const double white_point)
6072 {
6073   MagickBooleanType
6074     status;
6075
6076   assert(wand != (MagickWand *) NULL);
6077   assert(wand->signature == WandSignature);
6078   if (wand->debug != MagickFalse)
6079     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6080   if (wand->images == (Image *) NULL)
6081     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6082   status=LinearStretchImage(wand->images,black_point,white_point,
6083     &wand->images->exception);
6084   return(status);
6085 }
6086 \f
6087 /*
6088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6089 %                                                                             %
6090 %                                                                             %
6091 %                                                                             %
6092 %   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6093 %                                                                             %
6094 %                                                                             %
6095 %                                                                             %
6096 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6097 %
6098 %  MagickLiquidRescaleImage() rescales image with seam carving.
6099 %
6100 %      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6101 %        const size_t columns,const size_t rows,
6102 %        const double delta_x,const double rigidity)
6103 %
6104 %  A description of each parameter follows:
6105 %
6106 %    o wand: the magick wand.
6107 %
6108 %    o columns: the number of columns in the scaled image.
6109 %
6110 %    o rows: the number of rows in the scaled image.
6111 %
6112 %    o delta_x: maximum seam transversal step (0 means straight seams).
6113 %
6114 %    o rigidity: introduce a bias for non-straight seams (typically 0).
6115 %
6116 */
6117 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6118   const size_t columns,const size_t rows,const double delta_x,
6119   const double rigidity)
6120 {
6121   Image
6122     *rescale_image;
6123
6124   assert(wand != (MagickWand *) NULL);
6125   assert(wand->signature == WandSignature);
6126   if (wand->debug != MagickFalse)
6127     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6128   if (wand->images == (Image *) NULL)
6129     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6130   rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6131     rigidity,wand->exception);
6132   if (rescale_image == (Image *) NULL)
6133     return(MagickFalse);
6134   ReplaceImageInList(&wand->images,rescale_image);
6135   return(MagickTrue);
6136 }
6137 \f
6138 /*
6139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6140 %                                                                             %
6141 %                                                                             %
6142 %                                                                             %
6143 %   M a g i c k M a g n i f y I m a g e                                       %
6144 %                                                                             %
6145 %                                                                             %
6146 %                                                                             %
6147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6148 %
6149 %  MagickMagnifyImage() is a convenience method that scales an image
6150 %  proportionally to twice its original size.
6151 %
6152 %  The format of the MagickMagnifyImage method is:
6153 %
6154 %      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6155 %
6156 %  A description of each parameter follows:
6157 %
6158 %    o wand: the magick wand.
6159 %
6160 */
6161 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6162 {
6163   Image
6164     *magnify_image;
6165
6166   assert(wand != (MagickWand *) NULL);
6167   assert(wand->signature == WandSignature);
6168   if (wand->debug != MagickFalse)
6169     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6170   if (wand->images == (Image *) NULL)
6171     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6172   magnify_image=MagnifyImage(wand->images,wand->exception);
6173   if (magnify_image == (Image *) NULL)
6174     return(MagickFalse);
6175   ReplaceImageInList(&wand->images,magnify_image);
6176   return(MagickTrue);
6177 }
6178 \f
6179 /*
6180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6181 %                                                                             %
6182 %                                                                             %
6183 %                                                                             %
6184 %   M a g i c k M e r g e I m a g e L a y e r s                               %
6185 %                                                                             %
6186 %                                                                             %
6187 %                                                                             %
6188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6189 %
6190 %  MagickMergeImageLayers() composes all the image layers from the current
6191 %  given image onward to produce a single image of the merged layers.
6192 %
6193 %  The inital canvas's size depends on the given ImageLayerMethod, and is
6194 %  initialized using the first images background color.  The images
6195 %  are then compositied onto that image in sequence using the given
6196 %  composition that has been assigned to each individual image.
6197 %
6198 %  The format of the MagickMergeImageLayers method is:
6199 %
6200 %      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6201 %        const ImageLayerMethod method)
6202 %
6203 %  A description of each parameter follows:
6204 %
6205 %    o wand: the magick wand.
6206 %
6207 %    o method: the method of selecting the size of the initial canvas.
6208 %
6209 %        MergeLayer: Merge all layers onto a canvas just large enough
6210 %           to hold all the actual images. The virtual canvas of the
6211 %           first image is preserved but otherwise ignored.
6212 %
6213 %        FlattenLayer: Use the virtual canvas size of first image.
6214 %           Images which fall outside this canvas is clipped.
6215 %           This can be used to 'fill out' a given virtual canvas.
6216 %
6217 %        MosaicLayer: Start with the virtual canvas of the first image,
6218 %           enlarging left and right edges to contain all images.
6219 %           Images with negative offsets will be clipped.
6220 %
6221 */
6222 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6223   const ImageLayerMethod method)
6224 {
6225   Image
6226     *mosaic_image;
6227
6228   assert(wand != (MagickWand *) NULL);
6229   assert(wand->signature == WandSignature);
6230   if (wand->debug != MagickFalse)
6231     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6232   if (wand->images == (Image *) NULL)
6233     return((MagickWand *) NULL);
6234   mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6235   if (mosaic_image == (Image *) NULL)
6236     return((MagickWand *) NULL);
6237   return(CloneMagickWandFromImages(wand,mosaic_image));
6238 }
6239 \f
6240 /*
6241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6242 %                                                                             %
6243 %                                                                             %
6244 %                                                                             %
6245 %   M a g i c k M i n i f y I m a g e                                         %
6246 %                                                                             %
6247 %                                                                             %
6248 %                                                                             %
6249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6250 %
6251 %  MagickMinifyImage() is a convenience method that scales an image
6252 %  proportionally to one-half its original size
6253 %
6254 %  The format of the MagickMinifyImage method is:
6255 %
6256 %      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6257 %
6258 %  A description of each parameter follows:
6259 %
6260 %    o wand: the magick wand.
6261 %
6262 */
6263 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6264 {
6265   Image
6266     *minify_image;
6267
6268   assert(wand != (MagickWand *) NULL);
6269   assert(wand->signature == WandSignature);
6270   if (wand->debug != MagickFalse)
6271     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6272   if (wand->images == (Image *) NULL)
6273     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6274   minify_image=MinifyImage(wand->images,wand->exception);
6275   if (minify_image == (Image *) NULL)
6276     return(MagickFalse);
6277   ReplaceImageInList(&wand->images,minify_image);
6278   return(MagickTrue);
6279 }
6280 \f
6281 /*
6282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6283 %                                                                             %
6284 %                                                                             %
6285 %                                                                             %
6286 %   M a g i c k M o d u l a t e I m a g e                                     %
6287 %                                                                             %
6288 %                                                                             %
6289 %                                                                             %
6290 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6291 %
6292 %  MagickModulateImage() lets you control the brightness, saturation, and hue
6293 %  of an image.  Hue is the percentage of absolute rotation from the current
6294 %  position.  For example 50 results in a counter-clockwise rotation of 90
6295 %  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6296 %  both resulting in a rotation of 180 degrees.
6297 %
6298 %  To increase the color brightness by 20% and decrease the color saturation by
6299 %  10% and leave the hue unchanged, use: 120,90,100.
6300 %
6301 %  The format of the MagickModulateImage method is:
6302 %
6303 %      MagickBooleanType MagickModulateImage(MagickWand *wand,
6304 %        const double brightness,const double saturation,const double hue)
6305 %
6306 %  A description of each parameter follows:
6307 %
6308 %    o wand: the magick wand.
6309 %
6310 %    o brightness: the percent change in brighness.
6311 %
6312 %    o saturation: the percent change in saturation.
6313 %
6314 %    o hue: the percent change in hue.
6315 %
6316 */
6317 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6318   const double brightness,const double saturation,const double hue)
6319 {
6320   char
6321     modulate[MaxTextExtent];
6322
6323   MagickBooleanType
6324     status;
6325
6326   assert(wand != (MagickWand *) NULL);
6327   assert(wand->signature == WandSignature);
6328   if (wand->debug != MagickFalse)
6329     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6330   if (wand->images == (Image *) NULL)
6331     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6332   (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6333     brightness,saturation,hue);
6334   status=ModulateImage(wand->images,modulate,&wand->images->exception);
6335   return(status);
6336 }
6337 \f
6338 /*
6339 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6340 %                                                                             %
6341 %                                                                             %
6342 %                                                                             %
6343 %   M a g i c k M o n t a g e I m a g e                                       %
6344 %                                                                             %
6345 %                                                                             %
6346 %                                                                             %
6347 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6348 %
6349 %  MagickMontageImage() creates a composite image by combining several
6350 %  separate images. The images are tiled on the composite image with the name
6351 %  of the image optionally appearing just below the individual tile.
6352 %
6353 %  The format of the MagickMontageImage method is:
6354 %
6355 %      MagickWand *MagickMontageImage(MagickWand *wand,
6356 %        const DrawingWand drawing_wand,const char *tile_geometry,
6357 %        const char *thumbnail_geometry,const MontageMode mode,
6358 %        const char *frame)
6359 %
6360 %  A description of each parameter follows:
6361 %
6362 %    o wand: the magick wand.
6363 %
6364 %    o drawing_wand: the drawing wand.  The font name, size, and color are
6365 %      obtained from this wand.
6366 %
6367 %    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6368 %
6369 %    o thumbnail_geometry: Preferred image size and border size of each
6370 %      thumbnail (e.g. 120x120+4+3>).
6371 %
6372 %    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6373 %
6374 %    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6375 %      The frame color is that of the thumbnail's matte color.
6376 %
6377 */
6378 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6379   const DrawingWand *drawing_wand,const char *tile_geometry,
6380   const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6381 {
6382   char
6383     *font;
6384
6385   Image
6386     *montage_image;
6387
6388   MontageInfo
6389     *montage_info;
6390
6391   PixelWand
6392     *pixel_wand;
6393
6394   assert(wand != (MagickWand *) NULL);
6395   assert(wand->signature == WandSignature);
6396   if (wand->debug != MagickFalse)
6397     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6398   if (wand->images == (Image *) NULL)
6399     return((MagickWand *) NULL);
6400   montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6401   switch (mode)
6402   {
6403     case FrameMode:
6404     {
6405       (void) CloneString(&montage_info->frame,"15x15+3+3");
6406       montage_info->shadow=MagickTrue;
6407       break;
6408     }
6409     case UnframeMode:
6410     {
6411       montage_info->frame=(char *) NULL;
6412       montage_info->shadow=MagickFalse;
6413       montage_info->border_width=0;
6414       break;
6415     }
6416     case ConcatenateMode:
6417     {
6418       montage_info->frame=(char *) NULL;
6419       montage_info->shadow=MagickFalse;
6420       (void) CloneString(&montage_info->geometry,"+0+0");
6421       montage_info->border_width=0;
6422       break;
6423     }
6424     default:
6425       break;
6426   }
6427   font=DrawGetFont(drawing_wand);
6428   if (font != (char *) NULL)
6429     (void) CloneString(&montage_info->font,font);
6430   if (frame != (char *) NULL)
6431     (void) CloneString(&montage_info->frame,frame);
6432   montage_info->pointsize=DrawGetFontSize(drawing_wand);
6433   pixel_wand=NewPixelWand();
6434   DrawGetFillColor(drawing_wand,pixel_wand);
6435   PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6436   DrawGetStrokeColor(drawing_wand,pixel_wand);
6437   PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6438   pixel_wand=DestroyPixelWand(pixel_wand);
6439   if (thumbnail_geometry != (char *) NULL)
6440     (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6441   if (tile_geometry != (char *) NULL)
6442     (void) CloneString(&montage_info->tile,tile_geometry);
6443   montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6444     wand->exception);
6445   montage_info=DestroyMontageInfo(montage_info);
6446   if (montage_image == (Image *) NULL)
6447     return((MagickWand *) NULL);
6448   return(CloneMagickWandFromImages(wand,montage_image));
6449 }
6450 \f
6451 /*
6452 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6453 %                                                                             %
6454 %                                                                             %
6455 %                                                                             %
6456 %   M a g i c k M o r p h I m a g e s                                         %
6457 %                                                                             %
6458 %                                                                             %
6459 %                                                                             %
6460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6461 %
6462 %  MagickMorphImages() method morphs a set of images.  Both the image pixels
6463 %  and size are linearly interpolated to give the appearance of a
6464 %  meta-morphosis from one image to the next.
6465 %
6466 %  The format of the MagickMorphImages method is:
6467 %
6468 %      MagickWand *MagickMorphImages(MagickWand *wand,
6469 %        const size_t number_frames)
6470 %
6471 %  A description of each parameter follows:
6472 %
6473 %    o wand: the magick wand.
6474 %
6475 %    o number_frames: the number of in-between images to generate.
6476 %
6477 */
6478 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6479   const size_t number_frames)
6480 {
6481   Image
6482     *morph_image;
6483
6484   assert(wand != (MagickWand *) NULL);
6485   assert(wand->signature == WandSignature);
6486   if (wand->debug != MagickFalse)
6487     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6488   if (wand->images == (Image *) NULL)
6489     return((MagickWand *) NULL);
6490   morph_image=MorphImages(wand->images,number_frames,wand->exception);
6491   if (morph_image == (Image *) NULL)
6492     return((MagickWand *) NULL);
6493   return(CloneMagickWandFromImages(wand,morph_image));
6494 }
6495 \f
6496 /*
6497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6498 %                                                                             %
6499 %                                                                             %
6500 %                                                                             %
6501 %   M a g i c k M o r p h o l o g y I m a g e                                 %
6502 %                                                                             %
6503 %                                                                             %
6504 %                                                                             %
6505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6506 %
6507 %  MagickMorphologyImage() applies a user supplied kernel to the image
6508 %  according to the given mophology method.
6509 %
6510 %  The format of the MagickMorphologyImage method is:
6511 %
6512 %      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6513 %        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6514 %
6515 %  A description of each parameter follows:
6516 %
6517 %    o wand: the magick wand.
6518 %
6519 %    o method: the morphology method to be applied.
6520 %
6521 %    o iterations: apply the operation this many times (or no change).
6522 %      A value of -1 means loop until no change found.  How this is applied
6523 %      may depend on the morphology method.  Typically this is a value of 1.
6524 %
6525 %    o kernel: An array of doubles representing the morphology kernel.
6526 %
6527 */
6528 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6529   MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6530 {
6531   Image
6532     *morphology_image;
6533
6534   assert(wand != (MagickWand *) NULL);
6535   assert(wand->signature == WandSignature);
6536   if (wand->debug != MagickFalse)
6537     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6538   if (kernel == (const KernelInfo *) NULL)
6539     return(MagickFalse);
6540   if (wand->images == (Image *) NULL)
6541     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6542   morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6543     wand->exception);
6544   if (morphology_image == (Image *) NULL)
6545     return(MagickFalse);
6546   ReplaceImageInList(&wand->images,morphology_image);
6547   return(MagickTrue);
6548 }
6549 \f
6550 /*
6551 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6552 %                                                                             %
6553 %                                                                             %
6554 %                                                                             %
6555 %   M a g i c k M o t i o n B l u r I m a g e                                 %
6556 %                                                                             %
6557 %                                                                             %
6558 %                                                                             %
6559 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6560 %
6561 %  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6562 %  Gaussian operator of the given radius and standard deviation (sigma).
6563 %  For reasonable results, radius should be larger than sigma.  Use a
6564 %  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6565 %  Angle gives the angle of the blurring motion.
6566 %
6567 %  The format of the MagickMotionBlurImage method is:
6568 %
6569 %      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6570 %        const double radius,const double sigma,const double angle)
6571 %
6572 %  A description of each parameter follows:
6573 %
6574 %    o wand: the magick wand.
6575 %
6576 %    o radius: the radius of the Gaussian, in pixels, not counting
6577 %      the center pixel.
6578 %
6579 %    o sigma: the standard deviation of the Gaussian, in pixels.
6580 %
6581 %    o angle: Apply the effect along this angle.
6582 %
6583 */
6584 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6585   const double radius,const double sigma,const double angle)
6586 {
6587   Image
6588     *blur_image;
6589
6590   assert(wand != (MagickWand *) NULL);
6591   assert(wand->signature == WandSignature);
6592   if (wand->debug != MagickFalse)
6593     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6594   if (wand->images == (Image *) NULL)
6595     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6596   blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
6597   if (blur_image == (Image *) NULL)
6598     return(MagickFalse);
6599   ReplaceImageInList(&wand->images,blur_image);
6600   return(MagickTrue);
6601 }
6602 \f
6603 /*
6604 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6605 %                                                                             %
6606 %                                                                             %
6607 %                                                                             %
6608 %   M a g i c k N e g a t e I m a g e                                         %
6609 %                                                                             %
6610 %                                                                             %
6611 %                                                                             %
6612 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6613 %
6614 %  MagickNegateImage() negates the colors in the reference image.  The
6615 %  Grayscale option means that only grayscale values within the image are
6616 %  negated.
6617 %
6618 %  You can also reduce the influence of a particular channel with a gamma
6619 %  value of 0.
6620 %
6621 %  The format of the MagickNegateImage method is:
6622 %
6623 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
6624 %        const MagickBooleanType gray)
6625 %
6626 %  A description of each parameter follows:
6627 %
6628 %    o wand: the magick wand.
6629 %
6630 %    o gray: If MagickTrue, only negate grayscale pixels within the image.
6631 %
6632 */
6633 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6634   const MagickBooleanType gray)
6635 {
6636   MagickBooleanType
6637     status;
6638
6639   assert(wand != (MagickWand *) NULL);
6640   assert(wand->signature == WandSignature);
6641   if (wand->debug != MagickFalse)
6642     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6643   if (wand->images == (Image *) NULL)
6644     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6645   status=NegateImage(wand->images,gray,wand->exception);
6646   return(status);
6647 }
6648 \f
6649 /*
6650 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6651 %                                                                             %
6652 %                                                                             %
6653 %                                                                             %
6654 %   M a g i c k N e w I m a g e                                               %
6655 %                                                                             %
6656 %                                                                             %
6657 %                                                                             %
6658 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6659 %
6660 %  MagickNewImage() adds a blank image canvas of the specified size and
6661 %  background color to the wand.
6662 %
6663 %  The format of the MagickNewImage method is:
6664 %
6665 %      MagickBooleanType MagickNewImage(MagickWand *wand,
6666 %        const size_t columns,const size_t rows,
6667 %        const PixelWand *background)
6668 %
6669 %  A description of each parameter follows:
6670 %
6671 %    o wand: the magick wand.
6672 %
6673 %    o width: the image width.
6674 %
6675 %    o height: the image height.
6676 %
6677 %    o background: the image color.
6678 %
6679 */
6680 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,
6681   const size_t width,const size_t height,
6682   const PixelWand *background)
6683 {
6684   Image
6685     *images;
6686
6687   PixelInfo
6688     pixel;
6689
6690   assert(wand != (MagickWand *) NULL);
6691   assert(wand->signature == WandSignature);
6692   if (wand->debug != MagickFalse)
6693     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6694   PixelGetMagickColor(background,&pixel);
6695   images=NewMagickImage(wand->image_info,width,height,&pixel);
6696   if (images == (Image *) NULL)
6697     return(MagickFalse);
6698   if (images->exception.severity != UndefinedException)
6699     InheritException(wand->exception,&images->exception);
6700   return(InsertImageInWand(wand,images));
6701 }
6702 \f
6703 /*
6704 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6705 %                                                                             %
6706 %                                                                             %
6707 %                                                                             %
6708 %   M a g i c k N e x t I m a g e                                             %
6709 %                                                                             %
6710 %                                                                             %
6711 %                                                                             %
6712 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6713 %
6714 %  MagickNextImage() associates the next image in the image list with a magick
6715 %  wand.
6716 %
6717 %  The format of the MagickNextImage method is:
6718 %
6719 %      MagickBooleanType MagickNextImage(MagickWand *wand)
6720 %
6721 %  A description of each parameter follows:
6722 %
6723 %    o wand: the magick wand.
6724 %
6725 */
6726 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
6727 {
6728   assert(wand != (MagickWand *) NULL);
6729   assert(wand->signature == WandSignature);
6730   if (wand->debug != MagickFalse)
6731     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6732   if (wand->images == (Image *) NULL)
6733     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6734   if (wand->pend != MagickFalse)
6735     {
6736       wand->pend=MagickFalse;
6737       return(MagickTrue);
6738     }
6739   if (GetNextImageInList(wand->images) == (Image *) NULL)
6740     {
6741       wand->pend=MagickTrue;
6742       return(MagickFalse);
6743     }
6744   wand->images=GetNextImageInList(wand->images);
6745   return(MagickTrue);
6746 }
6747 \f
6748 /*
6749 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6750 %                                                                             %
6751 %                                                                             %
6752 %                                                                             %
6753 %   M a g i c k N o r m a l i z e I m a g e                                   %
6754 %                                                                             %
6755 %                                                                             %
6756 %                                                                             %
6757 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6758 %
6759 %  MagickNormalizeImage() enhances the contrast of a color image by adjusting
6760 %  the pixels color to span the entire range of colors available
6761 %
6762 %  You can also reduce the influence of a particular channel with a gamma
6763 %  value of 0.
6764 %
6765 %  The format of the MagickNormalizeImage method is:
6766 %
6767 %      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6768 %
6769 %  A description of each parameter follows:
6770 %
6771 %    o wand: the magick wand.
6772 %
6773 */
6774 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6775 {
6776   MagickBooleanType
6777     status;
6778
6779   assert(wand != (MagickWand *) NULL);
6780   assert(wand->signature == WandSignature);
6781   if (wand->debug != MagickFalse)
6782     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6783   if (wand->images == (Image *) NULL)
6784     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6785   status=NormalizeImage(wand->images,&wand->images->exception);
6786   return(status);
6787 }
6788 \f
6789 /*
6790 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6791 %                                                                             %
6792 %                                                                             %
6793 %                                                                             %
6794 %   M a g i c k O i l P a i n t I m a g e                                     %
6795 %                                                                             %
6796 %                                                                             %
6797 %                                                                             %
6798 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6799 %
6800 %  MagickOilPaintImage() applies a special effect filter that simulates an oil
6801 %  painting.  Each pixel is replaced by the most frequent color occurring
6802 %  in a circular region defined by radius.
6803 %
6804 %  The format of the MagickOilPaintImage method is:
6805 %
6806 %      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6807 %        const double radius,const double sigma)
6808 %
6809 %  A description of each parameter follows:
6810 %
6811 %    o wand: the magick wand.
6812 %
6813 %    o radius: the radius of the circular neighborhood.
6814 %
6815 %    o sigma: the standard deviation of the Gaussian, in pixels.
6816 %
6817 */
6818 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6819   const double radius,const double sigma)
6820 {
6821   Image
6822     *paint_image;
6823
6824   assert(wand != (MagickWand *) NULL);
6825   assert(wand->signature == WandSignature);
6826   if (wand->debug != MagickFalse)
6827     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6828   if (wand->images == (Image *) NULL)
6829     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6830   paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
6831   if (paint_image == (Image *) NULL)
6832     return(MagickFalse);
6833   ReplaceImageInList(&wand->images,paint_image);
6834   return(MagickTrue);
6835 }
6836 \f
6837 /*
6838 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6839 %                                                                             %
6840 %                                                                             %
6841 %                                                                             %
6842 %   M a g i c k O p a q u e P a i n t I m a g e                               %
6843 %                                                                             %
6844 %                                                                             %
6845 %                                                                             %
6846 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6847 %
6848 %  MagickOpaquePaintImage() changes any pixel that matches color with the color
6849 %  defined by fill.
6850 %
6851 %  The format of the MagickOpaquePaintImage method is:
6852 %
6853 %      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6854 %        const PixelWand *target,const PixelWand *fill,const double fuzz,
6855 %        const MagickBooleanType invert)
6856 %
6857 %  A description of each parameter follows:
6858 %
6859 %    o wand: the magick wand.
6860 %
6861 %    o target: Change this target color to the fill color within the image.
6862 %
6863 %    o fill: the fill pixel wand.
6864 %
6865 %    o fuzz: By default target must match a particular pixel color
6866 %      exactly.  However, in many cases two colors may differ by a small amount.
6867 %      The fuzz member of image defines how much tolerance is acceptable to
6868 %      consider two colors as the same.  For example, set fuzz to 10 and the
6869 %      color red at intensities of 100 and 102 respectively are now interpreted
6870 %      as the same color for the purposes of the floodfill.
6871 %
6872 %    o invert: paint any pixel that does not match the target color.
6873 %
6874 */
6875 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6876   const PixelWand *target,const PixelWand *fill,const double fuzz,
6877   const MagickBooleanType invert)
6878 {
6879   MagickBooleanType
6880     status;
6881
6882   PixelInfo
6883     fill_pixel,
6884     target_pixel;
6885
6886   assert(wand != (MagickWand *) NULL);
6887   assert(wand->signature == WandSignature);
6888   if (wand->debug != MagickFalse)
6889     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6890   if (wand->images == (Image *) NULL)
6891     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6892   PixelGetMagickColor(target,&target_pixel);
6893   PixelGetMagickColor(fill,&fill_pixel);
6894   wand->images->fuzz=fuzz;
6895   status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
6896     &wand->images->exception);
6897   return(status);
6898 }
6899 \f
6900 /*
6901 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6902 %                                                                             %
6903 %                                                                             %
6904 %                                                                             %
6905 %   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                         %
6906 %                                                                             %
6907 %                                                                             %
6908 %                                                                             %
6909 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6910 %
6911 %  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
6912 %  previous image in the sequence.  From this it attempts to select the
6913 %  smallest cropped image to replace each frame, while preserving the results
6914 %  of the animation.
6915 %
6916 %  The format of the MagickOptimizeImageLayers method is:
6917 %
6918 %      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6919 %
6920 %  A description of each parameter follows:
6921 %
6922 %    o wand: the magick wand.
6923 %
6924 */
6925 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6926 {
6927   Image
6928     *optimize_image;
6929
6930   assert(wand != (MagickWand *) NULL);
6931   assert(wand->signature == WandSignature);
6932   if (wand->debug != MagickFalse)
6933     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6934   if (wand->images == (Image *) NULL)
6935     return((MagickWand *) NULL);
6936   optimize_image=OptimizeImageLayers(wand->images,wand->exception);
6937   if (optimize_image == (Image *) NULL)
6938     return((MagickWand *) NULL);
6939   return(CloneMagickWandFromImages(wand,optimize_image));
6940 }
6941 \f
6942 /*
6943 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6944 %                                                                             %
6945 %                                                                             %
6946 %                                                                             %
6947 %     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                   %
6948 %                                                                             %
6949 %                                                                             %
6950 %                                                                             %
6951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6952 %
6953 %  MagickOrderedPosterizeImage() performs an ordered dither based on a number
6954 %  of pre-defined dithering threshold maps, but over multiple intensity levels,
6955 %  which can be different for different channels, according to the input
6956 %  arguments.
6957 %
6958 %  The format of the MagickOrderedPosterizeImage method is:
6959 %
6960 %      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
6961 %        const char *threshold_map)
6962 %
6963 %  A description of each parameter follows:
6964 %
6965 %    o image: the image.
6966 %
6967 %    o threshold_map: A string containing the name of the threshold dither
6968 %      map to use, followed by zero or more numbers representing the number of
6969 %      color levels tho dither between.
6970 %
6971 %      Any level number less than 2 is equivalent to 2, and means only binary
6972 %      dithering will be applied to each color channel.
6973 %
6974 %      No numbers also means a 2 level (bitmap) dither will be applied to all
6975 %      channels, while a single number is the number of levels applied to each
6976 %      channel in sequence.  More numbers will be applied in turn to each of
6977 %      the color channels.
6978 %
6979 %      For example: "o3x3,6" generates a 6 level posterization of the image
6980 %      with a ordered 3x3 diffused pixel dither being applied between each
6981 %      level. While checker,8,8,4 will produce a 332 colormaped image with
6982 %      only a single checkerboard hash pattern (50% grey) between each color
6983 %      level, to basically double the number of color levels with a bare
6984 %      minimim of dithering.
6985 %
6986 */
6987 WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
6988   const char *threshold_map)
6989 {
6990   MagickBooleanType
6991     status;
6992
6993   assert(wand != (MagickWand *) NULL);
6994   assert(wand->signature == WandSignature);
6995   if (wand->debug != MagickFalse)
6996     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6997   if (wand->images == (Image *) NULL)
6998     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6999   status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7000   return(status);
7001 }
7002 \f
7003 /*
7004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7005 %                                                                             %
7006 %                                                                             %
7007 %                                                                             %
7008 %   M a g i c k P i n g I m a g e                                             %
7009 %                                                                             %
7010 %                                                                             %
7011 %                                                                             %
7012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7013 %
7014 %  MagickPingImage() is like MagickReadImage() except the only valid
7015 %  information returned is the image width, height, size, and format.  It
7016 %  is designed to efficiently obtain this information from a file without
7017 %  reading the entire image sequence into memory.
7018 %
7019 %  The format of the MagickPingImage method is:
7020 %
7021 %      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7022 %
7023 %  A description of each parameter follows:
7024 %
7025 %    o wand: the magick wand.
7026 %
7027 %    o filename: the image filename.
7028 %
7029 */
7030 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7031   const char *filename)
7032 {
7033   Image
7034     *images;
7035
7036   ImageInfo
7037     *ping_info;
7038
7039   assert(wand != (MagickWand *) NULL);
7040   assert(wand->signature == WandSignature);
7041   if (wand->debug != MagickFalse)
7042     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7043   ping_info=CloneImageInfo(wand->image_info);
7044   if (filename != (const char *) NULL)
7045     (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7046   images=PingImage(ping_info,wand->exception);
7047   ping_info=DestroyImageInfo(ping_info);
7048   if (images == (Image *) NULL)
7049     return(MagickFalse);
7050   return(InsertImageInWand(wand,images));
7051 }
7052 \f
7053 /*
7054 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7055 %                                                                             %
7056 %                                                                             %
7057 %                                                                             %
7058 %   M a g i c k P i n g I m a g e B l o b                                     %
7059 %                                                                             %
7060 %                                                                             %
7061 %                                                                             %
7062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7063 %
7064 %  MagickPingImageBlob() pings an image or image sequence from a blob.
7065 %
7066 %  The format of the MagickPingImageBlob method is:
7067 %
7068 %      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7069 %        const void *blob,const size_t length)
7070 %
7071 %  A description of each parameter follows:
7072 %
7073 %    o wand: the magick wand.
7074 %
7075 %    o blob: the blob.
7076 %
7077 %    o length: the blob length.
7078 %
7079 */
7080 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7081   const void *blob,const size_t length)
7082 {
7083   Image
7084     *images;
7085
7086   ImageInfo
7087     *read_info;
7088
7089   assert(wand != (MagickWand *) NULL);
7090   assert(wand->signature == WandSignature);
7091   if (wand->debug != MagickFalse)
7092     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7093   read_info=CloneImageInfo(wand->image_info);
7094   SetImageInfoBlob(read_info,blob,length);
7095   images=PingImage(read_info,wand->exception);
7096   read_info=DestroyImageInfo(read_info);
7097   if (images == (Image *) NULL)
7098     return(MagickFalse);
7099   return(InsertImageInWand(wand,images));
7100 }
7101 \f
7102 /*
7103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7104 %                                                                             %
7105 %                                                                             %
7106 %                                                                             %
7107 %   M a g i c k P i n g I m a g e F i l e                                     %
7108 %                                                                             %
7109 %                                                                             %
7110 %                                                                             %
7111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7112 %
7113 %  MagickPingImageFile() pings an image or image sequence from an open file
7114 %  descriptor.
7115 %
7116 %  The format of the MagickPingImageFile method is:
7117 %
7118 %      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7119 %
7120 %  A description of each parameter follows:
7121 %
7122 %    o wand: the magick wand.
7123 %
7124 %    o file: the file descriptor.
7125 %
7126 */
7127 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7128 {
7129   Image
7130     *images;
7131
7132   ImageInfo
7133     *read_info;
7134
7135   assert(wand != (MagickWand *) NULL);
7136   assert(wand->signature == WandSignature);
7137   assert(file != (FILE *) NULL);
7138   if (wand->debug != MagickFalse)
7139     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7140   read_info=CloneImageInfo(wand->image_info);
7141   SetImageInfoFile(read_info,file);
7142   images=PingImage(read_info,wand->exception);
7143   read_info=DestroyImageInfo(read_info);
7144   if (images == (Image *) NULL)
7145     return(MagickFalse);
7146   return(InsertImageInWand(wand,images));
7147 }
7148 \f
7149 /*
7150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7151 %                                                                             %
7152 %                                                                             %
7153 %                                                                             %
7154 %   M a g i c k P o l a r o i d I m a g e                                     %
7155 %                                                                             %
7156 %                                                                             %
7157 %                                                                             %
7158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7159 %
7160 %  MagickPolaroidImage() simulates a Polaroid picture.
7161 %
7162 %  The format of the MagickPolaroidImage method is:
7163 %
7164 %      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7165 %        const DrawingWand *drawing_wand,const double angle)
7166 %
7167 %  A description of each parameter follows:
7168 %
7169 %    o wand: the magick wand.
7170 %
7171 %    o drawing_wand: the draw wand.
7172 %
7173 %    o angle: Apply the effect along this angle.
7174 %
7175 */
7176 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7177   const DrawingWand *drawing_wand,const double angle)
7178 {
7179   DrawInfo
7180     *draw_info;
7181
7182   Image
7183     *polaroid_image;
7184
7185   assert(wand != (MagickWand *) NULL);
7186   assert(wand->signature == WandSignature);
7187   if (wand->debug != MagickFalse)
7188     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7189   if (wand->images == (Image *) NULL)
7190     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7191   draw_info=PeekDrawingWand(drawing_wand);
7192   if (draw_info == (DrawInfo *) NULL)
7193     return(MagickFalse);
7194   polaroid_image=PolaroidImage(wand->images,draw_info,angle,wand->exception);
7195   if (polaroid_image == (Image *) NULL)
7196     return(MagickFalse);
7197   ReplaceImageInList(&wand->images,polaroid_image);
7198   return(MagickTrue);
7199 }
7200 \f
7201 /*
7202 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7203 %                                                                             %
7204 %                                                                             %
7205 %                                                                             %
7206 %   M a g i c k P o s t e r i z e I m a g e                                   %
7207 %                                                                             %
7208 %                                                                             %
7209 %                                                                             %
7210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7211 %
7212 %  MagickPosterizeImage() reduces the image to a limited number of color level.
7213 %
7214 %  The format of the MagickPosterizeImage method is:
7215 %
7216 %      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7217 %        const unsigned levels,const MagickBooleanType dither)
7218 %
7219 %  A description of each parameter follows:
7220 %
7221 %    o wand: the magick wand.
7222 %
7223 %    o levels: Number of color levels allowed in each channel.  Very low values
7224 %      (2, 3, or 4) have the most visible effect.
7225 %
7226 %    o dither: Set this integer value to something other than zero to dither
7227 %      the mapped image.
7228 %
7229 */
7230 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7231   const size_t levels,const MagickBooleanType dither)
7232 {
7233   MagickBooleanType
7234     status;
7235
7236   assert(wand != (MagickWand *) NULL);
7237   assert(wand->signature == WandSignature);
7238   if (wand->debug != MagickFalse)
7239     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7240   if (wand->images == (Image *) NULL)
7241     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7242   status=PosterizeImage(wand->images,levels,dither);
7243   if (status == MagickFalse)
7244     InheritException(wand->exception,&wand->images->exception);
7245   return(status);
7246 }
7247 \f
7248 /*
7249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7250 %                                                                             %
7251 %                                                                             %
7252 %                                                                             %
7253 %   M a g i c k P r e v i e w I m a g e s                                     %
7254 %                                                                             %
7255 %                                                                             %
7256 %                                                                             %
7257 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7258 %
7259 %  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7260 %  image processing operation applied at varying strengths.  This helpful
7261 %  to quickly pin-point an appropriate parameter for an image processing
7262 %  operation.
7263 %
7264 %  The format of the MagickPreviewImages method is:
7265 %
7266 %      MagickWand *MagickPreviewImages(MagickWand *wand,
7267 %        const PreviewType preview)
7268 %
7269 %  A description of each parameter follows:
7270 %
7271 %    o wand: the magick wand.
7272 %
7273 %    o preview: the preview type.
7274 %
7275 */
7276 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7277   const PreviewType preview)
7278 {
7279   Image
7280     *preview_image;
7281
7282   assert(wand != (MagickWand *) NULL);
7283   assert(wand->signature == WandSignature);
7284   if (wand->debug != MagickFalse)
7285     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7286   if (wand->images == (Image *) NULL)
7287     return((MagickWand *) NULL);
7288   preview_image=PreviewImage(wand->images,preview,wand->exception);
7289   if (preview_image == (Image *) NULL)
7290     return((MagickWand *) NULL);
7291   return(CloneMagickWandFromImages(wand,preview_image));
7292 }
7293 \f
7294 /*
7295 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7296 %                                                                             %
7297 %                                                                             %
7298 %                                                                             %
7299 %   M a g i c k P r e v i o u s I m a g e                                     %
7300 %                                                                             %
7301 %                                                                             %
7302 %                                                                             %
7303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7304 %
7305 %  MagickPreviousImage() assocates the previous image in an image list with
7306 %  the magick wand.
7307 %
7308 %  The format of the MagickPreviousImage method is:
7309 %
7310 %      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7311 %
7312 %  A description of each parameter follows:
7313 %
7314 %    o wand: the magick wand.
7315 %
7316 */
7317 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7318 {
7319   assert(wand != (MagickWand *) NULL);
7320   assert(wand->signature == WandSignature);
7321   if (wand->debug != MagickFalse)
7322     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7323   if (wand->images == (Image *) NULL)
7324     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7325   if (wand->pend != MagickFalse)
7326     {
7327       wand->pend=MagickFalse;
7328       return(MagickTrue);
7329     }
7330   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7331     {
7332       wand->pend=MagickTrue;
7333       return(MagickFalse);
7334     }
7335   wand->images=GetPreviousImageInList(wand->images);
7336   return(MagickTrue);
7337 }
7338 \f
7339 /*
7340 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7341 %                                                                             %
7342 %                                                                             %
7343 %                                                                             %
7344 %   M a g i c k Q u a n t i z e I m a g e                                     %
7345 %                                                                             %
7346 %                                                                             %
7347 %                                                                             %
7348 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7349 %
7350 %  MagickQuantizeImage() analyzes the colors within a reference image and
7351 %  chooses a fixed number of colors to represent the image.  The goal of the
7352 %  algorithm is to minimize the color difference between the input and output
7353 %  image while minimizing the processing time.
7354 %
7355 %  The format of the MagickQuantizeImage method is:
7356 %
7357 %      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7358 %        const size_t number_colors,const ColorspaceType colorspace,
7359 %        const size_t treedepth,const MagickBooleanType dither,
7360 %        const MagickBooleanType measure_error)
7361 %
7362 %  A description of each parameter follows:
7363 %
7364 %    o wand: the magick wand.
7365 %
7366 %    o number_colors: the number of colors.
7367 %
7368 %    o colorspace: Perform color reduction in this colorspace, typically
7369 %      RGBColorspace.
7370 %
7371 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7372 %      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
7373 %      reference image with the least amount of memory and the fastest
7374 %      computational speed.  In some cases, such as an image with low color
7375 %      dispersion (a few number of colors), a value other than
7376 %      Log4(number_colors) is required.  To expand the color tree completely,
7377 %      use a value of 8.
7378 %
7379 %    o dither: A value other than zero distributes the difference between an
7380 %      original image and the corresponding color reduced image to
7381 %      neighboring pixels along a Hilbert curve.
7382 %
7383 %    o measure_error: A value other than zero measures the difference between
7384 %      the original and quantized images.  This difference is the total
7385 %      quantization error.  The error is computed by summing over all pixels
7386 %      in an image the distance squared in RGB space between each reference
7387 %      pixel value and its quantized value.
7388 %
7389 */
7390 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7391   const size_t number_colors,const ColorspaceType colorspace,
7392   const size_t treedepth,const MagickBooleanType dither,
7393   const MagickBooleanType measure_error)
7394 {
7395   MagickBooleanType
7396     status;
7397
7398   QuantizeInfo
7399     *quantize_info;
7400
7401   assert(wand != (MagickWand *) NULL);
7402   assert(wand->signature == WandSignature);
7403   if (wand->debug != MagickFalse)
7404     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7405   if (wand->images == (Image *) NULL)
7406     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7407   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7408   quantize_info->number_colors=number_colors;
7409   quantize_info->dither=dither;
7410   quantize_info->tree_depth=treedepth;
7411   quantize_info->colorspace=colorspace;
7412   quantize_info->measure_error=measure_error;
7413   status=QuantizeImage(quantize_info,wand->images);
7414   if (status == MagickFalse)
7415     InheritException(wand->exception,&wand->images->exception);
7416   quantize_info=DestroyQuantizeInfo(quantize_info);
7417   return(status);
7418 }
7419 \f
7420 /*
7421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7422 %                                                                             %
7423 %                                                                             %
7424 %                                                                             %
7425 %   M a g i c k Q u a n t i z e I m a g e s                                   %
7426 %                                                                             %
7427 %                                                                             %
7428 %                                                                             %
7429 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7430 %
7431 %  MagickQuantizeImages() analyzes the colors within a sequence of images and
7432 %  chooses a fixed number of colors to represent the image.  The goal of the
7433 %  algorithm is to minimize the color difference between the input and output
7434 %  image while minimizing the processing time.
7435 %
7436 %  The format of the MagickQuantizeImages method is:
7437 %
7438 %      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7439 %        const size_t number_colors,const ColorspaceType colorspace,
7440 %        const size_t treedepth,const MagickBooleanType dither,
7441 %        const MagickBooleanType measure_error)
7442 %
7443 %  A description of each parameter follows:
7444 %
7445 %    o wand: the magick wand.
7446 %
7447 %    o number_colors: the number of colors.
7448 %
7449 %    o colorspace: Perform color reduction in this colorspace, typically
7450 %      RGBColorspace.
7451 %
7452 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7453 %      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
7454 %      reference image with the least amount of memory and the fastest
7455 %      computational speed.  In some cases, such as an image with low color
7456 %      dispersion (a few number of colors), a value other than
7457 %      Log4(number_colors) is required.  To expand the color tree completely,
7458 %      use a value of 8.
7459 %
7460 %    o dither: A value other than zero distributes the difference between an
7461 %      original image and the corresponding color reduced algorithm to
7462 %      neighboring pixels along a Hilbert curve.
7463 %
7464 %    o measure_error: A value other than zero measures the difference between
7465 %      the original and quantized images.  This difference is the total
7466 %      quantization error.  The error is computed by summing over all pixels
7467 %      in an image the distance squared in RGB space between each reference
7468 %      pixel value and its quantized value.
7469 %
7470 */
7471 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7472   const size_t number_colors,const ColorspaceType colorspace,
7473   const size_t treedepth,const MagickBooleanType dither,
7474   const MagickBooleanType measure_error)
7475 {
7476   MagickBooleanType
7477     status;
7478
7479   QuantizeInfo
7480     *quantize_info;
7481
7482   assert(wand != (MagickWand *) NULL);
7483   assert(wand->signature == WandSignature);
7484   if (wand->debug != MagickFalse)
7485     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7486   if (wand->images == (Image *) NULL)
7487     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7488   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7489   quantize_info->number_colors=number_colors;
7490   quantize_info->dither=dither;
7491   quantize_info->tree_depth=treedepth;
7492   quantize_info->colorspace=colorspace;
7493   quantize_info->measure_error=measure_error;
7494   status=QuantizeImages(quantize_info,wand->images);
7495   if (status == MagickFalse)
7496     InheritException(wand->exception,&wand->images->exception);
7497   quantize_info=DestroyQuantizeInfo(quantize_info);
7498   return(status);
7499 }
7500 \f
7501 /*
7502 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7503 %                                                                             %
7504 %                                                                             %
7505 %                                                                             %
7506 %   M a g i c k R a d i a l B l u r I m a g e                                 %
7507 %                                                                             %
7508 %                                                                             %
7509 %                                                                             %
7510 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7511 %
7512 %  MagickRadialBlurImage() radial blurs an image.
7513 %
7514 %  The format of the MagickRadialBlurImage method is:
7515 %
7516 %      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7517 %        const double angle)
7518 %
7519 %  A description of each parameter follows:
7520 %
7521 %    o wand: the magick wand.
7522 %
7523 %    o angle: the angle of the blur in degrees.
7524 %
7525 */
7526 WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7527   const double angle)
7528 {
7529   Image
7530     *blur_image;
7531
7532   assert(wand != (MagickWand *) NULL);
7533   assert(wand->signature == WandSignature);
7534   if (wand->debug != MagickFalse)
7535     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7536   if (wand->images == (Image *) NULL)
7537     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7538   blur_image=RadialBlurImage(wand->images,angle,wand->exception);
7539   if (blur_image == (Image *) NULL)
7540     return(MagickFalse);
7541   ReplaceImageInList(&wand->images,blur_image);
7542   return(MagickTrue);
7543 }
7544 \f
7545 /*
7546 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7547 %                                                                             %
7548 %                                                                             %
7549 %                                                                             %
7550 %   M a g i c k R a i s e I m a g e                                           %
7551 %                                                                             %
7552 %                                                                             %
7553 %                                                                             %
7554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7555 %
7556 %  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7557 %  by lightening and darkening the edges of the image.  Members width and
7558 %  height of raise_info define the width of the vertical and horizontal
7559 %  edge of the effect.
7560 %
7561 %  The format of the MagickRaiseImage method is:
7562 %
7563 %      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7564 %        const size_t width,const size_t height,const ssize_t x,
7565 %        const ssize_t y,const MagickBooleanType raise)
7566 %
7567 %  A description of each parameter follows:
7568 %
7569 %    o wand: the magick wand.
7570 %
7571 %    o width,height,x,y:  Define the dimensions of the area to raise.
7572 %
7573 %    o raise: A value other than zero creates a 3-D raise effect,
7574 %      otherwise it has a lowered effect.
7575 %
7576 */
7577 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7578   const size_t width,const size_t height,const ssize_t x,
7579   const ssize_t y,const MagickBooleanType raise)
7580 {
7581   MagickBooleanType
7582     status;
7583
7584   RectangleInfo
7585     raise_info;
7586
7587   assert(wand != (MagickWand *) NULL);
7588   assert(wand->signature == WandSignature);
7589   if (wand->debug != MagickFalse)
7590     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7591   if (wand->images == (Image *) NULL)
7592     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7593   raise_info.width=width;
7594   raise_info.height=height;
7595   raise_info.x=x;
7596   raise_info.y=y;
7597   status=RaiseImage(wand->images,&raise_info,raise,&wand->images->exception);
7598   return(status);
7599 }
7600 \f
7601 /*
7602 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7603 %                                                                             %
7604 %                                                                             %
7605 %                                                                             %
7606 %   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                       %
7607 %                                                                             %
7608 %                                                                             %
7609 %                                                                             %
7610 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7611 %
7612 %  MagickRandomThresholdImage() changes the value of individual pixels based on
7613 %  the intensity of each pixel compared to threshold.  The result is a
7614 %  high-contrast, two color image.
7615 %
7616 %  The format of the MagickRandomThresholdImage method is:
7617 %
7618 %      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7619 %        const double low,const double high)
7620 %
7621 %  A description of each parameter follows:
7622 %
7623 %    o wand: the magick wand.
7624 %
7625 %    o low,high: Specify the high and low thresholds.  These values range from
7626 %      0 to QuantumRange.
7627 %
7628 */
7629 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7630   const double low,const double high)
7631 {
7632   char
7633     threshold[MaxTextExtent];
7634
7635   MagickBooleanType
7636     status;
7637
7638   assert(wand != (MagickWand *) NULL);
7639   assert(wand->signature == WandSignature);
7640   if (wand->debug != MagickFalse)
7641     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7642   if (wand->images == (Image *) NULL)
7643     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7644   (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
7645   status=RandomThresholdImage(wand->images,threshold,wand->exception);
7646   if (status == MagickFalse)
7647     InheritException(wand->exception,&wand->images->exception);
7648   return(status);
7649 }
7650 \f
7651 /*
7652 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7653 %                                                                             %
7654 %                                                                             %
7655 %                                                                             %
7656 %   M a g i c k R e a d I m a g e                                             %
7657 %                                                                             %
7658 %                                                                             %
7659 %                                                                             %
7660 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7661 %
7662 %  MagickReadImage() reads an image or image sequence.  The images are inserted
7663 %  at the current image pointer position.   Use MagickSetFirstIterator(),
7664 %  MagickSetLastIterator, or MagickSetImageIndex() to specify the current
7665 %  image pointer position at the beginning of the image list, the end, or
7666 %  anywhere in-between respectively.
7667 %
7668 %  The format of the MagickReadImage method is:
7669 %
7670 %      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
7671 %
7672 %  A description of each parameter follows:
7673 %
7674 %    o wand: the magick wand.
7675 %
7676 %    o filename: the image filename.
7677 %
7678 */
7679 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
7680   const char *filename)
7681 {
7682   Image
7683     *images;
7684
7685   ImageInfo
7686     *read_info;
7687
7688   assert(wand != (MagickWand *) NULL);
7689   assert(wand->signature == WandSignature);
7690   if (wand->debug != MagickFalse)
7691     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7692   read_info=CloneImageInfo(wand->image_info);
7693   if (filename != (const char *) NULL)
7694     (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
7695   images=ReadImage(read_info,wand->exception);
7696   read_info=DestroyImageInfo(read_info);
7697   if (images == (Image *) NULL)
7698     return(MagickFalse);
7699   return(InsertImageInWand(wand,images));
7700 }
7701 \f
7702 /*
7703 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7704 %                                                                             %
7705 %                                                                             %
7706 %                                                                             %
7707 %   M a g i c k R e a d I m a g e B l o b                                     %
7708 %                                                                             %
7709 %                                                                             %
7710 %                                                                             %
7711 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7712 %
7713 %  MagickReadImageBlob() reads an image or image sequence from a blob.
7714 %
7715 %  The format of the MagickReadImageBlob method is:
7716 %
7717 %      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7718 %        const void *blob,const size_t length)
7719 %
7720 %  A description of each parameter follows:
7721 %
7722 %    o wand: the magick wand.
7723 %
7724 %    o blob: the blob.
7725 %
7726 %    o length: the blob length.
7727 %
7728 */
7729 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7730   const void *blob,const size_t length)
7731 {
7732   Image
7733     *images;
7734
7735   assert(wand != (MagickWand *) NULL);
7736   assert(wand->signature == WandSignature);
7737   if (wand->debug != MagickFalse)
7738     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7739   images=BlobToImage(wand->image_info,blob,length,wand->exception);
7740   if (images == (Image *) NULL)
7741     return(MagickFalse);
7742   return(InsertImageInWand(wand,images));
7743 }
7744 \f
7745 /*
7746 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7747 %                                                                             %
7748 %                                                                             %
7749 %                                                                             %
7750 %   M a g i c k R e a d I m a g e F i l e                                     %
7751 %                                                                             %
7752 %                                                                             %
7753 %                                                                             %
7754 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7755 %
7756 %  MagickReadImageFile() reads an image or image sequence from an open file
7757 %  descriptor.
7758 %
7759 %  The format of the MagickReadImageFile method is:
7760 %
7761 %      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7762 %
7763 %  A description of each parameter follows:
7764 %
7765 %    o wand: the magick wand.
7766 %
7767 %    o file: the file descriptor.
7768 %
7769 */
7770 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7771 {
7772   Image
7773     *images;
7774
7775   ImageInfo
7776     *read_info;
7777
7778   assert(wand != (MagickWand *) NULL);
7779   assert(wand->signature == WandSignature);
7780   assert(file != (FILE *) NULL);
7781   if (wand->debug != MagickFalse)
7782     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7783   read_info=CloneImageInfo(wand->image_info);
7784   SetImageInfoFile(read_info,file);
7785   images=ReadImage(read_info,wand->exception);
7786   read_info=DestroyImageInfo(read_info);
7787   if (images == (Image *) NULL)
7788     return(MagickFalse);
7789   return(InsertImageInWand(wand,images));
7790 }
7791 \f
7792 /*
7793 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7794 %                                                                             %
7795 %                                                                             %
7796 %                                                                             %
7797 %   M a g i c k R e m a p I m a g e                                           %
7798 %                                                                             %
7799 %                                                                             %
7800 %                                                                             %
7801 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7802 %
7803 %  MagickRemapImage() replaces the colors of an image with the closest color
7804 %  from a reference image.
7805 %
7806 %  The format of the MagickRemapImage method is:
7807 %
7808 %      MagickBooleanType MagickRemapImage(MagickWand *wand,
7809 %        const MagickWand *remap_wand,const DitherMethod method)
7810 %
7811 %  A description of each parameter follows:
7812 %
7813 %    o wand: the magick wand.
7814 %
7815 %    o affinity: the affinity wand.
7816 %
7817 %    o method: choose from these dither methods: NoDitherMethod,
7818 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7819 %
7820 */
7821 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
7822   const MagickWand *remap_wand,const DitherMethod method)
7823 {
7824   MagickBooleanType
7825     status;
7826
7827   QuantizeInfo
7828     *quantize_info;
7829
7830   assert(wand != (MagickWand *) NULL);
7831   assert(wand->signature == WandSignature);
7832   if (wand->debug != MagickFalse)
7833     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7834   if ((wand->images == (Image *) NULL) ||
7835       (remap_wand->images == (Image *) NULL))
7836     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7837   quantize_info=AcquireQuantizeInfo(wand->image_info);
7838   quantize_info->dither_method=method;
7839   if (method == NoDitherMethod)
7840     quantize_info->dither=MagickFalse;
7841   status=RemapImage(quantize_info,wand->images,remap_wand->images);
7842   quantize_info=DestroyQuantizeInfo(quantize_info);
7843   if (status == MagickFalse)
7844     InheritException(wand->exception,&wand->images->exception);
7845   return(status);
7846 }
7847 \f
7848 /*
7849 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7850 %                                                                             %
7851 %                                                                             %
7852 %                                                                             %
7853 %   M a g i c k R e m o v e I m a g e                                         %
7854 %                                                                             %
7855 %                                                                             %
7856 %                                                                             %
7857 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7858 %
7859 %  MagickRemoveImage() removes an image from the image list.
7860 %
7861 %  The format of the MagickRemoveImage method is:
7862 %
7863 %      MagickBooleanType MagickRemoveImage(MagickWand *wand)
7864 %
7865 %  A description of each parameter follows:
7866 %
7867 %    o wand: the magick wand.
7868 %
7869 %    o insert: the splice wand.
7870 %
7871 */
7872 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
7873 {
7874   assert(wand != (MagickWand *) NULL);
7875   assert(wand->signature == WandSignature);
7876   if (wand->debug != MagickFalse)
7877     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7878   if (wand->images == (Image *) NULL)
7879     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7880   DeleteImageFromList(&wand->images);
7881   return(MagickTrue);
7882 }
7883 \f
7884 /*
7885 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7886 %                                                                             %
7887 %                                                                             %
7888 %                                                                             %
7889 %   M a g i c k R e s a m p l e I m a g e                                     %
7890 %                                                                             %
7891 %                                                                             %
7892 %                                                                             %
7893 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7894 %
7895 %  MagickResampleImage() resample image to desired resolution.
7896 %
7897 %    Bessel   Blackman   Box
7898 %    Catrom   Cubic      Gaussian
7899 %    Hanning  Hermite    Lanczos
7900 %    Mitchell Point      Quandratic
7901 %    Sinc     Triangle
7902 %
7903 %  Most of the filters are FIR (finite impulse response), however, Bessel,
7904 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
7905 %  are windowed (brought down to zero) with the Blackman filter.
7906 %
7907 %  The format of the MagickResampleImage method is:
7908 %
7909 %      MagickBooleanType MagickResampleImage(MagickWand *wand,
7910 %        const double x_resolution,const double y_resolution,
7911 %        const FilterTypes filter,const double blur)
7912 %
7913 %  A description of each parameter follows:
7914 %
7915 %    o wand: the magick wand.
7916 %
7917 %    o x_resolution: the new image x resolution.
7918 %
7919 %    o y_resolution: the new image y resolution.
7920 %
7921 %    o filter: Image filter to use.
7922 %
7923 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
7924 %
7925 */
7926 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
7927   const double x_resolution,const double y_resolution,const FilterTypes filter,
7928   const double blur)
7929 {
7930   Image
7931     *resample_image;
7932
7933   assert(wand != (MagickWand *) NULL);
7934   assert(wand->signature == WandSignature);
7935   if (wand->debug != MagickFalse)
7936     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7937   if (wand->images == (Image *) NULL)
7938     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7939   resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
7940     blur,wand->exception);
7941   if (resample_image == (Image *) NULL)
7942     return(MagickFalse);
7943   ReplaceImageInList(&wand->images,resample_image);
7944   return(MagickTrue);
7945 }
7946 \f
7947 /*
7948 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7949 %                                                                             %
7950 %                                                                             %
7951 %                                                                             %
7952 %   M a g i c k R e s e t I m a g e P a g e                                   %
7953 %                                                                             %
7954 %                                                                             %
7955 %                                                                             %
7956 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7957 %
7958 %  MagickResetImagePage() resets the Wand page canvas and position.
7959 %
7960 %  The format of the MagickResetImagePage method is:
7961 %
7962 %      MagickBooleanType MagickResetImagePage(MagickWand *wand,
7963 %        const char *page)
7964 %
7965 %  A description of each parameter follows:
7966 %
7967 %    o wand: the magick wand.
7968 %
7969 %    o page: the relative page specification.
7970 %
7971 */
7972 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
7973   const char *page)
7974 {
7975   assert(wand != (MagickWand *) NULL);
7976   assert(wand->signature == WandSignature);
7977   if (wand->debug != MagickFalse)
7978     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7979   if (wand->images == (Image *) NULL)
7980     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7981   if ((page == (char *) NULL) || (*page == '\0'))
7982     {
7983       (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
7984       return(MagickTrue);
7985     }
7986   return(ResetImagePage(wand->images,page));
7987 }
7988 \f
7989 /*
7990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7991 %                                                                             %
7992 %                                                                             %
7993 %                                                                             %
7994 %   M a g i c k R e s i z e I m a g e                                         %
7995 %                                                                             %
7996 %                                                                             %
7997 %                                                                             %
7998 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7999 %
8000 %  MagickResizeImage() scales an image to the desired dimensions with one of
8001 %  these filters:
8002 %
8003 %    Bessel   Blackman   Box
8004 %    Catrom   Cubic      Gaussian
8005 %    Hanning  Hermite    Lanczos
8006 %    Mitchell Point      Quandratic
8007 %    Sinc     Triangle
8008 %
8009 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8010 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8011 %  are windowed (brought down to zero) with the Blackman filter.
8012 %
8013 %  The format of the MagickResizeImage method is:
8014 %
8015 %      MagickBooleanType MagickResizeImage(MagickWand *wand,
8016 %        const size_t columns,const size_t rows,
8017 %        const FilterTypes filter,const double blur)
8018 %
8019 %  A description of each parameter follows:
8020 %
8021 %    o wand: the magick wand.
8022 %
8023 %    o columns: the number of columns in the scaled image.
8024 %
8025 %    o rows: the number of rows in the scaled image.
8026 %
8027 %    o filter: Image filter to use.
8028 %
8029 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8030 %
8031 */
8032 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8033   const size_t columns,const size_t rows,const FilterTypes filter,
8034   const double blur)
8035 {
8036   Image
8037     *resize_image;
8038
8039   assert(wand != (MagickWand *) NULL);
8040   assert(wand->signature == WandSignature);
8041   if (wand->debug != MagickFalse)
8042     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8043   if (wand->images == (Image *) NULL)
8044     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8045   resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8046     wand->exception);
8047   if (resize_image == (Image *) NULL)
8048     return(MagickFalse);
8049   ReplaceImageInList(&wand->images,resize_image);
8050   return(MagickTrue);
8051 }
8052 \f
8053 /*
8054 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8055 %                                                                             %
8056 %                                                                             %
8057 %                                                                             %
8058 %   M a g i c k R o l l I m a g e                                             %
8059 %                                                                             %
8060 %                                                                             %
8061 %                                                                             %
8062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8063 %
8064 %  MagickRollImage() offsets an image as defined by x and y.
8065 %
8066 %  The format of the MagickRollImage method is:
8067 %
8068 %      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8069 %        const size_t y)
8070 %
8071 %  A description of each parameter follows:
8072 %
8073 %    o wand: the magick wand.
8074 %
8075 %    o x: the x offset.
8076 %
8077 %    o y: the y offset.
8078 %
8079 %
8080 */
8081 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8082   const ssize_t x,const ssize_t y)
8083 {
8084   Image
8085     *roll_image;
8086
8087   assert(wand != (MagickWand *) NULL);
8088   assert(wand->signature == WandSignature);
8089   if (wand->debug != MagickFalse)
8090     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8091   if (wand->images == (Image *) NULL)
8092     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8093   roll_image=RollImage(wand->images,x,y,wand->exception);
8094   if (roll_image == (Image *) NULL)
8095     return(MagickFalse);
8096   ReplaceImageInList(&wand->images,roll_image);
8097   return(MagickTrue);
8098 }
8099 \f
8100 /*
8101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8102 %                                                                             %
8103 %                                                                             %
8104 %                                                                             %
8105 %   M a g i c k R o t a t e I m a g e                                         %
8106 %                                                                             %
8107 %                                                                             %
8108 %                                                                             %
8109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8110 %
8111 %  MagickRotateImage() rotates an image the specified number of degrees. Empty
8112 %  triangles left over from rotating the image are filled with the
8113 %  background color.
8114 %
8115 %  The format of the MagickRotateImage method is:
8116 %
8117 %      MagickBooleanType MagickRotateImage(MagickWand *wand,
8118 %        const PixelWand *background,const double degrees)
8119 %
8120 %  A description of each parameter follows:
8121 %
8122 %    o wand: the magick wand.
8123 %
8124 %    o background: the background pixel wand.
8125 %
8126 %    o degrees: the number of degrees to rotate the image.
8127 %
8128 %
8129 */
8130 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8131   const PixelWand *background,const double degrees)
8132 {
8133   Image
8134     *rotate_image;
8135
8136   assert(wand != (MagickWand *) NULL);
8137   assert(wand->signature == WandSignature);
8138   if (wand->debug != MagickFalse)
8139     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8140   if (wand->images == (Image *) NULL)
8141     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8142   PixelGetQuantumPacket(background,&wand->images->background_color);
8143   rotate_image=RotateImage(wand->images,degrees,wand->exception);
8144   if (rotate_image == (Image *) NULL)
8145     return(MagickFalse);
8146   ReplaceImageInList(&wand->images,rotate_image);
8147   return(MagickTrue);
8148 }
8149 \f
8150 /*
8151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8152 %                                                                             %
8153 %                                                                             %
8154 %                                                                             %
8155 %   M a g i c k S a m p l e I m a g e                                         %
8156 %                                                                             %
8157 %                                                                             %
8158 %                                                                             %
8159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8160 %
8161 %  MagickSampleImage() scales an image to the desired dimensions with pixel
8162 %  sampling.  Unlike other scaling methods, this method does not introduce
8163 %  any additional color into the scaled image.
8164 %
8165 %  The format of the MagickSampleImage method is:
8166 %
8167 %      MagickBooleanType MagickSampleImage(MagickWand *wand,
8168 %        const size_t columns,const size_t rows)
8169 %
8170 %  A description of each parameter follows:
8171 %
8172 %    o wand: the magick wand.
8173 %
8174 %    o columns: the number of columns in the scaled image.
8175 %
8176 %    o rows: the number of rows in the scaled image.
8177 %
8178 %
8179 */
8180 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8181   const size_t columns,const size_t rows)
8182 {
8183   Image
8184     *sample_image;
8185
8186   assert(wand != (MagickWand *) NULL);
8187   assert(wand->signature == WandSignature);
8188   if (wand->debug != MagickFalse)
8189     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8190   if (wand->images == (Image *) NULL)
8191     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8192   sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8193   if (sample_image == (Image *) NULL)
8194     return(MagickFalse);
8195   ReplaceImageInList(&wand->images,sample_image);
8196   return(MagickTrue);
8197 }
8198 \f
8199 /*
8200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8201 %                                                                             %
8202 %                                                                             %
8203 %                                                                             %
8204 %   M a g i c k S c a l e I m a g e                                           %
8205 %                                                                             %
8206 %                                                                             %
8207 %                                                                             %
8208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8209 %
8210 %  MagickScaleImage() scales the size of an image to the given dimensions.
8211 %
8212 %  The format of the MagickScaleImage method is:
8213 %
8214 %      MagickBooleanType MagickScaleImage(MagickWand *wand,
8215 %        const size_t columns,const size_t rows)
8216 %
8217 %  A description of each parameter follows:
8218 %
8219 %    o wand: the magick wand.
8220 %
8221 %    o columns: the number of columns in the scaled image.
8222 %
8223 %    o rows: the number of rows in the scaled image.
8224 %
8225 %
8226 */
8227 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8228   const size_t columns,const size_t rows)
8229 {
8230   Image
8231     *scale_image;
8232
8233   assert(wand != (MagickWand *) NULL);
8234   assert(wand->signature == WandSignature);
8235   if (wand->debug != MagickFalse)
8236     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8237   if (wand->images == (Image *) NULL)
8238     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8239   scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8240   if (scale_image == (Image *) NULL)
8241     return(MagickFalse);
8242   ReplaceImageInList(&wand->images,scale_image);
8243   return(MagickTrue);
8244 }
8245 \f
8246 /*
8247 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8248 %                                                                             %
8249 %                                                                             %
8250 %                                                                             %
8251 %   M a g i c k S e g m e n t I m a g e                                       %
8252 %                                                                             %
8253 %                                                                             %
8254 %                                                                             %
8255 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8256 %
8257 %  MagickSegmentImage() segments an image by analyzing the histograms of the
8258 %  color components and identifying units that are homogeneous with the fuzzy
8259 %  C-means technique.
8260 %
8261 %  The format of the SegmentImage method is:
8262 %
8263 %      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8264 %        const ColorspaceType colorspace,const MagickBooleanType verbose,
8265 %        const double cluster_threshold,const double smooth_threshold)
8266 %
8267 %  A description of each parameter follows.
8268 %
8269 %    o wand: the wand.
8270 %
8271 %    o colorspace: the image colorspace.
8272 %
8273 %    o verbose:  Set to MagickTrue to print detailed information about the
8274 %      identified classes.
8275 %
8276 %    o cluster_threshold:  This represents the minimum number of pixels
8277 %      contained in a hexahedra before it can be considered valid (expressed as
8278 %      a percentage).
8279 %
8280 %    o smooth_threshold: the smoothing threshold eliminates noise in the second
8281 %      derivative of the histogram.  As the value is increased, you can expect a
8282 %      smoother second derivative.
8283 %
8284 */
8285 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8286   const ColorspaceType colorspace,const MagickBooleanType verbose,
8287   const double cluster_threshold,const double smooth_threshold)
8288 {
8289   MagickBooleanType
8290     status;
8291
8292   assert(wand != (MagickWand *) NULL);
8293   assert(wand->signature == WandSignature);
8294   if (wand->debug != MagickFalse)
8295     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8296   if (wand->images == (Image *) NULL)
8297     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8298   status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8299     smooth_threshold);
8300   if (status == MagickFalse)
8301     InheritException(wand->exception,&wand->images->exception);
8302   return(status);
8303 }
8304 \f
8305 /*
8306 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8307 %                                                                             %
8308 %                                                                             %
8309 %                                                                             %
8310 %   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8311 %                                                                             %
8312 %                                                                             %
8313 %                                                                             %
8314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8315 %
8316 %  MagickSelectiveBlurImage() selectively blur an image within a contrast
8317 %  threshold. It is similar to the unsharpen mask that sharpens everything with
8318 %  contrast above a certain threshold.
8319 %
8320 %  The format of the MagickSelectiveBlurImage method is:
8321 %
8322 %      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8323 %        const double radius,const double sigma,const double threshold)
8324 %
8325 %  A description of each parameter follows:
8326 %
8327 %    o wand: the magick wand.
8328 %
8329 %    o radius: the radius of the gaussian, in pixels, not counting the center
8330 %      pixel.
8331 %
8332 %    o sigma: the standard deviation of the gaussian, in pixels.
8333 %
8334 %    o threshold: only pixels within this contrast threshold are included
8335 %      in the blur operation.
8336 %
8337 */
8338 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8339   const double radius,const double sigma,const double threshold)
8340 {
8341   Image
8342     *blur_image;
8343
8344   assert(wand != (MagickWand *) NULL);
8345   assert(wand->signature == WandSignature);
8346   if (wand->debug != MagickFalse)
8347     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8348   if (wand->images == (Image *) NULL)
8349     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8350   blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
8351     wand->exception);
8352   if (blur_image == (Image *) NULL)
8353     return(MagickFalse);
8354   ReplaceImageInList(&wand->images,blur_image);
8355   return(MagickTrue);
8356 }
8357 \f
8358 /*
8359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8360 %                                                                             %
8361 %                                                                             %
8362 %                                                                             %
8363 %   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                       %
8364 %                                                                             %
8365 %                                                                             %
8366 %                                                                             %
8367 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8368 %
8369 %  MagickSeparateImage() separates a channel from the image and returns a
8370 %  grayscale image.  A channel is a particular color component of each pixel
8371 %  in the image.
8372 %
8373 %  The format of the MagickSeparateImage method is:
8374 %
8375 %      MagickBooleanType MagickSeparateImage(MagickWand *wand)
8376 %
8377 %  A description of each parameter follows:
8378 %
8379 %    o wand: the magick wand.
8380 %
8381 */
8382 WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand)
8383 {
8384   MagickBooleanType
8385     status;
8386
8387   assert(wand != (MagickWand *) NULL);
8388   assert(wand->signature == WandSignature);
8389   if (wand->debug != MagickFalse)
8390     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8391   if (wand->images == (Image *) NULL)
8392     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8393   status=SeparateImage(wand->images);
8394   if (status == MagickFalse)
8395     InheritException(wand->exception,&wand->images->exception);
8396   return(status);
8397 }
8398 \f
8399 /*
8400 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8401 %                                                                             %
8402 %                                                                             %
8403 %                                                                             %
8404 %     M a g i c k S e p i a T o n e I m a g e                                 %
8405 %                                                                             %
8406 %                                                                             %
8407 %                                                                             %
8408 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8409 %
8410 %  MagickSepiaToneImage() applies a special effect to the image, similar to the
8411 %  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8412 %  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8413 %  threshold of 80% is a good starting point for a reasonable tone.
8414 %
8415 %  The format of the MagickSepiaToneImage method is:
8416 %
8417 %      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8418 %        const double threshold)
8419 %
8420 %  A description of each parameter follows:
8421 %
8422 %    o wand: the magick wand.
8423 %
8424 %    o threshold:  Define the extent of the sepia toning.
8425 %
8426 */
8427 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8428   const double threshold)
8429 {
8430   Image
8431     *sepia_image;
8432
8433   assert(wand != (MagickWand *) NULL);
8434   assert(wand->signature == WandSignature);
8435   if (wand->debug != MagickFalse)
8436     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8437   if (wand->images == (Image *) NULL)
8438     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8439   sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8440   if (sepia_image == (Image *) NULL)
8441     return(MagickFalse);
8442   ReplaceImageInList(&wand->images,sepia_image);
8443   return(MagickTrue);
8444 }
8445 \f
8446 /*
8447 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8448 %                                                                             %
8449 %                                                                             %
8450 %                                                                             %
8451 %   M a g i c k S e t I m a g e                                               %
8452 %                                                                             %
8453 %                                                                             %
8454 %                                                                             %
8455 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8456 %
8457 %  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8458 %  MagickNextImage(), MagickPreviousImage() with the images from the specified
8459 %  wand.
8460 %
8461 %  The format of the MagickSetImage method is:
8462 %
8463 %      MagickBooleanType MagickSetImage(MagickWand *wand,
8464 %        const MagickWand *set_wand)
8465 %
8466 %  A description of each parameter follows:
8467 %
8468 %    o wand: the magick wand.
8469 %
8470 %    o set_wand: the set_wand wand.
8471 %
8472 */
8473 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8474   const MagickWand *set_wand)
8475 {
8476   Image
8477     *images;
8478
8479   assert(wand != (MagickWand *) NULL);
8480   assert(wand->signature == WandSignature);
8481   if (wand->debug != MagickFalse)
8482     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8483   assert(set_wand != (MagickWand *) NULL);
8484   assert(set_wand->signature == WandSignature);
8485   if (wand->debug != MagickFalse)
8486     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8487   if (set_wand->images == (Image *) NULL)
8488     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8489   images=CloneImageList(set_wand->images,wand->exception);
8490   if (images == (Image *) NULL)
8491     return(MagickFalse);
8492   ReplaceImageInList(&wand->images,images);
8493   return(MagickTrue);
8494 }
8495 \f
8496 /*
8497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8498 %                                                                             %
8499 %                                                                             %
8500 %                                                                             %
8501 %   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                       %
8502 %                                                                             %
8503 %                                                                             %
8504 %                                                                             %
8505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8506 %
8507 %  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8508 %  alpha channel.
8509 %
8510 %  The format of the MagickSetImageAlphaChannel method is:
8511 %
8512 %      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8513 %        const AlphaChannelType alpha_type)
8514 %
8515 %  A description of each parameter follows:
8516 %
8517 %    o wand: the magick wand.
8518 %
8519 %    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8520 %      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8521 %
8522 */
8523 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8524   const AlphaChannelType alpha_type)
8525 {
8526   assert(wand != (MagickWand *) NULL);
8527   assert(wand->signature == WandSignature);
8528   if (wand->debug != MagickFalse)
8529     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8530   if (wand->images == (Image *) NULL)
8531     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8532   return(SetImageAlphaChannel(wand->images,alpha_type,&wand->images->exception));
8533 }
8534 \f
8535 /*
8536 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8537 %                                                                             %
8538 %                                                                             %
8539 %                                                                             %
8540 %   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                 %
8541 %                                                                             %
8542 %                                                                             %
8543 %                                                                             %
8544 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8545 %
8546 %  MagickSetImageBackgroundColor() sets the image background color.
8547 %
8548 %  The format of the MagickSetImageBackgroundColor method is:
8549 %
8550 %      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8551 %        const PixelWand *background)
8552 %
8553 %  A description of each parameter follows:
8554 %
8555 %    o wand: the magick wand.
8556 %
8557 %    o background: the background pixel wand.
8558 %
8559 */
8560 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8561   const PixelWand *background)
8562 {
8563   assert(wand != (MagickWand *) NULL);
8564   assert(wand->signature == WandSignature);
8565   if (wand->debug != MagickFalse)
8566     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8567   if (wand->images == (Image *) NULL)
8568     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8569   PixelGetQuantumPacket(background,&wand->images->background_color);
8570   return(MagickTrue);
8571 }
8572 \f
8573 /*
8574 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8575 %                                                                             %
8576 %                                                                             %
8577 %                                                                             %
8578 %   M a g i c k S e t I m a g e B i a s                                       %
8579 %                                                                             %
8580 %                                                                             %
8581 %                                                                             %
8582 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8583 %
8584 %  MagickSetImageBias() sets the image bias for any method that convolves an
8585 %  image (e.g. MagickConvolveImage()).
8586 %
8587 %  The format of the MagickSetImageBias method is:
8588 %
8589 %      MagickBooleanType MagickSetImageBias(MagickWand *wand,
8590 %        const double bias)
8591 %
8592 %  A description of each parameter follows:
8593 %
8594 %    o wand: the magick wand.
8595 %
8596 %    o bias: the image bias.
8597 %
8598 */
8599 WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
8600   const double bias)
8601 {
8602   assert(wand != (MagickWand *) NULL);
8603   assert(wand->signature == WandSignature);
8604   if (wand->debug != MagickFalse)
8605     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8606   if (wand->images == (Image *) NULL)
8607     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8608   wand->images->bias=bias;
8609   return(MagickTrue);
8610 }
8611 \f
8612 /*
8613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8614 %                                                                             %
8615 %                                                                             %
8616 %                                                                             %
8617 %   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                         %
8618 %                                                                             %
8619 %                                                                             %
8620 %                                                                             %
8621 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8622 %
8623 %  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8624 %
8625 %  The format of the MagickSetImageBluePrimary method is:
8626 %
8627 %      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8628 %        const double x,const double y)
8629 %
8630 %  A description of each parameter follows:
8631 %
8632 %    o wand: the magick wand.
8633 %
8634 %    o x: the blue primary x-point.
8635 %
8636 %    o y: the blue primary y-point.
8637 %
8638 */
8639 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8640   const double x,const double y)
8641 {
8642   assert(wand != (MagickWand *) NULL);
8643   assert(wand->signature == WandSignature);
8644   if (wand->debug != MagickFalse)
8645     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8646   if (wand->images == (Image *) NULL)
8647     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8648   wand->images->chromaticity.blue_primary.x=x;
8649   wand->images->chromaticity.blue_primary.y=y;
8650   return(MagickTrue);
8651 }
8652 \f
8653 /*
8654 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8655 %                                                                             %
8656 %                                                                             %
8657 %                                                                             %
8658 %   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                         %
8659 %                                                                             %
8660 %                                                                             %
8661 %                                                                             %
8662 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8663 %
8664 %  MagickSetImageBorderColor() sets the image border color.
8665 %
8666 %  The format of the MagickSetImageBorderColor method is:
8667 %
8668 %      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8669 %        const PixelWand *border)
8670 %
8671 %  A description of each parameter follows:
8672 %
8673 %    o wand: the magick wand.
8674 %
8675 %    o border: the border pixel wand.
8676 %
8677 */
8678 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8679   const PixelWand *border)
8680 {
8681   assert(wand != (MagickWand *) NULL);
8682   assert(wand->signature == WandSignature);
8683   if (wand->debug != MagickFalse)
8684     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8685   if (wand->images == (Image *) NULL)
8686     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8687   PixelGetQuantumPacket(border,&wand->images->border_color);
8688   return(MagickTrue);
8689 }
8690 \f
8691 /*
8692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8693 %                                                                             %
8694 %                                                                             %
8695 %                                                                             %
8696 %   M a g i c k S e t I m a g e C l i p M a s k                               %
8697 %                                                                             %
8698 %                                                                             %
8699 %                                                                             %
8700 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8701 %
8702 %  MagickSetImageClipMask() sets image clip mask.
8703 %
8704 %  The format of the MagickSetImageClipMask method is:
8705 %
8706 %      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8707 %        const MagickWand *clip_mask)
8708 %
8709 %  A description of each parameter follows:
8710 %
8711 %    o wand: the magick wand.
8712 %
8713 %    o clip_mask: the clip_mask wand.
8714 %
8715 */
8716 WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8717   const MagickWand *clip_mask)
8718 {
8719   assert(wand != (MagickWand *) NULL);
8720   assert(wand->signature == WandSignature);
8721   if (wand->debug != MagickFalse)
8722     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8723   assert(clip_mask != (MagickWand *) NULL);
8724   assert(clip_mask->signature == WandSignature);
8725   if (wand->debug != MagickFalse)
8726     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
8727   if (clip_mask->images == (Image *) NULL)
8728     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8729   return(SetImageClipMask(wand->images,clip_mask->images));
8730 }
8731 \f
8732 /*
8733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8734 %                                                                             %
8735 %                                                                             %
8736 %                                                                             %
8737 %   M a g i c k S e t I m a g e C o l o r                                     %
8738 %                                                                             %
8739 %                                                                             %
8740 %                                                                             %
8741 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8742 %
8743 %  MagickSetImageColor() set the entire wand canvas to the specified color.
8744 %
8745 %  The format of the MagickSetImageColor method is:
8746 %
8747 %      MagickBooleanType MagickSetImageColor(MagickWand *wand,
8748 %        const PixelWand *color)
8749 %
8750 %  A description of each parameter follows:
8751 %
8752 %    o wand: the magick wand.
8753 %
8754 %    o background: the image color.
8755 %
8756 */
8757 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
8758   const PixelWand *color)
8759 {
8760   MagickBooleanType
8761     status;
8762
8763   PixelInfo
8764     pixel;
8765
8766   assert(wand != (MagickWand *) NULL);
8767   assert(wand->signature == WandSignature);
8768   if (wand->debug != MagickFalse)
8769     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8770   PixelGetMagickColor(color,&pixel);
8771   status=SetImageColor(wand->images,&pixel);
8772   if (status == MagickFalse)
8773     InheritException(wand->exception,&wand->images->exception);
8774   return(status);
8775 }
8776 \f
8777 /*
8778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8779 %                                                                             %
8780 %                                                                             %
8781 %                                                                             %
8782 %   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                     %
8783 %                                                                             %
8784 %                                                                             %
8785 %                                                                             %
8786 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8787 %
8788 %  MagickSetImageColormapColor() sets the color of the specified colormap
8789 %  index.
8790 %
8791 %  The format of the MagickSetImageColormapColor method is:
8792 %
8793 %      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8794 %        const size_t index,const PixelWand *color)
8795 %
8796 %  A description of each parameter follows:
8797 %
8798 %    o wand: the magick wand.
8799 %
8800 %    o index: the offset into the image colormap.
8801 %
8802 %    o color: Return the colormap color in this wand.
8803 %
8804 */
8805 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8806   const size_t index,const PixelWand *color)
8807 {
8808   assert(wand != (MagickWand *) NULL);
8809   assert(wand->signature == WandSignature);
8810   if (wand->debug != MagickFalse)
8811     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8812   if (wand->images == (Image *) NULL)
8813     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8814   if ((wand->images->colormap == (PixelPacket *) NULL) ||
8815       (index >= wand->images->colors))
8816     ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
8817   PixelGetQuantumPacket(color,wand->images->colormap+index);
8818   return(SyncImage(wand->images));
8819 }
8820 \f
8821 /*
8822 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8823 %                                                                             %
8824 %                                                                             %
8825 %                                                                             %
8826 %   M a g i c k S e t I m a g e C o l o r s p a c e                           %
8827 %                                                                             %
8828 %                                                                             %
8829 %                                                                             %
8830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8831 %
8832 %  MagickSetImageColorspace() sets the image colorspace.
8833 %
8834 %  The format of the MagickSetImageColorspace method is:
8835 %
8836 %      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8837 %        const ColorspaceType colorspace)
8838 %
8839 %  A description of each parameter follows:
8840 %
8841 %    o wand: the magick wand.
8842 %
8843 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
8844 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
8845 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
8846 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
8847 %      HSLColorspace, or HWBColorspace.
8848 %
8849 */
8850 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8851   const ColorspaceType colorspace)
8852 {
8853   assert(wand != (MagickWand *) NULL);
8854   assert(wand->signature == WandSignature);
8855   if (wand->debug != MagickFalse)
8856     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8857   if (wand->images == (Image *) NULL)
8858     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8859   return(SetImageColorspace(wand->images,colorspace,&wand->images->exception));
8860 }
8861 \f
8862 /*
8863 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8864 %                                                                             %
8865 %                                                                             %
8866 %                                                                             %
8867 %   M a g i c k S e t I m a g e C o m p o s e                                 %
8868 %                                                                             %
8869 %                                                                             %
8870 %                                                                             %
8871 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8872 %
8873 %  MagickSetImageCompose() sets the image composite operator, useful for
8874 %  specifying how to composite the image thumbnail when using the
8875 %  MagickMontageImage() method.
8876 %
8877 %  The format of the MagickSetImageCompose method is:
8878 %
8879 %      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8880 %        const CompositeOperator compose)
8881 %
8882 %  A description of each parameter follows:
8883 %
8884 %    o wand: the magick wand.
8885 %
8886 %    o compose: the image composite operator.
8887 %
8888 */
8889 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8890   const CompositeOperator compose)
8891 {
8892   assert(wand != (MagickWand *) NULL);
8893   assert(wand->signature == WandSignature);
8894   if (wand->debug != MagickFalse)
8895     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8896   if (wand->images == (Image *) NULL)
8897     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8898   wand->images->compose=compose;
8899   return(MagickTrue);
8900 }
8901 \f
8902 /*
8903 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8904 %                                                                             %
8905 %                                                                             %
8906 %                                                                             %
8907 %   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                         %
8908 %                                                                             %
8909 %                                                                             %
8910 %                                                                             %
8911 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8912 %
8913 %  MagickSetImageCompression() sets the image compression.
8914 %
8915 %  The format of the MagickSetImageCompression method is:
8916 %
8917 %      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8918 %        const CompressionType compression)
8919 %
8920 %  A description of each parameter follows:
8921 %
8922 %    o wand: the magick wand.
8923 %
8924 %    o compression: the image compression type.
8925 %
8926 */
8927 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8928   const CompressionType compression)
8929 {
8930   assert(wand != (MagickWand *) NULL);
8931   assert(wand->signature == WandSignature);
8932   if (wand->debug != MagickFalse)
8933     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8934   if (wand->images == (Image *) NULL)
8935     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8936   wand->images->compression=compression;
8937   return(MagickTrue);
8938 }
8939 \f
8940 /*
8941 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8942 %                                                                             %
8943 %                                                                             %
8944 %                                                                             %
8945 %   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           %
8946 %                                                                             %
8947 %                                                                             %
8948 %                                                                             %
8949 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8950 %
8951 %  MagickSetImageCompressionQuality() sets the image compression quality.
8952 %
8953 %  The format of the MagickSetImageCompressionQuality method is:
8954 %
8955 %      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
8956 %        const size_t quality)
8957 %
8958 %  A description of each parameter follows:
8959 %
8960 %    o wand: the magick wand.
8961 %
8962 %    o quality: the image compression tlityype.
8963 %
8964 */
8965 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
8966   const size_t quality)
8967 {
8968   assert(wand != (MagickWand *) NULL);
8969   assert(wand->signature == WandSignature);
8970   if (wand->debug != MagickFalse)
8971     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8972   if (wand->images == (Image *) NULL)
8973     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8974   wand->images->quality=quality;
8975   return(MagickTrue);
8976 }
8977 \f
8978 /*
8979 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8980 %                                                                             %
8981 %                                                                             %
8982 %                                                                             %
8983 %   M a g i c k S e t I m a g e D e l a y                                     %
8984 %                                                                             %
8985 %                                                                             %
8986 %                                                                             %
8987 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8988 %
8989 %  MagickSetImageDelay() sets the image delay.
8990 %
8991 %  The format of the MagickSetImageDelay method is:
8992 %
8993 %      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
8994 %        const size_t delay)
8995 %
8996 %  A description of each parameter follows:
8997 %
8998 %    o wand: the magick wand.
8999 %
9000 %    o delay: the image delay in ticks-per-second units.
9001 %
9002 */
9003 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9004   const size_t delay)
9005 {
9006   assert(wand != (MagickWand *) NULL);
9007   assert(wand->signature == WandSignature);
9008   if (wand->debug != MagickFalse)
9009     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9010   if (wand->images == (Image *) NULL)
9011     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9012   wand->images->delay=delay;
9013   return(MagickTrue);
9014 }
9015 \f
9016 /*
9017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9018 %                                                                             %
9019 %                                                                             %
9020 %                                                                             %
9021 %   M a g i c k S e t I m a g e D e p t h                                     %
9022 %                                                                             %
9023 %                                                                             %
9024 %                                                                             %
9025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9026 %
9027 %  MagickSetImageDepth() sets the image depth.
9028 %
9029 %  The format of the MagickSetImageDepth method is:
9030 %
9031 %      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9032 %        const size_t depth)
9033 %
9034 %  A description of each parameter follows:
9035 %
9036 %    o wand: the magick wand.
9037 %
9038 %    o depth: the image depth in bits: 8, 16, or 32.
9039 %
9040 */
9041 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9042   const size_t depth)
9043 {
9044   assert(wand != (MagickWand *) NULL);
9045   assert(wand->signature == WandSignature);
9046   if (wand->debug != MagickFalse)
9047     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9048   if (wand->images == (Image *) NULL)
9049     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9050   return(SetImageDepth(wand->images,depth));
9051 }
9052 \f
9053 /*
9054 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9055 %                                                                             %
9056 %                                                                             %
9057 %                                                                             %
9058 %   M a g i c k S e t I m a g e D i s p o s e                                 %
9059 %                                                                             %
9060 %                                                                             %
9061 %                                                                             %
9062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9063 %
9064 %  MagickSetImageDispose() sets the image disposal method.
9065 %
9066 %  The format of the MagickSetImageDispose method is:
9067 %
9068 %      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9069 %        const DisposeType dispose)
9070 %
9071 %  A description of each parameter follows:
9072 %
9073 %    o wand: the magick wand.
9074 %
9075 %    o dispose: the image disposeal type.
9076 %
9077 */
9078 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9079   const DisposeType dispose)
9080 {
9081   assert(wand != (MagickWand *) NULL);
9082   assert(wand->signature == WandSignature);
9083   if (wand->debug != MagickFalse)
9084     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9085   if (wand->images == (Image *) NULL)
9086     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9087   wand->images->dispose=dispose;
9088   return(MagickTrue);
9089 }
9090 \f
9091 /*
9092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9093 %                                                                             %
9094 %                                                                             %
9095 %                                                                             %
9096 %   M a g i c k S e t I m a g e E x t e n t                                   %
9097 %                                                                             %
9098 %                                                                             %
9099 %                                                                             %
9100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9101 %
9102 %  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9103 %
9104 %  The format of the MagickSetImageExtent method is:
9105 %
9106 %      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9107 %        const size_t columns,const unsigned rows)
9108 %
9109 %  A description of each parameter follows:
9110 %
9111 %    o wand: the magick wand.
9112 %
9113 %    o columns:  The image width in pixels.
9114 %
9115 %    o rows:  The image height in pixels.
9116 %
9117 */
9118 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9119   const size_t columns,const size_t rows)
9120 {
9121   assert(wand != (MagickWand *) NULL);
9122   assert(wand->signature == WandSignature);
9123   if (wand->debug != MagickFalse)
9124     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9125   if (wand->images == (Image *) NULL)
9126     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9127   return(SetImageExtent(wand->images,columns,rows,&wand->images->exception));
9128 }
9129 \f
9130 /*
9131 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9132 %                                                                             %
9133 %                                                                             %
9134 %                                                                             %
9135 %   M a g i c k S e t I m a g e F i l e n a m e                               %
9136 %                                                                             %
9137 %                                                                             %
9138 %                                                                             %
9139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9140 %
9141 %  MagickSetImageFilename() sets the filename of a particular image in a
9142 %  sequence.
9143 %
9144 %  The format of the MagickSetImageFilename method is:
9145 %
9146 %      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9147 %        const char *filename)
9148 %
9149 %  A description of each parameter follows:
9150 %
9151 %    o wand: the magick wand.
9152 %
9153 %    o filename: the image filename.
9154 %
9155 */
9156 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9157   const char *filename)
9158 {
9159   assert(wand != (MagickWand *) NULL);
9160   assert(wand->signature == WandSignature);
9161   if (wand->debug != MagickFalse)
9162     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9163   if (wand->images == (Image *) NULL)
9164     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9165   if (filename != (const char *) NULL)
9166     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9167   return(MagickTrue);
9168 }
9169 \f
9170 /*
9171 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9172 %                                                                             %
9173 %                                                                             %
9174 %                                                                             %
9175 %   M a g i c k S e t I m a g e F o r m a t                                   %
9176 %                                                                             %
9177 %                                                                             %
9178 %                                                                             %
9179 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9180 %
9181 %  MagickSetImageFormat() sets the format of a particular image in a
9182 %  sequence.
9183 %
9184 %  The format of the MagickSetImageFormat method is:
9185 %
9186 %      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9187 %        const char *format)
9188 %
9189 %  A description of each parameter follows:
9190 %
9191 %    o wand: the magick wand.
9192 %
9193 %    o format: the image format.
9194 %
9195 */
9196 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9197   const char *format)
9198 {
9199   const MagickInfo
9200     *magick_info;
9201
9202   assert(wand != (MagickWand *) NULL);
9203   assert(wand->signature == WandSignature);
9204   if (wand->debug != MagickFalse)
9205     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9206   if (wand->images == (Image *) NULL)
9207     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9208   if ((format == (char *) NULL) || (*format == '\0'))
9209     {
9210       *wand->images->magick='\0';
9211       return(MagickTrue);
9212     }
9213   magick_info=GetMagickInfo(format,wand->exception);
9214   if (magick_info == (const MagickInfo *) NULL)
9215     return(MagickFalse);
9216   ClearMagickException(wand->exception);
9217   (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9218   return(MagickTrue);
9219 }
9220 \f
9221 /*
9222 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9223 %                                                                             %
9224 %                                                                             %
9225 %                                                                             %
9226 %   M a g i c k S e t I m a g e F u z z                                       %
9227 %                                                                             %
9228 %                                                                             %
9229 %                                                                             %
9230 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9231 %
9232 %  MagickSetImageFuzz() sets the image fuzz.
9233 %
9234 %  The format of the MagickSetImageFuzz method is:
9235 %
9236 %      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9237 %        const double fuzz)
9238 %
9239 %  A description of each parameter follows:
9240 %
9241 %    o wand: the magick wand.
9242 %
9243 %    o fuzz: the image fuzz.
9244 %
9245 */
9246 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9247   const double fuzz)
9248 {
9249   assert(wand != (MagickWand *) NULL);
9250   assert(wand->signature == WandSignature);
9251   if (wand->debug != MagickFalse)
9252     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9253   if (wand->images == (Image *) NULL)
9254     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9255   wand->images->fuzz=fuzz;
9256   return(MagickTrue);
9257 }
9258 \f
9259 /*
9260 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9261 %                                                                             %
9262 %                                                                             %
9263 %                                                                             %
9264 %   M a g i c k S e t I m a g e G a m m a                                     %
9265 %                                                                             %
9266 %                                                                             %
9267 %                                                                             %
9268 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9269 %
9270 %  MagickSetImageGamma() sets the image gamma.
9271 %
9272 %  The format of the MagickSetImageGamma method is:
9273 %
9274 %      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9275 %        const double gamma)
9276 %
9277 %  A description of each parameter follows:
9278 %
9279 %    o wand: the magick wand.
9280 %
9281 %    o gamma: the image gamma.
9282 %
9283 */
9284 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9285   const double gamma)
9286 {
9287   assert(wand != (MagickWand *) NULL);
9288   assert(wand->signature == WandSignature);
9289   if (wand->debug != MagickFalse)
9290     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9291   if (wand->images == (Image *) NULL)
9292     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9293   wand->images->gamma=gamma;
9294   return(MagickTrue);
9295 }
9296 \f
9297 /*
9298 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9299 %                                                                             %
9300 %                                                                             %
9301 %                                                                             %
9302 %   M a g i c k S e t I m a g e G r a v i t y                                 %
9303 %                                                                             %
9304 %                                                                             %
9305 %                                                                             %
9306 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9307 %
9308 %  MagickSetImageGravity() sets the image gravity type.
9309 %
9310 %  The format of the MagickSetImageGravity method is:
9311 %
9312 %      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9313 %        const GravityType gravity)
9314 %
9315 %  A description of each parameter follows:
9316 %
9317 %    o wand: the magick wand.
9318 %
9319 %    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9320 %      PlaneInterlace, PartitionInterlace.
9321 %
9322 */
9323 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9324   const GravityType gravity)
9325 {
9326   assert(wand != (MagickWand *) NULL);
9327   assert(wand->signature == WandSignature);
9328   if (wand->debug != MagickFalse)
9329     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9330   if (wand->images == (Image *) NULL)
9331     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9332   wand->images->gravity=gravity;
9333   return(MagickTrue);
9334 }
9335 \f
9336 /*
9337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9338 %                                                                             %
9339 %                                                                             %
9340 %                                                                             %
9341 %   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                       %
9342 %                                                                             %
9343 %                                                                             %
9344 %                                                                             %
9345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9346 %
9347 %  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9348 %  point.
9349 %
9350 %  The format of the MagickSetImageGreenPrimary method is:
9351 %
9352 %      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9353 %        const double x,const double y)
9354 %
9355 %  A description of each parameter follows:
9356 %
9357 %    o wand: the magick wand.
9358 %
9359 %    o x: the green primary x-point.
9360 %
9361 %    o y: the green primary y-point.
9362 %
9363 %
9364 */
9365 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9366   const double x,const double y)
9367 {
9368   assert(wand != (MagickWand *) NULL);
9369   assert(wand->signature == WandSignature);
9370   if (wand->debug != MagickFalse)
9371     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9372   if (wand->images == (Image *) NULL)
9373     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9374   wand->images->chromaticity.green_primary.x=x;
9375   wand->images->chromaticity.green_primary.y=y;
9376   return(MagickTrue);
9377 }
9378 \f
9379 /*
9380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9381 %                                                                             %
9382 %                                                                             %
9383 %                                                                             %
9384 %   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                 %
9385 %                                                                             %
9386 %                                                                             %
9387 %                                                                             %
9388 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9389 %
9390 %  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9391 %
9392 %  The format of the MagickSetImageInterlaceScheme method is:
9393 %
9394 %      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9395 %        const InterlaceType interlace)
9396 %
9397 %  A description of each parameter follows:
9398 %
9399 %    o wand: the magick wand.
9400 %
9401 %    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9402 %      PlaneInterlace, PartitionInterlace.
9403 %
9404 */
9405 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9406   const InterlaceType interlace)
9407 {
9408   assert(wand != (MagickWand *) NULL);
9409   assert(wand->signature == WandSignature);
9410   if (wand->debug != MagickFalse)
9411     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9412   if (wand->images == (Image *) NULL)
9413     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9414   wand->images->interlace=interlace;
9415   return(MagickTrue);
9416 }
9417 \f
9418 /*
9419 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9420 %                                                                             %
9421 %                                                                             %
9422 %                                                                             %
9423 %   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             %
9424 %                                                                             %
9425 %                                                                             %
9426 %                                                                             %
9427 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9428 %
9429 %  MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
9430 %
9431 %  The format of the MagickSetImageInterpolateMethod method is:
9432 %
9433 %      MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
9434 %        const InterpolatePixelMethod method)
9435 %
9436 %  A description of each parameter follows:
9437 %
9438 %    o wand: the magick wand.
9439 %
9440 %    o method: the image interpole pixel methods: choose from Undefined,
9441 %      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9442 %
9443 */
9444 WandExport MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
9445   const InterpolatePixelMethod method)
9446 {
9447   assert(wand != (MagickWand *) NULL);
9448   assert(wand->signature == WandSignature);
9449   if (wand->debug != MagickFalse)
9450     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9451   if (wand->images == (Image *) NULL)
9452     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9453   wand->images->interpolate=method;
9454   return(MagickTrue);
9455 }
9456 \f
9457 /*
9458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9459 %                                                                             %
9460 %                                                                             %
9461 %                                                                             %
9462 %   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9463 %                                                                             %
9464 %                                                                             %
9465 %                                                                             %
9466 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9467 %
9468 %  MagickSetImageIterations() sets the image iterations.
9469 %
9470 %  The format of the MagickSetImageIterations method is:
9471 %
9472 %      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9473 %        const size_t iterations)
9474 %
9475 %  A description of each parameter follows:
9476 %
9477 %    o wand: the magick wand.
9478 %
9479 %    o delay: the image delay in 1/100th of a second.
9480 %
9481 */
9482 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9483   const size_t iterations)
9484 {
9485   assert(wand != (MagickWand *) NULL);
9486   assert(wand->signature == WandSignature);
9487   if (wand->debug != MagickFalse)
9488     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9489   if (wand->images == (Image *) NULL)
9490     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9491   wand->images->iterations=iterations;
9492   return(MagickTrue);
9493 }
9494 \f
9495 /*
9496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9497 %                                                                             %
9498 %                                                                             %
9499 %                                                                             %
9500 %   M a g i c k S e t I m a g e M a t t e                                     %
9501 %                                                                             %
9502 %                                                                             %
9503 %                                                                             %
9504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9505 %
9506 %  MagickSetImageMatte() sets the image matte channel.
9507 %
9508 %  The format of the MagickSetImageMatteColor method is:
9509 %
9510 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9511 %        const MagickBooleanType *matte)
9512 %
9513 %  A description of each parameter follows:
9514 %
9515 %    o wand: the magick wand.
9516 %
9517 %    o matte: Set to MagickTrue to enable the image matte channel otherwise
9518 %      MagickFalse.
9519 %
9520 */
9521 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9522   const MagickBooleanType matte)
9523 {
9524   assert(wand != (MagickWand *) NULL);
9525   assert(wand->signature == WandSignature);
9526   if (wand->debug != MagickFalse)
9527     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9528   if (wand->images == (Image *) NULL)
9529     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9530   if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
9531     (void) SetImageOpacity(wand->images,OpaqueAlpha);
9532   wand->images->matte=matte;
9533   return(MagickTrue);
9534 }
9535 \f
9536 /*
9537 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9538 %                                                                             %
9539 %                                                                             %
9540 %                                                                             %
9541 %   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9542 %                                                                             %
9543 %                                                                             %
9544 %                                                                             %
9545 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9546 %
9547 %  MagickSetImageMatteColor() sets the image matte color.
9548 %
9549 %  The format of the MagickSetImageMatteColor method is:
9550 %
9551 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9552 %        const PixelWand *matte)
9553 %
9554 %  A description of each parameter follows:
9555 %
9556 %    o wand: the magick wand.
9557 %
9558 %    o matte: the matte pixel wand.
9559 %
9560 */
9561 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9562   const PixelWand *matte)
9563 {
9564   assert(wand != (MagickWand *) NULL);
9565   assert(wand->signature == WandSignature);
9566   if (wand->debug != MagickFalse)
9567     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9568   if (wand->images == (Image *) NULL)
9569     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9570   PixelGetQuantumPacket(matte,&wand->images->matte_color);
9571   return(MagickTrue);
9572 }
9573 \f
9574 /*
9575 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9576 %                                                                             %
9577 %                                                                             %
9578 %                                                                             %
9579 %   M a g i c k S e t I m a g e O p a c i t y                                 %
9580 %                                                                             %
9581 %                                                                             %
9582 %                                                                             %
9583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9584 %
9585 %  MagickSetImageOpacity() sets the image to the specified opacity level.
9586 %
9587 %  The format of the MagickSetImageOpacity method is:
9588 %
9589 %      MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
9590 %        const double alpha)
9591 %
9592 %  A description of each parameter follows:
9593 %
9594 %    o wand: the magick wand.
9595 %
9596 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9597 %      transparent.
9598 %
9599 */
9600 WandExport MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
9601   const double alpha)
9602 {
9603   MagickBooleanType
9604     status;
9605
9606   assert(wand != (MagickWand *) NULL);
9607   assert(wand->signature == WandSignature);
9608   if (wand->debug != MagickFalse)
9609     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9610   if (wand->images == (Image *) NULL)
9611     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9612   status=SetImageOpacity(wand->images,ClampToQuantum(QuantumRange*alpha));
9613   if (status == MagickFalse)
9614     InheritException(wand->exception,&wand->images->exception);
9615   return(status);
9616 }
9617 \f
9618 /*
9619 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9620 %                                                                             %
9621 %                                                                             %
9622 %                                                                             %
9623 %   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                         %
9624 %                                                                             %
9625 %                                                                             %
9626 %                                                                             %
9627 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9628 %
9629 %  MagickSetImageOrientation() sets the image orientation.
9630 %
9631 %  The format of the MagickSetImageOrientation method is:
9632 %
9633 %      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9634 %        const OrientationType orientation)
9635 %
9636 %  A description of each parameter follows:
9637 %
9638 %    o wand: the magick wand.
9639 %
9640 %    o orientation: the image orientation type.
9641 %
9642 */
9643 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9644   const OrientationType orientation)
9645 {
9646   assert(wand != (MagickWand *) NULL);
9647   assert(wand->signature == WandSignature);
9648   if (wand->debug != MagickFalse)
9649     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9650   if (wand->images == (Image *) NULL)
9651     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9652   wand->images->orientation=orientation;
9653   return(MagickTrue);
9654 }
9655 \f
9656 /*
9657 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9658 %                                                                             %
9659 %                                                                             %
9660 %                                                                             %
9661 %   M a g i c k S e t I m a g e P a g e                                       %
9662 %                                                                             %
9663 %                                                                             %
9664 %                                                                             %
9665 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9666 %
9667 %  MagickSetImagePage() sets the page geometry of the image.
9668 %
9669 %  The format of the MagickSetImagePage method is:
9670 %
9671 %      MagickBooleanType MagickSetImagePage(MagickWand *wand,
9672 %        const size_t width,const size_t height,const ssize_t x,
9673 %        const ssize_t y)
9674 %
9675 %  A description of each parameter follows:
9676 %
9677 %    o wand: the magick wand.
9678 %
9679 %    o width: the page width.
9680 %
9681 %    o height: the page height.
9682 %
9683 %    o x: the page x-offset.
9684 %
9685 %    o y: the page y-offset.
9686 %
9687 */
9688 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
9689   const size_t width,const size_t height,const ssize_t x,
9690   const ssize_t y)
9691 {
9692   assert(wand != (MagickWand *) NULL);
9693   assert(wand->signature == WandSignature);
9694   if (wand->debug != MagickFalse)
9695     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9696   if (wand->images == (Image *) NULL)
9697     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9698   wand->images->page.width=width;
9699   wand->images->page.height=height;
9700   wand->images->page.x=x;
9701   wand->images->page.y=y;
9702   return(MagickTrue);
9703 }
9704 \f
9705 /*
9706 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9707 %                                                                             %
9708 %                                                                             %
9709 %                                                                             %
9710 %   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                 %
9711 %                                                                             %
9712 %                                                                             %
9713 %                                                                             %
9714 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9715 %
9716 %  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
9717 %  specified method and returns the previous progress monitor if any.  The
9718 %  progress monitor method looks like this:
9719 %
9720 %    MagickBooleanType MagickProgressMonitor(const char *text,
9721 %      const MagickOffsetType offset,const MagickSizeType span,
9722 %      void *client_data)
9723 %
9724 %  If the progress monitor returns MagickFalse, the current operation is
9725 %  interrupted.
9726 %
9727 %  The format of the MagickSetImageProgressMonitor method is:
9728 %
9729 %      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
9730 %        const MagickProgressMonitor progress_monitor,void *client_data)
9731 %
9732 %  A description of each parameter follows:
9733 %
9734 %    o wand: the magick wand.
9735 %
9736 %    o progress_monitor: Specifies a pointer to a method to monitor progress
9737 %      of an image operation.
9738 %
9739 %    o client_data: Specifies a pointer to any client data.
9740 %
9741 */
9742 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
9743   const MagickProgressMonitor progress_monitor,void *client_data)
9744 {
9745   MagickProgressMonitor
9746     previous_monitor;
9747
9748   assert(wand != (MagickWand *) NULL);
9749   assert(wand->signature == WandSignature);
9750   if (wand->debug != MagickFalse)
9751     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9752   if (wand->images == (Image *) NULL)
9753     {
9754       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
9755         "ContainsNoImages","`%s'",wand->name);
9756       return((MagickProgressMonitor) NULL);
9757     }
9758   previous_monitor=SetImageProgressMonitor(wand->images,
9759     progress_monitor,client_data);
9760   return(previous_monitor);
9761 }
9762 \f
9763 /*
9764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9765 %                                                                             %
9766 %                                                                             %
9767 %                                                                             %
9768 %   M a g i c k S e t I m a g e R e d P r i m a r y                           %
9769 %                                                                             %
9770 %                                                                             %
9771 %                                                                             %
9772 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9773 %
9774 %  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
9775 %
9776 %  The format of the MagickSetImageRedPrimary method is:
9777 %
9778 %      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9779 %        const double x,const double y)
9780 %
9781 %  A description of each parameter follows:
9782 %
9783 %    o wand: the magick wand.
9784 %
9785 %    o x: the red primary x-point.
9786 %
9787 %    o y: the red primary y-point.
9788 %
9789 */
9790 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9791   const double x,const double y)
9792 {
9793   assert(wand != (MagickWand *) NULL);
9794   assert(wand->signature == WandSignature);
9795   if (wand->debug != MagickFalse)
9796     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9797   if (wand->images == (Image *) NULL)
9798     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9799   wand->images->chromaticity.red_primary.x=x;
9800   wand->images->chromaticity.red_primary.y=y;
9801   return(MagickTrue);
9802 }
9803 \f
9804 /*
9805 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9806 %                                                                             %
9807 %                                                                             %
9808 %                                                                             %
9809 %   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                 %
9810 %                                                                             %
9811 %                                                                             %
9812 %                                                                             %
9813 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9814 %
9815 %  MagickSetImageRenderingIntent() sets the image rendering intent.
9816 %
9817 %  The format of the MagickSetImageRenderingIntent method is:
9818 %
9819 %      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9820 %        const RenderingIntent rendering_intent)
9821 %
9822 %  A description of each parameter follows:
9823 %
9824 %    o wand: the magick wand.
9825 %
9826 %    o rendering_intent: the image rendering intent: UndefinedIntent,
9827 %      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
9828 %
9829 */
9830 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9831   const RenderingIntent rendering_intent)
9832 {
9833   assert(wand != (MagickWand *) NULL);
9834   assert(wand->signature == WandSignature);
9835   if (wand->debug != MagickFalse)
9836     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9837   if (wand->images == (Image *) NULL)
9838     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9839   wand->images->rendering_intent=rendering_intent;
9840   return(MagickTrue);
9841 }
9842 \f
9843 /*
9844 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9845 %                                                                             %
9846 %                                                                             %
9847 %                                                                             %
9848 %   M a g i c k S e t I m a g e R e s o l u t i o n                           %
9849 %                                                                             %
9850 %                                                                             %
9851 %                                                                             %
9852 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9853 %
9854 %  MagickSetImageResolution() sets the image resolution.
9855 %
9856 %  The format of the MagickSetImageResolution method is:
9857 %
9858 %      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9859 %        const double x_resolution,const doubtl y_resolution)
9860 %
9861 %  A description of each parameter follows:
9862 %
9863 %    o wand: the magick wand.
9864 %
9865 %    o x_resolution: the image x resolution.
9866 %
9867 %    o y_resolution: the image y resolution.
9868 %
9869 */
9870 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9871   const double x_resolution,const double y_resolution)
9872 {
9873   assert(wand != (MagickWand *) NULL);
9874   assert(wand->signature == WandSignature);
9875   if (wand->debug != MagickFalse)
9876     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9877   if (wand->images == (Image *) NULL)
9878     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9879   wand->images->x_resolution=x_resolution;
9880   wand->images->y_resolution=y_resolution;
9881   return(MagickTrue);
9882 }
9883 \f
9884 /*
9885 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9886 %                                                                             %
9887 %                                                                             %
9888 %                                                                             %
9889 %   M a g i c k S e t I m a g e S c e n e                                     %
9890 %                                                                             %
9891 %                                                                             %
9892 %                                                                             %
9893 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9894 %
9895 %  MagickSetImageScene() sets the image scene.
9896 %
9897 %  The format of the MagickSetImageScene method is:
9898 %
9899 %      MagickBooleanType MagickSetImageScene(MagickWand *wand,
9900 %        const size_t scene)
9901 %
9902 %  A description of each parameter follows:
9903 %
9904 %    o wand: the magick wand.
9905 %
9906 %    o delay: the image scene number.
9907 %
9908 */
9909 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
9910   const size_t scene)
9911 {
9912   assert(wand != (MagickWand *) NULL);
9913   assert(wand->signature == WandSignature);
9914   if (wand->debug != MagickFalse)
9915     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9916   if (wand->images == (Image *) NULL)
9917     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9918   wand->images->scene=scene;
9919   return(MagickTrue);
9920 }
9921 \f
9922 /*
9923 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9924 %                                                                             %
9925 %                                                                             %
9926 %                                                                             %
9927 %   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                   %
9928 %                                                                             %
9929 %                                                                             %
9930 %                                                                             %
9931 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9932 %
9933 %  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
9934 %
9935 %  The format of the MagickSetImageTicksPerSecond method is:
9936 %
9937 %      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9938 %        const ssize_t ticks_per-second)
9939 %
9940 %  A description of each parameter follows:
9941 %
9942 %    o wand: the magick wand.
9943 %
9944 %    o ticks_per_second: the units to use for the image delay.
9945 %
9946 */
9947 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9948   const ssize_t ticks_per_second)
9949 {
9950   assert(wand != (MagickWand *) NULL);
9951   assert(wand->signature == WandSignature);
9952   if (wand->debug != MagickFalse)
9953     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9954   if (wand->images == (Image *) NULL)
9955     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9956   wand->images->ticks_per_second=ticks_per_second;
9957   return(MagickTrue);
9958 }
9959 \f
9960 /*
9961 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9962 %                                                                             %
9963 %                                                                             %
9964 %                                                                             %
9965 %   M a g i c k S e t I m a g e T y p e                                       %
9966 %                                                                             %
9967 %                                                                             %
9968 %                                                                             %
9969 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9970 %
9971 %  MagickSetImageType() sets the image type.
9972 %
9973 %  The format of the MagickSetImageType method is:
9974 %
9975 %      MagickBooleanType MagickSetImageType(MagickWand *wand,
9976 %        const ImageType image_type)
9977 %
9978 %  A description of each parameter follows:
9979 %
9980 %    o wand: the magick wand.
9981 %
9982 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
9983 %      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
9984 %      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
9985 %      or OptimizeType.
9986 %
9987 */
9988 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
9989   const ImageType image_type)
9990 {
9991   assert(wand != (MagickWand *) NULL);
9992   assert(wand->signature == WandSignature);
9993   if (wand->debug != MagickFalse)
9994     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9995   if (wand->images == (Image *) NULL)
9996     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9997   return(SetImageType(wand->images,image_type));
9998 }
9999 \f
10000 /*
10001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10002 %                                                                             %
10003 %                                                                             %
10004 %                                                                             %
10005 %   M a g i c k S e t I m a g e U n i t s                                     %
10006 %                                                                             %
10007 %                                                                             %
10008 %                                                                             %
10009 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10010 %
10011 %  MagickSetImageUnits() sets the image units of resolution.
10012 %
10013 %  The format of the MagickSetImageUnits method is:
10014 %
10015 %      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10016 %        const ResolutionType units)
10017 %
10018 %  A description of each parameter follows:
10019 %
10020 %    o wand: the magick wand.
10021 %
10022 %    o units: the image units of resolution : UndefinedResolution,
10023 %      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10024 %
10025 */
10026 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10027   const ResolutionType units)
10028 {
10029   assert(wand != (MagickWand *) NULL);
10030   assert(wand->signature == WandSignature);
10031   if (wand->debug != MagickFalse)
10032     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10033   if (wand->images == (Image *) NULL)
10034     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10035   wand->images->units=units;
10036   return(MagickTrue);
10037 }
10038 \f
10039 /*
10040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10041 %                                                                             %
10042 %                                                                             %
10043 %                                                                             %
10044 %   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           %
10045 %                                                                             %
10046 %                                                                             %
10047 %                                                                             %
10048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10049 %
10050 %  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10051 %
10052 %  The format of the MagickSetImageVirtualPixelMethod method is:
10053 %
10054 %      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10055 %        const VirtualPixelMethod method)
10056 %
10057 %  A description of each parameter follows:
10058 %
10059 %    o wand: the magick wand.
10060 %
10061 %    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10062 %      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10063 %      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10064 %
10065 */
10066 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10067   const VirtualPixelMethod method)
10068 {
10069   assert(wand != (MagickWand *) NULL);
10070   assert(wand->signature == WandSignature);
10071   if (wand->debug != MagickFalse)
10072     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10073   if (wand->images == (Image *) NULL)
10074     return(UndefinedVirtualPixelMethod);
10075   return(SetImageVirtualPixelMethod(wand->images,method));
10076 }
10077 \f
10078 /*
10079 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10080 %                                                                             %
10081 %                                                                             %
10082 %                                                                             %
10083 %   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10084 %                                                                             %
10085 %                                                                             %
10086 %                                                                             %
10087 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10088 %
10089 %  MagickSetImageWhitePoint() sets the image chromaticity white point.
10090 %
10091 %  The format of the MagickSetImageWhitePoint method is:
10092 %
10093 %      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10094 %        const double x,const double y)
10095 %
10096 %  A description of each parameter follows:
10097 %
10098 %    o wand: the magick wand.
10099 %
10100 %    o x: the white x-point.
10101 %
10102 %    o y: the white y-point.
10103 %
10104 */
10105 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10106   const double x,const double y)
10107 {
10108   assert(wand != (MagickWand *) NULL);
10109   assert(wand->signature == WandSignature);
10110   if (wand->debug != MagickFalse)
10111     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10112   if (wand->images == (Image *) NULL)
10113     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10114   wand->images->chromaticity.white_point.x=x;
10115   wand->images->chromaticity.white_point.y=y;
10116   return(MagickTrue);
10117 }
10118 \f
10119 /*
10120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10121 %                                                                             %
10122 %                                                                             %
10123 %                                                                             %
10124 %   M a g i c k S h a d e I m a g e C h a n n e l                             %
10125 %                                                                             %
10126 %                                                                             %
10127 %                                                                             %
10128 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10129 %
10130 %  MagickShadeImage() shines a distant light on an image to create a
10131 %  three-dimensional effect. You control the positioning of the light with
10132 %  azimuth and elevation; azimuth is measured in degrees off the x axis
10133 %  and elevation is measured in pixels above the Z axis.
10134 %
10135 %  The format of the MagickShadeImage method is:
10136 %
10137 %      MagickBooleanType MagickShadeImage(MagickWand *wand,
10138 %        const MagickBooleanType gray,const double azimuth,
10139 %        const double elevation)
10140 %
10141 %  A description of each parameter follows:
10142 %
10143 %    o wand: the magick wand.
10144 %
10145 %    o gray: A value other than zero shades the intensity of each pixel.
10146 %
10147 %    o azimuth, elevation:  Define the light source direction.
10148 %
10149 */
10150 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10151   const MagickBooleanType gray,const double asimuth,const double elevation)
10152 {
10153   Image
10154     *shade_image;
10155
10156   assert(wand != (MagickWand *) NULL);
10157   assert(wand->signature == WandSignature);
10158   if (wand->debug != MagickFalse)
10159     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10160   if (wand->images == (Image *) NULL)
10161     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10162   shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10163   if (shade_image == (Image *) NULL)
10164     return(MagickFalse);
10165   ReplaceImageInList(&wand->images,shade_image);
10166   return(MagickTrue);
10167 }
10168 \f
10169 /*
10170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10171 %                                                                             %
10172 %                                                                             %
10173 %                                                                             %
10174 %   M a g i c k S h a d o w I m a g e                                         %
10175 %                                                                             %
10176 %                                                                             %
10177 %                                                                             %
10178 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10179 %
10180 %  MagickShadowImage() simulates an image shadow.
10181 %
10182 %  The format of the MagickShadowImage method is:
10183 %
10184 %      MagickBooleanType MagickShadowImage(MagickWand *wand,
10185 %        const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10186 %
10187 %  A description of each parameter follows:
10188 %
10189 %    o wand: the magick wand.
10190 %
10191 %    o opacity: percentage transparency.
10192 %
10193 %    o sigma: the standard deviation of the Gaussian, in pixels.
10194 %
10195 %    o x: the shadow x-offset.
10196 %
10197 %    o y: the shadow y-offset.
10198 %
10199 */
10200 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10201   const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10202 {
10203   Image
10204     *shadow_image;
10205
10206   assert(wand != (MagickWand *) NULL);
10207   assert(wand->signature == WandSignature);
10208   if (wand->debug != MagickFalse)
10209     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10210   if (wand->images == (Image *) NULL)
10211     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10212   shadow_image=ShadowImage(wand->images,opacity,sigma,x,y,wand->exception);
10213   if (shadow_image == (Image *) NULL)
10214     return(MagickFalse);
10215   ReplaceImageInList(&wand->images,shadow_image);
10216   return(MagickTrue);
10217 }
10218 \f
10219 /*
10220 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10221 %                                                                             %
10222 %                                                                             %
10223 %                                                                             %
10224 %   M a g i c k S h a r p e n I m a g e                                       %
10225 %                                                                             %
10226 %                                                                             %
10227 %                                                                             %
10228 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10229 %
10230 %  MagickSharpenImage() sharpens an image.  We convolve the image with a
10231 %  Gaussian operator of the given radius and standard deviation (sigma).
10232 %  For reasonable results, the radius should be larger than sigma.  Use a
10233 %  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10234 %
10235 %  The format of the MagickSharpenImage method is:
10236 %
10237 %      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10238 %        const double radius,const double sigma)
10239 %
10240 %  A description of each parameter follows:
10241 %
10242 %    o wand: the magick wand.
10243 %
10244 %    o radius: the radius of the Gaussian, in pixels, not counting the center
10245 %      pixel.
10246 %
10247 %    o sigma: the standard deviation of the Gaussian, in pixels.
10248 %
10249 */
10250 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10251   const double radius,const double sigma)
10252 {
10253   Image
10254     *sharp_image;
10255
10256   assert(wand != (MagickWand *) NULL);
10257   assert(wand->signature == WandSignature);
10258   if (wand->debug != MagickFalse)
10259     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10260   if (wand->images == (Image *) NULL)
10261     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10262   sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
10263   if (sharp_image == (Image *) NULL)
10264     return(MagickFalse);
10265   ReplaceImageInList(&wand->images,sharp_image);
10266   return(MagickTrue);
10267 }
10268 \f
10269 /*
10270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10271 %                                                                             %
10272 %                                                                             %
10273 %                                                                             %
10274 %   M a g i c k S h a v e I m a g e                                           %
10275 %                                                                             %
10276 %                                                                             %
10277 %                                                                             %
10278 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10279 %
10280 %  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10281 %  memory necessary for the new Image structure and returns a pointer to the
10282 %  new image.
10283 %
10284 %  The format of the MagickShaveImage method is:
10285 %
10286 %      MagickBooleanType MagickShaveImage(MagickWand *wand,
10287 %        const size_t columns,const size_t rows)
10288 %
10289 %  A description of each parameter follows:
10290 %
10291 %    o wand: the magick wand.
10292 %
10293 %    o columns: the number of columns in the scaled image.
10294 %
10295 %    o rows: the number of rows in the scaled image.
10296 %
10297 %
10298 */
10299 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10300   const size_t columns,const size_t rows)
10301 {
10302   Image
10303     *shave_image;
10304
10305   RectangleInfo
10306     shave_info;
10307
10308   assert(wand != (MagickWand *) NULL);
10309   assert(wand->signature == WandSignature);
10310   if (wand->debug != MagickFalse)
10311     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10312   if (wand->images == (Image *) NULL)
10313     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10314   shave_info.width=columns;
10315   shave_info.height=rows;
10316   shave_info.x=0;
10317   shave_info.y=0;
10318   shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10319   if (shave_image == (Image *) NULL)
10320     return(MagickFalse);
10321   ReplaceImageInList(&wand->images,shave_image);
10322   return(MagickTrue);
10323 }
10324 \f
10325 /*
10326 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10327 %                                                                             %
10328 %                                                                             %
10329 %                                                                             %
10330 %   M a g i c k S h e a r I m a g e                                           %
10331 %                                                                             %
10332 %                                                                             %
10333 %                                                                             %
10334 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10335 %
10336 %  MagickShearImage() slides one edge of an image along the X or Y axis,
10337 %  creating a parallelogram.  An X direction shear slides an edge along the X
10338 %  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10339 %  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10340 %  is measured relative to the Y axis, and similarly, for Y direction shears
10341 %  y_shear is measured relative to the X axis.  Empty triangles left over from
10342 %  shearing the image are filled with the background color.
10343 %
10344 %  The format of the MagickShearImage method is:
10345 %
10346 %      MagickBooleanType MagickShearImage(MagickWand *wand,
10347 %        const PixelWand *background,const double x_shear,onst double y_shear)
10348 %
10349 %  A description of each parameter follows:
10350 %
10351 %    o wand: the magick wand.
10352 %
10353 %    o background: the background pixel wand.
10354 %
10355 %    o x_shear: the number of degrees to shear the image.
10356 %
10357 %    o y_shear: the number of degrees to shear the image.
10358 %
10359 */
10360 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10361   const PixelWand *background,const double x_shear,const double y_shear)
10362 {
10363   Image
10364     *shear_image;
10365
10366   assert(wand != (MagickWand *) NULL);
10367   assert(wand->signature == WandSignature);
10368   if (wand->debug != MagickFalse)
10369     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10370   if (wand->images == (Image *) NULL)
10371     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10372   PixelGetQuantumPacket(background,&wand->images->background_color);
10373   shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10374   if (shear_image == (Image *) NULL)
10375     return(MagickFalse);
10376   ReplaceImageInList(&wand->images,shear_image);
10377   return(MagickTrue);
10378 }
10379 \f
10380 /*
10381 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10382 %                                                                             %
10383 %                                                                             %
10384 %                                                                             %
10385 %   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                   %
10386 %                                                                             %
10387 %                                                                             %
10388 %                                                                             %
10389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10390 %
10391 %  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10392 %  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10393 %  image using a sigmoidal transfer function without saturating highlights or
10394 %  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10395 %  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10396 %  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10397 %  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10398 %  is reduced.
10399 %
10400 %  The format of the MagickSigmoidalContrastImage method is:
10401 %
10402 %      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10403 %        const MagickBooleanType sharpen,const double alpha,const double beta)
10404 %
10405 %  A description of each parameter follows:
10406 %
10407 %    o wand: the magick wand.
10408 %
10409 %    o sharpen: Increase or decrease image contrast.
10410 %
10411 %    o alpha: strength of the contrast, the larger the number the more
10412 %      'threshold-like' it becomes.
10413 %
10414 %    o beta: midpoint of the function as a color value 0 to QuantumRange.
10415 %
10416 */
10417 WandExport MagickBooleanType MagickSigmoidalContrastImage(
10418   MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10419   const double beta)
10420 {
10421   MagickBooleanType
10422     status;
10423
10424   assert(wand != (MagickWand *) NULL);
10425   assert(wand->signature == WandSignature);
10426   if (wand->debug != MagickFalse)
10427     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10428   if (wand->images == (Image *) NULL)
10429     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10430   status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10431     &wand->images->exception);
10432   return(status);
10433 }
10434 \f
10435 /*
10436 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10437 %                                                                             %
10438 %                                                                             %
10439 %                                                                             %
10440 %   M a g i c k S i m i l a r i t y I m a g e                                 %
10441 %                                                                             %
10442 %                                                                             %
10443 %                                                                             %
10444 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10445 %
10446 %  MagickSimilarityImage() compares the reference image of the image and
10447 %  returns the best match offset.  In addition, it returns a similarity image
10448 %  such that an exact match location is completely white and if none of the
10449 %  pixels match, black, otherwise some gray level in-between.
10450 %
10451 %  The format of the MagickSimilarityImage method is:
10452 %
10453 %      MagickWand *MagickSimilarityImage(MagickWand *wand,
10454 %        const MagickWand *reference,RectangeInfo *offset,double *similarity)
10455 %
10456 %  A description of each parameter follows:
10457 %
10458 %    o wand: the magick wand.
10459 %
10460 %    o reference: the reference wand.
10461 %
10462 %    o offset: the best match offset of the reference image within the image.
10463 %
10464 %    o similarity: the computed similarity between the images.
10465 %
10466 */
10467 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10468   const MagickWand *reference,RectangleInfo *offset,double *similarity)
10469 {
10470   Image
10471     *similarity_image;
10472
10473   assert(wand != (MagickWand *) NULL);
10474   assert(wand->signature == WandSignature);
10475   if (wand->debug != MagickFalse)
10476     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10477   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10478     {
10479       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10480         "ContainsNoImages","`%s'",wand->name);
10481       return((MagickWand *) NULL);
10482     }
10483   similarity_image=SimilarityImage(wand->images,reference->images,offset,
10484     similarity,&wand->images->exception);
10485   if (similarity_image == (Image *) NULL)
10486     return((MagickWand *) NULL);
10487   return(CloneMagickWandFromImages(wand,similarity_image));
10488 }
10489 \f
10490 /*
10491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10492 %                                                                             %
10493 %                                                                             %
10494 %                                                                             %
10495 %   M a g i c k S k e t c h I m a g e                                         %
10496 %                                                                             %
10497 %                                                                             %
10498 %                                                                             %
10499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10500 %
10501 %  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10502 %  a Gaussian operator of the given radius and standard deviation (sigma).
10503 %  For reasonable results, radius should be larger than sigma.  Use a
10504 %  radius of 0 and SketchImage() selects a suitable radius for you.
10505 %  Angle gives the angle of the blurring motion.
10506 %
10507 %  The format of the MagickSketchImage method is:
10508 %
10509 %      MagickBooleanType MagickSketchImage(MagickWand *wand,
10510 %        const double radius,const double sigma,const double angle)
10511 %
10512 %  A description of each parameter follows:
10513 %
10514 %    o wand: the magick wand.
10515 %
10516 %    o radius: the radius of the Gaussian, in pixels, not counting
10517 %      the center pixel.
10518 %
10519 %    o sigma: the standard deviation of the Gaussian, in pixels.
10520 %
10521 %    o angle: Apply the effect along this angle.
10522 %
10523 */
10524 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10525   const double radius,const double sigma,const double angle)
10526 {
10527   Image
10528     *sketch_image;
10529
10530   assert(wand != (MagickWand *) NULL);
10531   assert(wand->signature == WandSignature);
10532   if (wand->debug != MagickFalse)
10533     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10534   if (wand->images == (Image *) NULL)
10535     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10536   sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
10537   if (sketch_image == (Image *) NULL)
10538     return(MagickFalse);
10539   ReplaceImageInList(&wand->images,sketch_image);
10540   return(MagickTrue);
10541 }
10542 \f
10543 /*
10544 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10545 %                                                                             %
10546 %                                                                             %
10547 %                                                                             %
10548 %   M a g i c k S m u s h I m a g e s                                         %
10549 %                                                                             %
10550 %                                                                             %
10551 %                                                                             %
10552 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10553 %
10554 %  MagickSmushImages() takes all images from the current image pointer to the
10555 %  end of the image list and smushs them to each other top-to-bottom if the
10556 %  stack parameter is true, otherwise left-to-right.
10557 %
10558 %  The format of the MagickSmushImages method is:
10559 %
10560 %      MagickWand *MagickSmushImages(MagickWand *wand,
10561 %        const MagickBooleanType stack,const ssize_t offset)
10562 %
10563 %  A description of each parameter follows:
10564 %
10565 %    o wand: the magick wand.
10566 %
10567 %    o stack: By default, images are stacked left-to-right. Set stack to
10568 %      MagickTrue to stack them top-to-bottom.
10569 %
10570 %    o offset: minimum distance in pixels between images.
10571 %
10572 */
10573 WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10574   const MagickBooleanType stack,const ssize_t offset)
10575 {
10576   Image
10577     *smush_image;
10578
10579   assert(wand != (MagickWand *) NULL);
10580   assert(wand->signature == WandSignature);
10581   if (wand->debug != MagickFalse)
10582     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10583   if (wand->images == (Image *) NULL)
10584     return((MagickWand *) NULL);
10585   smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10586   if (smush_image == (Image *) NULL)
10587     return((MagickWand *) NULL);
10588   return(CloneMagickWandFromImages(wand,smush_image));
10589 }
10590 \f
10591 /*
10592 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10593 %                                                                             %
10594 %                                                                             %
10595 %                                                                             %
10596 %     M a g i c k S o l a r i z e I m a g e                                   %
10597 %                                                                             %
10598 %                                                                             %
10599 %                                                                             %
10600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10601 %
10602 %  MagickSolarizeImage() applies a special effect to the image, similar to the
10603 %  effect achieved in a photo darkroom by selectively exposing areas of photo
10604 %  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
10605 %  measure of the extent of the solarization.
10606 %
10607 %  The format of the MagickSolarizeImage method is:
10608 %
10609 %      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10610 %        const double threshold)
10611 %
10612 %  A description of each parameter follows:
10613 %
10614 %    o wand: the magick wand.
10615 %
10616 %    o threshold:  Define the extent of the solarization.
10617 %
10618 */
10619 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10620   const double threshold)
10621 {
10622   MagickBooleanType
10623     status;
10624
10625   assert(wand != (MagickWand *) NULL);
10626   assert(wand->signature == WandSignature);
10627   if (wand->debug != MagickFalse)
10628     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10629   if (wand->images == (Image *) NULL)
10630     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10631   status=SolarizeImage(wand->images,threshold,&wand->images->exception);
10632   return(status);
10633 }
10634 \f
10635 /*
10636 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10637 %                                                                             %
10638 %                                                                             %
10639 %                                                                             %
10640 %   M a g i c k S p a r s e C o l o r I m a g e                               %
10641 %                                                                             %
10642 %                                                                             %
10643 %                                                                             %
10644 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10645 %
10646 %  MagickSparseColorImage(), given a set of coordinates, interpolates the
10647 %  colors found at those coordinates, across the whole image, using various
10648 %  methods.
10649 %
10650 %  The format of the MagickSparseColorImage method is:
10651 %
10652 %      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10653 %        const SparseColorMethod method,const size_t number_arguments,
10654 %        const double *arguments)
10655 %
10656 %  A description of each parameter follows:
10657 %
10658 %    o image: the image to be sparseed.
10659 %
10660 %    o method: the method of image sparseion.
10661 %
10662 %        ArcSparseColorion will always ignore source image offset, and always
10663 %        'bestfit' the destination image with the top left corner offset
10664 %        relative to the polar mapping center.
10665 %
10666 %        Bilinear has no simple inverse mapping so will not allow 'bestfit'
10667 %        style of image sparseion.
10668 %
10669 %        Affine, Perspective, and Bilinear, will do least squares fitting of
10670 %        the distrotion when more than the minimum number of control point
10671 %        pairs are provided.
10672 %
10673 %        Perspective, and Bilinear, will fall back to a Affine sparseion when
10674 %        less than 4 control point pairs are provided. While Affine sparseions
10675 %        will let you use any number of control point pairs, that is Zero pairs
10676 %        is a No-Op (viewport only) distrotion, one pair is a translation and
10677 %        two pairs of control points will do a scale-rotate-translate, without
10678 %        any shearing.
10679 %
10680 %    o number_arguments: the number of arguments given for this sparseion
10681 %      method.
10682 %
10683 %    o arguments: the arguments for this sparseion method.
10684 %
10685 */
10686 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10687   const SparseColorMethod method,const size_t number_arguments,
10688   const double *arguments)
10689 {
10690   Image
10691     *sparse_image;
10692
10693   assert(wand != (MagickWand *) NULL);
10694   assert(wand->signature == WandSignature);
10695   if (wand->debug != MagickFalse)
10696     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10697   if (wand->images == (Image *) NULL)
10698     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10699   sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
10700     wand->exception);
10701   if (sparse_image == (Image *) NULL)
10702     return(MagickFalse);
10703   ReplaceImageInList(&wand->images,sparse_image);
10704   return(MagickTrue);
10705 }
10706 \f
10707 /*
10708 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10709 %                                                                             %
10710 %                                                                             %
10711 %                                                                             %
10712 %   M a g i c k S p l i c e I m a g e                                         %
10713 %                                                                             %
10714 %                                                                             %
10715 %                                                                             %
10716 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10717 %
10718 %  MagickSpliceImage() splices a solid color into the image.
10719 %
10720 %  The format of the MagickSpliceImage method is:
10721 %
10722 %      MagickBooleanType MagickSpliceImage(MagickWand *wand,
10723 %        const size_t width,const size_t height,const ssize_t x,
10724 %        const ssize_t y)
10725 %
10726 %  A description of each parameter follows:
10727 %
10728 %    o wand: the magick wand.
10729 %
10730 %    o width: the region width.
10731 %
10732 %    o height: the region height.
10733 %
10734 %    o x: the region x offset.
10735 %
10736 %    o y: the region y offset.
10737 %
10738 */
10739 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
10740   const size_t width,const size_t height,const ssize_t x,
10741   const ssize_t y)
10742 {
10743   Image
10744     *splice_image;
10745
10746   RectangleInfo
10747     splice;
10748
10749   assert(wand != (MagickWand *) NULL);
10750   assert(wand->signature == WandSignature);
10751   if (wand->debug != MagickFalse)
10752     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10753   if (wand->images == (Image *) NULL)
10754     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10755   splice.width=width;
10756   splice.height=height;
10757   splice.x=x;
10758   splice.y=y;
10759   splice_image=SpliceImage(wand->images,&splice,wand->exception);
10760   if (splice_image == (Image *) NULL)
10761     return(MagickFalse);
10762   ReplaceImageInList(&wand->images,splice_image);
10763   return(MagickTrue);
10764 }
10765 \f
10766 /*
10767 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10768 %                                                                             %
10769 %                                                                             %
10770 %                                                                             %
10771 %   M a g i c k S p r e a d I m a g e                                         %
10772 %                                                                             %
10773 %                                                                             %
10774 %                                                                             %
10775 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10776 %
10777 %  MagickSpreadImage() is a special effects method that randomly displaces each
10778 %  pixel in a block defined by the radius parameter.
10779 %
10780 %  The format of the MagickSpreadImage method is:
10781 %
10782 %      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius)
10783 %
10784 %  A description of each parameter follows:
10785 %
10786 %    o wand: the magick wand.
10787 %
10788 %    o radius:  Choose a random pixel in a neighborhood of this extent.
10789 %
10790 */
10791 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
10792   const double radius)
10793 {
10794   Image
10795     *spread_image;
10796
10797   assert(wand != (MagickWand *) NULL);
10798   assert(wand->signature == WandSignature);
10799   if (wand->debug != MagickFalse)
10800     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10801   if (wand->images == (Image *) NULL)
10802     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10803   spread_image=SpreadImage(wand->images,radius,wand->exception);
10804   if (spread_image == (Image *) NULL)
10805     return(MagickFalse);
10806   ReplaceImageInList(&wand->images,spread_image);
10807   return(MagickTrue);
10808 }
10809 \f
10810 /*
10811 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10812 %                                                                             %
10813 %                                                                             %
10814 %                                                                             %
10815 %   M a g i c k S t a t i s t i c I m a g e                                   %
10816 %                                                                             %
10817 %                                                                             %
10818 %                                                                             %
10819 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10820 %
10821 %  MagickStatisticImage() replace each pixel with corresponding statistic from
10822 %  the neighborhood of the specified width and height.
10823 %
10824 %  The format of the MagickStatisticImage method is:
10825 %
10826 %      MagickBooleanType MagickStatisticImage(MagickWand *wand,
10827 %        const StatisticType type,const double width,const size_t height)
10828 %
10829 %  A description of each parameter follows:
10830 %
10831 %    o wand: the magick wand.
10832 %
10833 %    o type: the statistic type (e.g. median, mode, etc.).
10834 %
10835 %    o width: the width of the pixel neighborhood.
10836 %
10837 %    o height: the height of the pixel neighborhood.
10838 %
10839 */
10840 WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
10841   const StatisticType type,const size_t width,const size_t height)
10842 {
10843   Image
10844     *statistic_image;
10845
10846   assert(wand != (MagickWand *) NULL);
10847   assert(wand->signature == WandSignature);
10848   if (wand->debug != MagickFalse)
10849     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10850   if (wand->images == (Image *) NULL)
10851     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10852   statistic_image=StatisticImage(wand->images,type,width,height,
10853     wand->exception);
10854   if (statistic_image == (Image *) NULL)
10855     return(MagickFalse);
10856   ReplaceImageInList(&wand->images,statistic_image);
10857   return(MagickTrue);
10858 }
10859 \f
10860 /*
10861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10862 %                                                                             %
10863 %                                                                             %
10864 %                                                                             %
10865 %   M a g i c k S t e g a n o I m a g e                                       %
10866 %                                                                             %
10867 %                                                                             %
10868 %                                                                             %
10869 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10870 %
10871 %  MagickSteganoImage() hides a digital watermark within the image.
10872 %  Recover the hidden watermark later to prove that the authenticity of
10873 %  an image.  Offset defines the start position within the image to hide
10874 %  the watermark.
10875 %
10876 %  The format of the MagickSteganoImage method is:
10877 %
10878 %      MagickWand *MagickSteganoImage(MagickWand *wand,
10879 %        const MagickWand *watermark_wand,const ssize_t offset)
10880 %
10881 %  A description of each parameter follows:
10882 %
10883 %    o wand: the magick wand.
10884 %
10885 %    o watermark_wand: the watermark wand.
10886 %
10887 %    o offset: Start hiding at this offset into the image.
10888 %
10889 */
10890 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
10891   const MagickWand *watermark_wand,const ssize_t offset)
10892 {
10893   Image
10894     *stegano_image;
10895
10896   assert(wand != (MagickWand *) NULL);
10897   assert(wand->signature == WandSignature);
10898   if (wand->debug != MagickFalse)
10899     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10900   if ((wand->images == (Image *) NULL) ||
10901       (watermark_wand->images == (Image *) NULL))
10902     {
10903       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10904         "ContainsNoImages","`%s'",wand->name);
10905       return((MagickWand *) NULL);
10906     }
10907   wand->images->offset=offset;
10908   stegano_image=SteganoImage(wand->images,watermark_wand->images,
10909     wand->exception);
10910   if (stegano_image == (Image *) NULL)
10911     return((MagickWand *) NULL);
10912   return(CloneMagickWandFromImages(wand,stegano_image));
10913 }
10914 \f
10915 /*
10916 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10917 %                                                                             %
10918 %                                                                             %
10919 %                                                                             %
10920 %   M a g i c k S t e r e o I m a g e                                         %
10921 %                                                                             %
10922 %                                                                             %
10923 %                                                                             %
10924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10925 %
10926 %  MagickStereoImage() composites two images and produces a single image that
10927 %  is the composite of a left and right image of a stereo pair
10928 %
10929 %  The format of the MagickStereoImage method is:
10930 %
10931 %      MagickWand *MagickStereoImage(MagickWand *wand,
10932 %        const MagickWand *offset_wand)
10933 %
10934 %  A description of each parameter follows:
10935 %
10936 %    o wand: the magick wand.
10937 %
10938 %    o offset_wand: Another image wand.
10939 %
10940 */
10941 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
10942   const MagickWand *offset_wand)
10943 {
10944   Image
10945     *stereo_image;
10946
10947   assert(wand != (MagickWand *) NULL);
10948   assert(wand->signature == WandSignature);
10949   if (wand->debug != MagickFalse)
10950     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10951   if ((wand->images == (Image *) NULL) ||
10952       (offset_wand->images == (Image *) NULL))
10953     {
10954       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10955         "ContainsNoImages","`%s'",wand->name);
10956       return((MagickWand *) NULL);
10957     }
10958   stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
10959   if (stereo_image == (Image *) NULL)
10960     return((MagickWand *) NULL);
10961   return(CloneMagickWandFromImages(wand,stereo_image));
10962 }
10963 \f
10964 /*
10965 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10966 %                                                                             %
10967 %                                                                             %
10968 %                                                                             %
10969 %   M a g i c k S t r i p I m a g e                                           %
10970 %                                                                             %
10971 %                                                                             %
10972 %                                                                             %
10973 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10974 %
10975 %  MagickStripImage() strips an image of all profiles and comments.
10976 %
10977 %  The format of the MagickStripImage method is:
10978 %
10979 %      MagickBooleanType MagickStripImage(MagickWand *wand)
10980 %
10981 %  A description of each parameter follows:
10982 %
10983 %    o wand: the magick wand.
10984 %
10985 */
10986 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
10987 {
10988   MagickBooleanType
10989     status;
10990
10991   assert(wand != (MagickWand *) NULL);
10992   assert(wand->signature == WandSignature);
10993   if (wand->debug != MagickFalse)
10994     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10995   if (wand->images == (Image *) NULL)
10996     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10997   status=StripImage(wand->images);
10998   if (status == MagickFalse)
10999     InheritException(wand->exception,&wand->images->exception);
11000   return(status);
11001 }
11002 \f
11003 /*
11004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11005 %                                                                             %
11006 %                                                                             %
11007 %                                                                             %
11008 %   M a g i c k S w i r l I m a g e                                           %
11009 %                                                                             %
11010 %                                                                             %
11011 %                                                                             %
11012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11013 %
11014 %  MagickSwirlImage() swirls the pixels about the center of the image, where
11015 %  degrees indicates the sweep of the arc through which each pixel is moved.
11016 %  You get a more dramatic effect as the degrees move from 1 to 360.
11017 %
11018 %  The format of the MagickSwirlImage method is:
11019 %
11020 %      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees)
11021 %
11022 %  A description of each parameter follows:
11023 %
11024 %    o wand: the magick wand.
11025 %
11026 %    o degrees: Define the tightness of the swirling effect.
11027 %
11028 */
11029 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11030   const double degrees)
11031 {
11032   Image
11033     *swirl_image;
11034
11035   assert(wand != (MagickWand *) NULL);
11036   assert(wand->signature == WandSignature);
11037   if (wand->debug != MagickFalse)
11038     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11039   if (wand->images == (Image *) NULL)
11040     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11041   swirl_image=SwirlImage(wand->images,degrees,wand->exception);
11042   if (swirl_image == (Image *) NULL)
11043     return(MagickFalse);
11044   ReplaceImageInList(&wand->images,swirl_image);
11045   return(MagickTrue);
11046 }
11047 \f
11048 /*
11049 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11050 %                                                                             %
11051 %                                                                             %
11052 %                                                                             %
11053 %   M a g i c k T e x t u r e I m a g e                                       %
11054 %                                                                             %
11055 %                                                                             %
11056 %                                                                             %
11057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11058 %
11059 %  MagickTextureImage() repeatedly tiles the texture image across and down the
11060 %  image canvas.
11061 %
11062 %  The format of the MagickTextureImage method is:
11063 %
11064 %      MagickWand *MagickTextureImage(MagickWand *wand,
11065 %        const MagickWand *texture_wand)
11066 %
11067 %  A description of each parameter follows:
11068 %
11069 %    o wand: the magick wand.
11070 %
11071 %    o texture_wand: the texture wand
11072 %
11073 */
11074 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11075   const MagickWand *texture_wand)
11076 {
11077   Image
11078     *texture_image;
11079
11080   MagickBooleanType
11081     status;
11082
11083   assert(wand != (MagickWand *) NULL);
11084   assert(wand->signature == WandSignature);
11085   if (wand->debug != MagickFalse)
11086     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11087   if ((wand->images == (Image *) NULL) ||
11088       (texture_wand->images == (Image *) NULL))
11089     {
11090       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11091         "ContainsNoImages","`%s'",wand->name);
11092       return((MagickWand *) NULL);
11093     }
11094   texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11095   if (texture_image == (Image *) NULL)
11096     return((MagickWand *) NULL);
11097   status=TextureImage(texture_image,texture_wand->images);
11098   if (status == MagickFalse)
11099     {
11100       InheritException(wand->exception,&texture_image->exception);
11101       texture_image=DestroyImage(texture_image);
11102       return((MagickWand *) NULL);
11103     }
11104   return(CloneMagickWandFromImages(wand,texture_image));
11105 }
11106 \f
11107 /*
11108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11109 %                                                                             %
11110 %                                                                             %
11111 %                                                                             %
11112 %   M a g i c k T h r e s h o l d I m a g e                                   %
11113 %                                                                             %
11114 %                                                                             %
11115 %                                                                             %
11116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11117 %
11118 %  MagickThresholdImage() changes the value of individual pixels based on
11119 %  the intensity of each pixel compared to threshold.  The result is a
11120 %  high-contrast, two color image.
11121 %
11122 %  The format of the MagickThresholdImage method is:
11123 %
11124 %      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11125 %        const double threshold)
11126 %      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11127 %        const ChannelType channel,const double threshold)
11128 %
11129 %  A description of each parameter follows:
11130 %
11131 %    o wand: the magick wand.
11132 %
11133 %    o channel: the image channel(s).
11134 %
11135 %    o threshold: Define the threshold value.
11136 %
11137 */
11138 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11139   const double threshold)
11140 {
11141   MagickBooleanType
11142     status;
11143
11144   status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11145   return(status);
11146 }
11147
11148 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11149   const ChannelType channel,const double threshold)
11150 {
11151   MagickBooleanType
11152     status;
11153
11154   assert(wand != (MagickWand *) NULL);
11155   assert(wand->signature == WandSignature);
11156   if (wand->debug != MagickFalse)
11157     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11158   if (wand->images == (Image *) NULL)
11159     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11160   status=BilevelImage(wand->images,threshold);
11161   if (status == MagickFalse)
11162     InheritException(wand->exception,&wand->images->exception);
11163   return(status);
11164 }
11165 \f
11166 /*
11167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11168 %                                                                             %
11169 %                                                                             %
11170 %                                                                             %
11171 %   M a g i c k T h u m b n a i l I m a g e                                   %
11172 %                                                                             %
11173 %                                                                             %
11174 %                                                                             %
11175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11176 %
11177 %  MagickThumbnailImage()  changes the size of an image to the given dimensions
11178 %  and removes any associated profiles.  The goal is to produce small low cost
11179 %  thumbnail images suited for display on the Web.
11180 %
11181 %  The format of the MagickThumbnailImage method is:
11182 %
11183 %      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11184 %        const size_t columns,const size_t rows)
11185 %
11186 %  A description of each parameter follows:
11187 %
11188 %    o wand: the magick wand.
11189 %
11190 %    o columns: the number of columns in the scaled image.
11191 %
11192 %    o rows: the number of rows in the scaled image.
11193 %
11194 */
11195 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11196   const size_t columns,const size_t rows)
11197 {
11198   Image
11199     *thumbnail_image;
11200
11201   assert(wand != (MagickWand *) NULL);
11202   assert(wand->signature == WandSignature);
11203   if (wand->debug != MagickFalse)
11204     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11205   if (wand->images == (Image *) NULL)
11206     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11207   thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11208   if (thumbnail_image == (Image *) NULL)
11209     return(MagickFalse);
11210   ReplaceImageInList(&wand->images,thumbnail_image);
11211   return(MagickTrue);
11212 }
11213 \f
11214 /*
11215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11216 %                                                                             %
11217 %                                                                             %
11218 %                                                                             %
11219 %   M a g i c k T i n t I m a g e                                             %
11220 %                                                                             %
11221 %                                                                             %
11222 %                                                                             %
11223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11224 %
11225 %  MagickTintImage() applies a color vector to each pixel in the image.  The
11226 %  length of the vector is 0 for black and white and at its maximum for the
11227 %  midtones.  The vector weighting function is
11228 %  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11229 %
11230 %  The format of the MagickTintImage method is:
11231 %
11232 %      MagickBooleanType MagickTintImage(MagickWand *wand,
11233 %        const PixelWand *tint,const PixelWand *opacity)
11234 %
11235 %  A description of each parameter follows:
11236 %
11237 %    o wand: the magick wand.
11238 %
11239 %    o tint: the tint pixel wand.
11240 %
11241 %    o opacity: the opacity pixel wand.
11242 %
11243 */
11244 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11245   const PixelWand *tint,const PixelWand *opacity)
11246 {
11247   char
11248     percent_opaque[MaxTextExtent];
11249
11250   Image
11251     *tint_image;
11252
11253   PixelPacket
11254     target;
11255
11256   assert(wand != (MagickWand *) NULL);
11257   assert(wand->signature == WandSignature);
11258   if (wand->debug != MagickFalse)
11259     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11260   if (wand->images == (Image *) NULL)
11261     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11262   (void) FormatLocaleString(percent_opaque,MaxTextExtent,
11263     "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11264     PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
11265     PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
11266     PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
11267     PixelGetOpacityQuantum(opacity)));
11268   PixelGetQuantumPacket(tint,&target);
11269   tint_image=TintImage(wand->images,percent_opaque,target,wand->exception);
11270   if (tint_image == (Image *) NULL)
11271     return(MagickFalse);
11272   ReplaceImageInList(&wand->images,tint_image);
11273   return(MagickTrue);
11274 }
11275 \f
11276 /*
11277 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11278 %                                                                             %
11279 %                                                                             %
11280 %                                                                             %
11281 %   M a g i c k T r a n s f o r m I m a g e                                   %
11282 %                                                                             %
11283 %                                                                             %
11284 %                                                                             %
11285 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11286 %
11287 %  MagickTransformImage() is a convenience method that behaves like
11288 %  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11289 %  information as a region geometry specification.  If the operation fails,
11290 %  a NULL image handle is returned.
11291 %
11292 %  The format of the MagickTransformImage method is:
11293 %
11294 %      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11295 %        const char *geometry)
11296 %
11297 %  A description of each parameter follows:
11298 %
11299 %    o wand: the magick wand.
11300 %
11301 %    o crop: A crop geometry string.  This geometry defines a subregion of the
11302 %      image to crop.
11303 %
11304 %    o geometry: An image geometry string.  This geometry defines the final
11305 %      size of the image.
11306 %
11307 */
11308 WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11309   const char *crop,const char *geometry)
11310 {
11311   Image
11312     *transform_image;
11313
11314   MagickBooleanType
11315     status;
11316
11317   assert(wand != (MagickWand *) NULL);
11318   assert(wand->signature == WandSignature);
11319   if (wand->debug != MagickFalse)
11320     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11321   if (wand->images == (Image *) NULL)
11322     return((MagickWand *) NULL);
11323   transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11324   if (transform_image == (Image *) NULL)
11325     return((MagickWand *) NULL);
11326   status=TransformImage(&transform_image,crop,geometry);
11327   if (status == MagickFalse)
11328     {
11329       InheritException(wand->exception,&transform_image->exception);
11330       transform_image=DestroyImage(transform_image);
11331       return((MagickWand *) NULL);
11332     }
11333   return(CloneMagickWandFromImages(wand,transform_image));
11334 }
11335 \f
11336 /*
11337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11338 %                                                                             %
11339 %                                                                             %
11340 %                                                                             %
11341 %   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               %
11342 %                                                                             %
11343 %                                                                             %
11344 %                                                                             %
11345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11346 %
11347 %  MagickTransformImageColorspace() transform the image colorspace.
11348 %
11349 %  The format of the MagickTransformImageColorspace method is:
11350 %
11351 %      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11352 %        const ColorspaceType colorspace)
11353 %
11354 %  A description of each parameter follows:
11355 %
11356 %    o wand: the magick wand.
11357 %
11358 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
11359 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
11360 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
11361 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
11362 %      HSLColorspace, or HWBColorspace.
11363 %
11364 */
11365 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11366   const ColorspaceType colorspace)
11367 {
11368   assert(wand != (MagickWand *) NULL);
11369   assert(wand->signature == WandSignature);
11370   if (wand->debug != MagickFalse)
11371     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11372   if (wand->images == (Image *) NULL)
11373     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11374   return(TransformImageColorspace(wand->images,colorspace));
11375 }
11376 \f
11377 /*
11378 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11379 %                                                                             %
11380 %                                                                             %
11381 %                                                                             %
11382 %   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                     %
11383 %                                                                             %
11384 %                                                                             %
11385 %                                                                             %
11386 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11387 %
11388 %  MagickTransparentPaintImage() changes any pixel that matches color with the
11389 %  color defined by fill.
11390 %
11391 %  The format of the MagickTransparentPaintImage method is:
11392 %
11393 %      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11394 %        const PixelWand *target,const double alpha,const double fuzz,
11395 %        const MagickBooleanType invert)
11396 %
11397 %  A description of each parameter follows:
11398 %
11399 %    o wand: the magick wand.
11400 %
11401 %    o target: Change this target color to specified opacity value within
11402 %      the image.
11403 %
11404 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11405 %      transparent.
11406 %
11407 %    o fuzz: By default target must match a particular pixel color
11408 %      exactly.  However, in many cases two colors may differ by a small amount.
11409 %      The fuzz member of image defines how much tolerance is acceptable to
11410 %      consider two colors as the same.  For example, set fuzz to 10 and the
11411 %      color red at intensities of 100 and 102 respectively are now interpreted
11412 %      as the same color for the purposes of the floodfill.
11413 %
11414 %    o invert: paint any pixel that does not match the target color.
11415 %
11416 */
11417 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11418   const PixelWand *target,const double alpha,const double fuzz,
11419   const MagickBooleanType invert)
11420 {
11421   MagickBooleanType
11422     status;
11423
11424   PixelInfo
11425     target_pixel;
11426
11427   assert(wand != (MagickWand *) NULL);
11428   assert(wand->signature == WandSignature);
11429   if (wand->debug != MagickFalse)
11430     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11431   if (wand->images == (Image *) NULL)
11432     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11433   PixelGetMagickColor(target,&target_pixel);
11434   wand->images->fuzz=fuzz;
11435   status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11436     QuantumRange*alpha),invert,&wand->images->exception);
11437   return(status);
11438 }
11439 \f
11440 /*
11441 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11442 %                                                                             %
11443 %                                                                             %
11444 %                                                                             %
11445 %   M a g i c k T r a n s p o s e I m a g e                                   %
11446 %                                                                             %
11447 %                                                                             %
11448 %                                                                             %
11449 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11450 %
11451 %  MagickTransposeImage() creates a vertical mirror image by reflecting the
11452 %  pixels around the central x-axis while rotating them 90-degrees.
11453 %
11454 %  The format of the MagickTransposeImage method is:
11455 %
11456 %      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11457 %
11458 %  A description of each parameter follows:
11459 %
11460 %    o wand: the magick wand.
11461 %
11462 */
11463 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11464 {
11465   Image
11466     *transpose_image;
11467
11468   assert(wand != (MagickWand *) NULL);
11469   assert(wand->signature == WandSignature);
11470   if (wand->debug != MagickFalse)
11471     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11472   if (wand->images == (Image *) NULL)
11473     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11474   transpose_image=TransposeImage(wand->images,wand->exception);
11475   if (transpose_image == (Image *) NULL)
11476     return(MagickFalse);
11477   ReplaceImageInList(&wand->images,transpose_image);
11478   return(MagickTrue);
11479 }
11480 \f
11481 /*
11482 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11483 %                                                                             %
11484 %                                                                             %
11485 %                                                                             %
11486 %   M a g i c k T r a n s v e r s e I m a g e                                 %
11487 %                                                                             %
11488 %                                                                             %
11489 %                                                                             %
11490 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11491 %
11492 %  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11493 %  pixels around the central y-axis while rotating them 270-degrees.
11494 %
11495 %  The format of the MagickTransverseImage method is:
11496 %
11497 %      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11498 %
11499 %  A description of each parameter follows:
11500 %
11501 %    o wand: the magick wand.
11502 %
11503 */
11504 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11505 {
11506   Image
11507     *transverse_image;
11508
11509   assert(wand != (MagickWand *) NULL);
11510   assert(wand->signature == WandSignature);
11511   if (wand->debug != MagickFalse)
11512     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11513   if (wand->images == (Image *) NULL)
11514     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11515   transverse_image=TransverseImage(wand->images,wand->exception);
11516   if (transverse_image == (Image *) NULL)
11517     return(MagickFalse);
11518   ReplaceImageInList(&wand->images,transverse_image);
11519   return(MagickTrue);
11520 }
11521 \f
11522 /*
11523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11524 %                                                                             %
11525 %                                                                             %
11526 %                                                                             %
11527 %   M a g i c k T r i m I m a g e                                             %
11528 %                                                                             %
11529 %                                                                             %
11530 %                                                                             %
11531 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11532 %
11533 %  MagickTrimImage() remove edges that are the background color from the image.
11534 %
11535 %  The format of the MagickTrimImage method is:
11536 %
11537 %      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11538 %
11539 %  A description of each parameter follows:
11540 %
11541 %    o wand: the magick wand.
11542 %
11543 %    o fuzz: By default target must match a particular pixel color
11544 %      exactly.  However, in many cases two colors may differ by a small amount.
11545 %      The fuzz member of image defines how much tolerance is acceptable to
11546 %      consider two colors as the same.  For example, set fuzz to 10 and the
11547 %      color red at intensities of 100 and 102 respectively are now interpreted
11548 %      as the same color for the purposes of the floodfill.
11549 %
11550 */
11551 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11552 {
11553   Image
11554     *trim_image;
11555
11556   assert(wand != (MagickWand *) NULL);
11557   assert(wand->signature == WandSignature);
11558   if (wand->debug != MagickFalse)
11559     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11560   if (wand->images == (Image *) NULL)
11561     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11562   wand->images->fuzz=fuzz;
11563   trim_image=TrimImage(wand->images,wand->exception);
11564   if (trim_image == (Image *) NULL)
11565     return(MagickFalse);
11566   ReplaceImageInList(&wand->images,trim_image);
11567   return(MagickTrue);
11568 }
11569 \f
11570 /*
11571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11572 %                                                                             %
11573 %                                                                             %
11574 %                                                                             %
11575 %   M a g i c k U n i q u e I m a g e C o l o r s                             %
11576 %                                                                             %
11577 %                                                                             %
11578 %                                                                             %
11579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11580 %
11581 %  MagickUniqueImageColors() discards all but one of any pixel color.
11582 %
11583 %  The format of the MagickUniqueImageColors method is:
11584 %
11585 %      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11586 %
11587 %  A description of each parameter follows:
11588 %
11589 %    o wand: the magick wand.
11590 %
11591 */
11592 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11593 {
11594   Image
11595     *unique_image;
11596
11597   assert(wand != (MagickWand *) NULL);
11598   assert(wand->signature == WandSignature);
11599   if (wand->debug != MagickFalse)
11600     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11601   if (wand->images == (Image *) NULL)
11602     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11603   unique_image=UniqueImageColors(wand->images,wand->exception);
11604   if (unique_image == (Image *) NULL)
11605     return(MagickFalse);
11606   ReplaceImageInList(&wand->images,unique_image);
11607   return(MagickTrue);
11608 }
11609 \f
11610 /*
11611 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11612 %                                                                             %
11613 %                                                                             %
11614 %                                                                             %
11615 %   M a g i c k U n s h a r p M a s k I m a g e                               %
11616 %                                                                             %
11617 %                                                                             %
11618 %                                                                             %
11619 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11620 %
11621 %  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
11622 %  Gaussian operator of the given radius and standard deviation (sigma).
11623 %  For reasonable results, radius should be larger than sigma.  Use a radius
11624 %  of 0 and UnsharpMaskImage() selects a suitable radius for you.
11625 %
11626 %  The format of the MagickUnsharpMaskImage method is:
11627 %
11628 %      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11629 %        const double radius,const double sigma,const double amount,
11630 %        const double threshold)
11631 %
11632 %  A description of each parameter follows:
11633 %
11634 %    o wand: the magick wand.
11635 %
11636 %    o radius: the radius of the Gaussian, in pixels, not counting the center
11637 %      pixel.
11638 %
11639 %    o sigma: the standard deviation of the Gaussian, in pixels.
11640 %
11641 %    o amount: the percentage of the difference between the original and the
11642 %      blur image that is added back into the original.
11643 %
11644 %    o threshold: the threshold in pixels needed to apply the diffence amount.
11645 %
11646 */
11647 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11648   const double radius,const double sigma,const double amount,
11649   const double threshold)
11650 {
11651   Image
11652     *unsharp_image;
11653
11654   assert(wand != (MagickWand *) NULL);
11655   assert(wand->signature == WandSignature);
11656   if (wand->debug != MagickFalse)
11657     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11658   if (wand->images == (Image *) NULL)
11659     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11660   unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
11661     wand->exception);
11662   if (unsharp_image == (Image *) NULL)
11663     return(MagickFalse);
11664   ReplaceImageInList(&wand->images,unsharp_image);
11665   return(MagickTrue);
11666 }
11667 \f
11668 /*
11669 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11670 %                                                                             %
11671 %                                                                             %
11672 %                                                                             %
11673 %   M a g i c k V i g n e t t e I m a g e                                     %
11674 %                                                                             %
11675 %                                                                             %
11676 %                                                                             %
11677 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11678 %
11679 %  MagickVignetteImage() softens the edges of the image in vignette style.
11680 %
11681 %  The format of the MagickVignetteImage method is:
11682 %
11683 %      MagickBooleanType MagickVignetteImage(MagickWand *wand,
11684 %        const double black_point,const double white_point,const ssize_t x,
11685 %        const ssize_t y)
11686 %
11687 %  A description of each parameter follows:
11688 %
11689 %    o wand: the magick wand.
11690 %
11691 %    o black_point: the black point.
11692 %
11693 %    o white_point: the white point.
11694 %
11695 %    o x, y:  Define the x and y ellipse offset.
11696 %
11697 */
11698 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
11699   const double black_point,const double white_point,const ssize_t x,const ssize_t y)
11700 {
11701   Image
11702     *vignette_image;
11703
11704   assert(wand != (MagickWand *) NULL);
11705   assert(wand->signature == WandSignature);
11706   if (wand->debug != MagickFalse)
11707     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11708   if (wand->images == (Image *) NULL)
11709     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11710   vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
11711     wand->exception);
11712   if (vignette_image == (Image *) NULL)
11713     return(MagickFalse);
11714   ReplaceImageInList(&wand->images,vignette_image);
11715   return(MagickTrue);
11716 }
11717 \f
11718 /*
11719 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11720 %                                                                             %
11721 %                                                                             %
11722 %                                                                             %
11723 %   M a g i c k W a v e I m a g e                                             %
11724 %                                                                             %
11725 %                                                                             %
11726 %                                                                             %
11727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11728 %
11729 %  MagickWaveImage()  creates a "ripple" effect in the image by shifting
11730 %  the pixels vertically along a sine wave whose amplitude and wavelength
11731 %  is specified by the given parameters.
11732 %
11733 %  The format of the MagickWaveImage method is:
11734 %
11735 %      MagickBooleanType MagickWaveImage(MagickWand *wand,const double amplitude,
11736 %        const double wave_length)
11737 %
11738 %  A description of each parameter follows:
11739 %
11740 %    o wand: the magick wand.
11741 %
11742 %    o amplitude, wave_length:  Define the amplitude and wave length of the
11743 %      sine wave.
11744 %
11745 */
11746 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
11747   const double amplitude,const double wave_length)
11748 {
11749   Image
11750     *wave_image;
11751
11752   assert(wand != (MagickWand *) NULL);
11753   assert(wand->signature == WandSignature);
11754   if (wand->debug != MagickFalse)
11755     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11756   if (wand->images == (Image *) NULL)
11757     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11758   wave_image=WaveImage(wand->images,amplitude,wave_length,wand->exception);
11759   if (wave_image == (Image *) NULL)
11760     return(MagickFalse);
11761   ReplaceImageInList(&wand->images,wave_image);
11762   return(MagickTrue);
11763 }
11764 \f
11765 /*
11766 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11767 %                                                                             %
11768 %                                                                             %
11769 %                                                                             %
11770 %   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                         %
11771 %                                                                             %
11772 %                                                                             %
11773 %                                                                             %
11774 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11775 %
11776 %  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
11777 %  above the threshold into white while leaving all pixels below the threshold
11778 %  unchanged.
11779 %
11780 %  The format of the MagickWhiteThresholdImage method is:
11781 %
11782 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11783 %        const PixelWand *threshold)
11784 %
11785 %  A description of each parameter follows:
11786 %
11787 %    o wand: the magick wand.
11788 %
11789 %    o threshold: the pixel wand.
11790 %
11791 */
11792 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11793   const PixelWand *threshold)
11794 {
11795   char
11796     thresholds[MaxTextExtent];
11797
11798   MagickBooleanType
11799     status;
11800
11801   assert(wand != (MagickWand *) NULL);
11802   assert(wand->signature == WandSignature);
11803   if (wand->debug != MagickFalse)
11804     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11805   if (wand->images == (Image *) NULL)
11806     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11807   (void) FormatLocaleString(thresholds,MaxTextExtent,
11808     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
11809     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
11810     PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
11811   status=WhiteThresholdImage(wand->images,thresholds,&wand->images->exception);
11812   if (status == MagickFalse)
11813     InheritException(wand->exception,&wand->images->exception);
11814   return(status);
11815 }
11816 \f
11817 /*
11818 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11819 %                                                                             %
11820 %                                                                             %
11821 %                                                                             %
11822 %   M a g i c k W r i t e I m a g e                                           %
11823 %                                                                             %
11824 %                                                                             %
11825 %                                                                             %
11826 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11827 %
11828 %  MagickWriteImage() writes an image to the specified filename.  If the
11829 %  filename parameter is NULL, the image is written to the filename set
11830 %  by MagickReadImage() or MagickSetImageFilename().
11831 %
11832 %  The format of the MagickWriteImage method is:
11833 %
11834 %      MagickBooleanType MagickWriteImage(MagickWand *wand,
11835 %        const char *filename)
11836 %
11837 %  A description of each parameter follows:
11838 %
11839 %    o wand: the magick wand.
11840 %
11841 %    o filename: the image filename.
11842 %
11843 %
11844 */
11845 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
11846   const char *filename)
11847 {
11848   Image
11849     *image;
11850
11851   ImageInfo
11852     *write_info;
11853
11854   MagickBooleanType
11855     status;
11856
11857   assert(wand != (MagickWand *) NULL);
11858   assert(wand->signature == WandSignature);
11859   if (wand->debug != MagickFalse)
11860     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11861   if (wand->images == (Image *) NULL)
11862     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11863   if (filename != (const char *) NULL)
11864     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
11865   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11866   if (image == (Image *) NULL)
11867     return(MagickFalse);
11868   write_info=CloneImageInfo(wand->image_info);
11869   write_info->adjoin=MagickTrue;
11870   status=WriteImage(write_info,image,&image->exception);
11871   image=DestroyImage(image);
11872   write_info=DestroyImageInfo(write_info);
11873   return(status);
11874 }
11875 \f
11876 /*
11877 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11878 %                                                                             %
11879 %                                                                             %
11880 %                                                                             %
11881 %   M a g i c k W r i t e I m a g e F i l e                                   %
11882 %                                                                             %
11883 %                                                                             %
11884 %                                                                             %
11885 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11886 %
11887 %  MagickWriteImageFile() writes an image to an open file descriptor.
11888 %
11889 %  The format of the MagickWriteImageFile method is:
11890 %
11891 %      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11892 %
11893 %  A description of each parameter follows:
11894 %
11895 %    o wand: the magick wand.
11896 %
11897 %    o file: the file descriptor.
11898 %
11899 */
11900 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11901 {
11902   Image
11903     *image;
11904
11905   ImageInfo
11906     *write_info;
11907
11908   MagickBooleanType
11909     status;
11910
11911   assert(wand != (MagickWand *) NULL);
11912   assert(wand->signature == WandSignature);
11913   assert(file != (FILE *) NULL);
11914   if (wand->debug != MagickFalse)
11915     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11916   if (wand->images == (Image *) NULL)
11917     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11918   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11919   if (image == (Image *) NULL)
11920     return(MagickFalse);
11921   write_info=CloneImageInfo(wand->image_info);
11922   SetImageInfoFile(write_info,file);
11923   write_info->adjoin=MagickTrue;
11924   status=WriteImage(write_info,image,&image->exception);
11925   write_info=DestroyImageInfo(write_info);
11926   image=DestroyImage(image);
11927   return(status);
11928 }
11929 \f
11930 /*
11931 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11932 %                                                                             %
11933 %                                                                             %
11934 %                                                                             %
11935 %   M a g i c k W r i t e I m a g e s                                         %
11936 %                                                                             %
11937 %                                                                             %
11938 %                                                                             %
11939 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11940 %
11941 %  MagickWriteImages() writes an image or image sequence.
11942 %
11943 %  The format of the MagickWriteImages method is:
11944 %
11945 %      MagickBooleanType MagickWriteImages(MagickWand *wand,
11946 %        const char *filename,const MagickBooleanType adjoin)
11947 %
11948 %  A description of each parameter follows:
11949 %
11950 %    o wand: the magick wand.
11951 %
11952 %    o filename: the image filename.
11953 %
11954 %    o adjoin: join images into a single multi-image file.
11955 %
11956 */
11957 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
11958   const char *filename,const MagickBooleanType adjoin)
11959 {
11960   ImageInfo
11961     *write_info;
11962
11963   MagickBooleanType
11964     status;
11965
11966   assert(wand != (MagickWand *) NULL);
11967   assert(wand->signature == WandSignature);
11968   if (wand->debug != MagickFalse)
11969     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11970   if (wand->images == (Image *) NULL)
11971     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11972   write_info=CloneImageInfo(wand->image_info);
11973   write_info->adjoin=adjoin;
11974   status=WriteImages(write_info,wand->images,filename,wand->exception);
11975   if (status == MagickFalse)
11976     InheritException(wand->exception,&wand->images->exception);
11977   write_info=DestroyImageInfo(write_info);
11978   return(status);
11979 }
11980 \f
11981 /*
11982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11983 %                                                                             %
11984 %                                                                             %
11985 %                                                                             %
11986 %   M a g i c k W r i t e I m a g e s F i l e                                 %
11987 %                                                                             %
11988 %                                                                             %
11989 %                                                                             %
11990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11991 %
11992 %  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
11993 %
11994 %  The format of the MagickWriteImagesFile method is:
11995 %
11996 %      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
11997 %
11998 %  A description of each parameter follows:
11999 %
12000 %    o wand: the magick wand.
12001 %
12002 %    o file: the file descriptor.
12003 %
12004 */
12005 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12006 {
12007   ImageInfo
12008     *write_info;
12009
12010   MagickBooleanType
12011     status;
12012
12013   assert(wand != (MagickWand *) NULL);
12014   assert(wand->signature == WandSignature);
12015   if (wand->debug != MagickFalse)
12016     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12017   if (wand->images == (Image *) NULL)
12018     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12019   write_info=CloneImageInfo(wand->image_info);
12020   SetImageInfoFile(write_info,file);
12021   write_info->adjoin=MagickTrue;
12022   status=WriteImages(write_info,wand->images,(const char *) NULL,
12023     wand->exception);
12024   write_info=DestroyImageInfo(write_info);
12025   if (status == MagickFalse)
12026     InheritException(wand->exception,&wand->images->exception);
12027   return(status);
12028 }