]> 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-2012 ImageMagick Studio LLC, a non-profit organization      %
27 %  dedicated to making software imaging solutions freely available.           %
28 %                                                                             %
29 %  You may not use this file except in compliance with the License.  You may  %
30 %  obtain a copy of the License at                                            %
31 %                                                                             %
32 %    http://www.imagemagick.org/script/license.php                            %
33 %                                                                             %
34 %  Unless required by applicable law or agreed to in writing, software        %
35 %  distributed under the License is distributed on an "AS IS" BASIS,          %
36 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
37 %  See the License for the specific language governing permissions and        %
38 %  limitations under the License.                                             %
39 %                                                                             %
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 %
42 %
43 %
44 */
45 \f
46 /*
47   Include declarations.
48 */
49 #include "MagickWand/studio.h"
50 #include "MagickWand/MagickWand.h"
51 #include "MagickWand/magick-wand-private.h"
52 #include "MagickWand/wand.h"
53 #include "MagickWand/pixel-wand-private.h"
54 \f
55 /*
56   Define declarations.
57 */
58 #define ThrowWandException(severity,tag,context) \
59 { \
60   (void) ThrowMagickException(wand->exception,GetMagickModule(),severity, \
61     tag,"`%s'",context); \
62   return(MagickFalse); \
63 }
64 #define MagickWandId  "MagickWand"
65 \f
66 /*
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68 %                                                                             %
69 %                                                                             %
70 %                                                                             %
71 +   C l o n e M a g i c k W a n d F r o m I m a g e s                         %
72 %                                                                             %
73 %                                                                             %
74 %                                                                             %
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76 %
77 %  CloneMagickWandFromImages() clones the magick wand and inserts a new image
78 %  list.
79 %
80 %  The format of the CloneMagickWandFromImages method is:
81 %
82 %      MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
83 %        Image *images)
84 %
85 %  A description of each parameter follows:
86 %
87 %    o wand: the magick wand.
88 %
89 %    o images: replace the image list with these image(s).
90 %
91 */
92 static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
93   Image *images)
94 {
95   MagickWand
96     *clone_wand;
97
98   assert(wand != (MagickWand *) NULL);
99   assert(wand->signature == WandSignature);
100   if (wand->debug != MagickFalse)
101     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
102   clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
103   if (clone_wand == (MagickWand *) NULL)
104     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
105       images->filename);
106   (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
107   clone_wand->id=AcquireWandId();
108   (void) FormatLocaleString(clone_wand->name,MaxTextExtent,"%s-%.20g",
109     MagickWandId,(double) clone_wand->id);
110   clone_wand->exception=AcquireExceptionInfo();
111   InheritException(clone_wand->exception,wand->exception);
112   clone_wand->image_info=CloneImageInfo(wand->image_info);
113   clone_wand->quantize_info=CloneQuantizeInfo(wand->quantize_info);
114   clone_wand->images=images;
115   clone_wand->debug=IsEventLogging();
116   if (clone_wand->debug != MagickFalse)
117     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
118   clone_wand->signature=WandSignature;
119   return(clone_wand);
120 }
121 \f
122 /*
123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
124 %                                                                             %
125 %                                                                             %
126 %                                                                             %
127 %   G e t I m a g e F r o m M a g i c k W a n d                               %
128 %                                                                             %
129 %                                                                             %
130 %                                                                             %
131 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
132 %
133 %  GetImageFromMagickWand() returns the current image from the magick wand.
134 %
135 %  The format of the GetImageFromMagickWand method is:
136 %
137 %      Image *GetImageFromMagickWand(const MagickWand *wand)
138 %
139 %  A description of each parameter follows:
140 %
141 %    o wand: the magick wand.
142 %
143 */
144 WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
145 {
146   assert(wand != (MagickWand *) NULL);
147   assert(wand->signature == WandSignature);
148   if (wand->debug != MagickFalse)
149     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
150   if (wand->images == (Image *) NULL)
151     {
152       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
153         "ContainsNoImages","`%s'",wand->name);
154       return((Image *) NULL);
155     }
156   return(wand->images);
157 }
158 \f
159 /*
160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
161 %                                                                             %
162 %                                                                             %
163 %                                                                             %
164 %   M a g i c k A d a p t i v e S h a r p e n I m a g e                       %
165 %                                                                             %
166 %                                                                             %
167 %                                                                             %
168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
169 %
170 %  MagickAdaptiveBlurImage() adaptively blurs the image by blurring
171 %  less intensely near image edges and more intensely far from edges. We
172 %  blur the image with a Gaussian operator of the given radius and standard
173 %  deviation (sigma).  For reasonable results, radius should be larger than
174 %  sigma.  Use a radius of 0 and MagickAdaptiveBlurImage() selects a
175 %  suitable radius for you.
176 %
177 %  The format of the MagickAdaptiveBlurImage method is:
178 %
179 %      MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
180 %        const double radius,const double sigma,const double bias)
181 %
182 %  A description of each parameter follows:
183 %
184 %    o wand: the magick wand.
185 %
186 %    o radius: the radius of the Gaussian, in pixels, not counting the center
187 %      pixel.
188 %
189 %    o sigma: the standard deviation of the Gaussian, in pixels.
190 %
191 %    o bias: the bias.
192 %
193 */
194 WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
195   const double radius,const double sigma,const double bias)
196 {
197   Image
198     *sharp_image;
199
200   assert(wand != (MagickWand *) NULL);
201   assert(wand->signature == WandSignature);
202   if (wand->debug != MagickFalse)
203     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
204   if (wand->images == (Image *) NULL)
205     ThrowWandException(WandError,"ContainsNoImages",wand->name);
206   sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,bias,wand->exception);
207   if (sharp_image == (Image *) NULL)
208     return(MagickFalse);
209   ReplaceImageInList(&wand->images,sharp_image);
210   return(MagickTrue);
211 }
212 \f
213 /*
214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
215 %                                                                             %
216 %                                                                             %
217 %                                                                             %
218 %   M a g i c k A d a p t i v e R e s i z e I m a g e                         %
219 %                                                                             %
220 %                                                                             %
221 %                                                                             %
222 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
223 %
224 %  MagickAdaptiveResizeImage() adaptively resize image with data dependent
225 %  triangulation.
226 %
227 %      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
228 %        const size_t columns,const size_t rows)
229 %
230 %  A description of each parameter follows:
231 %
232 %    o wand: the magick wand.
233 %
234 %    o columns: the number of columns in the scaled image.
235 %
236 %    o rows: the number of rows in the scaled image.
237 %
238 */
239 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
240   const size_t columns,const size_t rows)
241 {
242   Image
243     *resize_image;
244
245   assert(wand != (MagickWand *) NULL);
246   assert(wand->signature == WandSignature);
247   if (wand->debug != MagickFalse)
248     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
249   if (wand->images == (Image *) NULL)
250     ThrowWandException(WandError,"ContainsNoImages",wand->name);
251   resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
252   if (resize_image == (Image *) NULL)
253     return(MagickFalse);
254   ReplaceImageInList(&wand->images,resize_image);
255   return(MagickTrue);
256 }
257 \f
258 /*
259 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
260 %                                                                             %
261 %                                                                             %
262 %                                                                             %
263 %   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                       %
264 %                                                                             %
265 %                                                                             %
266 %                                                                             %
267 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
268 %
269 %  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
270 %  more intensely near image edges and less intensely far from edges. We
271 %  sharpen the image with a Gaussian operator of the given radius and standard
272 %  deviation (sigma).  For reasonable results, radius should be larger than
273 %  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
274 %  suitable radius for you.
275 %
276 %  The format of the MagickAdaptiveSharpenImage method is:
277 %
278 %      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
279 %        const double radius,const double sigma,const double bias)
280 %
281 %  A description of each parameter follows:
282 %
283 %    o wand: the magick wand.
284 %
285 %    o radius: the radius of the Gaussian, in pixels, not counting the center
286 %      pixel.
287 %
288 %    o sigma: the standard deviation of the Gaussian, in pixels.
289 %
290 %    o bias: the bias.
291 %
292 */
293 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
294   const double radius,const double sigma,const double bias)
295 {
296   Image
297     *sharp_image;
298
299   assert(wand != (MagickWand *) NULL);
300   assert(wand->signature == WandSignature);
301   if (wand->debug != MagickFalse)
302     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
303   if (wand->images == (Image *) NULL)
304     ThrowWandException(WandError,"ContainsNoImages",wand->name);
305   sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,bias,
306     wand->exception);
307   if (sharp_image == (Image *) NULL)
308     return(MagickFalse);
309   ReplaceImageInList(&wand->images,sharp_image);
310   return(MagickTrue);
311 }
312 \f
313 /*
314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
315 %                                                                             %
316 %                                                                             %
317 %                                                                             %
318 %   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                   %
319 %                                                                             %
320 %                                                                             %
321 %                                                                             %
322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
323 %
324 %  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
325 %  based on the range of intensity values in its local neighborhood.  This
326 %  allows for thresholding of an image whose global intensity histogram
327 %  doesn't contain distinctive peaks.
328 %
329 %  The format of the AdaptiveThresholdImage method is:
330 %
331 %      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
332 %        const size_t width,const size_t height,const double bias)
333 %
334 %  A description of each parameter follows:
335 %
336 %    o wand: the magick wand.
337 %
338 %    o width: the width of the local neighborhood.
339 %
340 %    o height: the height of the local neighborhood.
341 %
342 %    o offset: the mean bias.
343 %
344 */
345 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
346   const size_t width,const size_t height,const double bias)
347 {
348   Image
349     *threshold_image;
350
351   assert(wand != (MagickWand *) NULL);
352   assert(wand->signature == WandSignature);
353   if (wand->debug != MagickFalse)
354     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
355   if (wand->images == (Image *) NULL)
356     ThrowWandException(WandError,"ContainsNoImages",wand->name);
357   threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
358     wand->exception);
359   if (threshold_image == (Image *) NULL)
360     return(MagickFalse);
361   ReplaceImageInList(&wand->images,threshold_image);
362   return(MagickTrue);
363 }
364 \f
365 /*
366 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
367 %                                                                             %
368 %                                                                             %
369 %                                                                             %
370 %   M a g i c k A d d I m a g e                                               %
371 %                                                                             %
372 %                                                                             %
373 %                                                                             %
374 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
375 %
376 %  MagickAddImage() adds a clone of the images in the second wand and
377 %  inserts them into the first wand, at the current image location.
378 %
379 %  Use MagickSetFirstIterator(), to insert new images before all the current
380 %  images in the wand, otherwise image is placed after the current image.
381 %
382 %  The format of the MagickAddImage method is:
383 %
384 %      MagickBooleanType MagickAddImage(MagickWand *wand,
385 %        const MagickWand *add_wand)
386 %
387 %  A description of each parameter follows:
388 %
389 %    o wand: the magick wand.
390 %
391 %    o add_wand: A wand that contains images to add at the current image
392 %      location.
393 %
394 */
395
396 static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
397   Image *images)
398 {
399   Image
400     *current;
401
402   current=wand->images;  /* note the current image */
403
404   /* if no images in wand, just add them and set first image as current */
405   if (current == (Image *) NULL)
406     {
407       wand->images=GetFirstImageInList(images);
408       return(MagickTrue);
409     }
410
411   /* user jumped to first image, so prepend new images - remain active */
412   if ((wand->set_first != MagickFalse) &&
413        (current->previous == (Image *) NULL) )
414     {
415       PrependImageToList(&current,images);
416       wand->images=GetFirstImageInList(images);
417       return(MagickTrue);
418     }
419   wand->set_first = MagickFalse; /* flag no longer valid */
420
421   /* Current image was flaged as 'pending' iterative processing. */
422   if (wand->image_pending != MagickFalse)
423     {
424       /* current pending image is the last, append new images */
425       if (current->next == (Image *) NULL)
426         {
427           AppendImageToList(&current,images);
428           wand->images=GetLastImageInList(images);
429           return(MagickTrue);
430         }
431       /* current pending image is the first image, prepend it */
432       if (current->previous == (Image *) NULL)
433         {
434           PrependImageToList(&current,images);
435           wand->images=GetFirstImageInList(images);
436           return(MagickTrue);
437         }
438     }
439
440   /* if at last image append new images */
441   if (current->next == (Image *) NULL)
442     {
443       InsertImageInList(&current,images);
444       wand->images=GetLastImageInList(images);
445       return(MagickTrue);
446     }
447   /* otherwise just insert image, just after the current image */
448   InsertImageInList(&current,images);
449   wand->images=GetFirstImageInList(images);
450   return(MagickTrue);
451 }
452
453 WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
454   const MagickWand *add_wand)
455 {
456   Image
457     *images;
458
459   assert(wand != (MagickWand *) NULL);
460   assert(wand->signature == WandSignature);
461   if (wand->debug != MagickFalse)
462     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
463   assert(add_wand != (MagickWand *) NULL);
464   assert(add_wand->signature == WandSignature);
465   if (add_wand->images == (Image *) NULL)
466     ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
467
468   /* clone images in second wand, and insert into first */
469   images=CloneImageList(add_wand->images,wand->exception);
470   if (images == (Image *) NULL)
471     return(MagickFalse);
472   return(InsertImageInWand(wand,images));
473 }
474 \f
475 /*
476 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
477 %                                                                             %
478 %                                                                             %
479 %                                                                             %
480 %     M a g i c k A d d N o i s e I m a g e                                   %
481 %                                                                             %
482 %                                                                             %
483 %                                                                             %
484 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
485 %
486 %  MagickAddNoiseImage() adds random noise to the image.
487 %
488 %  The format of the MagickAddNoiseImage method is:
489 %
490 %      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
491 %        const NoiseType noise_type,const double attenuate)
492 %
493 %  A description of each parameter follows:
494 %
495 %    o wand: the magick wand.
496 %
497 %    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
498 %      Impulse, Laplacian, or Poisson.
499 %
500 %    o attenuate:  attenuate the random distribution.
501 %
502 */
503 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
504   const NoiseType noise_type,const double attenuate)
505 {
506   Image
507     *noise_image;
508
509   assert(wand != (MagickWand *) NULL);
510   assert(wand->signature == WandSignature);
511   if (wand->debug != MagickFalse)
512     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
513   if (wand->images == (Image *) NULL)
514     ThrowWandException(WandError,"ContainsNoImages",wand->name);
515   noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
516   if (noise_image == (Image *) NULL)
517     return(MagickFalse);
518   ReplaceImageInList(&wand->images,noise_image);
519   return(MagickTrue);
520 }
521 \f
522 /*
523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
524 %                                                                             %
525 %                                                                             %
526 %                                                                             %
527 %   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                       %
528 %                                                                             %
529 %                                                                             %
530 %                                                                             %
531 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
532 %
533 %  MagickAffineTransformImage() transforms an image as dictated by the affine
534 %  matrix of the drawing wand.
535 %
536 %  The format of the MagickAffineTransformImage method is:
537 %
538 %      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
539 %        const DrawingWand *drawing_wand)
540 %
541 %  A description of each parameter follows:
542 %
543 %    o wand: the magick wand.
544 %
545 %    o drawing_wand: the draw wand.
546 %
547 */
548 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
549   const DrawingWand *drawing_wand)
550 {
551   DrawInfo
552     *draw_info;
553
554   Image
555     *affine_image;
556
557   assert(wand != (MagickWand *) NULL);
558   assert(wand->signature == WandSignature);
559   if (wand->debug != MagickFalse)
560     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
561   if (wand->images == (Image *) NULL)
562     ThrowWandException(WandError,"ContainsNoImages",wand->name);
563   draw_info=PeekDrawingWand(drawing_wand);
564   if (draw_info == (DrawInfo *) NULL)
565     return(MagickFalse);
566   affine_image=AffineTransformImage(wand->images,&draw_info->affine,
567     wand->exception);
568   draw_info=DestroyDrawInfo(draw_info);
569   if (affine_image == (Image *) NULL)
570     return(MagickFalse);
571   ReplaceImageInList(&wand->images,affine_image);
572   return(MagickTrue);
573 }
574 \f
575 /*
576 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
577 %                                                                             %
578 %                                                                             %
579 %                                                                             %
580 %   M a g i c k A n n o t a t e I m a g e                                     %
581 %                                                                             %
582 %                                                                             %
583 %                                                                             %
584 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
585 %
586 %  MagickAnnotateImage() annotates an image with text.
587 %
588 %  The format of the MagickAnnotateImage method is:
589 %
590 %      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
591 %        const DrawingWand *drawing_wand,const double x,const double y,
592 %        const double angle,const char *text)
593 %
594 %  A description of each parameter follows:
595 %
596 %    o wand: the magick wand.
597 %
598 %    o drawing_wand: the draw wand.
599 %
600 %    o x: x ordinate to left of text
601 %
602 %    o y: y ordinate to text baseline
603 %
604 %    o angle: rotate text relative to this angle.
605 %
606 %    o text: text to draw
607 %
608 */
609 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
610   const DrawingWand *drawing_wand,const double x,const double y,
611   const double angle,const char *text)
612 {
613   char
614     geometry[MaxTextExtent];
615
616   DrawInfo
617     *draw_info;
618
619   MagickBooleanType
620     status;
621
622   assert(wand != (MagickWand *) NULL);
623   assert(wand->signature == WandSignature);
624   if (wand->debug != MagickFalse)
625     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
626   if (wand->images == (Image *) NULL)
627     ThrowWandException(WandError,"ContainsNoImages",wand->name);
628   draw_info=PeekDrawingWand(drawing_wand);
629   if (draw_info == (DrawInfo *) NULL)
630     return(MagickFalse);
631   (void) CloneString(&draw_info->text,text);
632   (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",x,y);
633   draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0)));
634   draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0)));
635   draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0))));
636   draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0)));
637   (void) CloneString(&draw_info->geometry,geometry);
638   status=AnnotateImage(wand->images,draw_info,wand->exception);
639   draw_info=DestroyDrawInfo(draw_info);
640   return(status);
641 }
642 \f
643 /*
644 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
645 %                                                                             %
646 %                                                                             %
647 %                                                                             %
648 %   M a g i c k A n i m a t e I m a g e s                                     %
649 %                                                                             %
650 %                                                                             %
651 %                                                                             %
652 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
653 %
654 %  MagickAnimateImages() animates an image or image sequence.
655 %
656 %  The format of the MagickAnimateImages method is:
657 %
658 %      MagickBooleanType MagickAnimateImages(MagickWand *wand,
659 %        const char *server_name)
660 %
661 %  A description of each parameter follows:
662 %
663 %    o wand: the magick wand.
664 %
665 %    o server_name: the X server name.
666 %
667 */
668 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
669   const char *server_name)
670 {
671   MagickBooleanType
672     status;
673
674   assert(wand != (MagickWand *) NULL);
675   assert(wand->signature == WandSignature);
676   if (wand->debug != MagickFalse)
677     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
678   (void) CloneString(&wand->image_info->server_name,server_name);
679   status=AnimateImages(wand->image_info,wand->images,wand->exception);
680   return(status);
681 }
682 \f
683 /*
684 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
685 %                                                                             %
686 %                                                                             %
687 %                                                                             %
688 %   M a g i c k A p p e n d I m a g e s                                       %
689 %                                                                             %
690 %                                                                             %
691 %                                                                             %
692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
693 %
694 %  MagickAppendImages() append a set of images.
695 %
696 %  The format of the MagickAppendImages method is:
697 %
698 %      MagickWand *MagickAppendImages(MagickWand *wand,
699 %        const MagickBooleanType stack)
700 %
701 %  A description of each parameter follows:
702 %
703 %    o wand: the magick wand.
704 %
705 %    o stack: By default, images are stacked left-to-right. Set stack to
706 %      MagickTrue to stack them top-to-bottom.
707 %
708 */
709 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
710   const MagickBooleanType stack)
711 {
712   Image
713     *append_image;
714
715   assert(wand != (MagickWand *) NULL);
716   assert(wand->signature == WandSignature);
717   if (wand->debug != MagickFalse)
718     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
719   if (wand->images == (Image *) NULL)
720     return((MagickWand *) NULL);
721   append_image=AppendImages(wand->images,stack,wand->exception);
722   if (append_image == (Image *) NULL)
723     return((MagickWand *) NULL);
724   return(CloneMagickWandFromImages(wand,append_image));
725 }
726 \f
727 /*
728 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
729 %                                                                             %
730 %                                                                             %
731 %                                                                             %
732 %   M a g i c k A u t o G a m m a I m a g e                                   %
733 %                                                                             %
734 %                                                                             %
735 %                                                                             %
736 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
737 %
738 %  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
739 %  image to try make set its gamma appropriatally.
740 %
741 %  The format of the MagickAutoGammaImage method is:
742 %
743 %      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
744 %
745 %  A description of each parameter follows:
746 %
747 %    o wand: the magick wand.
748 %
749 */
750 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
751 {
752   MagickBooleanType
753     status;
754
755   assert(wand != (MagickWand *) NULL);
756   assert(wand->signature == WandSignature);
757   if (wand->debug != MagickFalse)
758     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
759   if (wand->images == (Image *) NULL)
760     ThrowWandException(WandError,"ContainsNoImages",wand->name);
761   status=AutoGammaImage(wand->images,wand->exception);
762   return(status);
763 }
764 \f
765 /*
766 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
767 %                                                                             %
768 %                                                                             %
769 %                                                                             %
770 %   M a g i c k A u t o L e v e l I m a g e                                   %
771 %                                                                             %
772 %                                                                             %
773 %                                                                             %
774 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
775 %
776 %  MagickAutoLevelImage() adjusts the levels of a particular image channel by
777 %  scaling the minimum and maximum values to the full quantum range.
778 %
779 %  The format of the MagickAutoLevelImage method is:
780 %
781 %      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
782 %
783 %  A description of each parameter follows:
784 %
785 %    o wand: the magick wand.
786 %
787 */
788 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
789 {
790   MagickBooleanType
791     status;
792
793   assert(wand != (MagickWand *) NULL);
794   assert(wand->signature == WandSignature);
795   if (wand->debug != MagickFalse)
796     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
797   if (wand->images == (Image *) NULL)
798     ThrowWandException(WandError,"ContainsNoImages",wand->name);
799   status=AutoLevelImage(wand->images,wand->exception);
800   return(status);
801 }
802 \f
803 /*
804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
805 %                                                                             %
806 %                                                                             %
807 %                                                                             %
808 %   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                         %
809 %                                                                             %
810 %                                                                             %
811 %                                                                             %
812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
813 %
814 %  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
815 %  pixels below the threshold into black while leaving all pixels above the
816 %  threshold unchanged.
817 %
818 %  The format of the MagickBlackThresholdImage method is:
819 %
820 %      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
821 %        const PixelWand *threshold)
822 %
823 %  A description of each parameter follows:
824 %
825 %    o wand: the magick wand.
826 %
827 %    o threshold: the pixel wand.
828 %
829 */
830 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
831   const PixelWand *threshold)
832 {
833   char
834     thresholds[MaxTextExtent];
835
836   MagickBooleanType
837     status;
838
839   assert(wand != (MagickWand *) NULL);
840   assert(wand->signature == WandSignature);
841   if (wand->debug != MagickFalse)
842     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
843   if (wand->images == (Image *) NULL)
844     ThrowWandException(WandError,"ContainsNoImages",wand->name);
845   (void) FormatLocaleString(thresholds,MaxTextExtent,
846     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
847     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
848     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
849   status=BlackThresholdImage(wand->images,thresholds,wand->exception);
850   return(status);
851 }
852 \f
853 /*
854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
855 %                                                                             %
856 %                                                                             %
857 %                                                                             %
858 %   M a g i c k B l u e S h i f t I m a g e                                   %
859 %                                                                             %
860 %                                                                             %
861 %                                                                             %
862 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
863 %
864 %  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
865 %  nighttime in the moonlight.
866 %
867 %  The format of the MagickBlueShiftImage method is:
868 %
869 %      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
870 %        const double factor)
871 %
872 %  A description of each parameter follows:
873 %
874 %    o wand: the magick wand.
875 %
876 %    o factor: the blue shift factor (default 1.5)
877 %
878 */
879 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
880   const double factor)
881 {
882   Image
883     *shift_image;
884
885   assert(wand != (MagickWand *) NULL);
886   assert(wand->signature == WandSignature);
887   if (wand->debug != MagickFalse)
888     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
889   if (wand->images == (Image *) NULL)
890     ThrowWandException(WandError,"ContainsNoImages",wand->name);
891   shift_image=BlueShiftImage(wand->images,factor,wand->exception);
892   if (shift_image == (Image *) NULL)
893     return(MagickFalse);
894   ReplaceImageInList(&wand->images,shift_image);
895   return(MagickTrue);
896 }
897 \f
898 /*
899 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
900 %                                                                             %
901 %                                                                             %
902 %                                                                             %
903 %   M a g i c k B l u r I m a g e                                             %
904 %                                                                             %
905 %                                                                             %
906 %                                                                             %
907 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
908 %
909 %  MagickBlurImage() blurs an image.  We convolve the image with a
910 %  gaussian operator of the given radius and standard deviation (sigma).
911 %  For reasonable results, the radius should be larger than sigma.  Use a
912 %  radius of 0 and BlurImage() selects a suitable radius for you.
913 %
914 %  The format of the MagickBlurImage method is:
915 %
916 %      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
917 %        const double sigmaconst double bias)
918 %
919 %  A description of each parameter follows:
920 %
921 %    o wand: the magick wand.
922 %
923 %    o radius: the radius of the , in pixels, not counting the center
924 %      pixel.
925 %
926 %    o sigma: the standard deviation of the , in pixels.
927 %
928 %    o bias: the bias.
929 %
930 */
931 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
932   const double radius,const double sigma,const double bias)
933 {
934   Image
935     *blur_image;
936
937   assert(wand != (MagickWand *) NULL);
938   assert(wand->signature == WandSignature);
939   if (wand->debug != MagickFalse)
940     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
941   if (wand->images == (Image *) NULL)
942     ThrowWandException(WandError,"ContainsNoImages",wand->name);
943   blur_image=BlurImage(wand->images,radius,sigma,bias,wand->exception);
944   if (blur_image == (Image *) NULL)
945     return(MagickFalse);
946   ReplaceImageInList(&wand->images,blur_image);
947   return(MagickTrue);
948 }
949 \f
950 /*
951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
952 %                                                                             %
953 %                                                                             %
954 %                                                                             %
955 %   M a g i c k B o r d e r I m a g e                                         %
956 %                                                                             %
957 %                                                                             %
958 %                                                                             %
959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
960 %
961 %  MagickBorderImage() surrounds the image with a border of the color defined
962 %  by the bordercolor pixel wand.
963 %
964 %  The format of the MagickBorderImage method is:
965 %
966 %      MagickBooleanType MagickBorderImage(MagickWand *wand,
967 %        const PixelWand *bordercolor,const size_t width,
968 %        const size_t height,const CompositeOperator compose)
969 %
970 %  A description of each parameter follows:
971 %
972 %    o wand: the magick wand.
973 %
974 %    o bordercolor: the border color pixel wand.
975 %
976 %    o width: the border width.
977 %
978 %    o height: the border height.
979 %
980 %    o compose: the composite operator.
981 %
982 */
983 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
984   const PixelWand *bordercolor,const size_t width,const size_t height,
985   const CompositeOperator compose)
986 {
987   Image
988     *border_image;
989
990   RectangleInfo
991     border_info;
992
993   assert(wand != (MagickWand *) NULL);
994   assert(wand->signature == WandSignature);
995   if (wand->debug != MagickFalse)
996     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
997   if (wand->images == (Image *) NULL)
998     ThrowWandException(WandError,"ContainsNoImages",wand->name);
999   border_info.width=width;
1000   border_info.height=height;
1001   border_info.x=0;
1002   border_info.y=0;
1003   PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
1004   border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
1005   if (border_image == (Image *) NULL)
1006     return(MagickFalse);
1007   ReplaceImageInList(&wand->images,border_image);
1008   return(MagickTrue);
1009 }
1010 \f
1011 /*
1012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1013 %                                                                             %
1014 %                                                                             %
1015 %                                                                             %
1016 %   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   %
1017 %                                                                             %
1018 %                                                                             %
1019 %                                                                             %
1020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1021 %
1022 %  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1023 %  of an image.  It converts the brightness and contrast parameters into slope
1024 %  and intercept and calls a polynomical function to apply to the image.
1025
1026 %
1027 %  The format of the MagickBrightnessContrastImage method is:
1028 %
1029 %      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1030 %        const double brightness,const double contrast)
1031 %
1032 %  A description of each parameter follows:
1033 %
1034 %    o wand: the magick wand.
1035 %
1036 %    o brightness: the brightness percent (-100 .. 100).
1037 %
1038 %    o contrast: the contrast percent (-100 .. 100).
1039 %
1040 */
1041 WandExport MagickBooleanType MagickBrightnessContrastImage(
1042   MagickWand *wand,const double brightness,const double contrast)
1043 {
1044   MagickBooleanType
1045     status;
1046
1047   assert(wand != (MagickWand *) NULL);
1048   assert(wand->signature == WandSignature);
1049   if (wand->debug != MagickFalse)
1050     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1051   if (wand->images == (Image *) NULL)
1052     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1053   status=BrightnessContrastImage(wand->images,brightness,contrast,
1054     wand->exception);
1055   return(status);
1056 }
1057 \f
1058 /*
1059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1060 %                                                                             %
1061 %                                                                             %
1062 %                                                                             %
1063 %   M a g i c k C h a r c o a l I m a g e                                     %
1064 %                                                                             %
1065 %                                                                             %
1066 %                                                                             %
1067 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1068 %
1069 %  MagickCharcoalImage() simulates a charcoal drawing.
1070 %
1071 %  The format of the MagickCharcoalImage method is:
1072 %
1073 %      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1074 %        const double radius,const double sigma,const double bias)
1075 %
1076 %  A description of each parameter follows:
1077 %
1078 %    o wand: the magick wand.
1079 %
1080 %    o radius: the radius of the Gaussian, in pixels, not counting the center
1081 %      pixel.
1082 %
1083 %    o sigma: the standard deviation of the Gaussian, in pixels.
1084 %
1085 %    o bias: the bias.
1086 %
1087 */
1088 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1089   const double radius,const double sigma,const double bias)
1090 {
1091   Image
1092     *charcoal_image;
1093
1094   assert(wand != (MagickWand *) NULL);
1095   assert(wand->signature == WandSignature);
1096   if (wand->debug != MagickFalse)
1097     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1098   if (wand->images == (Image *) NULL)
1099     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1100   charcoal_image=CharcoalImage(wand->images,radius,sigma,bias,wand->exception);
1101   if (charcoal_image == (Image *) NULL)
1102     return(MagickFalse);
1103   ReplaceImageInList(&wand->images,charcoal_image);
1104   return(MagickTrue);
1105 }
1106 \f
1107 /*
1108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1109 %                                                                             %
1110 %                                                                             %
1111 %                                                                             %
1112 %   M a g i c k C h o p I m a g e                                             %
1113 %                                                                             %
1114 %                                                                             %
1115 %                                                                             %
1116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1117 %
1118 %  MagickChopImage() removes a region of an image and collapses the image to
1119 %  occupy the removed portion
1120 %
1121 %  The format of the MagickChopImage method is:
1122 %
1123 %      MagickBooleanType MagickChopImage(MagickWand *wand,
1124 %        const size_t width,const size_t height,const ssize_t x,
1125 %        const ssize_t y)
1126 %
1127 %  A description of each parameter follows:
1128 %
1129 %    o wand: the magick wand.
1130 %
1131 %    o width: the region width.
1132 %
1133 %    o height: the region height.
1134 %
1135 %    o x: the region x offset.
1136 %
1137 %    o y: the region y offset.
1138 %
1139 %
1140 */
1141 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1142   const size_t width,const size_t height,const ssize_t x,
1143   const ssize_t y)
1144 {
1145   Image
1146     *chop_image;
1147
1148   RectangleInfo
1149     chop;
1150
1151   assert(wand != (MagickWand *) NULL);
1152   assert(wand->signature == WandSignature);
1153   if (wand->debug != MagickFalse)
1154     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1155   if (wand->images == (Image *) NULL)
1156     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1157   chop.width=width;
1158   chop.height=height;
1159   chop.x=x;
1160   chop.y=y;
1161   chop_image=ChopImage(wand->images,&chop,wand->exception);
1162   if (chop_image == (Image *) NULL)
1163     return(MagickFalse);
1164   ReplaceImageInList(&wand->images,chop_image);
1165   return(MagickTrue);
1166 }
1167 \f
1168 /*
1169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1170 %                                                                             %
1171 %                                                                             %
1172 %                                                                             %
1173 %   M a g i c k C l a m p I m a g e                                           %
1174 %                                                                             %
1175 %                                                                             %
1176 %                                                                             %
1177 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1178 %
1179 %  MagickClampImage() restricts the color range from 0 to the quantum depth.
1180 %
1181 %  The format of the MagickClampImage method is:
1182 %
1183 %      MagickBooleanType MagickClampImage(MagickWand *wand)
1184 %
1185 %  A description of each parameter follows:
1186 %
1187 %    o wand: the magick wand.
1188 %
1189 %    o channel: the channel.
1190 %
1191 */
1192 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1193 {
1194   assert(wand != (MagickWand *) NULL);
1195   assert(wand->signature == WandSignature);
1196   if (wand->debug != MagickFalse)
1197     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1198   if (wand->images == (Image *) NULL)
1199     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1200   return(ClampImage(wand->images,wand->exception));
1201 }
1202 \f
1203 /*
1204 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1205 %                                                                             %
1206 %                                                                             %
1207 %                                                                             %
1208 %   M a g i c k C l i p I m a g e                                             %
1209 %                                                                             %
1210 %                                                                             %
1211 %                                                                             %
1212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1213 %
1214 %  MagickClipImage() clips along the first path from the 8BIM profile, if
1215 %  present.
1216 %
1217 %  The format of the MagickClipImage method is:
1218 %
1219 %      MagickBooleanType MagickClipImage(MagickWand *wand)
1220 %
1221 %  A description of each parameter follows:
1222 %
1223 %    o wand: the magick wand.
1224 %
1225 */
1226 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1227 {
1228   MagickBooleanType
1229     status;
1230
1231   assert(wand != (MagickWand *) NULL);
1232   assert(wand->signature == WandSignature);
1233   if (wand->debug != MagickFalse)
1234     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1235   if (wand->images == (Image *) NULL)
1236     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1237   status=ClipImage(wand->images,wand->exception);
1238   return(status);
1239 }
1240 \f
1241 /*
1242 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1243 %                                                                             %
1244 %                                                                             %
1245 %                                                                             %
1246 %   M a g i c k C l i p I m a g e P a t h                                     %
1247 %                                                                             %
1248 %                                                                             %
1249 %                                                                             %
1250 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1251 %
1252 %  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1253 %  present. Later operations take effect inside the path.  Id may be a number
1254 %  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1255 %  path.
1256 %
1257 %  The format of the MagickClipImagePath method is:
1258 %
1259 %      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1260 %        const char *pathname,const MagickBooleanType inside)
1261 %
1262 %  A description of each parameter follows:
1263 %
1264 %    o wand: the magick wand.
1265 %
1266 %    o pathname: name of clipping path resource. If name is preceded by #, use
1267 %      clipping path numbered by name.
1268 %
1269 %    o inside: if non-zero, later operations take effect inside clipping path.
1270 %      Otherwise later operations take effect outside clipping path.
1271 %
1272 */
1273 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1274   const char *pathname,const MagickBooleanType inside)
1275 {
1276   MagickBooleanType
1277     status;
1278
1279   assert(wand != (MagickWand *) NULL);
1280   assert(wand->signature == WandSignature);
1281   if (wand->debug != MagickFalse)
1282     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1283   if (wand->images == (Image *) NULL)
1284     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1285   status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1286   return(status);
1287 }
1288 \f
1289 /*
1290 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1291 %                                                                             %
1292 %                                                                             %
1293 %                                                                             %
1294 %   M a g i c k C l u t I m a g e                                             %
1295 %                                                                             %
1296 %                                                                             %
1297 %                                                                             %
1298 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1299 %
1300 %  MagickClutImage() replaces colors in the image from a color lookup table.
1301 %
1302 %  The format of the MagickClutImage method is:
1303 %
1304 %      MagickBooleanType MagickClutImage(MagickWand *wand,
1305 %        const MagickWand *clut_wand,const PixelInterpolateMethod method)
1306 %
1307 %  A description of each parameter follows:
1308 %
1309 %    o wand: the magick wand.
1310 %
1311 %    o clut_image: the clut image.
1312 %
1313 %    o method: the pixel interpolation method.
1314 %
1315 */
1316 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1317   const MagickWand *clut_wand,const PixelInterpolateMethod method)
1318 {
1319   MagickBooleanType
1320     status;
1321
1322   assert(wand != (MagickWand *) NULL);
1323   assert(wand->signature == WandSignature);
1324   if (wand->debug != MagickFalse)
1325     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1326   if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1327     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1328   status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1329   return(status);
1330 }
1331 \f
1332 /*
1333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1334 %                                                                             %
1335 %                                                                             %
1336 %                                                                             %
1337 %   M a g i c k C o a l e s c e I m a g e s                                   %
1338 %                                                                             %
1339 %                                                                             %
1340 %                                                                             %
1341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1342 %
1343 %  MagickCoalesceImages() composites a set of images while respecting any page
1344 %  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1345 %  typically start with an image background and each subsequent image
1346 %  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1347 %  where each image in the sequence is the same size as the first and
1348 %  composited with the next image in the sequence.
1349 %
1350 %  The format of the MagickCoalesceImages method is:
1351 %
1352 %      MagickWand *MagickCoalesceImages(MagickWand *wand)
1353 %
1354 %  A description of each parameter follows:
1355 %
1356 %    o wand: the magick wand.
1357 %
1358 */
1359 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1360 {
1361   Image
1362     *coalesce_image;
1363
1364   assert(wand != (MagickWand *) NULL);
1365   assert(wand->signature == WandSignature);
1366   if (wand->debug != MagickFalse)
1367     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1368   if (wand->images == (Image *) NULL)
1369     return((MagickWand *) NULL);
1370   coalesce_image=CoalesceImages(wand->images,wand->exception);
1371   if (coalesce_image == (Image *) NULL)
1372     return((MagickWand *) NULL);
1373   return(CloneMagickWandFromImages(wand,coalesce_image));
1374 }
1375 \f
1376 /*
1377 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1378 %                                                                             %
1379 %                                                                             %
1380 %                                                                             %
1381 %   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1382 %                                                                             %
1383 %                                                                             %
1384 %                                                                             %
1385 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1386 %
1387 %  MagickColorDecisionListImage() accepts a lightweight Color Correction
1388 %  Collection (CCC) file which solely contains one or more color corrections
1389 %  and applies the color correction to the image.  Here is a sample CCC file:
1390 %
1391 %    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1392 %          <ColorCorrection id="cc03345">
1393 %                <SOPNode>
1394 %                     <Slope> 0.9 1.2 0.5 </Slope>
1395 %                     <Offset> 0.4 -0.5 0.6 </Offset>
1396 %                     <Power> 1.0 0.8 1.5 </Power>
1397 %                </SOPNode>
1398 %                <SATNode>
1399 %                     <Saturation> 0.85 </Saturation>
1400 %                </SATNode>
1401 %          </ColorCorrection>
1402 %    </ColorCorrectionCollection>
1403 %
1404 %  which includes the offset, slope, and power for each of the RGB channels
1405 %  as well as the saturation.
1406 %
1407 %  The format of the MagickColorDecisionListImage method is:
1408 %
1409 %      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1410 %        const double gamma)
1411 %
1412 %  A description of each parameter follows:
1413 %
1414 %    o wand: the magick wand.
1415 %
1416 %    o color_correction_collection: the color correction collection in XML.
1417 %
1418 */
1419 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1420   const char *color_correction_collection)
1421 {
1422   MagickBooleanType
1423     status;
1424
1425   assert(wand != (MagickWand *) NULL);
1426   assert(wand->signature == WandSignature);
1427   if (wand->debug != MagickFalse)
1428     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1429   if (wand->images == (Image *) NULL)
1430     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1431   status=ColorDecisionListImage(wand->images,color_correction_collection,
1432     wand->exception);
1433   return(status);
1434 }
1435 \f
1436 /*
1437 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1438 %                                                                             %
1439 %                                                                             %
1440 %                                                                             %
1441 %   M a g i c k C o l o r i z e I m a g e                                     %
1442 %                                                                             %
1443 %                                                                             %
1444 %                                                                             %
1445 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1446 %
1447 %  MagickColorizeImage() blends the fill color with each pixel in the image.
1448 %
1449 %  The format of the MagickColorizeImage method is:
1450 %
1451 %      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1452 %        const PixelWand *colorize,const PixelWand *blend)
1453 %
1454 %  A description of each parameter follows:
1455 %
1456 %    o wand: the magick wand.
1457 %
1458 %    o colorize: the colorize pixel wand.
1459 %
1460 %    o alpha: the alpha pixel wand.
1461 %
1462 */
1463 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1464   const PixelWand *colorize,const PixelWand *blend)
1465 {
1466   char
1467     percent_blend[MaxTextExtent];
1468
1469   Image
1470     *colorize_image;
1471
1472   PixelInfo
1473     target;
1474
1475   assert(wand != (MagickWand *) NULL);
1476   assert(wand->signature == WandSignature);
1477   if (wand->debug != MagickFalse)
1478     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1479   if (wand->images == (Image *) NULL)
1480     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1481   GetPixelInfo(wand->images,&target);
1482   if (target.colorspace != CMYKColorspace)
1483     (void) FormatLocaleString(percent_blend,MaxTextExtent,
1484       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1485       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1486       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1487       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1488       PixelGetAlphaQuantum(blend)));
1489   else
1490     (void) FormatLocaleString(percent_blend,MaxTextExtent,
1491       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1492       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1493       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1494       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1495       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1496       PixelGetAlphaQuantum(blend)));
1497   target=PixelGetPixel(colorize);
1498   colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1499     wand->exception);
1500   if (colorize_image == (Image *) NULL)
1501     return(MagickFalse);
1502   ReplaceImageInList(&wand->images,colorize_image);
1503   return(MagickTrue);
1504 }
1505 \f
1506 /*
1507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1508 %                                                                             %
1509 %                                                                             %
1510 %                                                                             %
1511 %   M a g i c k C o l o r M a t r i x I m a g e                               %
1512 %                                                                             %
1513 %                                                                             %
1514 %                                                                             %
1515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1516 %
1517 %  MagickColorMatrixImage() apply color transformation to an image. The method
1518 %  permits saturation changes, hue rotation, luminance to alpha, and various
1519 %  other effects.  Although variable-sized transformation matrices can be used,
1520 %  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1521 %  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1522 %  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1523 %  and offsets are normalized (divide Flash offset by 255).
1524 %
1525 %  The format of the MagickColorMatrixImage method is:
1526 %
1527 %      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1528 %        const KernelInfo *color_matrix)
1529 %
1530 %  A description of each parameter follows:
1531 %
1532 %    o wand: the magick wand.
1533 %
1534 %    o color_matrix:  the color matrix.
1535 %
1536 */
1537 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1538   const KernelInfo *color_matrix)
1539 {
1540   Image
1541     *color_image;
1542
1543   assert(wand != (MagickWand *) NULL);
1544   assert(wand->signature == WandSignature);
1545   if (wand->debug != MagickFalse)
1546     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1547   if (color_matrix == (const KernelInfo *) NULL)
1548     return(MagickFalse);
1549   if (wand->images == (Image *) NULL)
1550     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1551   color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1552   if (color_image == (Image *) NULL)
1553     return(MagickFalse);
1554   ReplaceImageInList(&wand->images,color_image);
1555   return(MagickTrue);
1556 }
1557 \f
1558 /*
1559 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1560 %                                                                             %
1561 %                                                                             %
1562 %                                                                             %
1563 %   M a g i c k C o m b i n e I m a g e s                                     %
1564 %                                                                             %
1565 %                                                                             %
1566 %                                                                             %
1567 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1568 %
1569 %  MagickCombineImages() combines one or more images into a single image.  The
1570 %  grayscale value of the pixels of each image in the sequence is assigned in
1571 %  order to the specified  hannels of the combined image.   The typical
1572 %  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1573 %
1574 %  The format of the MagickCombineImages method is:
1575 %
1576 %      MagickWand *MagickCombineImages(MagickWand *wand)
1577 %
1578 %  A description of each parameter follows:
1579 %
1580 %    o wand: the magick wand.
1581 %
1582 */
1583 WandExport MagickWand *MagickCombineImages(MagickWand *wand)
1584 {
1585   Image
1586     *combine_image;
1587
1588   assert(wand != (MagickWand *) NULL);
1589   assert(wand->signature == WandSignature);
1590   if (wand->debug != MagickFalse)
1591     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1592   if (wand->images == (Image *) NULL)
1593     return((MagickWand *) NULL);
1594   combine_image=CombineImages(wand->images,wand->exception);
1595   if (combine_image == (Image *) NULL)
1596     return((MagickWand *) NULL);
1597   return(CloneMagickWandFromImages(wand,combine_image));
1598 }
1599 \f
1600 /*
1601 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1602 %                                                                             %
1603 %                                                                             %
1604 %                                                                             %
1605 %   M a g i c k C o m m e n t I m a g e                                       %
1606 %                                                                             %
1607 %                                                                             %
1608 %                                                                             %
1609 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1610 %
1611 %  MagickCommentImage() adds a comment to your image.
1612 %
1613 %  The format of the MagickCommentImage method is:
1614 %
1615 %      MagickBooleanType MagickCommentImage(MagickWand *wand,
1616 %        const char *comment)
1617 %
1618 %  A description of each parameter follows:
1619 %
1620 %    o wand: the magick wand.
1621 %
1622 %    o comment: the image comment.
1623 %
1624 */
1625 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1626   const char *comment)
1627 {
1628   MagickBooleanType
1629     status;
1630
1631   assert(wand != (MagickWand *) NULL);
1632   assert(wand->signature == WandSignature);
1633   if (wand->debug != MagickFalse)
1634     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1635   if (wand->images == (Image *) NULL)
1636     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1637   status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1638   return(status);
1639 }
1640 \f
1641 /*
1642 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1643 %                                                                             %
1644 %                                                                             %
1645 %                                                                             %
1646 %   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1647 %                                                                             %
1648 %                                                                             %
1649 %                                                                             %
1650 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1651 %
1652 %  MagickCompareImagesLayers() compares each image with the next in a sequence
1653 %  and returns the maximum bounding region of any pixel differences it
1654 %  discovers.
1655 %
1656 %  The format of the MagickCompareImagesLayers method is:
1657 %
1658 %      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1659 %        const ImageLayerMethod method)
1660 %
1661 %  A description of each parameter follows:
1662 %
1663 %    o wand: the magick wand.
1664 %
1665 %    o method: the compare method.
1666 %
1667 */
1668 WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1669   const ImageLayerMethod method)
1670 {
1671   Image
1672     *layers_image;
1673
1674   assert(wand != (MagickWand *) NULL);
1675   assert(wand->signature == WandSignature);
1676   if (wand->debug != MagickFalse)
1677     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1678   if (wand->images == (Image *) NULL)
1679     return((MagickWand *) NULL);
1680   layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1681   if (layers_image == (Image *) NULL)
1682     return((MagickWand *) NULL);
1683   return(CloneMagickWandFromImages(wand,layers_image));
1684 }
1685 \f
1686 /*
1687 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1688 %                                                                             %
1689 %                                                                             %
1690 %                                                                             %
1691 %   M a g i c k C o m p a r e I m a g e s                                     %
1692 %                                                                             %
1693 %                                                                             %
1694 %                                                                             %
1695 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1696 %
1697 %  MagickCompareImages() compares an image to a reconstructed image and returns
1698 %  the specified difference image.
1699 %
1700 %  The format of the MagickCompareImages method is:
1701 %
1702 %      MagickWand *MagickCompareImages(MagickWand *wand,
1703 %        const MagickWand *reference,const MetricType metric,
1704 %        double *distortion)
1705 %
1706 %  A description of each parameter follows:
1707 %
1708 %    o wand: the magick wand.
1709 %
1710 %    o reference: the reference wand.
1711 %
1712 %    o metric: the metric.
1713 %
1714 %    o distortion: the computed distortion between the images.
1715 %
1716 */
1717 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1718   const MagickWand *reference,const MetricType metric,double *distortion)
1719 {
1720   Image
1721     *compare_image;
1722
1723
1724   assert(wand != (MagickWand *) NULL);
1725   assert(wand->signature == WandSignature);
1726   if (wand->debug != MagickFalse)
1727     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1728   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1729     {
1730       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1731         "ContainsNoImages","`%s'",wand->name);
1732       return((MagickWand *) NULL);
1733     }
1734   compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1735     wand->exception);
1736   if (compare_image == (Image *) NULL)
1737     return((MagickWand *) NULL);
1738   return(CloneMagickWandFromImages(wand,compare_image));
1739 }
1740 \f
1741 /*
1742 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1743 %                                                                             %
1744 %                                                                             %
1745 %                                                                             %
1746 %   M a g i c k C o m p o s i t e I m a g e                                   %
1747 %                                                                             %
1748 %                                                                             %
1749 %                                                                             %
1750 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1751 %
1752 %  MagickCompositeImage() composite one image onto another at the specified
1753 %  offset.
1754 %
1755 %  The format of the MagickCompositeImage method is:
1756 %
1757 %      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1758 %        const MagickWand *composite_wand,const CompositeOperator compose,
1759 %        const ssize_t x,const ssize_t y)
1760 %
1761 %  A description of each parameter follows:
1762 %
1763 %    o wand: the magick wand.
1764 %
1765 %    o composite_image: the composite image.
1766 %
1767 %    o compose: This operator affects how the composite is applied to the
1768 %      image.  The default is Over.  Choose from these operators:
1769 %
1770 %        OverCompositeOp       InCompositeOp         OutCompositeOp
1771 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1772 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1773 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1774 %        DisplaceCompositeOp
1775 %
1776 %    o x: the column offset of the composited image.
1777 %
1778 %    o y: the row offset of the composited image.
1779 %
1780 */
1781 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1782   const MagickWand *composite_wand,const CompositeOperator compose,
1783   const ssize_t x,const ssize_t y)
1784 {
1785   MagickBooleanType
1786     status;
1787
1788   assert(wand != (MagickWand *) NULL);
1789   assert(wand->signature == WandSignature);
1790   if (wand->debug != MagickFalse)
1791     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1792   if ((wand->images == (Image *) NULL) ||
1793       (composite_wand->images == (Image *) NULL))
1794     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1795   status=CompositeImage(wand->images,compose,composite_wand->images,x,y,
1796     wand->exception);
1797   return(status);
1798 }
1799 \f
1800 /*
1801 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1802 %                                                                             %
1803 %                                                                             %
1804 %                                                                             %
1805 %   M a g i c k C o n t r a s t I m a g e                                     %
1806 %                                                                             %
1807 %                                                                             %
1808 %                                                                             %
1809 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1810 %
1811 %  MagickContrastImage() enhances the intensity differences between the lighter
1812 %  and darker elements of the image.  Set sharpen to a value other than 0 to
1813 %  increase the image contrast otherwise the contrast is reduced.
1814 %
1815 %  The format of the MagickContrastImage method is:
1816 %
1817 %      MagickBooleanType MagickContrastImage(MagickWand *wand,
1818 %        const MagickBooleanType sharpen)
1819 %
1820 %  A description of each parameter follows:
1821 %
1822 %    o wand: the magick wand.
1823 %
1824 %    o sharpen: Increase or decrease image contrast.
1825 %
1826 %
1827 */
1828 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1829   const MagickBooleanType sharpen)
1830 {
1831   MagickBooleanType
1832     status;
1833
1834   assert(wand != (MagickWand *) NULL);
1835   assert(wand->signature == WandSignature);
1836   if (wand->debug != MagickFalse)
1837     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1838   if (wand->images == (Image *) NULL)
1839     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1840   status=ContrastImage(wand->images,sharpen,wand->exception);
1841   return(status);
1842 }
1843 \f
1844 /*
1845 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1846 %                                                                             %
1847 %                                                                             %
1848 %                                                                             %
1849 %   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                       %
1850 %                                                                             %
1851 %                                                                             %
1852 %                                                                             %
1853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1854 %
1855 %  MagickContrastStretchImage() enhances the contrast of a color image by
1856 %  adjusting the pixels color to span the entire range of colors available.
1857 %  You can also reduce the influence of a particular channel with a gamma
1858 %  value of 0.
1859 %
1860 %  The format of the MagickContrastStretchImage method is:
1861 %
1862 %      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1863 %        const double black_point,const double white_point)
1864 %
1865 %  A description of each parameter follows:
1866 %
1867 %    o wand: the magick wand.
1868 %
1869 %    o black_point: the black point.
1870 %
1871 %    o white_point: the white point.
1872 %
1873 */
1874 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1875   const double black_point,const double white_point)
1876 {
1877   MagickBooleanType
1878     status;
1879
1880   assert(wand != (MagickWand *) NULL);
1881   assert(wand->signature == WandSignature);
1882   if (wand->debug != MagickFalse)
1883     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1884   if (wand->images == (Image *) NULL)
1885     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1886   status=ContrastStretchImage(wand->images,black_point,white_point,
1887     wand->exception);
1888   return(status);
1889 }
1890 \f
1891 /*
1892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1893 %                                                                             %
1894 %                                                                             %
1895 %                                                                             %
1896 %   M a g i c k C o n v o l v e I m a g e                                     %
1897 %                                                                             %
1898 %                                                                             %
1899 %                                                                             %
1900 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1901 %
1902 %  MagickConvolveImage() applies a custom convolution kernel to the image.
1903 %
1904 %  The format of the MagickConvolveImage method is:
1905 %
1906 %      MagickBooleanType MagickConvolveImage(MagickWand *wand,
1907 %        const KernelInfo *kernel)
1908 %
1909 %  A description of each parameter follows:
1910 %
1911 %    o wand: the magick wand.
1912 %
1913 %    o kernel: An array of doubles representing the convolution kernel.
1914 %
1915 */
1916 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
1917   const KernelInfo *kernel)
1918 {
1919   Image
1920     *filter_image;
1921
1922   assert(wand != (MagickWand *) NULL);
1923   assert(wand->signature == WandSignature);
1924   if (wand->debug != MagickFalse)
1925     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1926   if (kernel == (const KernelInfo *) NULL)
1927     return(MagickFalse);
1928   if (wand->images == (Image *) NULL)
1929     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1930   filter_image=ConvolveImage(wand->images,kernel,wand->exception);
1931   if (filter_image == (Image *) NULL)
1932     return(MagickFalse);
1933   ReplaceImageInList(&wand->images,filter_image);
1934   return(MagickTrue);
1935 }
1936 \f
1937 /*
1938 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1939 %                                                                             %
1940 %                                                                             %
1941 %                                                                             %
1942 %   M a g i c k C r o p I m a g e                                             %
1943 %                                                                             %
1944 %                                                                             %
1945 %                                                                             %
1946 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1947 %
1948 %  MagickCropImage() extracts a region of the image.
1949 %
1950 %  The format of the MagickCropImage method is:
1951 %
1952 %      MagickBooleanType MagickCropImage(MagickWand *wand,
1953 %        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1954 %
1955 %  A description of each parameter follows:
1956 %
1957 %    o wand: the magick wand.
1958 %
1959 %    o width: the region width.
1960 %
1961 %    o height: the region height.
1962 %
1963 %    o x: the region x-offset.
1964 %
1965 %    o y: the region y-offset.
1966 %
1967 */
1968 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
1969   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1970 {
1971   Image
1972     *crop_image;
1973
1974   RectangleInfo
1975     crop;
1976
1977   assert(wand != (MagickWand *) NULL);
1978   assert(wand->signature == WandSignature);
1979   if (wand->debug != MagickFalse)
1980     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1981   if (wand->images == (Image *) NULL)
1982     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1983   crop.width=width;
1984   crop.height=height;
1985   crop.x=x;
1986   crop.y=y;
1987   crop_image=CropImage(wand->images,&crop,wand->exception);
1988   if (crop_image == (Image *) NULL)
1989     return(MagickFalse);
1990   ReplaceImageInList(&wand->images,crop_image);
1991   return(MagickTrue);
1992 }
1993 \f
1994 /*
1995 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1996 %                                                                             %
1997 %                                                                             %
1998 %                                                                             %
1999 %   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2000 %                                                                             %
2001 %                                                                             %
2002 %                                                                             %
2003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2004 %
2005 %  MagickCycleColormapImage() displaces an image's colormap by a given number
2006 %  of positions.  If you cycle the colormap a number of times you can produce
2007 %  a psychodelic effect.
2008 %
2009 %  The format of the MagickCycleColormapImage method is:
2010 %
2011 %      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2012 %        const ssize_t displace)
2013 %
2014 %  A description of each parameter follows:
2015 %
2016 %    o wand: the magick wand.
2017 %
2018 %    o pixel_wand: the pixel wand.
2019 %
2020 */
2021 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2022   const ssize_t displace)
2023 {
2024   MagickBooleanType
2025     status;
2026
2027   assert(wand != (MagickWand *) NULL);
2028   assert(wand->signature == WandSignature);
2029   if (wand->debug != MagickFalse)
2030     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2031   if (wand->images == (Image *) NULL)
2032     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2033   status=CycleColormapImage(wand->images,displace,wand->exception);
2034   return(status);
2035 }
2036 \f
2037 /*
2038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2039 %                                                                             %
2040 %                                                                             %
2041 %                                                                             %
2042 %   M a g i c k C o n s t i t u t e I m a g e                                 %
2043 %                                                                             %
2044 %                                                                             %
2045 %                                                                             %
2046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2047 %
2048 %  MagickConstituteImage() adds an image to the wand comprised of the pixel
2049 %  data you supply.  The pixel data must be in scanline order top-to-bottom.
2050 %  The data can be char, short int, int, float, or double.  Float and double
2051 %  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2052 %  is the maximum value the type can accomodate (e.g. 255 for char).  For
2053 %  example, to create a 640x480 image from unsigned red-green-blue character
2054 %  data, use
2055 %
2056 %      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2057 %
2058 %  The format of the MagickConstituteImage method is:
2059 %
2060 %      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2061 %        const size_t columns,const size_t rows,const char *map,
2062 %        const StorageType storage,void *pixels)
2063 %
2064 %  A description of each parameter follows:
2065 %
2066 %    o wand: the magick wand.
2067 %
2068 %    o columns: width in pixels of the image.
2069 %
2070 %    o rows: height in pixels of the image.
2071 %
2072 %    o map:  This string reflects the expected ordering of the pixel array.
2073 %      It can be any combination or order of R = red, G = green, B = blue,
2074 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2075 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2076 %      P = pad.
2077 %
2078 %    o storage: Define the data type of the pixels.  Float and double types are
2079 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2080 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2081 %      LongPixel, QuantumPixel, or ShortPixel.
2082 %
2083 %    o pixels: This array of values contain the pixel components as defined by
2084 %      map and type.  You must preallocate this array where the expected
2085 %      length varies depending on the values of width, height, map, and type.
2086 %
2087 %
2088 */
2089 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2090   const size_t columns,const size_t rows,const char *map,
2091   const StorageType storage,const void *pixels)
2092 {
2093   Image
2094     *images;
2095
2096   assert(wand != (MagickWand *) NULL);
2097   assert(wand->signature == WandSignature);
2098   if (wand->debug != MagickFalse)
2099     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2100   images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2101   if (images == (Image *) NULL)
2102     return(MagickFalse);
2103   return(InsertImageInWand(wand,images));
2104 }
2105 \f
2106 /*
2107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2108 %                                                                             %
2109 %                                                                             %
2110 %                                                                             %
2111 %   M a g i c k D e c i p h e r I m a g e                                     %
2112 %                                                                             %
2113 %                                                                             %
2114 %                                                                             %
2115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2116 %
2117 %  MagickDecipherImage() converts cipher pixels to plain pixels.
2118 %
2119 %  The format of the MagickDecipherImage method is:
2120 %
2121 %      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2122 %        const char *passphrase)
2123 %
2124 %  A description of each parameter follows:
2125 %
2126 %    o wand: the magick wand.
2127 %
2128 %    o passphrase: the passphrase.
2129 %
2130 */
2131 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2132   const char *passphrase)
2133 {
2134   assert(wand != (MagickWand *) NULL);
2135   assert(wand->signature == WandSignature);
2136   if (wand->debug != MagickFalse)
2137     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2138   if (wand->images == (Image *) NULL)
2139     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2140   return(DecipherImage(wand->images,passphrase,wand->exception));
2141 }
2142 \f
2143 /*
2144 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2145 %                                                                             %
2146 %                                                                             %
2147 %                                                                             %
2148 %   M a g i c k D e c o n s t r u c t I m a g e s                             %
2149 %                                                                             %
2150 %                                                                             %
2151 %                                                                             %
2152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2153 %
2154 %  MagickDeconstructImages() compares each image with the next in a sequence
2155 %  and returns the maximum bounding region of any pixel differences it
2156 %  discovers.
2157 %
2158 %  The format of the MagickDeconstructImages method is:
2159 %
2160 %      MagickWand *MagickDeconstructImages(MagickWand *wand)
2161 %
2162 %  A description of each parameter follows:
2163 %
2164 %    o wand: the magick wand.
2165 %
2166 */
2167 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2168 {
2169   Image
2170     *deconstruct_image;
2171
2172   assert(wand != (MagickWand *) NULL);
2173   assert(wand->signature == WandSignature);
2174   if (wand->debug != MagickFalse)
2175     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2176   if (wand->images == (Image *) NULL)
2177     return((MagickWand *) NULL);
2178   deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2179     wand->exception);
2180   if (deconstruct_image == (Image *) NULL)
2181     return((MagickWand *) NULL);
2182   return(CloneMagickWandFromImages(wand,deconstruct_image));
2183 }
2184 \f
2185 /*
2186 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2187 %                                                                             %
2188 %                                                                             %
2189 %                                                                             %
2190 %     M a g i c k D e s k e w I m a g e                                       %
2191 %                                                                             %
2192 %                                                                             %
2193 %                                                                             %
2194 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2195 %
2196 %  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2197 %  occurs in scanned images because of the camera being misaligned,
2198 %  imperfections in the scanning or surface, or simply because the paper was
2199 %  not placed completely flat when scanned.
2200 %
2201 %  The format of the MagickDeskewImage method is:
2202 %
2203 %      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2204 %        const double threshold)
2205 %
2206 %  A description of each parameter follows:
2207 %
2208 %    o wand: the magick wand.
2209 %
2210 %    o threshold: separate background from foreground.
2211 %
2212 */
2213 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2214   const double threshold)
2215 {
2216   Image
2217     *sepia_image;
2218
2219   assert(wand != (MagickWand *) NULL);
2220   assert(wand->signature == WandSignature);
2221   if (wand->debug != MagickFalse)
2222     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2223   if (wand->images == (Image *) NULL)
2224     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2225   sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2226   if (sepia_image == (Image *) NULL)
2227     return(MagickFalse);
2228   ReplaceImageInList(&wand->images,sepia_image);
2229   return(MagickTrue);
2230 }
2231 \f
2232 /*
2233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2234 %                                                                             %
2235 %                                                                             %
2236 %                                                                             %
2237 %     M a g i c k D e s p e c k l e I m a g e                                 %
2238 %                                                                             %
2239 %                                                                             %
2240 %                                                                             %
2241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2242 %
2243 %  MagickDespeckleImage() reduces the speckle noise in an image while
2244 %  perserving the edges of the original image.
2245 %
2246 %  The format of the MagickDespeckleImage method is:
2247 %
2248 %      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2249 %
2250 %  A description of each parameter follows:
2251 %
2252 %    o wand: the magick wand.
2253 %
2254 */
2255 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2256 {
2257   Image
2258     *despeckle_image;
2259
2260   assert(wand != (MagickWand *) NULL);
2261   assert(wand->signature == WandSignature);
2262   if (wand->debug != MagickFalse)
2263     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2264   if (wand->images == (Image *) NULL)
2265     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2266   despeckle_image=DespeckleImage(wand->images,wand->exception);
2267   if (despeckle_image == (Image *) NULL)
2268     return(MagickFalse);
2269   ReplaceImageInList(&wand->images,despeckle_image);
2270   return(MagickTrue);
2271 }
2272 \f
2273 /*
2274 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2275 %                                                                             %
2276 %                                                                             %
2277 %                                                                             %
2278 %   M a g i c k D e s t r o y I m a g e                                       %
2279 %                                                                             %
2280 %                                                                             %
2281 %                                                                             %
2282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2283 %
2284 %  MagickDestroyImage() dereferences an image, deallocating memory associated
2285 %  with the image if the reference count becomes zero.
2286 %
2287 %  The format of the MagickDestroyImage method is:
2288 %
2289 %      Image *MagickDestroyImage(Image *image)
2290 %
2291 %  A description of each parameter follows:
2292 %
2293 %    o image: the image.
2294 %
2295 */
2296 WandExport Image *MagickDestroyImage(Image *image)
2297 {
2298   return(DestroyImage(image));
2299 }
2300 \f
2301 /*
2302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2303 %                                                                             %
2304 %                                                                             %
2305 %                                                                             %
2306 %   M a g i c k D i s p l a y I m a g e                                       %
2307 %                                                                             %
2308 %                                                                             %
2309 %                                                                             %
2310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2311 %
2312 %  MagickDisplayImage() displays an image.
2313 %
2314 %  The format of the MagickDisplayImage method is:
2315 %
2316 %      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2317 %        const char *server_name)
2318 %
2319 %  A description of each parameter follows:
2320 %
2321 %    o wand: the magick wand.
2322 %
2323 %    o server_name: the X server name.
2324 %
2325 */
2326 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2327   const char *server_name)
2328 {
2329   Image
2330     *image;
2331
2332   MagickBooleanType
2333     status;
2334
2335   assert(wand != (MagickWand *) NULL);
2336   assert(wand->signature == WandSignature);
2337   if (wand->debug != MagickFalse)
2338     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2339   if (wand->images == (Image *) NULL)
2340     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2341   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2342   if (image == (Image *) NULL)
2343     return(MagickFalse);
2344   (void) CloneString(&wand->image_info->server_name,server_name);
2345   status=DisplayImages(wand->image_info,image,wand->exception);
2346   image=DestroyImage(image);
2347   return(status);
2348 }
2349 \f
2350 /*
2351 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2352 %                                                                             %
2353 %                                                                             %
2354 %                                                                             %
2355 %   M a g i c k D i s p l a y I m a g e s                                     %
2356 %                                                                             %
2357 %                                                                             %
2358 %                                                                             %
2359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2360 %
2361 %  MagickDisplayImages() displays an image or image sequence.
2362 %
2363 %  The format of the MagickDisplayImages method is:
2364 %
2365 %      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2366 %        const char *server_name)
2367 %
2368 %  A description of each parameter follows:
2369 %
2370 %    o wand: the magick wand.
2371 %
2372 %    o server_name: the X server name.
2373 %
2374 */
2375 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2376   const char *server_name)
2377 {
2378   MagickBooleanType
2379     status;
2380
2381   assert(wand != (MagickWand *) NULL);
2382   assert(wand->signature == WandSignature);
2383   if (wand->debug != MagickFalse)
2384     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2385   (void) CloneString(&wand->image_info->server_name,server_name);
2386   status=DisplayImages(wand->image_info,wand->images,wand->exception);
2387   return(status);
2388 }
2389 \f
2390 /*
2391 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2392 %                                                                             %
2393 %                                                                             %
2394 %                                                                             %
2395 %   M a g i c k D i s t o r t I m a g e                                       %
2396 %                                                                             %
2397 %                                                                             %
2398 %                                                                             %
2399 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2400 %
2401 %  MagickDistortImage() distorts an image using various distortion methods, by
2402 %  mapping color lookups of the source image to a new destination image
2403 %  usally of the same size as the source image, unless 'bestfit' is set to
2404 %  true.
2405 %
2406 %  If 'bestfit' is enabled, and distortion allows it, the destination image is
2407 %  adjusted to ensure the whole source 'image' will just fit within the final
2408 %  destination image, which will be sized and offset accordingly.  Also in
2409 %  many cases the virtual offset of the source image will be taken into
2410 %  account in the mapping.
2411 %
2412 %  The format of the MagickDistortImage method is:
2413 %
2414 %      MagickBooleanType MagickDistortImage(MagickWand *wand,
2415 %        const DistortImageMethod method,const size_t number_arguments,
2416 %        const double *arguments,const MagickBooleanType bestfit)
2417 %
2418 %  A description of each parameter follows:
2419 %
2420 %    o image: the image to be distorted.
2421 %
2422 %    o method: the method of image distortion.
2423 %
2424 %        ArcDistortion always ignores the source image offset, and always
2425 %        'bestfit' the destination image with the top left corner offset
2426 %        relative to the polar mapping center.
2427 %
2428 %        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2429 %        style of image distortion.
2430 %
2431 %        Affine, Perspective, and Bilinear, do least squares fitting of the
2432 %        distortion when more than the minimum number of control point pairs
2433 %        are provided.
2434 %
2435 %        Perspective, and Bilinear, falls back to a Affine distortion when less
2436 %        that 4 control point pairs are provided. While Affine distortions let
2437 %        you use any number of control point pairs, that is Zero pairs is a
2438 %        no-Op (viewport only) distrotion, one pair is a translation and two
2439 %        pairs of control points do a scale-rotate-translate, without any
2440 %        shearing.
2441 %
2442 %    o number_arguments: the number of arguments given for this distortion
2443 %      method.
2444 %
2445 %    o arguments: the arguments for this distortion method.
2446 %
2447 %    o bestfit: Attempt to resize destination to fit distorted source.
2448 %
2449 */
2450 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2451   const DistortImageMethod method,const size_t number_arguments,
2452   const double *arguments,const MagickBooleanType bestfit)
2453 {
2454   Image
2455     *distort_image;
2456
2457   assert(wand != (MagickWand *) NULL);
2458   assert(wand->signature == WandSignature);
2459   if (wand->debug != MagickFalse)
2460     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2461   if (wand->images == (Image *) NULL)
2462     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2463   distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2464     bestfit,wand->exception);
2465   if (distort_image == (Image *) NULL)
2466     return(MagickFalse);
2467   ReplaceImageInList(&wand->images,distort_image);
2468   return(MagickTrue);
2469 }
2470 \f
2471 /*
2472 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2473 %                                                                             %
2474 %                                                                             %
2475 %                                                                             %
2476 %   M a g i c k D r a w I m a g e                                             %
2477 %                                                                             %
2478 %                                                                             %
2479 %                                                                             %
2480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2481 %
2482 %  MagickDrawImage() renders the drawing wand on the current image.
2483 %
2484 %  The format of the MagickDrawImage method is:
2485 %
2486 %      MagickBooleanType MagickDrawImage(MagickWand *wand,
2487 %        const DrawingWand *drawing_wand)
2488 %
2489 %  A description of each parameter follows:
2490 %
2491 %    o wand: the magick wand.
2492 %
2493 %    o drawing_wand: the draw wand.
2494 %
2495 */
2496 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2497   const DrawingWand *drawing_wand)
2498 {
2499   char
2500     *primitive;
2501
2502   DrawInfo
2503     *draw_info;
2504
2505   MagickBooleanType
2506     status;
2507
2508   assert(wand != (MagickWand *) NULL);
2509   assert(wand->signature == WandSignature);
2510   if (wand->debug != MagickFalse)
2511     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2512   if (wand->images == (Image *) NULL)
2513     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2514   draw_info=PeekDrawingWand(drawing_wand);
2515   if ((draw_info == (DrawInfo *) NULL) ||
2516       (draw_info->primitive == (char *) NULL))
2517     return(MagickFalse);
2518   primitive=AcquireString(draw_info->primitive);
2519   draw_info=DestroyDrawInfo(draw_info);
2520   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2521   draw_info->primitive=primitive;
2522   status=DrawImage(wand->images,draw_info,wand->exception);
2523   draw_info=DestroyDrawInfo(draw_info);
2524   return(status);
2525 }
2526 \f
2527 /*
2528 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2529 %                                                                             %
2530 %                                                                             %
2531 %                                                                             %
2532 %   M a g i c k E d g e I m a g e                                             %
2533 %                                                                             %
2534 %                                                                             %
2535 %                                                                             %
2536 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2537 %
2538 %  MagickEdgeImage() enhance edges within the image with a convolution filter
2539 %  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2540 %  radius for you.
2541 %
2542 %  The format of the MagickEdgeImage method is:
2543 %
2544 %      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius,
2545 %        const double sigma)
2546 %
2547 %  A description of each parameter follows:
2548 %
2549 %    o wand: the magick wand.
2550 %
2551 %    o radius: the radius of the pixel neighborhood.
2552 %
2553 %    o sigma: the standard deviation of the Gaussian, in pixels.
2554 %
2555 */
2556 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2557   const double radius,const double sigma)
2558 {
2559   Image
2560     *edge_image;
2561
2562   assert(wand != (MagickWand *) NULL);
2563   assert(wand->signature == WandSignature);
2564   if (wand->debug != MagickFalse)
2565     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2566   if (wand->images == (Image *) NULL)
2567     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2568   edge_image=EdgeImage(wand->images,radius,sigma,wand->exception);
2569   if (edge_image == (Image *) NULL)
2570     return(MagickFalse);
2571   ReplaceImageInList(&wand->images,edge_image);
2572   return(MagickTrue);
2573 }
2574 \f
2575 /*
2576 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2577 %                                                                             %
2578 %                                                                             %
2579 %                                                                             %
2580 %   M a g i c k E m b o s s I m a g e                                         %
2581 %                                                                             %
2582 %                                                                             %
2583 %                                                                             %
2584 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2585 %
2586 %  MagickEmbossImage() returns a grayscale image with a three-dimensional
2587 %  effect.  We convolve the image with a Gaussian operator of the given radius
2588 %  and standard deviation (sigma).  For reasonable results, radius should be
2589 %  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2590 %  radius for you.
2591 %
2592 %  The format of the MagickEmbossImage method is:
2593 %
2594 %      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2595 %        const double sigma)
2596 %
2597 %  A description of each parameter follows:
2598 %
2599 %    o wand: the magick wand.
2600 %
2601 %    o radius: the radius of the Gaussian, in pixels, not counting the center
2602 %      pixel.
2603 %
2604 %    o sigma: the standard deviation of the Gaussian, in pixels.
2605 %
2606 */
2607 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2608   const double radius,const double sigma)
2609 {
2610   Image
2611     *emboss_image;
2612
2613   assert(wand != (MagickWand *) NULL);
2614   assert(wand->signature == WandSignature);
2615   if (wand->debug != MagickFalse)
2616     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2617   if (wand->images == (Image *) NULL)
2618     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2619   emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2620   if (emboss_image == (Image *) NULL)
2621     return(MagickFalse);
2622   ReplaceImageInList(&wand->images,emboss_image);
2623   return(MagickTrue);
2624 }
2625 \f
2626 /*
2627 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2628 %                                                                             %
2629 %                                                                             %
2630 %                                                                             %
2631 %   M a g i c k E n c i p h e r I m a g e                                     %
2632 %                                                                             %
2633 %                                                                             %
2634 %                                                                             %
2635 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2636 %
2637 %  MagickEncipherImage() converts plaint pixels to cipher pixels.
2638 %
2639 %  The format of the MagickEncipherImage method is:
2640 %
2641 %      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2642 %        const char *passphrase)
2643 %
2644 %  A description of each parameter follows:
2645 %
2646 %    o wand: the magick wand.
2647 %
2648 %    o passphrase: the passphrase.
2649 %
2650 */
2651 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2652   const char *passphrase)
2653 {
2654   assert(wand != (MagickWand *) NULL);
2655   assert(wand->signature == WandSignature);
2656   if (wand->debug != MagickFalse)
2657     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2658   if (wand->images == (Image *) NULL)
2659     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2660   return(EncipherImage(wand->images,passphrase,wand->exception));
2661 }
2662 \f
2663 /*
2664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2665 %                                                                             %
2666 %                                                                             %
2667 %                                                                             %
2668 %   M a g i c k E n h a n c e I m a g e                                       %
2669 %                                                                             %
2670 %                                                                             %
2671 %                                                                             %
2672 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2673 %
2674 %  MagickEnhanceImage() applies a digital filter that improves the quality of a
2675 %  noisy image.
2676 %
2677 %  The format of the MagickEnhanceImage method is:
2678 %
2679 %      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2680 %
2681 %  A description of each parameter follows:
2682 %
2683 %    o wand: the magick wand.
2684 %
2685 */
2686 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2687 {
2688   Image
2689     *enhance_image;
2690
2691   assert(wand != (MagickWand *) NULL);
2692   assert(wand->signature == WandSignature);
2693   if (wand->debug != MagickFalse)
2694     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2695   if (wand->images == (Image *) NULL)
2696     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2697   enhance_image=EnhanceImage(wand->images,wand->exception);
2698   if (enhance_image == (Image *) NULL)
2699     return(MagickFalse);
2700   ReplaceImageInList(&wand->images,enhance_image);
2701   return(MagickTrue);
2702 }
2703 \f
2704 /*
2705 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2706 %                                                                             %
2707 %                                                                             %
2708 %                                                                             %
2709 %   M a g i c k E q u a l i z e I m a g e                                     %
2710 %                                                                             %
2711 %                                                                             %
2712 %                                                                             %
2713 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2714 %
2715 %  MagickEqualizeImage() equalizes the image histogram.
2716 %
2717 %  The format of the MagickEqualizeImage method is:
2718 %
2719 %      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2720 %
2721 %  A description of each parameter follows:
2722 %
2723 %    o wand: the magick wand.
2724 %
2725 %    o channel: the image channel(s).
2726 %
2727 */
2728 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2729 {
2730   MagickBooleanType
2731     status;
2732
2733   assert(wand != (MagickWand *) NULL);
2734   assert(wand->signature == WandSignature);
2735   if (wand->debug != MagickFalse)
2736     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2737   if (wand->images == (Image *) NULL)
2738     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2739   status=EqualizeImage(wand->images,wand->exception);
2740   return(status);
2741 }
2742 \f
2743 /*
2744 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2745 %                                                                             %
2746 %                                                                             %
2747 %                                                                             %
2748 %   M a g i c k E v a l u a t e I m a g e                                     %
2749 %                                                                             %
2750 %                                                                             %
2751 %                                                                             %
2752 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2753 %
2754 %  MagickEvaluateImage() applys an arithmetic, relational, or logical
2755 %  expression to an image.  Use these operators to lighten or darken an image,
2756 %  to increase or decrease contrast in an image, or to produce the "negative"
2757 %  of an image.
2758 %
2759 %  The format of the MagickEvaluateImage method is:
2760 %
2761 %      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2762 %        const MagickEvaluateOperator operator,const double value)
2763 %      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2764 %        const MagickEvaluateOperator operator)
2765 %
2766 %  A description of each parameter follows:
2767 %
2768 %    o wand: the magick wand.
2769 %
2770 %    o op: A channel operator.
2771 %
2772 %    o value: A value value.
2773 %
2774 */
2775
2776 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2777   const MagickEvaluateOperator op)
2778 {
2779   Image
2780     *evaluate_image;
2781
2782   assert(wand != (MagickWand *) NULL);
2783   assert(wand->signature == WandSignature);
2784   if (wand->debug != MagickFalse)
2785     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2786   if (wand->images == (Image *) NULL)
2787     return((MagickWand *) NULL);
2788   evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2789   if (evaluate_image == (Image *) NULL)
2790     return((MagickWand *) NULL);
2791   return(CloneMagickWandFromImages(wand,evaluate_image));
2792 }
2793
2794 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2795   const MagickEvaluateOperator op,const double value)
2796 {
2797   MagickBooleanType
2798     status;
2799
2800   assert(wand != (MagickWand *) NULL);
2801   assert(wand->signature == WandSignature);
2802   if (wand->debug != MagickFalse)
2803     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2804   if (wand->images == (Image *) NULL)
2805     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2806   status=EvaluateImage(wand->images,op,value,wand->exception);
2807   return(status);
2808 }
2809 \f
2810 /*
2811 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2812 %                                                                             %
2813 %                                                                             %
2814 %                                                                             %
2815 %   M a g i c k E x p o r t I m a g e P i x e l s                             %
2816 %                                                                             %
2817 %                                                                             %
2818 %                                                                             %
2819 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2820 %
2821 %  MagickExportImagePixels() extracts pixel data from an image and returns it
2822 %  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2823 %  an error is encountered.  The data is returned as char, short int, int,
2824 %  ssize_t, float, or double in the order specified by map.
2825 %
2826 %  Suppose you want to extract the first scanline of a 640x480 image as
2827 %  character data in red-green-blue order:
2828 %
2829 %      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
2830 %
2831 %  The format of the MagickExportImagePixels method is:
2832 %
2833 %      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2834 %        const ssize_t x,const ssize_t y,const size_t columns,
2835 %        const size_t rows,const char *map,const StorageType storage,
2836 %        void *pixels)
2837 %
2838 %  A description of each parameter follows:
2839 %
2840 %    o wand: the magick wand.
2841 %
2842 %    o x, y, columns, rows:  These values define the perimeter
2843 %      of a region of pixels you want to extract.
2844 %
2845 %    o map:  This string reflects the expected ordering of the pixel array.
2846 %      It can be any combination or order of R = red, G = green, B = blue,
2847 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2848 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2849 %      P = pad.
2850 %
2851 %    o storage: Define the data type of the pixels.  Float and double types are
2852 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2853 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2854 %      LongPixel, QuantumPixel, or ShortPixel.
2855 %
2856 %    o pixels: This array of values contain the pixel components as defined by
2857 %      map and type.  You must preallocate this array where the expected
2858 %      length varies depending on the values of width, height, map, and type.
2859 %
2860 */
2861 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2862   const ssize_t x,const ssize_t y,const size_t columns,
2863   const size_t rows,const char *map,const StorageType storage,
2864   void *pixels)
2865 {
2866   MagickBooleanType
2867     status;
2868
2869   assert(wand != (MagickWand *) NULL);
2870   assert(wand->signature == WandSignature);
2871   if (wand->debug != MagickFalse)
2872     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2873   if (wand->images == (Image *) NULL)
2874     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2875   status=ExportImagePixels(wand->images,x,y,columns,rows,map,
2876     storage,pixels,wand->exception);
2877   return(status);
2878 }
2879 \f
2880 /*
2881 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2882 %                                                                             %
2883 %                                                                             %
2884 %                                                                             %
2885 %   M a g i c k E x t e n t I m a g e                                         %
2886 %                                                                             %
2887 %                                                                             %
2888 %                                                                             %
2889 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2890 %
2891 %  MagickExtentImage() extends the image as defined by the geometry, gravity,
2892 %  and wand background color.  Set the (x,y) offset of the geometry to move
2893 %  the original wand relative to the extended wand.
2894 %
2895 %  The format of the MagickExtentImage method is:
2896 %
2897 %      MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
2898 %        const size_t height,const ssize_t x,const ssize_t y)
2899 %
2900 %  A description of each parameter follows:
2901 %
2902 %    o wand: the magick wand.
2903 %
2904 %    o width: the region width.
2905 %
2906 %    o height: the region height.
2907 %
2908 %    o x: the region x offset.
2909 %
2910 %    o y: the region y offset.
2911 %
2912 */
2913 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
2914   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2915 {
2916   Image
2917     *extent_image;
2918
2919   RectangleInfo
2920     extent;
2921
2922   assert(wand != (MagickWand *) NULL);
2923   assert(wand->signature == WandSignature);
2924   if (wand->debug != MagickFalse)
2925     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2926   if (wand->images == (Image *) NULL)
2927     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2928   extent.width=width;
2929   extent.height=height;
2930   extent.x=x;
2931   extent.y=y;
2932   extent_image=ExtentImage(wand->images,&extent,wand->exception);
2933   if (extent_image == (Image *) NULL)
2934     return(MagickFalse);
2935   ReplaceImageInList(&wand->images,extent_image);
2936   return(MagickTrue);
2937 }
2938 \f
2939 /*
2940 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2941 %                                                                             %
2942 %                                                                             %
2943 %                                                                             %
2944 %   M a g i c k F l i p I m a g e                                             %
2945 %                                                                             %
2946 %                                                                             %
2947 %                                                                             %
2948 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2949 %
2950 %  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
2951 %  around the central x-axis.
2952 %
2953 %  The format of the MagickFlipImage method is:
2954 %
2955 %      MagickBooleanType MagickFlipImage(MagickWand *wand)
2956 %
2957 %  A description of each parameter follows:
2958 %
2959 %    o wand: the magick wand.
2960 %
2961 */
2962 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
2963 {
2964   Image
2965     *flip_image;
2966
2967   assert(wand != (MagickWand *) NULL);
2968   assert(wand->signature == WandSignature);
2969   if (wand->debug != MagickFalse)
2970     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2971   if (wand->images == (Image *) NULL)
2972     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2973   flip_image=FlipImage(wand->images,wand->exception);
2974   if (flip_image == (Image *) NULL)
2975     return(MagickFalse);
2976   ReplaceImageInList(&wand->images,flip_image);
2977   return(MagickTrue);
2978 }
2979 \f
2980 /*
2981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2982 %                                                                             %
2983 %                                                                             %
2984 %                                                                             %
2985 %   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                         %
2986 %                                                                             %
2987 %                                                                             %
2988 %                                                                             %
2989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2990 %
2991 %  MagickFloodfillPaintImage() changes the color value of any pixel that matches
2992 %  target and is an immediate neighbor.  If the method FillToBorderMethod is
2993 %  specified, the color value is changed for any neighbor pixel that does not
2994 %  match the bordercolor member of image.
2995 %
2996 %  The format of the MagickFloodfillPaintImage method is:
2997 %
2998 %      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
2999 %        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3000 %        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3001 %
3002 %  A description of each parameter follows:
3003 %
3004 %    o wand: the magick wand.
3005 %
3006 %    o fill: the floodfill color pixel wand.
3007 %
3008 %    o fuzz: By default target must match a particular pixel color
3009 %      exactly.  However, in many cases two colors may differ by a small amount.
3010 %      The fuzz member of image defines how much tolerance is acceptable to
3011 %      consider two colors as the same.  For example, set fuzz to 10 and the
3012 %      color red at intensities of 100 and 102 respectively are now interpreted
3013 %      as the same color for the purposes of the floodfill.
3014 %
3015 %    o bordercolor: the border color pixel wand.
3016 %
3017 %    o x,y: the starting location of the operation.
3018 %
3019 %    o invert: paint any pixel that does not match the target color.
3020 %
3021 */
3022 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3023   const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3024   const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3025 {
3026   DrawInfo
3027     *draw_info;
3028
3029   MagickBooleanType
3030     status;
3031
3032   PixelInfo
3033     target;
3034
3035   assert(wand != (MagickWand *) NULL);
3036   assert(wand->signature == WandSignature);
3037   if (wand->debug != MagickFalse)
3038     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3039   if (wand->images == (Image *) NULL)
3040     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3041   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3042   PixelGetQuantumPacket(fill,&draw_info->fill);
3043   (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
3044     wand->images->columns,y % wand->images->rows,&target,wand->exception);
3045   if (bordercolor != (PixelWand *) NULL)
3046     PixelGetMagickColor(bordercolor,&target);
3047   wand->images->fuzz=fuzz;
3048   status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3049     wand->exception);
3050   draw_info=DestroyDrawInfo(draw_info);
3051   return(status);
3052 }
3053 \f
3054 /*
3055 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3056 %                                                                             %
3057 %                                                                             %
3058 %                                                                             %
3059 %   M a g i c k F l o p I m a g e                                             %
3060 %                                                                             %
3061 %                                                                             %
3062 %                                                                             %
3063 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3064 %
3065 %  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3066 %  around the central y-axis.
3067 %
3068 %  The format of the MagickFlopImage method is:
3069 %
3070 %      MagickBooleanType MagickFlopImage(MagickWand *wand)
3071 %
3072 %  A description of each parameter follows:
3073 %
3074 %    o wand: the magick wand.
3075 %
3076 */
3077 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3078 {
3079   Image
3080     *flop_image;
3081
3082   assert(wand != (MagickWand *) NULL);
3083   assert(wand->signature == WandSignature);
3084   if (wand->debug != MagickFalse)
3085     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3086   if (wand->images == (Image *) NULL)
3087     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3088   flop_image=FlopImage(wand->images,wand->exception);
3089   if (flop_image == (Image *) NULL)
3090     return(MagickFalse);
3091   ReplaceImageInList(&wand->images,flop_image);
3092   return(MagickTrue);
3093 }
3094 \f
3095 /*
3096 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3097 %                                                                             %
3098 %                                                                             %
3099 %                                                                             %
3100 %   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                     %
3101 %                                                                             %
3102 %                                                                             %
3103 %                                                                             %
3104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3105 %
3106 %  MagickForwardFourierTransformImage() implements the discrete Fourier
3107 %  transform (DFT) of the image either as a magnitude / phase or real /
3108 %  imaginary image pair.
3109 %
3110 %  The format of the MagickForwardFourierTransformImage method is:
3111 %
3112 %      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3113 %        const MagickBooleanType magnitude)
3114 %
3115 %  A description of each parameter follows:
3116 %
3117 %    o wand: the magick wand.
3118 %
3119 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3120 %      imaginary image pair.
3121 %
3122 */
3123 WandExport MagickBooleanType MagickForwardFourierTransformImage(
3124   MagickWand *wand,const MagickBooleanType magnitude)
3125 {
3126   Image
3127     *forward_image;
3128
3129   assert(wand != (MagickWand *) NULL);
3130   assert(wand->signature == WandSignature);
3131   if (wand->debug != MagickFalse)
3132     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3133   if (wand->images == (Image *) NULL)
3134     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3135   forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3136     wand->exception);
3137   if (forward_image == (Image *) NULL)
3138     return(MagickFalse);
3139   ReplaceImageInList(&wand->images,forward_image);
3140   return(MagickTrue);
3141 }
3142 \f
3143 /*
3144 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3145 %                                                                             %
3146 %                                                                             %
3147 %                                                                             %
3148 %   M a g i c k F r a m e I m a g e                                           %
3149 %                                                                             %
3150 %                                                                             %
3151 %                                                                             %
3152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3153 %
3154 %  MagickFrameImage() adds a simulated three-dimensional border around the
3155 %  image.  The width and height specify the border width of the vertical and
3156 %  horizontal sides of the frame.  The inner and outer bevels indicate the
3157 %  width of the inner and outer shadows of the frame.
3158 %
3159 %  The format of the MagickFrameImage method is:
3160 %
3161 %      MagickBooleanType MagickFrameImage(MagickWand *wand,
3162 %        const PixelWand *matte_color,const size_t width,
3163 %        const size_t height,const ssize_t inner_bevel,
3164 %        const ssize_t outer_bevel,const CompositeOperator compose)
3165 %
3166 %  A description of each parameter follows:
3167 %
3168 %    o wand: the magick wand.
3169 %
3170 %    o matte_color: the frame color pixel wand.
3171 %
3172 %    o width: the border width.
3173 %
3174 %    o height: the border height.
3175 %
3176 %    o inner_bevel: the inner bevel width.
3177 %
3178 %    o outer_bevel: the outer bevel width.
3179 %
3180 %    o compose: the composite operator.
3181 %
3182 */
3183 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3184   const PixelWand *matte_color,const size_t width,const size_t height,
3185   const ssize_t inner_bevel,const ssize_t outer_bevel,
3186   const CompositeOperator compose)
3187 {
3188   Image
3189     *frame_image;
3190
3191   FrameInfo
3192     frame_info;
3193
3194   assert(wand != (MagickWand *) NULL);
3195   assert(wand->signature == WandSignature);
3196   if (wand->debug != MagickFalse)
3197     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3198   if (wand->images == (Image *) NULL)
3199     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3200   (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3201   frame_info.width=wand->images->columns+2*width;
3202   frame_info.height=wand->images->rows+2*height;
3203   frame_info.x=(ssize_t) width;
3204   frame_info.y=(ssize_t) height;
3205   frame_info.inner_bevel=inner_bevel;
3206   frame_info.outer_bevel=outer_bevel;
3207   PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3208   frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3209   if (frame_image == (Image *) NULL)
3210     return(MagickFalse);
3211   ReplaceImageInList(&wand->images,frame_image);
3212   return(MagickTrue);
3213 }
3214 \f
3215 /*
3216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3217 %                                                                             %
3218 %                                                                             %
3219 %                                                                             %
3220 %   M a g i c k F u n c t i o n I m a g e                                     %
3221 %                                                                             %
3222 %                                                                             %
3223 %                                                                             %
3224 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3225 %
3226 %  MagickFunctionImage() applys an arithmetic, relational, or logical
3227 %  expression to an image.  Use these operators to lighten or darken an image,
3228 %  to increase or decrease contrast in an image, or to produce the "negative"
3229 %  of an image.
3230 %
3231 %  The format of the MagickFunctionImage method is:
3232 %
3233 %      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3234 %        const MagickFunction function,const size_t number_arguments,
3235 %        const double *arguments)
3236 %
3237 %  A description of each parameter follows:
3238 %
3239 %    o wand: the magick wand.
3240 %
3241 %    o function: the image function.
3242 %
3243 %    o number_arguments: the number of function arguments.
3244 %
3245 %    o arguments: the function arguments.
3246 %
3247 */
3248 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3249   const MagickFunction function,const size_t number_arguments,
3250   const double *arguments)
3251 {
3252   MagickBooleanType
3253     status;
3254
3255   assert(wand != (MagickWand *) NULL);
3256   assert(wand->signature == WandSignature);
3257   if (wand->debug != MagickFalse)
3258     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3259   if (wand->images == (Image *) NULL)
3260     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3261   status=FunctionImage(wand->images,function,number_arguments,arguments,
3262     wand->exception);
3263   return(status);
3264 }
3265 \f
3266 /*
3267 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3268 %                                                                             %
3269 %                                                                             %
3270 %                                                                             %
3271 %   M a g i c k F x I m a g e                                                 %
3272 %                                                                             %
3273 %                                                                             %
3274 %                                                                             %
3275 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3276 %
3277 %  MagickFxImage() evaluate expression for each pixel in the image.
3278 %
3279 %  The format of the MagickFxImage method is:
3280 %
3281 %      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3282 %
3283 %  A description of each parameter follows:
3284 %
3285 %    o wand: the magick wand.
3286 %
3287 %    o expression: the expression.
3288 %
3289 */
3290 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3291 {
3292   Image
3293     *fx_image;
3294
3295   assert(wand != (MagickWand *) NULL);
3296   assert(wand->signature == WandSignature);
3297   if (wand->debug != MagickFalse)
3298     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3299   if (wand->images == (Image *) NULL)
3300     return((MagickWand *) NULL);
3301   fx_image=FxImage(wand->images,expression,wand->exception);
3302   if (fx_image == (Image *) NULL)
3303     return((MagickWand *) NULL);
3304   return(CloneMagickWandFromImages(wand,fx_image));
3305 }
3306 \f
3307 /*
3308 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3309 %                                                                             %
3310 %                                                                             %
3311 %                                                                             %
3312 %   M a g i c k G a m m a I m a g e                                           %
3313 %                                                                             %
3314 %                                                                             %
3315 %                                                                             %
3316 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3317 %
3318 %  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3319 %  different devices will have perceptual differences in the way the image's
3320 %  intensities are represented on the screen.  Specify individual gamma levels
3321 %  for the red, green, and blue channels, or adjust all three with the gamma
3322 %  parameter.  Values typically range from 0.8 to 2.3.
3323 %
3324 %  You can also reduce the influence of a particular channel with a gamma
3325 %  value of 0.
3326 %
3327 %  The format of the MagickGammaImage method is:
3328 %
3329 %      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3330 %
3331 %  A description of each parameter follows:
3332 %
3333 %    o wand: the magick wand.
3334 %
3335 %    o level: Define the level of gamma correction.
3336 %
3337 */
3338 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3339   const double gamma)
3340 {
3341   MagickBooleanType
3342     status;
3343
3344   assert(wand != (MagickWand *) NULL);
3345   assert(wand->signature == WandSignature);
3346   if (wand->debug != MagickFalse)
3347     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3348   if (wand->images == (Image *) NULL)
3349     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3350   status=GammaImage(wand->images,gamma,wand->exception);
3351   return(status);
3352 }
3353 \f
3354 /*
3355 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3356 %                                                                             %
3357 %                                                                             %
3358 %                                                                             %
3359 %   M a g i c k G a u s s i a n B l u r I m a g e                             %
3360 %                                                                             %
3361 %                                                                             %
3362 %                                                                             %
3363 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3364 %
3365 %  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3366 %  Gaussian operator of the given radius and standard deviation (sigma).
3367 %  For reasonable results, the radius should be larger than sigma.  Use a
3368 %  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3369 %
3370 %  The format of the MagickGaussianBlurImage method is:
3371 %
3372 %      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3373 %        const double radius,const double sigma)
3374 %
3375 %  A description of each parameter follows:
3376 %
3377 %    o wand: the magick wand.
3378 %
3379 %    o radius: the radius of the Gaussian, in pixels, not counting the center
3380 %      pixel.
3381 %
3382 %    o sigma: the standard deviation of the Gaussian, in pixels.
3383 %
3384 */
3385 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3386   const double radius,const double sigma)
3387 {
3388   Image
3389     *blur_image;
3390
3391   assert(wand != (MagickWand *) NULL);
3392   assert(wand->signature == WandSignature);
3393   if (wand->debug != MagickFalse)
3394     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3395   if (wand->images == (Image *) NULL)
3396     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3397   blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3398   if (blur_image == (Image *) NULL)
3399     return(MagickFalse);
3400   ReplaceImageInList(&wand->images,blur_image);
3401   return(MagickTrue);
3402 }
3403 \f
3404 /*
3405 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3406 %                                                                             %
3407 %                                                                             %
3408 %                                                                             %
3409 %   M a g i c k G e t I m a g e                                               %
3410 %                                                                             %
3411 %                                                                             %
3412 %                                                                             %
3413 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3414 %
3415 %  MagickGetImage() gets the image at the current image index.
3416 %
3417 %  The format of the MagickGetImage method is:
3418 %
3419 %      MagickWand *MagickGetImage(MagickWand *wand)
3420 %
3421 %  A description of each parameter follows:
3422 %
3423 %    o wand: the magick wand.
3424 %
3425 */
3426 WandExport MagickWand *MagickGetImage(MagickWand *wand)
3427 {
3428   Image
3429     *image;
3430
3431   assert(wand != (MagickWand *) NULL);
3432   assert(wand->signature == WandSignature);
3433   if (wand->debug != MagickFalse)
3434     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3435   if (wand->images == (Image *) NULL)
3436     {
3437       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3438         "ContainsNoImages","`%s'",wand->name);
3439       return((MagickWand *) NULL);
3440     }
3441   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3442   if (image == (Image *) NULL)
3443     return((MagickWand *) NULL);
3444   return(CloneMagickWandFromImages(wand,image));
3445 }
3446 \f
3447 /*
3448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3449 %                                                                             %
3450 %                                                                             %
3451 %                                                                             %
3452 %   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                       %
3453 %                                                                             %
3454 %                                                                             %
3455 %                                                                             %
3456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3457 %
3458 %  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3459 %  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3460 %  than CMYKA.
3461 %
3462 %  The format of the MagickGetImageAlphaChannel method is:
3463 %
3464 %      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3465 %
3466 %  A description of each parameter follows:
3467 %
3468 %    o wand: the magick wand.
3469 %
3470 */
3471 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3472 {
3473   assert(wand != (MagickWand *) NULL);
3474   assert(wand->signature == WandSignature);
3475   if (wand->debug != MagickFalse)
3476     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3477   if (wand->images == (Image *) NULL)
3478     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3479   return(GetImageAlphaChannel(wand->images));
3480 }
3481 \f
3482 /*
3483 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3484 %                                                                             %
3485 %                                                                             %
3486 %                                                                             %
3487 %   M a g i c k G e t I m a g e C l i p M a s k                               %
3488 %                                                                             %
3489 %                                                                             %
3490 %                                                                             %
3491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3492 %
3493 %  MagickGetImageMask() gets the image clip mask at the current image index.
3494 %
3495 %  The format of the MagickGetImageMask method is:
3496 %
3497 %      MagickWand *MagickGetImageMask(MagickWand *wand)
3498 %
3499 %  A description of each parameter follows:
3500 %
3501 %    o wand: the magick wand.
3502 %
3503 */
3504 WandExport MagickWand *MagickGetImageMask(MagickWand *wand)
3505 {
3506   Image
3507     *image;
3508
3509   assert(wand != (MagickWand *) NULL);
3510   assert(wand->signature == WandSignature);
3511   if (wand->debug != MagickFalse)
3512     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3513   if (wand->images == (Image *) NULL)
3514     {
3515       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3516         "ContainsNoImages","`%s'",wand->name);
3517       return((MagickWand *) NULL);
3518     }
3519   image=GetImageMask(wand->images,wand->exception);
3520   if (image == (Image *) NULL)
3521     return((MagickWand *) NULL);
3522   return(CloneMagickWandFromImages(wand,image));
3523 }
3524 \f
3525 /*
3526 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3527 %                                                                             %
3528 %                                                                             %
3529 %                                                                             %
3530 %   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                 %
3531 %                                                                             %
3532 %                                                                             %
3533 %                                                                             %
3534 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3535 %
3536 %  MagickGetImageBackgroundColor() returns the image background color.
3537 %
3538 %  The format of the MagickGetImageBackgroundColor method is:
3539 %
3540 %      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3541 %        PixelWand *background_color)
3542 %
3543 %  A description of each parameter follows:
3544 %
3545 %    o wand: the magick wand.
3546 %
3547 %    o background_color: Return the background color.
3548 %
3549 */
3550 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3551   PixelWand *background_color)
3552 {
3553   assert(wand != (MagickWand *) NULL);
3554   assert(wand->signature == WandSignature);
3555   if (wand->debug != MagickFalse)
3556     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3557   if (wand->images == (Image *) NULL)
3558     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3559   PixelSetPixelColor(background_color,&wand->images->background_color);
3560   return(MagickTrue);
3561 }
3562 \f
3563 /*
3564 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3565 %                                                                             %
3566 %                                                                             %
3567 %                                                                             %
3568 %   M a g i c k G e t I m a g e B l o b                                       %
3569 %                                                                             %
3570 %                                                                             %
3571 %                                                                             %
3572 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3573 %
3574 %  MagickGetImageBlob() implements direct to memory image formats.  It returns
3575 %  the image as a blob (a formatted "file" in memory) and its length, starting
3576 %  from the current position in the image sequence.  Use MagickSetImageFormat()
3577 %  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3578 %
3579 %  Utilize MagickResetIterator() to ensure the write is from the beginning of
3580 %  the image sequence.
3581 %
3582 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
3583 %
3584 %  The format of the MagickGetImageBlob method is:
3585 %
3586 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3587 %
3588 %  A description of each parameter follows:
3589 %
3590 %    o wand: the magick wand.
3591 %
3592 %    o length: the length of the blob.
3593 %
3594 */
3595 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3596 {
3597   assert(wand != (MagickWand *) NULL);
3598   assert(wand->signature == WandSignature);
3599   if (wand->debug != MagickFalse)
3600     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3601   if (wand->images == (Image *) NULL)
3602     {
3603       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3604         "ContainsNoImages","`%s'",wand->name);
3605       return((unsigned char *) NULL);
3606     }
3607   return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3608 }
3609 \f
3610 /*
3611 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3612 %                                                                             %
3613 %                                                                             %
3614 %                                                                             %
3615 %   M a g i c k G e t I m a g e s B l o b                                     %
3616 %                                                                             %
3617 %                                                                             %
3618 %                                                                             %
3619 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3620 %
3621 %  MagickGetImageBlob() implements direct to memory image formats.  It
3622 %  returns the image sequence as a blob and its length.  The format of the image
3623 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3624 %  return a different image format, use MagickSetImageFormat().
3625 %
3626 %  Note, some image formats do not permit multiple images to the same image
3627 %  stream (e.g. JPEG).  in this instance, just the first image of the
3628 %  sequence is returned as a blob.
3629 %
3630 %  The format of the MagickGetImagesBlob method is:
3631 %
3632 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3633 %
3634 %  A description of each parameter follows:
3635 %
3636 %    o wand: the magick wand.
3637 %
3638 %    o length: the length of the blob.
3639 %
3640 */
3641 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3642 {
3643   unsigned char
3644     *blob;
3645
3646   assert(wand != (MagickWand *) NULL);
3647   assert(wand->signature == WandSignature);
3648   if (wand->debug != MagickFalse)
3649     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3650   if (wand->images == (Image *) NULL)
3651     {
3652       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3653         "ContainsNoImages","`%s'",wand->name);
3654       return((unsigned char *) NULL);
3655     }
3656   blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3657     wand->exception);
3658   return(blob);
3659 }
3660 \f
3661 /*
3662 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3663 %                                                                             %
3664 %                                                                             %
3665 %                                                                             %
3666 %   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                         %
3667 %                                                                             %
3668 %                                                                             %
3669 %                                                                             %
3670 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3671 %
3672 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3673 %  image.
3674 %
3675 %  The format of the MagickGetImageBluePrimary method is:
3676 %
3677 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3678 %        double *y)
3679 %
3680 %  A description of each parameter follows:
3681 %
3682 %    o wand: the magick wand.
3683 %
3684 %    o x: the chromaticity blue primary x-point.
3685 %
3686 %    o y: the chromaticity blue primary y-point.
3687 %
3688 */
3689 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3690   double *x,double *y)
3691 {
3692   assert(wand != (MagickWand *) NULL);
3693   assert(wand->signature == WandSignature);
3694   if (wand->debug != MagickFalse)
3695     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3696   if (wand->images == (Image *) NULL)
3697     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3698   *x=wand->images->chromaticity.blue_primary.x;
3699   *y=wand->images->chromaticity.blue_primary.y;
3700   return(MagickTrue);
3701 }
3702 \f
3703 /*
3704 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3705 %                                                                             %
3706 %                                                                             %
3707 %                                                                             %
3708 %   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                         %
3709 %                                                                             %
3710 %                                                                             %
3711 %                                                                             %
3712 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3713 %
3714 %  MagickGetImageBorderColor() returns the image border color.
3715 %
3716 %  The format of the MagickGetImageBorderColor method is:
3717 %
3718 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3719 %        PixelWand *border_color)
3720 %
3721 %  A description of each parameter follows:
3722 %
3723 %    o wand: the magick wand.
3724 %
3725 %    o border_color: Return the border color.
3726 %
3727 */
3728 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3729   PixelWand *border_color)
3730 {
3731   assert(wand != (MagickWand *) NULL);
3732   assert(wand->signature == WandSignature);
3733   if (wand->debug != MagickFalse)
3734     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3735   if (wand->images == (Image *) NULL)
3736     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3737   PixelSetPixelColor(border_color,&wand->images->border_color);
3738   return(MagickTrue);
3739 }
3740 \f
3741 /*
3742 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3743 %                                                                             %
3744 %                                                                             %
3745 %                                                                             %
3746 %   M a g i c k G e t I m a g e F e a t u r e s                               %
3747 %                                                                             %
3748 %                                                                             %
3749 %                                                                             %
3750 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3751 %
3752 %  MagickGetImageFeatures() returns features for each channel in the
3753 %  image in each of four directions (horizontal, vertical, left and right
3754 %  diagonals) for the specified distance.  The features include the angular
3755 %  second moment, contrast, correlation, sum of squares: variance, inverse
3756 %  difference moment, sum average, sum varience, sum entropy, entropy,
3757 %  difference variance, difference entropy, information measures of
3758 %  correlation 1, information measures of correlation 2, and maximum
3759 %  correlation coefficient.  You can access the red channel contrast, for
3760 %  example, like this:
3761 %
3762 %      channel_features=MagickGetImageFeatures(wand,1);
3763 %      contrast=channel_features[RedPixelChannel].contrast[0];
3764 %
3765 %  Use MagickRelinquishMemory() to free the statistics buffer.
3766 %
3767 %  The format of the MagickGetImageFeatures method is:
3768 %
3769 %      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3770 %        const size_t distance)
3771 %
3772 %  A description of each parameter follows:
3773 %
3774 %    o wand: the magick wand.
3775 %
3776 %    o distance: the distance.
3777 %
3778 */
3779 WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3780   const size_t distance)
3781 {
3782   assert(wand != (MagickWand *) NULL);
3783   assert(wand->signature == WandSignature);
3784   if (wand->debug != MagickFalse)
3785     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3786   if (wand->images == (Image *) NULL)
3787     {
3788       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3789         "ContainsNoImages","`%s'",wand->name);
3790       return((ChannelFeatures *) NULL);
3791     }
3792   return(GetImageFeatures(wand->images,distance,wand->exception));
3793 }
3794 \f
3795 /*
3796 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3797 %                                                                             %
3798 %                                                                             %
3799 %                                                                             %
3800 %   M a g i c k G e t I m a g e K u r t o s i s                               %
3801 %                                                                             %
3802 %                                                                             %
3803 %                                                                             %
3804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3805 %
3806 %  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
3807 %  more image channels.
3808 %
3809 %  The format of the MagickGetImageKurtosis method is:
3810 %
3811 %      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3812 %        double *kurtosis,double *skewness)
3813 %
3814 %  A description of each parameter follows:
3815 %
3816 %    o wand: the magick wand.
3817 %
3818 %    o kurtosis:  The kurtosis for the specified channel(s).
3819 %
3820 %    o skewness:  The skewness for the specified channel(s).
3821 %
3822 */
3823 WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3824   double *kurtosis,double *skewness)
3825 {
3826   MagickBooleanType
3827     status;
3828
3829   assert(wand != (MagickWand *) NULL);
3830   assert(wand->signature == WandSignature);
3831   if (wand->debug != MagickFalse)
3832     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3833   if (wand->images == (Image *) NULL)
3834     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3835   status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
3836   return(status);
3837 }
3838 \f
3839 /*
3840 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3841 %                                                                             %
3842 %                                                                             %
3843 %                                                                             %
3844 %   M a g i c k G e t I m a g e M e a n                                       %
3845 %                                                                             %
3846 %                                                                             %
3847 %                                                                             %
3848 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3849 %
3850 %  MagickGetImageMean() gets the mean and standard deviation of one or more
3851 %  image channels.
3852 %
3853 %  The format of the MagickGetImageMean method is:
3854 %
3855 %      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3856 %        double *standard_deviation)
3857 %
3858 %  A description of each parameter follows:
3859 %
3860 %    o wand: the magick wand.
3861 %
3862 %    o channel: the image channel(s).
3863 %
3864 %    o mean:  The mean pixel value for the specified channel(s).
3865 %
3866 %    o standard_deviation:  The standard deviation for the specified channel(s).
3867 %
3868 */
3869 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3870   double *standard_deviation)
3871 {
3872   MagickBooleanType
3873     status;
3874
3875   assert(wand != (MagickWand *) NULL);
3876   assert(wand->signature == WandSignature);
3877   if (wand->debug != MagickFalse)
3878     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3879   if (wand->images == (Image *) NULL)
3880     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3881   status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
3882   return(status);
3883 }
3884 \f
3885 /*
3886 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3887 %                                                                             %
3888 %                                                                             %
3889 %                                                                             %
3890 %   M a g i c k G e t I m a g e R a n g e                                     %
3891 %                                                                             %
3892 %                                                                             %
3893 %                                                                             %
3894 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3895 %
3896 %  MagickGetImageRange() gets the range for one or more image channels.
3897 %
3898 %  The format of the MagickGetImageRange method is:
3899 %
3900 %      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
3901 %        double *maxima)
3902 %
3903 %  A description of each parameter follows:
3904 %
3905 %    o wand: the magick wand.
3906 %
3907 %    o minima:  The minimum pixel value for the specified channel(s).
3908 %
3909 %    o maxima:  The maximum pixel value for the specified channel(s).
3910 %
3911 */
3912 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
3913   double *minima,double *maxima)
3914 {
3915   MagickBooleanType
3916     status;
3917
3918   assert(wand != (MagickWand *) NULL);
3919   assert(wand->signature == WandSignature);
3920   if (wand->debug != MagickFalse)
3921     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3922   if (wand->images == (Image *) NULL)
3923     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3924   status=GetImageRange(wand->images,minima,maxima,wand->exception);
3925   return(status);
3926 }
3927 \f
3928 /*
3929 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3930 %                                                                             %
3931 %                                                                             %
3932 %                                                                             %
3933 %   M a g i c k G e t I m a g e S t a t i s t i c s                           %
3934 %                                                                             %
3935 %                                                                             %
3936 %                                                                             %
3937 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3938 %
3939 %  MagickGetImageStatistics() returns statistics for each channel in the
3940 %  image.  The statistics include the channel depth, its minima and
3941 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
3942 %  You can access the red channel mean, for example, like this:
3943 %
3944 %      channel_statistics=MagickGetImageStatistics(wand);
3945 %      red_mean=channel_statistics[RedPixelChannel].mean;
3946 %
3947 %  Use MagickRelinquishMemory() to free the statistics buffer.
3948 %
3949 %  The format of the MagickGetImageStatistics method is:
3950 %
3951 %      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3952 %
3953 %  A description of each parameter follows:
3954 %
3955 %    o wand: the magick wand.
3956 %
3957 */
3958 WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3959 {
3960   assert(wand != (MagickWand *) NULL);
3961   assert(wand->signature == WandSignature);
3962   if (wand->debug != MagickFalse)
3963     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3964   if (wand->images == (Image *) NULL)
3965     {
3966       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3967         "ContainsNoImages","`%s'",wand->name);
3968       return((ChannelStatistics *) NULL);
3969     }
3970   return(GetImageStatistics(wand->images,wand->exception));
3971 }
3972 \f
3973 /*
3974 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3975 %                                                                             %
3976 %                                                                             %
3977 %                                                                             %
3978 %   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                     %
3979 %                                                                             %
3980 %                                                                             %
3981 %                                                                             %
3982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3983 %
3984 %  MagickGetImageColormapColor() returns the color of the specified colormap
3985 %  index.
3986 %
3987 %  The format of the MagickGetImageColormapColor method is:
3988 %
3989 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
3990 %        const size_t index,PixelWand *color)
3991 %
3992 %  A description of each parameter follows:
3993 %
3994 %    o wand: the magick wand.
3995 %
3996 %    o index: the offset into the image colormap.
3997 %
3998 %    o color: Return the colormap color in this wand.
3999 %
4000 */
4001 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4002   const size_t index,PixelWand *color)
4003 {
4004   assert(wand != (MagickWand *) NULL);
4005   assert(wand->signature == WandSignature);
4006   if (wand->debug != MagickFalse)
4007     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4008   if (wand->images == (Image *) NULL)
4009     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4010   if ((wand->images->colormap == (PixelInfo *) NULL) ||
4011       (index >= wand->images->colors))
4012     {
4013       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4014         "InvalidColormapIndex","`%s'",wand->name);
4015       return(MagickFalse);
4016     }
4017   PixelSetPixelColor(color,wand->images->colormap+index);
4018   return(MagickTrue);
4019 }
4020 \f
4021 /*
4022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4023 %                                                                             %
4024 %                                                                             %
4025 %                                                                             %
4026 %   M a g i c k G e t I m a g e C o l o r s                                   %
4027 %                                                                             %
4028 %                                                                             %
4029 %                                                                             %
4030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4031 %
4032 %  MagickGetImageColors() gets the number of unique colors in the image.
4033 %
4034 %  The format of the MagickGetImageColors method is:
4035 %
4036 %      size_t MagickGetImageColors(MagickWand *wand)
4037 %
4038 %  A description of each parameter follows:
4039 %
4040 %    o wand: the magick wand.
4041 %
4042 */
4043 WandExport size_t MagickGetImageColors(MagickWand *wand)
4044 {
4045   assert(wand != (MagickWand *) NULL);
4046   assert(wand->signature == WandSignature);
4047   if (wand->debug != MagickFalse)
4048     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4049   if (wand->images == (Image *) NULL)
4050     {
4051       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4052         "ContainsNoImages","`%s'",wand->name);
4053       return(0);
4054     }
4055   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4056 }
4057 \f
4058 /*
4059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4060 %                                                                             %
4061 %                                                                             %
4062 %                                                                             %
4063 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4064 %                                                                             %
4065 %                                                                             %
4066 %                                                                             %
4067 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4068 %
4069 %  MagickGetImageColorspace() gets the image colorspace.
4070 %
4071 %  The format of the MagickGetImageColorspace method is:
4072 %
4073 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4074 %
4075 %  A description of each parameter follows:
4076 %
4077 %    o wand: the magick wand.
4078 %
4079 */
4080 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4081 {
4082   assert(wand != (MagickWand *) NULL);
4083   assert(wand->signature == WandSignature);
4084   if (wand->debug != MagickFalse)
4085     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4086   if (wand->images == (Image *) NULL)
4087     {
4088       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4089         "ContainsNoImages","`%s'",wand->name);
4090       return(UndefinedColorspace);
4091     }
4092   return(wand->images->colorspace);
4093 }
4094 \f
4095 /*
4096 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4097 %                                                                             %
4098 %                                                                             %
4099 %                                                                             %
4100 %   M a g i c k G e t I m a g e C o m p o s e                                 %
4101 %                                                                             %
4102 %                                                                             %
4103 %                                                                             %
4104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4105 %
4106 %  MagickGetImageCompose() returns the composite operator associated with the
4107 %  image.
4108 %
4109 %  The format of the MagickGetImageCompose method is:
4110 %
4111 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4112 %
4113 %  A description of each parameter follows:
4114 %
4115 %    o wand: the magick wand.
4116 %
4117 */
4118 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4119 {
4120   assert(wand != (MagickWand *) NULL);
4121   assert(wand->signature == WandSignature);
4122   if (wand->debug != MagickFalse)
4123     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4124   if (wand->images == (Image *) NULL)
4125     {
4126       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4127         "ContainsNoImages","`%s'",wand->name);
4128       return(UndefinedCompositeOp);
4129     }
4130   return(wand->images->compose);
4131 }
4132 \f
4133 /*
4134 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4135 %                                                                             %
4136 %                                                                             %
4137 %                                                                             %
4138 %   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                         %
4139 %                                                                             %
4140 %                                                                             %
4141 %                                                                             %
4142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4143 %
4144 %  MagickGetImageCompression() gets the image compression.
4145 %
4146 %  The format of the MagickGetImageCompression method is:
4147 %
4148 %      CompressionType MagickGetImageCompression(MagickWand *wand)
4149 %
4150 %  A description of each parameter follows:
4151 %
4152 %    o wand: the magick wand.
4153 %
4154 */
4155 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4156 {
4157   assert(wand != (MagickWand *) NULL);
4158   assert(wand->signature == WandSignature);
4159   if (wand->debug != MagickFalse)
4160     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4161   if (wand->images == (Image *) NULL)
4162     {
4163       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4164         "ContainsNoImages","`%s'",wand->name);
4165       return(UndefinedCompression);
4166     }
4167   return(wand->images->compression);
4168 }
4169 \f
4170 /*
4171 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4172 %                                                                             %
4173 %                                                                             %
4174 %                                                                             %
4175 %   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           %
4176 %                                                                             %
4177 %                                                                             %
4178 %                                                                             %
4179 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4180 %
4181 %  MagickGetImageCompression() gets the image compression quality.
4182 %
4183 %  The format of the MagickGetImageCompression method is:
4184 %
4185 %      size_t MagickGetImageCompression(MagickWand *wand)
4186 %
4187 %  A description of each parameter follows:
4188 %
4189 %    o wand: the magick wand.
4190 %
4191 */
4192 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4193 {
4194   assert(wand != (MagickWand *) NULL);
4195   assert(wand->signature == WandSignature);
4196   if (wand->debug != MagickFalse)
4197     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4198   if (wand->images == (Image *) NULL)
4199     {
4200       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4201         "ContainsNoImages","`%s'",wand->name);
4202       return(0UL);
4203     }
4204   return(wand->images->quality);
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 l a y                                     %
4213 %                                                                             %
4214 %                                                                             %
4215 %                                                                             %
4216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4217 %
4218 %  MagickGetImageDelay() gets the image delay.
4219 %
4220 %  The format of the MagickGetImageDelay method is:
4221 %
4222 %      size_t MagickGetImageDelay(MagickWand *wand)
4223 %
4224 %  A description of each parameter follows:
4225 %
4226 %    o wand: the magick wand.
4227 %
4228 */
4229 WandExport size_t MagickGetImageDelay(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(wand->images->delay);
4238 }
4239 \f
4240 /*
4241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4242 %                                                                             %
4243 %                                                                             %
4244 %                                                                             %
4245 %   M a g i c k G e t I m a g e D e p t h                                     %
4246 %                                                                             %
4247 %                                                                             %
4248 %                                                                             %
4249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4250 %
4251 %  MagickGetImageDepth() gets the image depth.
4252 %
4253 %  The format of the MagickGetImageDepth method is:
4254 %
4255 %      size_t MagickGetImageDepth(MagickWand *wand)
4256 %
4257 %  A description of each parameter follows:
4258 %
4259 %    o wand: the magick wand.
4260 %
4261 */
4262 WandExport size_t MagickGetImageDepth(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     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4270   return(wand->images->depth);
4271 }
4272 \f
4273 /*
4274 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4275 %                                                                             %
4276 %                                                                             %
4277 %                                                                             %
4278 %   M a g i c k G e t I m a g e D i s p o s e                                 %
4279 %                                                                             %
4280 %                                                                             %
4281 %                                                                             %
4282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4283 %
4284 %  MagickGetImageDispose() gets the image disposal method.
4285 %
4286 %  The format of the MagickGetImageDispose method is:
4287 %
4288 %      DisposeType MagickGetImageDispose(MagickWand *wand)
4289 %
4290 %  A description of each parameter follows:
4291 %
4292 %    o wand: the magick wand.
4293 %
4294 */
4295 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4296 {
4297   assert(wand != (MagickWand *) NULL);
4298   assert(wand->signature == WandSignature);
4299   if (wand->debug != MagickFalse)
4300     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4301   if (wand->images == (Image *) NULL)
4302     {
4303       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4304         "ContainsNoImages","`%s'",wand->name);
4305       return(UndefinedDispose);
4306     }
4307   return((DisposeType) wand->images->dispose);
4308 }
4309 \f
4310 /*
4311 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4312 %                                                                             %
4313 %                                                                             %
4314 %                                                                             %
4315 %   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4316 %                                                                             %
4317 %                                                                             %
4318 %                                                                             %
4319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4320 %
4321 %  MagickGetImageDistortion() compares an image to a reconstructed image and
4322 %  returns the specified distortion metric.
4323 %
4324 %  The format of the MagickGetImageDistortion method is:
4325 %
4326 %      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4327 %        const MagickWand *reference,const MetricType metric,
4328 %        double *distortion)
4329 %
4330 %  A description of each parameter follows:
4331 %
4332 %    o wand: the magick wand.
4333 %
4334 %    o reference: the reference wand.
4335 %
4336 %    o metric: the metric.
4337 %
4338 %    o distortion: the computed distortion between the images.
4339 %
4340 */
4341 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4342   const MagickWand *reference,const MetricType metric,double *distortion)
4343 {
4344   MagickBooleanType
4345     status;
4346
4347   assert(wand != (MagickWand *) NULL);
4348   assert(wand->signature == WandSignature);
4349   if (wand->debug != MagickFalse)
4350     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4351   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4352     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4353   status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4354     wand->exception);
4355   return(status);
4356 }
4357 \f
4358 /*
4359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4360 %                                                                             %
4361 %                                                                             %
4362 %                                                                             %
4363 %   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                         %
4364 %                                                                             %
4365 %                                                                             %
4366 %                                                                             %
4367 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4368 %
4369 %  MagickGetImageDistortions() compares one or more pixel channels of an
4370 %  image to a reconstructed image and returns the specified distortion metrics.
4371 %
4372 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4373 %
4374 %  The format of the MagickGetImageDistortion method is:
4375 %
4376 %      double *MagickGetImageDistortion(MagickWand *wand,
4377 %        const MagickWand *reference,const MetricType metric)
4378 %
4379 %  A description of each parameter follows:
4380 %
4381 %    o wand: the magick wand.
4382 %
4383 %    o reference: the reference wand.
4384 %
4385 %    o metric: the metric.
4386 %
4387 */
4388 WandExport double *MagickGetImageDistortions(MagickWand *wand,
4389   const MagickWand *reference,const MetricType metric)
4390 {
4391   double
4392     *channel_distortion;
4393
4394   assert(wand != (MagickWand *) NULL);
4395   assert(wand->signature == WandSignature);
4396   if (wand->debug != MagickFalse)
4397     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4398   assert(reference != (MagickWand *) NULL);
4399   assert(reference->signature == WandSignature);
4400   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4401     {
4402       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4403         "ContainsNoImages","`%s'",wand->name);
4404       return((double *) NULL);
4405     }
4406   channel_distortion=GetImageDistortions(wand->images,reference->images,
4407     metric,wand->exception);
4408   return(channel_distortion);
4409 }
4410 \f
4411 /*
4412 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4413 %                                                                             %
4414 %                                                                             %
4415 %                                                                             %
4416 %   M a g i c k G e t I m a g e F i l e n a m e                               %
4417 %                                                                             %
4418 %                                                                             %
4419 %                                                                             %
4420 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4421 %
4422 %  MagickGetImageFilename() returns the filename of a particular image in a
4423 %  sequence.
4424 %
4425 %  The format of the MagickGetImageFilename method is:
4426 %
4427 %      char *MagickGetImageFilename(MagickWand *wand)
4428 %
4429 %  A description of each parameter follows:
4430 %
4431 %    o wand: the magick wand.
4432 %
4433 */
4434 WandExport char *MagickGetImageFilename(MagickWand *wand)
4435 {
4436   assert(wand != (MagickWand *) NULL);
4437   assert(wand->signature == WandSignature);
4438   if (wand->debug != MagickFalse)
4439     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4440   if (wand->images == (Image *) NULL)
4441     {
4442       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4443         "ContainsNoImages","`%s'",wand->name);
4444       return((char *) NULL);
4445     }
4446   return(AcquireString(wand->images->filename));
4447 }
4448 \f
4449 /*
4450 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4451 %                                                                             %
4452 %                                                                             %
4453 %                                                                             %
4454 %   M a g i c k G e t I m a g e F o r m a t                                   %
4455 %                                                                             %
4456 %                                                                             %
4457 %                                                                             %
4458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4459 %
4460 %  MagickGetImageFormat() returns the format of a particular image in a
4461 %  sequence.
4462 %
4463 %  The format of the MagickGetImageFormat method is:
4464 %
4465 %      const char *MagickGetImageFormat(MagickWand *wand)
4466 %
4467 %  A description of each parameter follows:
4468 %
4469 %    o wand: the magick wand.
4470 %
4471 */
4472 WandExport char *MagickGetImageFormat(MagickWand *wand)
4473 {
4474   assert(wand != (MagickWand *) NULL);
4475   assert(wand->signature == WandSignature);
4476   if (wand->debug != MagickFalse)
4477     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4478   if (wand->images == (Image *) NULL)
4479     {
4480       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4481         "ContainsNoImages","`%s'",wand->name);
4482       return((char *) NULL);
4483     }
4484   return(AcquireString(wand->images->magick));
4485 }
4486 \f
4487 /*
4488 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4489 %                                                                             %
4490 %                                                                             %
4491 %                                                                             %
4492 %   M a g i c k G e t I m a g e F u z z                                       %
4493 %                                                                             %
4494 %                                                                             %
4495 %                                                                             %
4496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4497 %
4498 %  MagickGetImageFuzz() gets the image fuzz.
4499 %
4500 %  The format of the MagickGetImageFuzz method is:
4501 %
4502 %      double MagickGetImageFuzz(MagickWand *wand)
4503 %
4504 %  A description of each parameter follows:
4505 %
4506 %    o wand: the magick wand.
4507 %
4508 */
4509 WandExport double MagickGetImageFuzz(MagickWand *wand)
4510 {
4511   assert(wand != (MagickWand *) NULL);
4512   assert(wand->signature == WandSignature);
4513   if (wand->debug != MagickFalse)
4514     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4515   if (wand->images == (Image *) NULL)
4516     {
4517       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4518         "ContainsNoImages","`%s'",wand->name);
4519       return(0.0);
4520     }
4521   return(wand->images->fuzz);
4522 }
4523 \f
4524 /*
4525 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4526 %                                                                             %
4527 %                                                                             %
4528 %                                                                             %
4529 %   M a g i c k G e t I m a g e G a m m a                                     %
4530 %                                                                             %
4531 %                                                                             %
4532 %                                                                             %
4533 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4534 %
4535 %  MagickGetImageGamma() gets the image gamma.
4536 %
4537 %  The format of the MagickGetImageGamma method is:
4538 %
4539 %      double MagickGetImageGamma(MagickWand *wand)
4540 %
4541 %  A description of each parameter follows:
4542 %
4543 %    o wand: the magick wand.
4544 %
4545 */
4546 WandExport double MagickGetImageGamma(MagickWand *wand)
4547 {
4548   assert(wand != (MagickWand *) NULL);
4549   assert(wand->signature == WandSignature);
4550   if (wand->debug != MagickFalse)
4551     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4552   if (wand->images == (Image *) NULL)
4553     {
4554       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4555         "ContainsNoImages","`%s'",wand->name);
4556       return(0.0);
4557     }
4558   return(wand->images->gamma);
4559 }
4560 \f
4561 /*
4562 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4563 %                                                                             %
4564 %                                                                             %
4565 %                                                                             %
4566 %   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                 %
4567 %                                                                             %
4568 %                                                                             %
4569 %                                                                             %
4570 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4571 %
4572 %  MagickGetImageGravity() gets the image gravity.
4573 %
4574 %  The format of the MagickGetImageGravity method is:
4575 %
4576 %      GravityType MagickGetImageGravity(MagickWand *wand)
4577 %
4578 %  A description of each parameter follows:
4579 %
4580 %    o wand: the magick wand.
4581 %
4582 */
4583 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4584 {
4585   assert(wand != (MagickWand *) NULL);
4586   assert(wand->signature == WandSignature);
4587   if (wand->debug != MagickFalse)
4588     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4589   if (wand->images == (Image *) NULL)
4590     {
4591       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4592         "ContainsNoImages","`%s'",wand->name);
4593       return(UndefinedGravity);
4594     }
4595   return(wand->images->gravity);
4596 }
4597 \f
4598 /*
4599 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4600 %                                                                             %
4601 %                                                                             %
4602 %                                                                             %
4603 %   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                       %
4604 %                                                                             %
4605 %                                                                             %
4606 %                                                                             %
4607 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4608 %
4609 %  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4610 %
4611 %  The format of the MagickGetImageGreenPrimary method is:
4612 %
4613 %      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4614 %        double *y)
4615 %
4616 %  A description of each parameter follows:
4617 %
4618 %    o wand: the magick wand.
4619 %
4620 %    o x: the chromaticity green primary x-point.
4621 %
4622 %    o y: the chromaticity green primary y-point.
4623 %
4624 */
4625 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4626   double *x,double *y)
4627 {
4628   assert(wand != (MagickWand *) NULL);
4629   assert(wand->signature == WandSignature);
4630   if (wand->debug != MagickFalse)
4631     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4632   if (wand->images == (Image *) NULL)
4633     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4634   *x=wand->images->chromaticity.green_primary.x;
4635   *y=wand->images->chromaticity.green_primary.y;
4636   return(MagickTrue);
4637 }
4638 \f
4639 /*
4640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4641 %                                                                             %
4642 %                                                                             %
4643 %                                                                             %
4644 %   M a g i c k G e t I m a g e H e i g h t                                   %
4645 %                                                                             %
4646 %                                                                             %
4647 %                                                                             %
4648 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4649 %
4650 %  MagickGetImageHeight() returns the image height.
4651 %
4652 %  The format of the MagickGetImageHeight method is:
4653 %
4654 %      size_t MagickGetImageHeight(MagickWand *wand)
4655 %
4656 %  A description of each parameter follows:
4657 %
4658 %    o wand: the magick wand.
4659 %
4660 */
4661 WandExport size_t MagickGetImageHeight(MagickWand *wand)
4662 {
4663   assert(wand != (MagickWand *) NULL);
4664   assert(wand->signature == WandSignature);
4665   if (wand->debug != MagickFalse)
4666     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4667   if (wand->images == (Image *) NULL)
4668     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4669   return(wand->images->rows);
4670 }
4671 \f
4672 /*
4673 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4674 %                                                                             %
4675 %                                                                             %
4676 %                                                                             %
4677 %   M a g i c k G e t I m a g e H i s t o g r a m                             %
4678 %                                                                             %
4679 %                                                                             %
4680 %                                                                             %
4681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4682 %
4683 %  MagickGetImageHistogram() returns the image histogram as an array of
4684 %  PixelWand wands.
4685 %
4686 %  The format of the MagickGetImageHistogram method is:
4687 %
4688 %      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4689 %        size_t *number_colors)
4690 %
4691 %  A description of each parameter follows:
4692 %
4693 %    o wand: the magick wand.
4694 %
4695 %    o number_colors: the number of unique colors in the image and the number
4696 %      of pixel wands returned.
4697 %
4698 */
4699 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4700   size_t *number_colors)
4701 {
4702   PixelInfo
4703     *histogram;
4704
4705   PixelWand
4706     **pixel_wands;
4707
4708   register ssize_t
4709     i;
4710
4711   assert(wand != (MagickWand *) NULL);
4712   assert(wand->signature == WandSignature);
4713   if (wand->debug != MagickFalse)
4714     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4715   if (wand->images == (Image *) NULL)
4716     {
4717       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4718         "ContainsNoImages","`%s'",wand->name);
4719       return((PixelWand **) NULL);
4720     }
4721   histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4722   if (histogram == (PixelInfo *) NULL)
4723     return((PixelWand **) NULL);
4724   pixel_wands=NewPixelWands(*number_colors);
4725   for (i=0; i < (ssize_t) *number_colors; i++)
4726   {
4727     PixelSetPixelColor(pixel_wands[i],&histogram[i]);
4728     PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4729   }
4730   histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
4731   return(pixel_wands);
4732 }
4733 \f
4734 /*
4735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4736 %                                                                             %
4737 %                                                                             %
4738 %                                                                             %
4739 %   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                 %
4740 %                                                                             %
4741 %                                                                             %
4742 %                                                                             %
4743 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4744 %
4745 %  MagickGetImageInterlaceScheme() gets the image interlace scheme.
4746 %
4747 %  The format of the MagickGetImageInterlaceScheme method is:
4748 %
4749 %      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4750 %
4751 %  A description of each parameter follows:
4752 %
4753 %    o wand: the magick wand.
4754 %
4755 */
4756 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4757 {
4758   assert(wand != (MagickWand *) NULL);
4759   assert(wand->signature == WandSignature);
4760   if (wand->debug != MagickFalse)
4761     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4762   if (wand->images == (Image *) NULL)
4763     {
4764       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4765         "ContainsNoImages","`%s'",wand->name);
4766       return(UndefinedInterlace);
4767     }
4768   return(wand->images->interlace);
4769 }
4770 \f
4771 /*
4772 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4773 %                                                                             %
4774 %                                                                             %
4775 %                                                                             %
4776 %   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             %
4777 %                                                                             %
4778 %                                                                             %
4779 %                                                                             %
4780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4781 %
4782 %  MagickGetImageInterpolateMethod() returns the interpolation method for the
4783 %  sepcified image.
4784 %
4785 %  The format of the MagickGetImageInterpolateMethod method is:
4786 %
4787 %      PixelInterpolateMethod MagickGetImagePixelInterpolateMethod(
4788 %        MagickWand *wand)
4789 %
4790 %  A description of each parameter follows:
4791 %
4792 %    o wand: the magick wand.
4793 %
4794 */
4795 WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
4796   MagickWand *wand)
4797 {
4798   assert(wand != (MagickWand *) NULL);
4799   assert(wand->signature == WandSignature);
4800   if (wand->debug != MagickFalse)
4801     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4802   if (wand->images == (Image *) NULL)
4803     {
4804       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4805         "ContainsNoImages","`%s'",wand->name);
4806       return(UndefinedInterpolatePixel);
4807     }
4808   return(wand->images->interpolate);
4809 }
4810 \f
4811 /*
4812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4813 %                                                                             %
4814 %                                                                             %
4815 %                                                                             %
4816 %   M a g i c k G e t I m a g e I t e r a t i o n s                           %
4817 %                                                                             %
4818 %                                                                             %
4819 %                                                                             %
4820 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4821 %
4822 %  MagickGetImageIterations() gets the image iterations.
4823 %
4824 %  The format of the MagickGetImageIterations method is:
4825 %
4826 %      size_t MagickGetImageIterations(MagickWand *wand)
4827 %
4828 %  A description of each parameter follows:
4829 %
4830 %    o wand: the magick wand.
4831 %
4832 */
4833 WandExport size_t MagickGetImageIterations(MagickWand *wand)
4834 {
4835   assert(wand != (MagickWand *) NULL);
4836   assert(wand->signature == WandSignature);
4837   if (wand->debug != MagickFalse)
4838     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4839   if (wand->images == (Image *) NULL)
4840     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4841   return(wand->images->iterations);
4842 }
4843 \f
4844 /*
4845 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4846 %                                                                             %
4847 %                                                                             %
4848 %                                                                             %
4849 %   M a g i c k G e t I m a g e L e n g t h                                   %
4850 %                                                                             %
4851 %                                                                             %
4852 %                                                                             %
4853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4854 %
4855 %  MagickGetImageLength() returns the image length in bytes.
4856 %
4857 %  The format of the MagickGetImageLength method is:
4858 %
4859 %      MagickBooleanType MagickGetImageLength(MagickWand *wand,
4860 %        MagickSizeType *length)
4861 %
4862 %  A description of each parameter follows:
4863 %
4864 %    o wand: the magick wand.
4865 %
4866 %    o length: the image length in bytes.
4867 %
4868 */
4869 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
4870   MagickSizeType *length)
4871 {
4872   assert(wand != (MagickWand *) NULL);
4873   assert(wand->signature == WandSignature);
4874   if (wand->debug != MagickFalse)
4875     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4876   if (wand->images == (Image *) NULL)
4877     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4878   *length=GetBlobSize(wand->images);
4879   return(MagickTrue);
4880 }
4881 \f
4882 /*
4883 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4884 %                                                                             %
4885 %                                                                             %
4886 %                                                                             %
4887 %   M a g i c k G e t I m a g e M a t t e C o l o r                           %
4888 %                                                                             %
4889 %                                                                             %
4890 %                                                                             %
4891 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4892 %
4893 %  MagickGetImageMatteColor() returns the image matte color.
4894 %
4895 %  The format of the MagickGetImageMatteColor method is:
4896 %
4897 %      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
4898 %        PixelWand *matte_color)
4899 %
4900 %  A description of each parameter follows:
4901 %
4902 %    o wand: the magick wand.
4903 %
4904 %    o matte_color: Return the matte color.
4905 %
4906 */
4907 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
4908   PixelWand *matte_color)
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     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4916   PixelSetPixelColor(matte_color,&wand->images->matte_color);
4917   return(MagickTrue);
4918 }
4919 \f
4920 /*
4921 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4922 %                                                                             %
4923 %                                                                             %
4924 %                                                                             %
4925 %   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                         %
4926 %                                                                             %
4927 %                                                                             %
4928 %                                                                             %
4929 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4930 %
4931 %  MagickGetImageOrientation() returns the image orientation.
4932 %
4933 %  The format of the MagickGetImageOrientation method is:
4934 %
4935 %      OrientationType MagickGetImageOrientation(MagickWand *wand)
4936 %
4937 %  A description of each parameter follows:
4938 %
4939 %    o wand: the magick wand.
4940 %
4941 */
4942 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
4943 {
4944   assert(wand != (MagickWand *) NULL);
4945   assert(wand->signature == WandSignature);
4946   if (wand->debug != MagickFalse)
4947     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4948   if (wand->images == (Image *) NULL)
4949     {
4950       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4951         "ContainsNoImages","`%s'",wand->name);
4952       return(UndefinedOrientation);
4953     }
4954   return(wand->images->orientation);
4955 }
4956 \f
4957 /*
4958 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4959 %                                                                             %
4960 %                                                                             %
4961 %                                                                             %
4962 %   M a g i c k G e t I m a g e P a g e                                       %
4963 %                                                                             %
4964 %                                                                             %
4965 %                                                                             %
4966 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4967 %
4968 %  MagickGetImagePage() returns the page geometry associated with the image.
4969 %
4970 %  The format of the MagickGetImagePage method is:
4971 %
4972 %      MagickBooleanType MagickGetImagePage(MagickWand *wand,
4973 %        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4974 %
4975 %  A description of each parameter follows:
4976 %
4977 %    o wand: the magick wand.
4978 %
4979 %    o width: the page width.
4980 %
4981 %    o height: the page height.
4982 %
4983 %    o x: the page x-offset.
4984 %
4985 %    o y: the page y-offset.
4986 %
4987 */
4988 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
4989   size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4990 {
4991   assert(wand != (const MagickWand *) NULL);
4992   assert(wand->signature == WandSignature);
4993   if (wand->debug != MagickFalse)
4994     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4995   if (wand->images == (Image *) NULL)
4996     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4997   *width=wand->images->page.width;
4998   *height=wand->images->page.height;
4999   *x=wand->images->page.x;
5000   *y=wand->images->page.y;
5001   return(MagickTrue);
5002 }
5003 \f
5004 /*
5005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5006 %                                                                             %
5007 %                                                                             %
5008 %                                                                             %
5009 %   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5010 %                                                                             %
5011 %                                                                             %
5012 %                                                                             %
5013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5014 %
5015 %  MagickGetImagePixelColor() returns the color of the specified pixel.
5016 %
5017 %  The format of the MagickGetImagePixelColor method is:
5018 %
5019 %      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5020 %        const ssize_t x,const ssize_t y,PixelWand *color)
5021 %
5022 %  A description of each parameter follows:
5023 %
5024 %    o wand: the magick wand.
5025 %
5026 %    o x,y: the pixel offset into the image.
5027 %
5028 %    o color: Return the colormap color in this wand.
5029 %
5030 */
5031 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5032   const ssize_t x,const ssize_t y,PixelWand *color)
5033 {
5034   register const Quantum
5035     *p;
5036
5037   CacheView
5038     *image_view;
5039
5040   assert(wand != (MagickWand *) NULL);
5041   assert(wand->signature == WandSignature);
5042   if (wand->debug != MagickFalse)
5043     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5044   if (wand->images == (Image *) NULL)
5045     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5046   image_view=AcquireCacheView(wand->images);
5047   p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5048   if (p == (const Quantum *) NULL)
5049     {
5050       image_view=DestroyCacheView(image_view);
5051       return(MagickFalse);
5052     }
5053   PixelSetQuantumPixel(wand->images,p,color);
5054   image_view=DestroyCacheView(image_view);
5055   return(MagickTrue);
5056 }
5057 \f
5058 /*
5059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5060 %                                                                             %
5061 %                                                                             %
5062 %                                                                             %
5063 %   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5064 %                                                                             %
5065 %                                                                             %
5066 %                                                                             %
5067 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5068 %
5069 %  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5070 %
5071 %  The format of the MagickGetImageRedPrimary method is:
5072 %
5073 %      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5074 %        double *y)
5075 %
5076 %  A description of each parameter follows:
5077 %
5078 %    o wand: the magick wand.
5079 %
5080 %    o x: the chromaticity red primary x-point.
5081 %
5082 %    o y: the chromaticity red primary y-point.
5083 %
5084 */
5085 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5086   double *x,double *y)
5087 {
5088   assert(wand != (MagickWand *) NULL);
5089   assert(wand->signature == WandSignature);
5090   if (wand->debug != MagickFalse)
5091     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5092   if (wand->images == (Image *) NULL)
5093     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5094   *x=wand->images->chromaticity.red_primary.x;
5095   *y=wand->images->chromaticity.red_primary.y;
5096   return(MagickTrue);
5097 }
5098 \f
5099 /*
5100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5101 %                                                                             %
5102 %                                                                             %
5103 %                                                                             %
5104 %   M a g i c k G e t I m a g e R e g i o n                                   %
5105 %                                                                             %
5106 %                                                                             %
5107 %                                                                             %
5108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5109 %
5110 %  MagickGetImageRegion() extracts a region of the image and returns it as a
5111 %  a new wand.
5112 %
5113 %  The format of the MagickGetImageRegion method is:
5114 %
5115 %      MagickWand *MagickGetImageRegion(MagickWand *wand,
5116 %        const size_t width,const size_t height,const ssize_t x,
5117 %        const ssize_t y)
5118 %
5119 %  A description of each parameter follows:
5120 %
5121 %    o wand: the magick wand.
5122 %
5123 %    o width: the region width.
5124 %
5125 %    o height: the region height.
5126 %
5127 %    o x: the region x offset.
5128 %
5129 %    o y: the region y offset.
5130 %
5131 */
5132 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5133   const size_t width,const size_t height,const ssize_t x,
5134   const ssize_t y)
5135 {
5136   Image
5137     *region_image;
5138
5139   RectangleInfo
5140     region;
5141
5142   assert(wand != (MagickWand *) NULL);
5143   assert(wand->signature == WandSignature);
5144   if (wand->debug != MagickFalse)
5145     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5146   if (wand->images == (Image *) NULL)
5147     return((MagickWand *) NULL);
5148   region.width=width;
5149   region.height=height;
5150   region.x=x;
5151   region.y=y;
5152   region_image=CropImage(wand->images,&region,wand->exception);
5153   if (region_image == (Image *) NULL)
5154     return((MagickWand *) NULL);
5155   return(CloneMagickWandFromImages(wand,region_image));
5156 }
5157 \f
5158 /*
5159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5160 %                                                                             %
5161 %                                                                             %
5162 %                                                                             %
5163 %   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                 %
5164 %                                                                             %
5165 %                                                                             %
5166 %                                                                             %
5167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5168 %
5169 %  MagickGetImageRenderingIntent() gets the image rendering intent.
5170 %
5171 %  The format of the MagickGetImageRenderingIntent method is:
5172 %
5173 %      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5174 %
5175 %  A description of each parameter follows:
5176 %
5177 %    o wand: the magick wand.
5178 %
5179 */
5180 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5181 {
5182   assert(wand != (MagickWand *) NULL);
5183   assert(wand->signature == WandSignature);
5184   if (wand->debug != MagickFalse)
5185     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5186   if (wand->images == (Image *) NULL)
5187     {
5188       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5189         "ContainsNoImages","`%s'",wand->name);
5190       return(UndefinedIntent);
5191     }
5192   return((RenderingIntent) wand->images->rendering_intent);
5193 }
5194 \f
5195 /*
5196 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5197 %                                                                             %
5198 %                                                                             %
5199 %                                                                             %
5200 %   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5201 %                                                                             %
5202 %                                                                             %
5203 %                                                                             %
5204 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5205 %
5206 %  MagickGetImageResolution() gets the image X and Y resolution.
5207 %
5208 %  The format of the MagickGetImageResolution method is:
5209 %
5210 %      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5211 %        double *y)
5212 %
5213 %  A description of each parameter follows:
5214 %
5215 %    o wand: the magick wand.
5216 %
5217 %    o x: the image x-resolution.
5218 %
5219 %    o y: the image y-resolution.
5220 %
5221 */
5222 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5223   double *x,double *y)
5224 {
5225   assert(wand != (MagickWand *) NULL);
5226   assert(wand->signature == WandSignature);
5227   if (wand->debug != MagickFalse)
5228     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5229   if (wand->images == (Image *) NULL)
5230     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5231   *x=wand->images->resolution.x;
5232   *y=wand->images->resolution.y;
5233   return(MagickTrue);
5234 }
5235 \f
5236 /*
5237 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5238 %                                                                             %
5239 %                                                                             %
5240 %                                                                             %
5241 %   M a g i c k G e t I m a g e S c e n e                                     %
5242 %                                                                             %
5243 %                                                                             %
5244 %                                                                             %
5245 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5246 %
5247 %  MagickGetImageScene() gets the image scene.
5248 %
5249 %  The format of the MagickGetImageScene method is:
5250 %
5251 %      size_t MagickGetImageScene(MagickWand *wand)
5252 %
5253 %  A description of each parameter follows:
5254 %
5255 %    o wand: the magick wand.
5256 %
5257 */
5258 WandExport size_t MagickGetImageScene(MagickWand *wand)
5259 {
5260   assert(wand != (MagickWand *) NULL);
5261   assert(wand->signature == WandSignature);
5262   if (wand->debug != MagickFalse)
5263     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5264   if (wand->images == (Image *) NULL)
5265     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5266   return(wand->images->scene);
5267 }
5268 \f
5269 /*
5270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5271 %                                                                             %
5272 %                                                                             %
5273 %                                                                             %
5274 %   M a g i c k G e t I m a g e S i g n a t u r e                             %
5275 %                                                                             %
5276 %                                                                             %
5277 %                                                                             %
5278 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5279 %
5280 %  MagickGetImageSignature() generates an SHA-256 message digest for the image
5281 %  pixel stream.
5282 %
5283 %  The format of the MagickGetImageSignature method is:
5284 %
5285 %      const char MagickGetImageSignature(MagickWand *wand)
5286 %
5287 %  A description of each parameter follows:
5288 %
5289 %    o wand: the magick wand.
5290 %
5291 */
5292 WandExport char *MagickGetImageSignature(MagickWand *wand)
5293 {
5294   const char
5295     *value;
5296
5297   MagickBooleanType
5298     status;
5299
5300   assert(wand != (MagickWand *) NULL);
5301   assert(wand->signature == WandSignature);
5302   if (wand->debug != MagickFalse)
5303     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5304   if (wand->images == (Image *) NULL)
5305     {
5306       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5307         "ContainsNoImages","`%s'",wand->name);
5308       return((char *) NULL);
5309     }
5310   status=SignatureImage(wand->images,wand->exception);
5311   if (status == MagickFalse)
5312     return((char *) NULL);
5313   value=GetImageProperty(wand->images,"signature",wand->exception);
5314   if (value == (const char *) NULL)
5315     return((char *) NULL);
5316   return(AcquireString(value));
5317 }
5318 \f
5319 /*
5320 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5321 %                                                                             %
5322 %                                                                             %
5323 %                                                                             %
5324 %   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                   %
5325 %                                                                             %
5326 %                                                                             %
5327 %                                                                             %
5328 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5329 %
5330 %  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5331 %
5332 %  The format of the MagickGetImageTicksPerSecond method is:
5333 %
5334 %      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5335 %
5336 %  A description of each parameter follows:
5337 %
5338 %    o wand: the magick wand.
5339 %
5340 */
5341 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5342 {
5343   assert(wand != (MagickWand *) NULL);
5344   assert(wand->signature == WandSignature);
5345   if (wand->debug != MagickFalse)
5346     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5347   if (wand->images == (Image *) NULL)
5348     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5349   return((size_t) wand->images->ticks_per_second);
5350 }
5351 \f
5352 /*
5353 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5354 %                                                                             %
5355 %                                                                             %
5356 %                                                                             %
5357 %   M a g i c k G e t I m a g e T y p e                                       %
5358 %                                                                             %
5359 %                                                                             %
5360 %                                                                             %
5361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5362 %
5363 %  MagickGetImageType() gets the potential image type:
5364 %
5365 %        Bilevel        Grayscale       GrayscaleMatte
5366 %        Palette        PaletteMatte    TrueColor
5367 %        TrueColorMatte ColorSeparation ColorSeparationMatte
5368 %
5369 %  To ensure the image type matches its potential, use MagickSetImageType():
5370 %
5371 %    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5372 %
5373 %  The format of the MagickGetImageType method is:
5374 %
5375 %      ImageType MagickGetImageType(MagickWand *wand)
5376 %
5377 %  A description of each parameter follows:
5378 %
5379 %    o wand: the magick wand.
5380 %
5381 */
5382 WandExport ImageType MagickGetImageType(MagickWand *wand)
5383 {
5384   assert(wand != (MagickWand *) NULL);
5385   assert(wand->signature == WandSignature);
5386   if (wand->debug != MagickFalse)
5387     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5388   if (wand->images == (Image *) NULL)
5389     {
5390       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5391         "ContainsNoImages","`%s'",wand->name);
5392       return(UndefinedType);
5393     }
5394   return(GetImageType(wand->images,wand->exception));
5395 }
5396 \f
5397 /*
5398 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5399 %                                                                             %
5400 %                                                                             %
5401 %                                                                             %
5402 %   M a g i c k G e t I m a g e U n i t s                                     %
5403 %                                                                             %
5404 %                                                                             %
5405 %                                                                             %
5406 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5407 %
5408 %  MagickGetImageUnits() gets the image units of resolution.
5409 %
5410 %  The format of the MagickGetImageUnits method is:
5411 %
5412 %      ResolutionType MagickGetImageUnits(MagickWand *wand)
5413 %
5414 %  A description of each parameter follows:
5415 %
5416 %    o wand: the magick wand.
5417 %
5418 */
5419 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5420 {
5421   assert(wand != (MagickWand *) NULL);
5422   assert(wand->signature == WandSignature);
5423   if (wand->debug != MagickFalse)
5424     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5425   if (wand->images == (Image *) NULL)
5426     {
5427       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5428         "ContainsNoImages","`%s'",wand->name);
5429       return(UndefinedResolution);
5430     }
5431   return(wand->images->units);
5432 }
5433 \f
5434 /*
5435 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5436 %                                                                             %
5437 %                                                                             %
5438 %                                                                             %
5439 %   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           %
5440 %                                                                             %
5441 %                                                                             %
5442 %                                                                             %
5443 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5444 %
5445 %  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5446 %  sepcified image.
5447 %
5448 %  The format of the MagickGetImageVirtualPixelMethod method is:
5449 %
5450 %      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5451 %
5452 %  A description of each parameter follows:
5453 %
5454 %    o wand: the magick wand.
5455 %
5456 */
5457 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5458 {
5459   assert(wand != (MagickWand *) NULL);
5460   assert(wand->signature == WandSignature);
5461   if (wand->debug != MagickFalse)
5462     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5463   if (wand->images == (Image *) NULL)
5464     {
5465       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5466         "ContainsNoImages","`%s'",wand->name);
5467       return(UndefinedVirtualPixelMethod);
5468     }
5469   return(GetImageVirtualPixelMethod(wand->images));
5470 }
5471 \f
5472 /*
5473 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5474 %                                                                             %
5475 %                                                                             %
5476 %                                                                             %
5477 %   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5478 %                                                                             %
5479 %                                                                             %
5480 %                                                                             %
5481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5482 %
5483 %  MagickGetImageWhitePoint() returns the chromaticy white point.
5484 %
5485 %  The format of the MagickGetImageWhitePoint method is:
5486 %
5487 %      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5488 %        double *y)
5489 %
5490 %  A description of each parameter follows:
5491 %
5492 %    o wand: the magick wand.
5493 %
5494 %    o x: the chromaticity white x-point.
5495 %
5496 %    o y: the chromaticity white y-point.
5497 %
5498 */
5499 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5500   double *x,double *y)
5501 {
5502   assert(wand != (MagickWand *) NULL);
5503   assert(wand->signature == WandSignature);
5504   if (wand->debug != MagickFalse)
5505     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5506   if (wand->images == (Image *) NULL)
5507     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5508   *x=wand->images->chromaticity.white_point.x;
5509   *y=wand->images->chromaticity.white_point.y;
5510   return(MagickTrue);
5511 }
5512 \f
5513 /*
5514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5515 %                                                                             %
5516 %                                                                             %
5517 %                                                                             %
5518 %   M a g i c k G e t I m a g e W i d t h                                     %
5519 %                                                                             %
5520 %                                                                             %
5521 %                                                                             %
5522 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5523 %
5524 %  MagickGetImageWidth() returns the image width.
5525 %
5526 %  The format of the MagickGetImageWidth method is:
5527 %
5528 %      size_t MagickGetImageWidth(MagickWand *wand)
5529 %
5530 %  A description of each parameter follows:
5531 %
5532 %    o wand: the magick wand.
5533 %
5534 */
5535 WandExport size_t MagickGetImageWidth(MagickWand *wand)
5536 {
5537   assert(wand != (MagickWand *) NULL);
5538   assert(wand->signature == WandSignature);
5539   if (wand->debug != MagickFalse)
5540     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5541   if (wand->images == (Image *) NULL)
5542     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5543   return(wand->images->columns);
5544 }
5545 \f
5546 /*
5547 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5548 %                                                                             %
5549 %                                                                             %
5550 %                                                                             %
5551 %   M a g i c k G e t N u m b e r I m a g e s                                 %
5552 %                                                                             %
5553 %                                                                             %
5554 %                                                                             %
5555 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5556 %
5557 %  MagickGetNumberImages() returns the number of images associated with a
5558 %  magick wand.
5559 %
5560 %  The format of the MagickGetNumberImages method is:
5561 %
5562 %      size_t MagickGetNumberImages(MagickWand *wand)
5563 %
5564 %  A description of each parameter follows:
5565 %
5566 %    o wand: the magick wand.
5567 %
5568 */
5569 WandExport size_t MagickGetNumberImages(MagickWand *wand)
5570 {
5571   assert(wand != (MagickWand *) NULL);
5572   assert(wand->signature == WandSignature);
5573   if (wand->debug != MagickFalse)
5574     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5575   return(GetImageListLength(wand->images));
5576 }
5577 \f
5578 /*
5579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5580 %                                                                             %
5581 %                                                                             %
5582 %                                                                             %
5583 %   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                 %
5584 %                                                                             %
5585 %                                                                             %
5586 %                                                                             %
5587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5588 %
5589 %  MagickGetImageTotalInkDensity() gets the image total ink density.
5590 %
5591 %  The format of the MagickGetImageTotalInkDensity method is:
5592 %
5593 %      double MagickGetImageTotalInkDensity(MagickWand *wand)
5594 %
5595 %  A description of each parameter follows:
5596 %
5597 %    o wand: the magick wand.
5598 %
5599 */
5600 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5601 {
5602   assert(wand != (MagickWand *) NULL);
5603   assert(wand->signature == WandSignature);
5604   if (wand->debug != MagickFalse)
5605     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5606   if (wand->images == (Image *) NULL)
5607     {
5608       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5609         "ContainsNoImages","`%s'",wand->name);
5610       return(0.0);
5611     }
5612   return(GetImageTotalInkDensity(wand->images,wand->exception));
5613 }
5614 \f
5615 /*
5616 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5617 %                                                                             %
5618 %                                                                             %
5619 %                                                                             %
5620 %   M a g i c k H a l d C l u t I m a g e                                     %
5621 %                                                                             %
5622 %                                                                             %
5623 %                                                                             %
5624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5625 %
5626 %  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5627 %  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5628 %  dimensions.  Create it with the HALD coder.  You can apply any color
5629 %  transformation to the Hald image and then use this method to apply the
5630 %  transform to the image.
5631 %
5632 %  The format of the MagickHaldClutImage method is:
5633 %
5634 %      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5635 %        const MagickWand *hald_wand)
5636 %
5637 %  A description of each parameter follows:
5638 %
5639 %    o wand: the magick wand.
5640 %
5641 %    o hald_image: the hald CLUT image.
5642 %
5643 */
5644 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5645   const MagickWand *hald_wand)
5646 {
5647   MagickBooleanType
5648     status;
5649
5650   assert(wand != (MagickWand *) NULL);
5651   assert(wand->signature == WandSignature);
5652   if (wand->debug != MagickFalse)
5653     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5654   if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5655     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5656   status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
5657   return(status);
5658 }
5659 \f
5660 /*
5661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5662 %                                                                             %
5663 %                                                                             %
5664 %                                                                             %
5665 %   M a g i c k H a s N e x t I m a g e                                       %
5666 %                                                                             %
5667 %                                                                             %
5668 %                                                                             %
5669 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5670 %
5671 %  MagickHasNextImage() returns MagickTrue if the wand has more images when
5672 %  traversing the list in the forward direction
5673 %
5674 %  The format of the MagickHasNextImage method is:
5675 %
5676 %      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5677 %
5678 %  A description of each parameter follows:
5679 %
5680 %    o wand: the magick wand.
5681 %
5682 */
5683 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5684 {
5685   assert(wand != (MagickWand *) NULL);
5686   assert(wand->signature == WandSignature);
5687   if (wand->debug != MagickFalse)
5688     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5689   if (wand->images == (Image *) NULL)
5690     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5691   if (GetNextImageInList(wand->images) == (Image *) NULL)
5692     return(MagickFalse);
5693   return(MagickTrue);
5694 }
5695 \f
5696 /*
5697 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5698 %                                                                             %
5699 %                                                                             %
5700 %                                                                             %
5701 %   M a g i c k H a s P r e v i o u s I m a g e                               %
5702 %                                                                             %
5703 %                                                                             %
5704 %                                                                             %
5705 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5706 %
5707 %  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5708 %  traversing the list in the reverse direction
5709 %
5710 %  The format of the MagickHasPreviousImage method is:
5711 %
5712 %      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5713 %
5714 %  A description of each parameter follows:
5715 %
5716 %    o wand: the magick wand.
5717 %
5718 */
5719 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5720 {
5721   assert(wand != (MagickWand *) NULL);
5722   assert(wand->signature == WandSignature);
5723   if (wand->debug != MagickFalse)
5724     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5725   if (wand->images == (Image *) NULL)
5726     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5727   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5728     return(MagickFalse);
5729   return(MagickTrue);
5730 }
5731 \f
5732 /*
5733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5734 %                                                                             %
5735 %                                                                             %
5736 %                                                                             %
5737 %   M a g i c k I d e n t i f y I m a g e                                     %
5738 %                                                                             %
5739 %                                                                             %
5740 %                                                                             %
5741 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5742 %
5743 %  MagickIdentifyImage() identifies an image by printing its attributes to the
5744 %  file.  Attributes include the image width, height, size, and others.
5745 %
5746 %  The format of the MagickIdentifyImage method is:
5747 %
5748 %      const char *MagickIdentifyImage(MagickWand *wand)
5749 %
5750 %  A description of each parameter follows:
5751 %
5752 %    o wand: the magick wand.
5753 %
5754 */
5755 WandExport char *MagickIdentifyImage(MagickWand *wand)
5756 {
5757   char
5758     *description,
5759     filename[MaxTextExtent];
5760
5761   FILE
5762     *file;
5763
5764   int
5765     unique_file;
5766
5767   assert(wand != (MagickWand *) NULL);
5768   assert(wand->signature == WandSignature);
5769   if (wand->debug != MagickFalse)
5770     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5771   if (wand->images == (Image *) NULL)
5772     {
5773       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5774         "ContainsNoImages","`%s'",wand->name);
5775       return((char *) NULL);
5776     }
5777   description=(char *) NULL;
5778   unique_file=AcquireUniqueFileResource(filename);
5779   file=(FILE *) NULL;
5780   if (unique_file != -1)
5781     file=fdopen(unique_file,"wb");
5782   if ((unique_file == -1) || (file == (FILE *) NULL))
5783     {
5784       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5785         "UnableToCreateTemporaryFile","`%s'",wand->name);
5786       return((char *) NULL);
5787     }
5788   (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
5789   (void) fclose(file);
5790   description=FileToString(filename,~0,wand->exception);
5791   (void) RelinquishUniqueFileResource(filename);
5792   return(description);
5793 }
5794 \f
5795 /*
5796 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5797 %                                                                             %
5798 %                                                                             %
5799 %                                                                             %
5800 %   M a g i c k I m p l o d e I m a g e                                       %
5801 %                                                                             %
5802 %                                                                             %
5803 %                                                                             %
5804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5805 %
5806 %  MagickImplodeImage() creates a new image that is a copy of an existing
5807 %  one with the image pixels "implode" by the specified percentage.  It
5808 %  allocates the memory necessary for the new Image structure and returns a
5809 %  pointer to the new image.
5810 %
5811 %  The format of the MagickImplodeImage method is:
5812 %
5813 %      MagickBooleanType MagickImplodeImage(MagickWand *wand,
5814 %        const double radius,const PixelInterpolateMethod method)
5815 %
5816 %  A description of each parameter follows:
5817 %
5818 %    o wand: the magick wand.
5819 %
5820 %    o amount: Define the extent of the implosion.
5821 %
5822 %    o method: the pixel interpolation method.
5823 %
5824 */
5825 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
5826   const double amount,const PixelInterpolateMethod method)
5827 {
5828   Image
5829     *implode_image;
5830
5831   assert(wand != (MagickWand *) NULL);
5832   assert(wand->signature == WandSignature);
5833   if (wand->debug != MagickFalse)
5834     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5835   if (wand->images == (Image *) NULL)
5836     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5837   implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
5838   if (implode_image == (Image *) NULL)
5839     return(MagickFalse);
5840   ReplaceImageInList(&wand->images,implode_image);
5841   return(MagickTrue);
5842 }
5843 \f
5844 /*
5845 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5846 %                                                                             %
5847 %                                                                             %
5848 %                                                                             %
5849 %   M a g i c k I m p o r t I m a g e P i x e l s                             %
5850 %                                                                             %
5851 %                                                                             %
5852 %                                                                             %
5853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5854 %
5855 %  MagickImportImagePixels() accepts pixel datand stores it in the image at the
5856 %  location you specify.  The method returns MagickFalse on success otherwise
5857 %  MagickTrue if an error is encountered.  The pixel data can be either char,
5858 %  short int, int, ssize_t, float, or double in the order specified by map.
5859 %
5860 %  Suppose your want to upload the first scanline of a 640x480 image from
5861 %  character data in red-green-blue order:
5862 %
5863 %      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
5864 %
5865 %  The format of the MagickImportImagePixels method is:
5866 %
5867 %      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5868 %        const ssize_t x,const ssize_t y,const size_t columns,
5869 %        const size_t rows,const char *map,const StorageType storage,
5870 %        const void *pixels)
5871 %
5872 %  A description of each parameter follows:
5873 %
5874 %    o wand: the magick wand.
5875 %
5876 %    o x, y, columns, rows:  These values define the perimeter of a region
5877 %      of pixels you want to define.
5878 %
5879 %    o map:  This string reflects the expected ordering of the pixel array.
5880 %      It can be any combination or order of R = red, G = green, B = blue,
5881 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
5882 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
5883 %      P = pad.
5884 %
5885 %    o storage: Define the data type of the pixels.  Float and double types are
5886 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
5887 %      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
5888 %      or DoublePixel.
5889 %
5890 %    o pixels: This array of values contain the pixel components as defined by
5891 %      map and type.  You must preallocate this array where the expected
5892 %      length varies depending on the values of width, height, map, and type.
5893 %
5894 */
5895 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5896   const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
5897   const char *map,const StorageType storage,const void *pixels)
5898 {
5899   MagickBooleanType
5900     status;
5901
5902   assert(wand != (MagickWand *) NULL);
5903   assert(wand->signature == WandSignature);
5904   if (wand->debug != MagickFalse)
5905     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5906   if (wand->images == (Image *) NULL)
5907     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5908   status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
5909     wand->exception);
5910   return(status);
5911 }
5912 \f
5913 /*
5914 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5915 %                                                                             %
5916 %                                                                             %
5917 %                                                                             %
5918 %   M a g i c k I n t e r p o l a t i v e R e s i z e I m a g e               %
5919 %                                                                             %
5920 %                                                                             %
5921 %                                                                             %
5922 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5923 %
5924 %  MagickInterpolativeResizeImage() resize image using a interpolative
5925 %  method.
5926 %
5927 %      MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
5928 %        const size_t columns,const size_t rows,
5929 %        const PixelInterpolateMethod method)
5930 %
5931 %  A description of each parameter follows:
5932 %
5933 %    o wand: the magick wand.
5934 %
5935 %    o columns: the number of columns in the scaled image.
5936 %
5937 %    o rows: the number of rows in the scaled image.
5938 %
5939 %    o interpolate: the pixel interpolation method.
5940 %
5941 */
5942 WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
5943   const size_t columns,const size_t rows,const PixelInterpolateMethod method)
5944 {
5945   Image
5946     *resize_image;
5947
5948   assert(wand != (MagickWand *) NULL);
5949   assert(wand->signature == WandSignature);
5950   if (wand->debug != MagickFalse)
5951     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5952   if (wand->images == (Image *) NULL)
5953     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5954   resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
5955     wand->exception);
5956   if (resize_image == (Image *) NULL)
5957     return(MagickFalse);
5958   ReplaceImageInList(&wand->images,resize_image);
5959   return(MagickTrue);
5960 }
5961 \f
5962 /*
5963 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5964 %                                                                             %
5965 %                                                                             %
5966 %                                                                             %
5967 %   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       %
5968 %                                                                             %
5969 %                                                                             %
5970 %                                                                             %
5971 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5972 %
5973 %  MagickInverseFourierTransformImage() implements the inverse discrete
5974 %  Fourier transform (DFT) of the image either as a magnitude / phase or real /
5975 %  imaginary image pair.
5976 %
5977 %  The format of the MagickInverseFourierTransformImage method is:
5978 %
5979 %      MagickBooleanType MagickInverseFourierTransformImage(
5980 %        MagickWand *magnitude_wand,MagickWand *phase_wand,
5981 %        const MagickBooleanType magnitude)
5982 %
5983 %  A description of each parameter follows:
5984 %
5985 %    o magnitude_wand: the magnitude or real wand.
5986 %
5987 %    o phase_wand: the phase or imaginary wand.
5988 %
5989 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
5990 %      imaginary image pair.
5991 %
5992 */
5993 WandExport MagickBooleanType MagickInverseFourierTransformImage(
5994   MagickWand *magnitude_wand,MagickWand *phase_wand,
5995   const MagickBooleanType magnitude)
5996 {
5997   Image
5998     *inverse_image;
5999
6000   MagickWand
6001     *wand;
6002
6003   assert(magnitude_wand != (MagickWand *) NULL);
6004   assert(magnitude_wand->signature == WandSignature);
6005   if (magnitude_wand->debug != MagickFalse)
6006     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6007       magnitude_wand->name);
6008   wand=magnitude_wand;
6009   if (magnitude_wand->images == (Image *) NULL)
6010     ThrowWandException(WandError,"ContainsNoImages",
6011       magnitude_wand->name);
6012   assert(phase_wand != (MagickWand *) NULL);
6013   assert(phase_wand->signature == WandSignature);
6014   inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6015     phase_wand->images,magnitude,wand->exception);
6016   if (inverse_image == (Image *) NULL)
6017     return(MagickFalse);
6018   ReplaceImageInList(&wand->images,inverse_image);
6019   return(MagickTrue);
6020 }
6021 \f
6022 /*
6023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6024 %                                                                             %
6025 %                                                                             %
6026 %                                                                             %
6027 %   M a g i c k L a b e l I m a g e                                           %
6028 %                                                                             %
6029 %                                                                             %
6030 %                                                                             %
6031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6032 %
6033 %  MagickLabelImage() adds a label to your image.
6034 %
6035 %  The format of the MagickLabelImage method is:
6036 %
6037 %      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6038 %
6039 %  A description of each parameter follows:
6040 %
6041 %    o wand: the magick wand.
6042 %
6043 %    o label: the image label.
6044 %
6045 */
6046 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6047   const char *label)
6048 {
6049   MagickBooleanType
6050     status;
6051
6052   assert(wand != (MagickWand *) NULL);
6053   assert(wand->signature == WandSignature);
6054   if (wand->debug != MagickFalse)
6055     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6056   if (wand->images == (Image *) NULL)
6057     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6058   status=SetImageProperty(wand->images,"label",label,wand->exception);
6059   return(status);
6060 }
6061 \f
6062 /*
6063 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6064 %                                                                             %
6065 %                                                                             %
6066 %                                                                             %
6067 %   M a g i c k L e v e l I m a g e                                           %
6068 %                                                                             %
6069 %                                                                             %
6070 %                                                                             %
6071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6072 %
6073 %  MagickLevelImage() adjusts the levels of an image by scaling the colors
6074 %  falling between specified white and black points to the full available
6075 %  quantum range. The parameters provided represent the black, mid, and white
6076 %  points. The black point specifies the darkest color in the image. Colors
6077 %  darker than the black point are set to zero. Mid point specifies a gamma
6078 %  correction to apply to the image.  White point specifies the lightest color
6079 %  in the image. Colors brighter than the white point are set to the maximum
6080 %  quantum value.
6081 %
6082 %  The format of the MagickLevelImage method is:
6083 %
6084 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6085 %        const double black_point,const double gamma,const double white_point)
6086 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6087 %        const ChannelType channel,const double black_point,const double gamma,
6088 %        const double white_point)
6089 %
6090 %  A description of each parameter follows:
6091 %
6092 %    o wand: the magick wand.
6093 %
6094 %    o channel: Identify which channel to level: RedPixelChannel,
6095 %      GreenPixelChannel, etc.
6096 %
6097 %    o black_point: the black point.
6098 %
6099 %    o gamma: the gamma.
6100 %
6101 %    o white_point: the white point.
6102 %
6103 */
6104 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6105   const double black_point,const double gamma,const double white_point)
6106 {
6107   MagickBooleanType
6108     status;
6109
6110   assert(wand != (MagickWand *) NULL);
6111   assert(wand->signature == WandSignature);
6112   if (wand->debug != MagickFalse)
6113     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6114   if (wand->images == (Image *) NULL)
6115     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6116   status=LevelImage(wand->images,black_point,white_point,gamma,
6117     wand->exception);
6118   return(status);
6119 }
6120 \f
6121 /*
6122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6123 %                                                                             %
6124 %                                                                             %
6125 %                                                                             %
6126 %   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6127 %                                                                             %
6128 %                                                                             %
6129 %                                                                             %
6130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6131 %
6132 %  MagickLinearStretchImage() stretches with saturation the image intensity.
6133 %
6134 %  You can also reduce the influence of a particular channel with a gamma
6135 %  value of 0.
6136 %
6137 %  The format of the MagickLinearStretchImage method is:
6138 %
6139 %      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6140 %        const double black_point,const double white_point)
6141 %
6142 %  A description of each parameter follows:
6143 %
6144 %    o wand: the magick wand.
6145 %
6146 %    o black_point: the black point.
6147 %
6148 %    o white_point: the white point.
6149 %
6150 */
6151 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6152   const double black_point,const double white_point)
6153 {
6154   MagickBooleanType
6155     status;
6156
6157   assert(wand != (MagickWand *) NULL);
6158   assert(wand->signature == WandSignature);
6159   if (wand->debug != MagickFalse)
6160     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6161   if (wand->images == (Image *) NULL)
6162     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6163   status=LinearStretchImage(wand->images,black_point,white_point,
6164     wand->exception);
6165   return(status);
6166 }
6167 \f
6168 /*
6169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6170 %                                                                             %
6171 %                                                                             %
6172 %                                                                             %
6173 %   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6174 %                                                                             %
6175 %                                                                             %
6176 %                                                                             %
6177 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6178 %
6179 %  MagickLiquidRescaleImage() rescales image with seam carving.
6180 %
6181 %      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6182 %        const size_t columns,const size_t rows,
6183 %        const double delta_x,const double rigidity)
6184 %
6185 %  A description of each parameter follows:
6186 %
6187 %    o wand: the magick wand.
6188 %
6189 %    o columns: the number of columns in the scaled image.
6190 %
6191 %    o rows: the number of rows in the scaled image.
6192 %
6193 %    o delta_x: maximum seam transversal step (0 means straight seams).
6194 %
6195 %    o rigidity: introduce a bias for non-straight seams (typically 0).
6196 %
6197 */
6198 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6199   const size_t columns,const size_t rows,const double delta_x,
6200   const double rigidity)
6201 {
6202   Image
6203     *rescale_image;
6204
6205   assert(wand != (MagickWand *) NULL);
6206   assert(wand->signature == WandSignature);
6207   if (wand->debug != MagickFalse)
6208     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6209   if (wand->images == (Image *) NULL)
6210     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6211   rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6212     rigidity,wand->exception);
6213   if (rescale_image == (Image *) NULL)
6214     return(MagickFalse);
6215   ReplaceImageInList(&wand->images,rescale_image);
6216   return(MagickTrue);
6217 }
6218 \f
6219 /*
6220 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6221 %                                                                             %
6222 %                                                                             %
6223 %                                                                             %
6224 %   M a g i c k M a g n i f y I m a g e                                       %
6225 %                                                                             %
6226 %                                                                             %
6227 %                                                                             %
6228 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6229 %
6230 %  MagickMagnifyImage() is a convenience method that scales an image
6231 %  proportionally to twice its original size.
6232 %
6233 %  The format of the MagickMagnifyImage method is:
6234 %
6235 %      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6236 %
6237 %  A description of each parameter follows:
6238 %
6239 %    o wand: the magick wand.
6240 %
6241 */
6242 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6243 {
6244   Image
6245     *magnify_image;
6246
6247   assert(wand != (MagickWand *) NULL);
6248   assert(wand->signature == WandSignature);
6249   if (wand->debug != MagickFalse)
6250     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6251   if (wand->images == (Image *) NULL)
6252     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6253   magnify_image=MagnifyImage(wand->images,wand->exception);
6254   if (magnify_image == (Image *) NULL)
6255     return(MagickFalse);
6256   ReplaceImageInList(&wand->images,magnify_image);
6257   return(MagickTrue);
6258 }
6259 \f
6260 /*
6261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6262 %                                                                             %
6263 %                                                                             %
6264 %                                                                             %
6265 %   M a g i c k M e r g e I m a g e L a y e r s                               %
6266 %                                                                             %
6267 %                                                                             %
6268 %                                                                             %
6269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6270 %
6271 %  MagickMergeImageLayers() composes all the image layers from the current
6272 %  given image onward to produce a single image of the merged layers.
6273 %
6274 %  The inital canvas's size depends on the given ImageLayerMethod, and is
6275 %  initialized using the first images background color.  The images
6276 %  are then compositied onto that image in sequence using the given
6277 %  composition that has been assigned to each individual image.
6278 %
6279 %  The format of the MagickMergeImageLayers method is:
6280 %
6281 %      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6282 %        const ImageLayerMethod method)
6283 %
6284 %  A description of each parameter follows:
6285 %
6286 %    o wand: the magick wand.
6287 %
6288 %    o method: the method of selecting the size of the initial canvas.
6289 %
6290 %        MergeLayer: Merge all layers onto a canvas just large enough
6291 %           to hold all the actual images. The virtual canvas of the
6292 %           first image is preserved but otherwise ignored.
6293 %
6294 %        FlattenLayer: Use the virtual canvas size of first image.
6295 %           Images which fall outside this canvas is clipped.
6296 %           This can be used to 'fill out' a given virtual canvas.
6297 %
6298 %        MosaicLayer: Start with the virtual canvas of the first image,
6299 %           enlarging left and right edges to contain all images.
6300 %           Images with negative offsets will be clipped.
6301 %
6302 */
6303 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6304   const ImageLayerMethod method)
6305 {
6306   Image
6307     *mosaic_image;
6308
6309   assert(wand != (MagickWand *) NULL);
6310   assert(wand->signature == WandSignature);
6311   if (wand->debug != MagickFalse)
6312     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6313   if (wand->images == (Image *) NULL)
6314     return((MagickWand *) NULL);
6315   mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6316   if (mosaic_image == (Image *) NULL)
6317     return((MagickWand *) NULL);
6318   return(CloneMagickWandFromImages(wand,mosaic_image));
6319 }
6320 \f
6321 /*
6322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6323 %                                                                             %
6324 %                                                                             %
6325 %                                                                             %
6326 %   M a g i c k M i n i f y I m a g e                                         %
6327 %                                                                             %
6328 %                                                                             %
6329 %                                                                             %
6330 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6331 %
6332 %  MagickMinifyImage() is a convenience method that scales an image
6333 %  proportionally to one-half its original size
6334 %
6335 %  The format of the MagickMinifyImage method is:
6336 %
6337 %      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6338 %
6339 %  A description of each parameter follows:
6340 %
6341 %    o wand: the magick wand.
6342 %
6343 */
6344 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6345 {
6346   Image
6347     *minify_image;
6348
6349   assert(wand != (MagickWand *) NULL);
6350   assert(wand->signature == WandSignature);
6351   if (wand->debug != MagickFalse)
6352     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6353   if (wand->images == (Image *) NULL)
6354     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6355   minify_image=MinifyImage(wand->images,wand->exception);
6356   if (minify_image == (Image *) NULL)
6357     return(MagickFalse);
6358   ReplaceImageInList(&wand->images,minify_image);
6359   return(MagickTrue);
6360 }
6361 \f
6362 /*
6363 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6364 %                                                                             %
6365 %                                                                             %
6366 %                                                                             %
6367 %   M a g i c k M o d u l a t e I m a g e                                     %
6368 %                                                                             %
6369 %                                                                             %
6370 %                                                                             %
6371 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6372 %
6373 %  MagickModulateImage() lets you control the brightness, saturation, and hue
6374 %  of an image.  Hue is the percentage of absolute rotation from the current
6375 %  position.  For example 50 results in a counter-clockwise rotation of 90
6376 %  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6377 %  both resulting in a rotation of 180 degrees.
6378 %
6379 %  To increase the color brightness by 20% and decrease the color saturation by
6380 %  10% and leave the hue unchanged, use: 120,90,100.
6381 %
6382 %  The format of the MagickModulateImage method is:
6383 %
6384 %      MagickBooleanType MagickModulateImage(MagickWand *wand,
6385 %        const double brightness,const double saturation,const double hue)
6386 %
6387 %  A description of each parameter follows:
6388 %
6389 %    o wand: the magick wand.
6390 %
6391 %    o brightness: the percent change in brighness.
6392 %
6393 %    o saturation: the percent change in saturation.
6394 %
6395 %    o hue: the percent change in hue.
6396 %
6397 */
6398 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6399   const double brightness,const double saturation,const double hue)
6400 {
6401   char
6402     modulate[MaxTextExtent];
6403
6404   MagickBooleanType
6405     status;
6406
6407   assert(wand != (MagickWand *) NULL);
6408   assert(wand->signature == WandSignature);
6409   if (wand->debug != MagickFalse)
6410     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6411   if (wand->images == (Image *) NULL)
6412     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6413   (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6414     brightness,saturation,hue);
6415   status=ModulateImage(wand->images,modulate,wand->exception);
6416   return(status);
6417 }
6418 \f
6419 /*
6420 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6421 %                                                                             %
6422 %                                                                             %
6423 %                                                                             %
6424 %   M a g i c k M o n t a g e I m a g e                                       %
6425 %                                                                             %
6426 %                                                                             %
6427 %                                                                             %
6428 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6429 %
6430 %  MagickMontageImage() creates a composite image by combining several
6431 %  separate images. The images are tiled on the composite image with the name
6432 %  of the image optionally appearing just below the individual tile.
6433 %
6434 %  The format of the MagickMontageImage method is:
6435 %
6436 %      MagickWand *MagickMontageImage(MagickWand *wand,
6437 %        const DrawingWand drawing_wand,const char *tile_geometry,
6438 %        const char *thumbnail_geometry,const MontageMode mode,
6439 %        const char *frame)
6440 %
6441 %  A description of each parameter follows:
6442 %
6443 %    o wand: the magick wand.
6444 %
6445 %    o drawing_wand: the drawing wand.  The font name, size, and color are
6446 %      obtained from this wand.
6447 %
6448 %    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6449 %
6450 %    o thumbnail_geometry: Preferred image size and border size of each
6451 %      thumbnail (e.g. 120x120+4+3>).
6452 %
6453 %    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6454 %
6455 %    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6456 %      The frame color is that of the thumbnail's matte color.
6457 %
6458 */
6459 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6460   const DrawingWand *drawing_wand,const char *tile_geometry,
6461   const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6462 {
6463   char
6464     *font;
6465
6466   Image
6467     *montage_image;
6468
6469   MontageInfo
6470     *montage_info;
6471
6472   PixelWand
6473     *pixel_wand;
6474
6475   assert(wand != (MagickWand *) NULL);
6476   assert(wand->signature == WandSignature);
6477   if (wand->debug != MagickFalse)
6478     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6479   if (wand->images == (Image *) NULL)
6480     return((MagickWand *) NULL);
6481   montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6482   switch (mode)
6483   {
6484     case FrameMode:
6485     {
6486       (void) CloneString(&montage_info->frame,"15x15+3+3");
6487       montage_info->shadow=MagickTrue;
6488       break;
6489     }
6490     case UnframeMode:
6491     {
6492       montage_info->frame=(char *) NULL;
6493       montage_info->shadow=MagickFalse;
6494       montage_info->border_width=0;
6495       break;
6496     }
6497     case ConcatenateMode:
6498     {
6499       montage_info->frame=(char *) NULL;
6500       montage_info->shadow=MagickFalse;
6501       (void) CloneString(&montage_info->geometry,"+0+0");
6502       montage_info->border_width=0;
6503       break;
6504     }
6505     default:
6506       break;
6507   }
6508   font=DrawGetFont(drawing_wand);
6509   if (font != (char *) NULL)
6510     (void) CloneString(&montage_info->font,font);
6511   if (frame != (char *) NULL)
6512     (void) CloneString(&montage_info->frame,frame);
6513   montage_info->pointsize=DrawGetFontSize(drawing_wand);
6514   pixel_wand=NewPixelWand();
6515   DrawGetFillColor(drawing_wand,pixel_wand);
6516   PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6517   DrawGetStrokeColor(drawing_wand,pixel_wand);
6518   PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6519   pixel_wand=DestroyPixelWand(pixel_wand);
6520   if (thumbnail_geometry != (char *) NULL)
6521     (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6522   if (tile_geometry != (char *) NULL)
6523     (void) CloneString(&montage_info->tile,tile_geometry);
6524   montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6525     wand->exception);
6526   montage_info=DestroyMontageInfo(montage_info);
6527   if (montage_image == (Image *) NULL)
6528     return((MagickWand *) NULL);
6529   return(CloneMagickWandFromImages(wand,montage_image));
6530 }
6531 \f
6532 /*
6533 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6534 %                                                                             %
6535 %                                                                             %
6536 %                                                                             %
6537 %   M a g i c k M o r p h I m a g e s                                         %
6538 %                                                                             %
6539 %                                                                             %
6540 %                                                                             %
6541 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6542 %
6543 %  MagickMorphImages() method morphs a set of images.  Both the image pixels
6544 %  and size are linearly interpolated to give the appearance of a
6545 %  meta-morphosis from one image to the next.
6546 %
6547 %  The format of the MagickMorphImages method is:
6548 %
6549 %      MagickWand *MagickMorphImages(MagickWand *wand,
6550 %        const size_t number_frames)
6551 %
6552 %  A description of each parameter follows:
6553 %
6554 %    o wand: the magick wand.
6555 %
6556 %    o number_frames: the number of in-between images to generate.
6557 %
6558 */
6559 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6560   const size_t number_frames)
6561 {
6562   Image
6563     *morph_image;
6564
6565   assert(wand != (MagickWand *) NULL);
6566   assert(wand->signature == WandSignature);
6567   if (wand->debug != MagickFalse)
6568     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6569   if (wand->images == (Image *) NULL)
6570     return((MagickWand *) NULL);
6571   morph_image=MorphImages(wand->images,number_frames,wand->exception);
6572   if (morph_image == (Image *) NULL)
6573     return((MagickWand *) NULL);
6574   return(CloneMagickWandFromImages(wand,morph_image));
6575 }
6576 \f
6577 /*
6578 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6579 %                                                                             %
6580 %                                                                             %
6581 %                                                                             %
6582 %   M a g i c k M o r p h o l o g y I m a g e                                 %
6583 %                                                                             %
6584 %                                                                             %
6585 %                                                                             %
6586 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6587 %
6588 %  MagickMorphologyImage() applies a user supplied kernel to the image
6589 %  according to the given mophology method.
6590 %
6591 %  The format of the MagickMorphologyImage method is:
6592 %
6593 %      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6594 %        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6595 %
6596 %  A description of each parameter follows:
6597 %
6598 %    o wand: the magick wand.
6599 %
6600 %    o method: the morphology method to be applied.
6601 %
6602 %    o iterations: apply the operation this many times (or no change).
6603 %      A value of -1 means loop until no change found.  How this is applied
6604 %      may depend on the morphology method.  Typically this is a value of 1.
6605 %
6606 %    o kernel: An array of doubles representing the morphology kernel.
6607 %
6608 */
6609 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6610   MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6611 {
6612   Image
6613     *morphology_image;
6614
6615   assert(wand != (MagickWand *) NULL);
6616   assert(wand->signature == WandSignature);
6617   if (wand->debug != MagickFalse)
6618     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6619   if (kernel == (const KernelInfo *) NULL)
6620     return(MagickFalse);
6621   if (wand->images == (Image *) NULL)
6622     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6623   morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6624     wand->exception);
6625   if (morphology_image == (Image *) NULL)
6626     return(MagickFalse);
6627   ReplaceImageInList(&wand->images,morphology_image);
6628   return(MagickTrue);
6629 }
6630 \f
6631 /*
6632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6633 %                                                                             %
6634 %                                                                             %
6635 %                                                                             %
6636 %   M a g i c k M o t i o n B l u r I m a g e                                 %
6637 %                                                                             %
6638 %                                                                             %
6639 %                                                                             %
6640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6641 %
6642 %  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6643 %  Gaussian operator of the given radius and standard deviation (sigma).
6644 %  For reasonable results, radius should be larger than sigma.  Use a
6645 %  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6646 %  Angle gives the angle of the blurring motion.
6647 %
6648 %  The format of the MagickMotionBlurImage method is:
6649 %
6650 %      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6651 %        const double radius,const double sigma,const double angle,
6652 %        const double bias)
6653 %
6654 %  A description of each parameter follows:
6655 %
6656 %    o wand: the magick wand.
6657 %
6658 %    o radius: the radius of the Gaussian, in pixels, not counting
6659 %      the center pixel.
6660 %
6661 %    o sigma: the standard deviation of the Gaussian, in pixels.
6662 %
6663 %    o angle: Apply the effect along this angle.
6664 %
6665 */
6666 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6667   const double radius,const double sigma,const double angle,const double bias)
6668 {
6669   Image
6670     *blur_image;
6671
6672   assert(wand != (MagickWand *) NULL);
6673   assert(wand->signature == WandSignature);
6674   if (wand->debug != MagickFalse)
6675     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6676   if (wand->images == (Image *) NULL)
6677     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6678   blur_image=MotionBlurImage(wand->images,radius,sigma,angle,bias,
6679     wand->exception);
6680   if (blur_image == (Image *) NULL)
6681     return(MagickFalse);
6682   ReplaceImageInList(&wand->images,blur_image);
6683   return(MagickTrue);
6684 }
6685 \f
6686 /*
6687 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6688 %                                                                             %
6689 %                                                                             %
6690 %                                                                             %
6691 %   M a g i c k N e g a t e I m a g e                                         %
6692 %                                                                             %
6693 %                                                                             %
6694 %                                                                             %
6695 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6696 %
6697 %  MagickNegateImage() negates the colors in the reference image.  The
6698 %  Grayscale option means that only grayscale values within the image are
6699 %  negated.
6700 %
6701 %  You can also reduce the influence of a particular channel with a gamma
6702 %  value of 0.
6703 %
6704 %  The format of the MagickNegateImage method is:
6705 %
6706 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
6707 %        const MagickBooleanType gray)
6708 %
6709 %  A description of each parameter follows:
6710 %
6711 %    o wand: the magick wand.
6712 %
6713 %    o gray: If MagickTrue, only negate grayscale pixels within the image.
6714 %
6715 */
6716 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6717   const MagickBooleanType gray)
6718 {
6719   MagickBooleanType
6720     status;
6721
6722   assert(wand != (MagickWand *) NULL);
6723   assert(wand->signature == WandSignature);
6724   if (wand->debug != MagickFalse)
6725     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6726   if (wand->images == (Image *) NULL)
6727     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6728   status=NegateImage(wand->images,gray,wand->exception);
6729   return(status);
6730 }
6731 \f
6732 /*
6733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6734 %                                                                             %
6735 %                                                                             %
6736 %                                                                             %
6737 %   M a g i c k N e w I m a g e                                               %
6738 %                                                                             %
6739 %                                                                             %
6740 %                                                                             %
6741 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6742 %
6743 %  MagickNewImage() adds a blank image canvas of the specified size and
6744 %  background color to the wand.
6745 %
6746 %  The format of the MagickNewImage method is:
6747 %
6748 %      MagickBooleanType MagickNewImage(MagickWand *wand,
6749 %        const size_t columns,const size_t rows,
6750 %        const PixelWand *background)
6751 %
6752 %  A description of each parameter follows:
6753 %
6754 %    o wand: the magick wand.
6755 %
6756 %    o width: the image width.
6757 %
6758 %    o height: the image height.
6759 %
6760 %    o background: the image color.
6761 %
6762 */
6763 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
6764   const size_t height,const PixelWand *background)
6765 {
6766   Image
6767     *images;
6768
6769   PixelInfo
6770     pixel;
6771
6772   assert(wand != (MagickWand *) NULL);
6773   assert(wand->signature == WandSignature);
6774   if (wand->debug != MagickFalse)
6775     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6776   PixelGetMagickColor(background,&pixel);
6777   images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
6778   if (images == (Image *) NULL)
6779     return(MagickFalse);
6780   return(InsertImageInWand(wand,images));
6781 }
6782 \f
6783 /*
6784 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6785 %                                                                             %
6786 %                                                                             %
6787 %                                                                             %
6788 %   M a g i c k N e x t I m a g e                                             %
6789 %                                                                             %
6790 %                                                                             %
6791 %                                                                             %
6792 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6793 %
6794 %  MagickNextImage() associates the next image in the image list with a magick
6795 %  wand.  It returns true if the it succeeds, meaning the current image is the
6796 %  next image to be iterated over.
6797 %
6798 %  The format of the MagickNextImage method is:
6799 %
6800 %      MagickBooleanType MagickNextImage(MagickWand *wand)
6801 %
6802 %  A description of each parameter follows:
6803 %
6804 %    o wand: the magick wand.
6805 %
6806 */
6807 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
6808 {
6809   assert(wand != (MagickWand *) NULL);
6810   assert(wand->signature == WandSignature);
6811   if (wand->debug != MagickFalse)
6812     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6813   if (wand->images == (Image *) NULL)
6814     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6815   /* If current image is 'pending' just return true.  */
6816   if (wand->image_pending != MagickFalse)
6817     {
6818       wand->image_pending=MagickFalse;
6819       return(MagickTrue);
6820     }
6821   /* If there is no next image, (Iterator is finished) */
6822   if (GetNextImageInList(wand->images) == (Image *) NULL)
6823       return(MagickFalse);
6824   /* just move to next image - current image is not 'pending' */
6825   wand->images=GetNextImageInList(wand->images);
6826   return(MagickTrue);
6827 }
6828 \f
6829 /*
6830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6831 %                                                                             %
6832 %                                                                             %
6833 %                                                                             %
6834 %   M a g i c k N o r m a l i z e I m a g e                                   %
6835 %                                                                             %
6836 %                                                                             %
6837 %                                                                             %
6838 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6839 %
6840 %  MagickNormalizeImage() enhances the contrast of a color image by adjusting
6841 %  the pixels color to span the entire range of colors available
6842 %
6843 %  You can also reduce the influence of a particular channel with a gamma
6844 %  value of 0.
6845 %
6846 %  The format of the MagickNormalizeImage method is:
6847 %
6848 %      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6849 %
6850 %  A description of each parameter follows:
6851 %
6852 %    o wand: the magick wand.
6853 %
6854 */
6855 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6856 {
6857   MagickBooleanType
6858     status;
6859
6860   assert(wand != (MagickWand *) NULL);
6861   assert(wand->signature == WandSignature);
6862   if (wand->debug != MagickFalse)
6863     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6864   if (wand->images == (Image *) NULL)
6865     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6866   status=NormalizeImage(wand->images,wand->exception);
6867   return(status);
6868 }
6869 \f
6870 /*
6871 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6872 %                                                                             %
6873 %                                                                             %
6874 %                                                                             %
6875 %   M a g i c k O i l P a i n t I m a g e                                     %
6876 %                                                                             %
6877 %                                                                             %
6878 %                                                                             %
6879 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6880 %
6881 %  MagickOilPaintImage() applies a special effect filter that simulates an oil
6882 %  painting.  Each pixel is replaced by the most frequent color occurring
6883 %  in a circular region defined by radius.
6884 %
6885 %  The format of the MagickOilPaintImage method is:
6886 %
6887 %      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6888 %        const double radius,const double sigma)
6889 %
6890 %  A description of each parameter follows:
6891 %
6892 %    o wand: the magick wand.
6893 %
6894 %    o radius: the radius of the circular neighborhood.
6895 %
6896 %    o sigma: the standard deviation of the Gaussian, in pixels.
6897 %
6898 */
6899 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6900   const double radius,const double sigma)
6901 {
6902   Image
6903     *paint_image;
6904
6905   assert(wand != (MagickWand *) NULL);
6906   assert(wand->signature == WandSignature);
6907   if (wand->debug != MagickFalse)
6908     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6909   if (wand->images == (Image *) NULL)
6910     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6911   paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
6912   if (paint_image == (Image *) NULL)
6913     return(MagickFalse);
6914   ReplaceImageInList(&wand->images,paint_image);
6915   return(MagickTrue);
6916 }
6917 \f
6918 /*
6919 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6920 %                                                                             %
6921 %                                                                             %
6922 %                                                                             %
6923 %   M a g i c k O p a q u e P a i n t I m a g e                               %
6924 %                                                                             %
6925 %                                                                             %
6926 %                                                                             %
6927 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6928 %
6929 %  MagickOpaquePaintImage() changes any pixel that matches color with the color
6930 %  defined by fill.
6931 %
6932 %  The format of the MagickOpaquePaintImage method is:
6933 %
6934 %      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6935 %        const PixelWand *target,const PixelWand *fill,const double fuzz,
6936 %        const MagickBooleanType invert)
6937 %
6938 %  A description of each parameter follows:
6939 %
6940 %    o wand: the magick wand.
6941 %
6942 %    o target: Change this target color to the fill color within the image.
6943 %
6944 %    o fill: the fill pixel wand.
6945 %
6946 %    o fuzz: By default target must match a particular pixel color
6947 %      exactly.  However, in many cases two colors may differ by a small amount.
6948 %      The fuzz member of image defines how much tolerance is acceptable to
6949 %      consider two colors as the same.  For example, set fuzz to 10 and the
6950 %      color red at intensities of 100 and 102 respectively are now interpreted
6951 %      as the same color for the purposes of the floodfill.
6952 %
6953 %    o invert: paint any pixel that does not match the target color.
6954 %
6955 */
6956 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6957   const PixelWand *target,const PixelWand *fill,const double fuzz,
6958   const MagickBooleanType invert)
6959 {
6960   MagickBooleanType
6961     status;
6962
6963   PixelInfo
6964     fill_pixel,
6965     target_pixel;
6966
6967   assert(wand != (MagickWand *) NULL);
6968   assert(wand->signature == WandSignature);
6969   if (wand->debug != MagickFalse)
6970     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6971   if (wand->images == (Image *) NULL)
6972     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6973   PixelGetMagickColor(target,&target_pixel);
6974   PixelGetMagickColor(fill,&fill_pixel);
6975   wand->images->fuzz=fuzz;
6976   status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
6977     wand->exception);
6978   return(status);
6979 }
6980 \f
6981 /*
6982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6983 %                                                                             %
6984 %                                                                             %
6985 %                                                                             %
6986 %   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                         %
6987 %                                                                             %
6988 %                                                                             %
6989 %                                                                             %
6990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6991 %
6992 %  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
6993 %  previous image in the sequence.  From this it attempts to select the
6994 %  smallest cropped image to replace each frame, while preserving the results
6995 %  of the animation.
6996 %
6997 %  The format of the MagickOptimizeImageLayers method is:
6998 %
6999 %      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7000 %
7001 %  A description of each parameter follows:
7002 %
7003 %    o wand: the magick wand.
7004 %
7005 */
7006 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7007 {
7008   Image
7009     *optimize_image;
7010
7011   assert(wand != (MagickWand *) NULL);
7012   assert(wand->signature == WandSignature);
7013   if (wand->debug != MagickFalse)
7014     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7015   if (wand->images == (Image *) NULL)
7016     return((MagickWand *) NULL);
7017   optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7018   if (optimize_image == (Image *) NULL)
7019     return((MagickWand *) NULL);
7020   return(CloneMagickWandFromImages(wand,optimize_image));
7021 }
7022 \f
7023 /*
7024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7025 %                                                                             %
7026 %                                                                             %
7027 %                                                                             %
7028 %     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                   %
7029 %                                                                             %
7030 %                                                                             %
7031 %                                                                             %
7032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7033 %
7034 %  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7035 %  of pre-defined dithering threshold maps, but over multiple intensity levels,
7036 %  which can be different for different channels, according to the input
7037 %  arguments.
7038 %
7039 %  The format of the MagickOrderedPosterizeImage method is:
7040 %
7041 %      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7042 %        const char *threshold_map)
7043 %
7044 %  A description of each parameter follows:
7045 %
7046 %    o image: the image.
7047 %
7048 %    o threshold_map: A string containing the name of the threshold dither
7049 %      map to use, followed by zero or more numbers representing the number of
7050 %      color levels tho dither between.
7051 %
7052 %      Any level number less than 2 is equivalent to 2, and means only binary
7053 %      dithering will be applied to each color channel.
7054 %
7055 %      No numbers also means a 2 level (bitmap) dither will be applied to all
7056 %      channels, while a single number is the number of levels applied to each
7057 %      channel in sequence.  More numbers will be applied in turn to each of
7058 %      the color channels.
7059 %
7060 %      For example: "o3x3,6" generates a 6 level posterization of the image
7061 %      with a ordered 3x3 diffused pixel dither being applied between each
7062 %      level. While checker,8,8,4 will produce a 332 colormaped image with
7063 %      only a single checkerboard hash pattern (50% grey) between each color
7064 %      level, to basically double the number of color levels with a bare
7065 %      minimim of dithering.
7066 %
7067 */
7068 WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7069   const char *threshold_map)
7070 {
7071   MagickBooleanType
7072     status;
7073
7074   assert(wand != (MagickWand *) NULL);
7075   assert(wand->signature == WandSignature);
7076   if (wand->debug != MagickFalse)
7077     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7078   if (wand->images == (Image *) NULL)
7079     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7080   status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7081   return(status);
7082 }
7083 \f
7084 /*
7085 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7086 %                                                                             %
7087 %                                                                             %
7088 %                                                                             %
7089 %   M a g i c k P i n g I m a g e                                             %
7090 %                                                                             %
7091 %                                                                             %
7092 %                                                                             %
7093 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7094 %
7095 %  MagickPingImage() is the same as MagickReadImage() except the only valid
7096 %  information returned is the image width, height, size, and format.  It
7097 %  is designed to efficiently obtain this information from a file without
7098 %  reading the entire image sequence into memory.
7099 %
7100 %  The format of the MagickPingImage method is:
7101 %
7102 %      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7103 %
7104 %  A description of each parameter follows:
7105 %
7106 %    o wand: the magick wand.
7107 %
7108 %    o filename: the image filename.
7109 %
7110 */
7111 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7112   const char *filename)
7113 {
7114   Image
7115     *images;
7116
7117   ImageInfo
7118     *ping_info;
7119
7120   assert(wand != (MagickWand *) NULL);
7121   assert(wand->signature == WandSignature);
7122   if (wand->debug != MagickFalse)
7123     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7124   ping_info=CloneImageInfo(wand->image_info);
7125   if (filename != (const char *) NULL)
7126     (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7127   images=PingImage(ping_info,wand->exception);
7128   ping_info=DestroyImageInfo(ping_info);
7129   if (images == (Image *) NULL)
7130     return(MagickFalse);
7131   return(InsertImageInWand(wand,images));
7132 }
7133 \f
7134 /*
7135 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7136 %                                                                             %
7137 %                                                                             %
7138 %                                                                             %
7139 %   M a g i c k P i n g I m a g e B l o b                                     %
7140 %                                                                             %
7141 %                                                                             %
7142 %                                                                             %
7143 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7144 %
7145 %  MagickPingImageBlob() pings an image or image sequence from a blob.
7146 %
7147 %  The format of the MagickPingImageBlob method is:
7148 %
7149 %      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7150 %        const void *blob,const size_t length)
7151 %
7152 %  A description of each parameter follows:
7153 %
7154 %    o wand: the magick wand.
7155 %
7156 %    o blob: the blob.
7157 %
7158 %    o length: the blob length.
7159 %
7160 */
7161 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7162   const void *blob,const size_t length)
7163 {
7164   Image
7165     *images;
7166
7167   ImageInfo
7168     *read_info;
7169
7170   assert(wand != (MagickWand *) NULL);
7171   assert(wand->signature == WandSignature);
7172   if (wand->debug != MagickFalse)
7173     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7174   read_info=CloneImageInfo(wand->image_info);
7175   SetImageInfoBlob(read_info,blob,length);
7176   images=PingImage(read_info,wand->exception);
7177   read_info=DestroyImageInfo(read_info);
7178   if (images == (Image *) NULL)
7179     return(MagickFalse);
7180   return(InsertImageInWand(wand,images));
7181 }
7182 \f
7183 /*
7184 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7185 %                                                                             %
7186 %                                                                             %
7187 %                                                                             %
7188 %   M a g i c k P i n g I m a g e F i l e                                     %
7189 %                                                                             %
7190 %                                                                             %
7191 %                                                                             %
7192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7193 %
7194 %  MagickPingImageFile() pings an image or image sequence from an open file
7195 %  descriptor.
7196 %
7197 %  The format of the MagickPingImageFile method is:
7198 %
7199 %      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7200 %
7201 %  A description of each parameter follows:
7202 %
7203 %    o wand: the magick wand.
7204 %
7205 %    o file: the file descriptor.
7206 %
7207 */
7208 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7209 {
7210   Image
7211     *images;
7212
7213   ImageInfo
7214     *read_info;
7215
7216   assert(wand != (MagickWand *) NULL);
7217   assert(wand->signature == WandSignature);
7218   assert(file != (FILE *) NULL);
7219   if (wand->debug != MagickFalse)
7220     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7221   read_info=CloneImageInfo(wand->image_info);
7222   SetImageInfoFile(read_info,file);
7223   images=PingImage(read_info,wand->exception);
7224   read_info=DestroyImageInfo(read_info);
7225   if (images == (Image *) NULL)
7226     return(MagickFalse);
7227   return(InsertImageInWand(wand,images));
7228 }
7229 \f
7230 /*
7231 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7232 %                                                                             %
7233 %                                                                             %
7234 %                                                                             %
7235 %   M a g i c k P o l a r o i d I m a g e                                     %
7236 %                                                                             %
7237 %                                                                             %
7238 %                                                                             %
7239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7240 %
7241 %  MagickPolaroidImage() simulates a Polaroid picture.
7242 %
7243 %  The format of the MagickPolaroidImage method is:
7244 %
7245 %      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7246 %        const DrawingWand *drawing_wand,const char *caption,const double angle,
7247 %        const PixelInterpolateMethod method)
7248 %
7249 %  A description of each parameter follows:
7250 %
7251 %    o wand: the magick wand.
7252 %
7253 %    o drawing_wand: the draw wand.
7254 %
7255 %    o caption: the Polaroid caption.
7256 %
7257 %    o angle: Apply the effect along this angle.
7258 %
7259 %    o method: the pixel interpolation method.
7260 %
7261 */
7262 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7263   const DrawingWand *drawing_wand,const char *caption,const double angle,
7264   const PixelInterpolateMethod method)
7265 {
7266   DrawInfo
7267     *draw_info;
7268
7269   Image
7270     *polaroid_image;
7271
7272   assert(wand != (MagickWand *) NULL);
7273   assert(wand->signature == WandSignature);
7274   if (wand->debug != MagickFalse)
7275     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7276   if (wand->images == (Image *) NULL)
7277     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7278   draw_info=PeekDrawingWand(drawing_wand);
7279   if (draw_info == (DrawInfo *) NULL)
7280     return(MagickFalse);
7281   polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
7282     wand->exception);
7283   if (polaroid_image == (Image *) NULL)
7284     return(MagickFalse);
7285   ReplaceImageInList(&wand->images,polaroid_image);
7286   return(MagickTrue);
7287 }
7288 \f
7289 /*
7290 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7291 %                                                                             %
7292 %                                                                             %
7293 %                                                                             %
7294 %   M a g i c k P o s t e r i z e I m a g e                                   %
7295 %                                                                             %
7296 %                                                                             %
7297 %                                                                             %
7298 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7299 %
7300 %  MagickPosterizeImage() reduces the image to a limited number of color level.
7301 %
7302 %  The format of the MagickPosterizeImage method is:
7303 %
7304 %      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7305 %        const unsigned levels,const MagickBooleanType dither)
7306 %
7307 %  A description of each parameter follows:
7308 %
7309 %    o wand: the magick wand.
7310 %
7311 %    o levels: Number of color levels allowed in each channel.  Very low values
7312 %      (2, 3, or 4) have the most visible effect.
7313 %
7314 %    o dither: Set this integer value to something other than zero to dither
7315 %      the mapped image.
7316 %
7317 */
7318 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7319   const size_t levels,const MagickBooleanType dither)
7320 {
7321   MagickBooleanType
7322     status;
7323
7324   assert(wand != (MagickWand *) NULL);
7325   assert(wand->signature == WandSignature);
7326   if (wand->debug != MagickFalse)
7327     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7328   if (wand->images == (Image *) NULL)
7329     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7330   status=PosterizeImage(wand->images,levels,dither,wand->exception);
7331   return(status);
7332 }
7333 \f
7334 /*
7335 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7336 %                                                                             %
7337 %                                                                             %
7338 %                                                                             %
7339 %   M a g i c k P r e v i e w I m a g e s                                     %
7340 %                                                                             %
7341 %                                                                             %
7342 %                                                                             %
7343 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7344 %
7345 %  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7346 %  image processing operation applied at varying strengths.  This helpful
7347 %  to quickly pin-point an appropriate parameter for an image processing
7348 %  operation.
7349 %
7350 %  The format of the MagickPreviewImages method is:
7351 %
7352 %      MagickWand *MagickPreviewImages(MagickWand *wand,
7353 %        const PreviewType preview)
7354 %
7355 %  A description of each parameter follows:
7356 %
7357 %    o wand: the magick wand.
7358 %
7359 %    o preview: the preview type.
7360 %
7361 */
7362 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7363   const PreviewType preview)
7364 {
7365   Image
7366     *preview_image;
7367
7368   assert(wand != (MagickWand *) NULL);
7369   assert(wand->signature == WandSignature);
7370   if (wand->debug != MagickFalse)
7371     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7372   if (wand->images == (Image *) NULL)
7373     return((MagickWand *) NULL);
7374   preview_image=PreviewImage(wand->images,preview,wand->exception);
7375   if (preview_image == (Image *) NULL)
7376     return((MagickWand *) NULL);
7377   return(CloneMagickWandFromImages(wand,preview_image));
7378 }
7379 \f
7380 /*
7381 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7382 %                                                                             %
7383 %                                                                             %
7384 %                                                                             %
7385 %   M a g i c k P r e v i o u s I m a g e                                     %
7386 %                                                                             %
7387 %                                                                             %
7388 %                                                                             %
7389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7390 %
7391 %  MagickPreviousImage() assocates the previous image in an image list with
7392 %  the magick wand.
7393 %
7394 %  The format of the MagickPreviousImage method is:
7395 %
7396 %      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7397 %
7398 %  A description of each parameter follows:
7399 %
7400 %    o wand: the magick wand.
7401 %
7402 */
7403 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7404 {
7405   assert(wand != (MagickWand *) NULL);
7406   assert(wand->signature == WandSignature);
7407   if (wand->debug != MagickFalse)
7408     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7409   if (wand->images == (Image *) NULL)
7410     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7411
7412   wand->image_pending=MagickFalse;  /* pending status has no meaning */
7413   /* If there is no prev image, return false (Iterator is finished) */
7414   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7415       return(MagickFalse);
7416   /* just do it - current image is not 'pending' */
7417   wand->images=GetPreviousImageInList(wand->images);
7418   return(MagickTrue);
7419 }
7420 \f
7421 /*
7422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7423 %                                                                             %
7424 %                                                                             %
7425 %                                                                             %
7426 %   M a g i c k Q u a n t i z e I m a g e                                     %
7427 %                                                                             %
7428 %                                                                             %
7429 %                                                                             %
7430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7431 %
7432 %  MagickQuantizeImage() analyzes the colors within a reference image and
7433 %  chooses a fixed number of colors to represent the image.  The goal of the
7434 %  algorithm is to minimize the color difference between the input and output
7435 %  image while minimizing the processing time.
7436 %
7437 %  The format of the MagickQuantizeImage method is:
7438 %
7439 %      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7440 %        const size_t number_colors,const ColorspaceType colorspace,
7441 %        const size_t treedepth,const MagickBooleanType dither,
7442 %        const MagickBooleanType measure_error)
7443 %
7444 %  A description of each parameter follows:
7445 %
7446 %    o wand: the magick wand.
7447 %
7448 %    o number_colors: the number of colors.
7449 %
7450 %    o colorspace: Perform color reduction in this colorspace, typically
7451 %      RGBColorspace.
7452 %
7453 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7454 %      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
7455 %      reference image with the least amount of memory and the fastest
7456 %      computational speed.  In some cases, such as an image with low color
7457 %      dispersion (a few number of colors), a value other than
7458 %      Log4(number_colors) is required.  To expand the color tree completely,
7459 %      use a value of 8.
7460 %
7461 %    o dither: A value other than zero distributes the difference between an
7462 %      original image and the corresponding color reduced image to
7463 %      neighboring pixels along a Hilbert curve.
7464 %
7465 %    o measure_error: A value other than zero measures the difference between
7466 %      the original and quantized images.  This difference is the total
7467 %      quantization error.  The error is computed by summing over all pixels
7468 %      in an image the distance squared in RGB space between each reference
7469 %      pixel value and its quantized value.
7470 %
7471 */
7472 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7473   const size_t number_colors,const ColorspaceType colorspace,
7474   const size_t treedepth,const MagickBooleanType dither,
7475   const MagickBooleanType measure_error)
7476 {
7477   MagickBooleanType
7478     status;
7479
7480   QuantizeInfo
7481     *quantize_info;
7482
7483   assert(wand != (MagickWand *) NULL);
7484   assert(wand->signature == WandSignature);
7485   if (wand->debug != MagickFalse)
7486     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7487   if (wand->images == (Image *) NULL)
7488     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7489   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7490   quantize_info->number_colors=number_colors;
7491   quantize_info->dither=dither;
7492   quantize_info->tree_depth=treedepth;
7493   quantize_info->colorspace=colorspace;
7494   quantize_info->measure_error=measure_error;
7495   status=QuantizeImage(quantize_info,wand->images,wand->exception);
7496   quantize_info=DestroyQuantizeInfo(quantize_info);
7497   return(status);
7498 }
7499 \f
7500 /*
7501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7502 %                                                                             %
7503 %                                                                             %
7504 %                                                                             %
7505 %   M a g i c k Q u a n t i z e I m a g e s                                   %
7506 %                                                                             %
7507 %                                                                             %
7508 %                                                                             %
7509 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7510 %
7511 %  MagickQuantizeImages() analyzes the colors within a sequence of images and
7512 %  chooses a fixed number of colors to represent the image.  The goal of the
7513 %  algorithm is to minimize the color difference between the input and output
7514 %  image while minimizing the processing time.
7515 %
7516 %  The format of the MagickQuantizeImages method is:
7517 %
7518 %      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7519 %        const size_t number_colors,const ColorspaceType colorspace,
7520 %        const size_t treedepth,const MagickBooleanType dither,
7521 %        const MagickBooleanType measure_error)
7522 %
7523 %  A description of each parameter follows:
7524 %
7525 %    o wand: the magick wand.
7526 %
7527 %    o number_colors: the number of colors.
7528 %
7529 %    o colorspace: Perform color reduction in this colorspace, typically
7530 %      RGBColorspace.
7531 %
7532 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7533 %      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
7534 %      reference image with the least amount of memory and the fastest
7535 %      computational speed.  In some cases, such as an image with low color
7536 %      dispersion (a few number of colors), a value other than
7537 %      Log4(number_colors) is required.  To expand the color tree completely,
7538 %      use a value of 8.
7539 %
7540 %    o dither: A value other than zero distributes the difference between an
7541 %      original image and the corresponding color reduced algorithm to
7542 %      neighboring pixels along a Hilbert curve.
7543 %
7544 %    o measure_error: A value other than zero measures the difference between
7545 %      the original and quantized images.  This difference is the total
7546 %      quantization error.  The error is computed by summing over all pixels
7547 %      in an image the distance squared in RGB space between each reference
7548 %      pixel value and its quantized value.
7549 %
7550 */
7551 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7552   const size_t number_colors,const ColorspaceType colorspace,
7553   const size_t treedepth,const MagickBooleanType dither,
7554   const MagickBooleanType measure_error)
7555 {
7556   MagickBooleanType
7557     status;
7558
7559   QuantizeInfo
7560     *quantize_info;
7561
7562   assert(wand != (MagickWand *) NULL);
7563   assert(wand->signature == WandSignature);
7564   if (wand->debug != MagickFalse)
7565     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7566   if (wand->images == (Image *) NULL)
7567     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7568   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7569   quantize_info->number_colors=number_colors;
7570   quantize_info->dither=dither;
7571   quantize_info->tree_depth=treedepth;
7572   quantize_info->colorspace=colorspace;
7573   quantize_info->measure_error=measure_error;
7574   status=QuantizeImages(quantize_info,wand->images,wand->exception);
7575   quantize_info=DestroyQuantizeInfo(quantize_info);
7576   return(status);
7577 }
7578 \f
7579 /*
7580 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7581 %                                                                             %
7582 %                                                                             %
7583 %                                                                             %
7584 %   M a g i c k R a d i a l B l u r I m a g e                                 %
7585 %                                                                             %
7586 %                                                                             %
7587 %                                                                             %
7588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7589 %
7590 %  MagickRadialBlurImage() radial blurs an image.
7591 %
7592 %  The format of the MagickRadialBlurImage method is:
7593 %
7594 %      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7595 %        const double angle,const double bias)
7596 %
7597 %  A description of each parameter follows:
7598 %
7599 %    o wand: the magick wand.
7600 %
7601 %    o angle: the angle of the blur in degrees.
7602 %
7603 %    o bias: the bias.
7604 %
7605 */
7606 WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7607   const double angle,const double bias)
7608 {
7609   Image
7610     *blur_image;
7611
7612   assert(wand != (MagickWand *) NULL);
7613   assert(wand->signature == WandSignature);
7614   if (wand->debug != MagickFalse)
7615     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7616   if (wand->images == (Image *) NULL)
7617     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7618   blur_image=RadialBlurImage(wand->images,angle,bias,wand->exception);
7619   if (blur_image == (Image *) NULL)
7620     return(MagickFalse);
7621   ReplaceImageInList(&wand->images,blur_image);
7622   return(MagickTrue);
7623 }
7624 \f
7625 /*
7626 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7627 %                                                                             %
7628 %                                                                             %
7629 %                                                                             %
7630 %   M a g i c k R a i s e I m a g e                                           %
7631 %                                                                             %
7632 %                                                                             %
7633 %                                                                             %
7634 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7635 %
7636 %  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7637 %  by lightening and darkening the edges of the image.  Members width and
7638 %  height of raise_info define the width of the vertical and horizontal
7639 %  edge of the effect.
7640 %
7641 %  The format of the MagickRaiseImage method is:
7642 %
7643 %      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7644 %        const size_t width,const size_t height,const ssize_t x,
7645 %        const ssize_t y,const MagickBooleanType raise)
7646 %
7647 %  A description of each parameter follows:
7648 %
7649 %    o wand: the magick wand.
7650 %
7651 %    o width,height,x,y:  Define the dimensions of the area to raise.
7652 %
7653 %    o raise: A value other than zero creates a 3-D raise effect,
7654 %      otherwise it has a lowered effect.
7655 %
7656 */
7657 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7658   const size_t width,const size_t height,const ssize_t x,
7659   const ssize_t y,const MagickBooleanType raise)
7660 {
7661   MagickBooleanType
7662     status;
7663
7664   RectangleInfo
7665     raise_info;
7666
7667   assert(wand != (MagickWand *) NULL);
7668   assert(wand->signature == WandSignature);
7669   if (wand->debug != MagickFalse)
7670     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7671   if (wand->images == (Image *) NULL)
7672     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7673   raise_info.width=width;
7674   raise_info.height=height;
7675   raise_info.x=x;
7676   raise_info.y=y;
7677   status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
7678   return(status);
7679 }
7680 \f
7681 /*
7682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7683 %                                                                             %
7684 %                                                                             %
7685 %                                                                             %
7686 %   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                       %
7687 %                                                                             %
7688 %                                                                             %
7689 %                                                                             %
7690 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7691 %
7692 %  MagickRandomThresholdImage() changes the value of individual pixels based on
7693 %  the intensity of each pixel compared to threshold.  The result is a
7694 %  high-contrast, two color image.
7695 %
7696 %  The format of the MagickRandomThresholdImage method is:
7697 %
7698 %      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7699 %        const double low,const double high)
7700 %
7701 %  A description of each parameter follows:
7702 %
7703 %    o wand: the magick wand.
7704 %
7705 %    o low,high: Specify the high and low thresholds.  These values range from
7706 %      0 to QuantumRange.
7707 %
7708 */
7709 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7710   const double low,const double high)
7711 {
7712   char
7713     threshold[MaxTextExtent];
7714
7715   assert(wand != (MagickWand *) NULL);
7716   assert(wand->signature == WandSignature);
7717   if (wand->debug != MagickFalse)
7718     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7719   if (wand->images == (Image *) NULL)
7720     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7721   (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
7722   return(RandomThresholdImage(wand->images,threshold,wand->exception));
7723 }
7724 \f
7725 /*
7726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7727 %                                                                             %
7728 %                                                                             %
7729 %                                                                             %
7730 %   M a g i c k R e a d I m a g e                                             %
7731 %                                                                             %
7732 %                                                                             %
7733 %                                                                             %
7734 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7735 %
7736 %  MagickReadImage() reads an image or image sequence.  The images are inserted
7737 %  at the current image pointer position.
7738 %
7739 %  Use MagickSetFirstIterator(), to insert new images before all the current
7740 %  images in the wand, MagickSetLastIterator() to append add to the end,
7741 %  MagickSetImageIndex() to place images just after the given index.
7742 %
7743 %  The format of the MagickReadImage method is:
7744 %
7745 %      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
7746 %
7747 %  A description of each parameter follows:
7748 %
7749 %    o wand: the magick wand.
7750 %
7751 %    o filename: the image filename.
7752 %
7753 */
7754 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
7755   const char *filename)
7756 {
7757   Image
7758     *images;
7759
7760   ImageInfo
7761     *read_info;
7762
7763   assert(wand != (MagickWand *) NULL);
7764   assert(wand->signature == WandSignature);
7765   if (wand->debug != MagickFalse)
7766     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7767   read_info=CloneImageInfo(wand->image_info);
7768   if (filename != (const char *) NULL)
7769     (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
7770   images=ReadImage(read_info,wand->exception);
7771   read_info=DestroyImageInfo(read_info);
7772   if (images == (Image *) NULL)
7773     return(MagickFalse);
7774   return(InsertImageInWand(wand,images));
7775 }
7776 \f
7777 /*
7778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7779 %                                                                             %
7780 %                                                                             %
7781 %                                                                             %
7782 %   M a g i c k R e a d I m a g e B l o b                                     %
7783 %                                                                             %
7784 %                                                                             %
7785 %                                                                             %
7786 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7787 %
7788 %  MagickReadImageBlob() reads an image or image sequence from a blob.
7789 %  In all other respects it is like MagickReadImage().
7790 %
7791 %  The format of the MagickReadImageBlob method is:
7792 %
7793 %      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7794 %        const void *blob,const size_t length)
7795 %
7796 %  A description of each parameter follows:
7797 %
7798 %    o wand: the magick wand.
7799 %
7800 %    o blob: the blob.
7801 %
7802 %    o length: the blob length.
7803 %
7804 */
7805 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7806   const void *blob,const size_t length)
7807 {
7808   Image
7809     *images;
7810
7811   assert(wand != (MagickWand *) NULL);
7812   assert(wand->signature == WandSignature);
7813   if (wand->debug != MagickFalse)
7814     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7815   images=BlobToImage(wand->image_info,blob,length,wand->exception);
7816   if (images == (Image *) NULL)
7817     return(MagickFalse);
7818   return(InsertImageInWand(wand,images));
7819 }
7820 \f
7821 /*
7822 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7823 %                                                                             %
7824 %                                                                             %
7825 %                                                                             %
7826 %   M a g i c k R e a d I m a g e F i l e                                     %
7827 %                                                                             %
7828 %                                                                             %
7829 %                                                                             %
7830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7831 %
7832 %  MagickReadImageFile() reads an image or image sequence from an already
7833 %  opened file descriptor.  Otherwise it is like MagickReadImage().
7834 %
7835 %  The format of the MagickReadImageFile method is:
7836 %
7837 %      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7838 %
7839 %  A description of each parameter follows:
7840 %
7841 %    o wand: the magick wand.
7842 %
7843 %    o file: the file descriptor.
7844 %
7845 */
7846 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7847 {
7848   Image
7849     *images;
7850
7851   ImageInfo
7852     *read_info;
7853
7854   assert(wand != (MagickWand *) NULL);
7855   assert(wand->signature == WandSignature);
7856   assert(file != (FILE *) NULL);
7857   if (wand->debug != MagickFalse)
7858     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7859   read_info=CloneImageInfo(wand->image_info);
7860   SetImageInfoFile(read_info,file);
7861   images=ReadImage(read_info,wand->exception);
7862   read_info=DestroyImageInfo(read_info);
7863   if (images == (Image *) NULL)
7864     return(MagickFalse);
7865   return(InsertImageInWand(wand,images));
7866 }
7867 \f
7868 /*
7869 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7870 %                                                                             %
7871 %                                                                             %
7872 %                                                                             %
7873 %   M a g i c k R e m a p I m a g e                                           %
7874 %                                                                             %
7875 %                                                                             %
7876 %                                                                             %
7877 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7878 %
7879 %  MagickRemapImage() replaces the colors of an image with the closest color
7880 %  from a reference image.
7881 %
7882 %  The format of the MagickRemapImage method is:
7883 %
7884 %      MagickBooleanType MagickRemapImage(MagickWand *wand,
7885 %        const MagickWand *remap_wand,const DitherMethod method)
7886 %
7887 %  A description of each parameter follows:
7888 %
7889 %    o wand: the magick wand.
7890 %
7891 %    o affinity: the affinity wand.
7892 %
7893 %    o method: choose from these dither methods: NoDitherMethod,
7894 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7895 %
7896 */
7897 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
7898   const MagickWand *remap_wand,const DitherMethod method)
7899 {
7900   MagickBooleanType
7901     status;
7902
7903   QuantizeInfo
7904     *quantize_info;
7905
7906   assert(wand != (MagickWand *) NULL);
7907   assert(wand->signature == WandSignature);
7908   if (wand->debug != MagickFalse)
7909     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7910   if ((wand->images == (Image *) NULL) ||
7911       (remap_wand->images == (Image *) NULL))
7912     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7913   quantize_info=AcquireQuantizeInfo(wand->image_info);
7914   quantize_info->dither_method=method;
7915   if (method == NoDitherMethod)
7916     quantize_info->dither=MagickFalse;
7917   status=RemapImage(quantize_info,wand->images,remap_wand->images,
7918     wand->exception);
7919   quantize_info=DestroyQuantizeInfo(quantize_info);
7920   return(status);
7921 }
7922 \f
7923 /*
7924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7925 %                                                                             %
7926 %                                                                             %
7927 %                                                                             %
7928 %   M a g i c k R e m o v e I m a g e                                         %
7929 %                                                                             %
7930 %                                                                             %
7931 %                                                                             %
7932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7933 %
7934 %  MagickRemoveImage() removes an image from the image list.
7935 %
7936 %  The format of the MagickRemoveImage method is:
7937 %
7938 %      MagickBooleanType MagickRemoveImage(MagickWand *wand)
7939 %
7940 %  A description of each parameter follows:
7941 %
7942 %    o wand: the magick wand.
7943 %
7944 %    o insert: the splice wand.
7945 %
7946 */
7947 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
7948 {
7949   assert(wand != (MagickWand *) NULL);
7950   assert(wand->signature == WandSignature);
7951   if (wand->debug != MagickFalse)
7952     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7953   if (wand->images == (Image *) NULL)
7954     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7955   DeleteImageFromList(&wand->images);
7956   return(MagickTrue);
7957 }
7958 \f
7959 /*
7960 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7961 %                                                                             %
7962 %                                                                             %
7963 %                                                                             %
7964 %   M a g i c k R e s a m p l e I m a g e                                     %
7965 %                                                                             %
7966 %                                                                             %
7967 %                                                                             %
7968 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7969 %
7970 %  MagickResampleImage() resample image to desired resolution.
7971 %
7972 %    Bessel   Blackman   Box
7973 %    Catrom   Cubic      Gaussian
7974 %    Hanning  Hermite    Lanczos
7975 %    Mitchell Point      Quandratic
7976 %    Sinc     Triangle
7977 %
7978 %  Most of the filters are FIR (finite impulse response), however, Bessel,
7979 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
7980 %  are windowed (brought down to zero) with the Blackman filter.
7981 %
7982 %  The format of the MagickResampleImage method is:
7983 %
7984 %      MagickBooleanType MagickResampleImage(MagickWand *wand,
7985 %        const double x_resolution,const double y_resolution,
7986 %        const FilterTypes filter,const double blur)
7987 %
7988 %  A description of each parameter follows:
7989 %
7990 %    o wand: the magick wand.
7991 %
7992 %    o x_resolution: the new image x resolution.
7993 %
7994 %    o y_resolution: the new image y resolution.
7995 %
7996 %    o filter: Image filter to use.
7997 %
7998 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
7999 %
8000 */
8001 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8002   const double x_resolution,const double y_resolution,const FilterTypes filter,
8003   const double blur)
8004 {
8005   Image
8006     *resample_image;
8007
8008   assert(wand != (MagickWand *) NULL);
8009   assert(wand->signature == WandSignature);
8010   if (wand->debug != MagickFalse)
8011     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8012   if (wand->images == (Image *) NULL)
8013     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8014   resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8015     blur,wand->exception);
8016   if (resample_image == (Image *) NULL)
8017     return(MagickFalse);
8018   ReplaceImageInList(&wand->images,resample_image);
8019   return(MagickTrue);
8020 }
8021 \f
8022 /*
8023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8024 %                                                                             %
8025 %                                                                             %
8026 %                                                                             %
8027 %   M a g i c k R e s e t I m a g e P a g e                                   %
8028 %                                                                             %
8029 %                                                                             %
8030 %                                                                             %
8031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8032 %
8033 %  MagickResetImagePage() resets the Wand page canvas and position.
8034 %
8035 %  The format of the MagickResetImagePage method is:
8036 %
8037 %      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8038 %        const char *page)
8039 %
8040 %  A description of each parameter follows:
8041 %
8042 %    o wand: the magick wand.
8043 %
8044 %    o page: the relative page specification.
8045 %
8046 */
8047 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8048   const char *page)
8049 {
8050   assert(wand != (MagickWand *) NULL);
8051   assert(wand->signature == WandSignature);
8052   if (wand->debug != MagickFalse)
8053     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8054   if (wand->images == (Image *) NULL)
8055     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8056   if ((page == (char *) NULL) || (*page == '\0'))
8057     {
8058       (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8059       return(MagickTrue);
8060     }
8061   return(ResetImagePage(wand->images,page));
8062 }
8063 \f
8064 /*
8065 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8066 %                                                                             %
8067 %                                                                             %
8068 %                                                                             %
8069 %   M a g i c k R e s i z e I m a g e                                         %
8070 %                                                                             %
8071 %                                                                             %
8072 %                                                                             %
8073 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8074 %
8075 %  MagickResizeImage() scales an image to the desired dimensions with one of
8076 %  these filters:
8077 %
8078 %    Bessel   Blackman   Box
8079 %    Catrom   Cubic      Gaussian
8080 %    Hanning  Hermite    Lanczos
8081 %    Mitchell Point      Quandratic
8082 %    Sinc     Triangle
8083 %
8084 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8085 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8086 %  are windowed (brought down to zero) with the Blackman filter.
8087 %
8088 %  The format of the MagickResizeImage method is:
8089 %
8090 %      MagickBooleanType MagickResizeImage(MagickWand *wand,
8091 %        const size_t columns,const size_t rows,
8092 %        const FilterTypes filter,const double blur)
8093 %
8094 %  A description of each parameter follows:
8095 %
8096 %    o wand: the magick wand.
8097 %
8098 %    o columns: the number of columns in the scaled image.
8099 %
8100 %    o rows: the number of rows in the scaled image.
8101 %
8102 %    o filter: Image filter to use.
8103 %
8104 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8105 %
8106 */
8107 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8108   const size_t columns,const size_t rows,const FilterTypes filter,
8109   const double blur)
8110 {
8111   Image
8112     *resize_image;
8113
8114   assert(wand != (MagickWand *) NULL);
8115   assert(wand->signature == WandSignature);
8116   if (wand->debug != MagickFalse)
8117     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8118   if (wand->images == (Image *) NULL)
8119     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8120   resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8121     wand->exception);
8122   if (resize_image == (Image *) NULL)
8123     return(MagickFalse);
8124   ReplaceImageInList(&wand->images,resize_image);
8125   return(MagickTrue);
8126 }
8127 \f
8128 /*
8129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8130 %                                                                             %
8131 %                                                                             %
8132 %                                                                             %
8133 %   M a g i c k R o l l I m a g e                                             %
8134 %                                                                             %
8135 %                                                                             %
8136 %                                                                             %
8137 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8138 %
8139 %  MagickRollImage() offsets an image as defined by x and y.
8140 %
8141 %  The format of the MagickRollImage method is:
8142 %
8143 %      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8144 %        const size_t y)
8145 %
8146 %  A description of each parameter follows:
8147 %
8148 %    o wand: the magick wand.
8149 %
8150 %    o x: the x offset.
8151 %
8152 %    o y: the y offset.
8153 %
8154 %
8155 */
8156 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8157   const ssize_t x,const ssize_t y)
8158 {
8159   Image
8160     *roll_image;
8161
8162   assert(wand != (MagickWand *) NULL);
8163   assert(wand->signature == WandSignature);
8164   if (wand->debug != MagickFalse)
8165     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8166   if (wand->images == (Image *) NULL)
8167     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8168   roll_image=RollImage(wand->images,x,y,wand->exception);
8169   if (roll_image == (Image *) NULL)
8170     return(MagickFalse);
8171   ReplaceImageInList(&wand->images,roll_image);
8172   return(MagickTrue);
8173 }
8174 \f
8175 /*
8176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8177 %                                                                             %
8178 %                                                                             %
8179 %                                                                             %
8180 %   M a g i c k R o t a t e I m a g e                                         %
8181 %                                                                             %
8182 %                                                                             %
8183 %                                                                             %
8184 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8185 %
8186 %  MagickRotateImage() rotates an image the specified number of degrees. Empty
8187 %  triangles left over from rotating the image are filled with the
8188 %  background color.
8189 %
8190 %  The format of the MagickRotateImage method is:
8191 %
8192 %      MagickBooleanType MagickRotateImage(MagickWand *wand,
8193 %        const PixelWand *background,const double degrees)
8194 %
8195 %  A description of each parameter follows:
8196 %
8197 %    o wand: the magick wand.
8198 %
8199 %    o background: the background pixel wand.
8200 %
8201 %    o degrees: the number of degrees to rotate the image.
8202 %
8203 %
8204 */
8205 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8206   const PixelWand *background,const double degrees)
8207 {
8208   Image
8209     *rotate_image;
8210
8211   assert(wand != (MagickWand *) NULL);
8212   assert(wand->signature == WandSignature);
8213   if (wand->debug != MagickFalse)
8214     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8215   if (wand->images == (Image *) NULL)
8216     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8217   PixelGetQuantumPacket(background,&wand->images->background_color);
8218   rotate_image=RotateImage(wand->images,degrees,wand->exception);
8219   if (rotate_image == (Image *) NULL)
8220     return(MagickFalse);
8221   ReplaceImageInList(&wand->images,rotate_image);
8222   return(MagickTrue);
8223 }
8224 \f
8225 /*
8226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8227 %                                                                             %
8228 %                                                                             %
8229 %                                                                             %
8230 %   M a g i c k S a m p l e I m a g e                                         %
8231 %                                                                             %
8232 %                                                                             %
8233 %                                                                             %
8234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8235 %
8236 %  MagickSampleImage() scales an image to the desired dimensions with pixel
8237 %  sampling.  Unlike other scaling methods, this method does not introduce
8238 %  any additional color into the scaled image.
8239 %
8240 %  The format of the MagickSampleImage method is:
8241 %
8242 %      MagickBooleanType MagickSampleImage(MagickWand *wand,
8243 %        const size_t columns,const size_t rows)
8244 %
8245 %  A description of each parameter follows:
8246 %
8247 %    o wand: the magick wand.
8248 %
8249 %    o columns: the number of columns in the scaled image.
8250 %
8251 %    o rows: the number of rows in the scaled image.
8252 %
8253 %
8254 */
8255 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8256   const size_t columns,const size_t rows)
8257 {
8258   Image
8259     *sample_image;
8260
8261   assert(wand != (MagickWand *) NULL);
8262   assert(wand->signature == WandSignature);
8263   if (wand->debug != MagickFalse)
8264     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8265   if (wand->images == (Image *) NULL)
8266     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8267   sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8268   if (sample_image == (Image *) NULL)
8269     return(MagickFalse);
8270   ReplaceImageInList(&wand->images,sample_image);
8271   return(MagickTrue);
8272 }
8273 \f
8274 /*
8275 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8276 %                                                                             %
8277 %                                                                             %
8278 %                                                                             %
8279 %   M a g i c k S c a l e I m a g e                                           %
8280 %                                                                             %
8281 %                                                                             %
8282 %                                                                             %
8283 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8284 %
8285 %  MagickScaleImage() scales the size of an image to the given dimensions.
8286 %
8287 %  The format of the MagickScaleImage method is:
8288 %
8289 %      MagickBooleanType MagickScaleImage(MagickWand *wand,
8290 %        const size_t columns,const size_t rows)
8291 %
8292 %  A description of each parameter follows:
8293 %
8294 %    o wand: the magick wand.
8295 %
8296 %    o columns: the number of columns in the scaled image.
8297 %
8298 %    o rows: the number of rows in the scaled image.
8299 %
8300 %
8301 */
8302 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8303   const size_t columns,const size_t rows)
8304 {
8305   Image
8306     *scale_image;
8307
8308   assert(wand != (MagickWand *) NULL);
8309   assert(wand->signature == WandSignature);
8310   if (wand->debug != MagickFalse)
8311     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8312   if (wand->images == (Image *) NULL)
8313     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8314   scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8315   if (scale_image == (Image *) NULL)
8316     return(MagickFalse);
8317   ReplaceImageInList(&wand->images,scale_image);
8318   return(MagickTrue);
8319 }
8320 \f
8321 /*
8322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8323 %                                                                             %
8324 %                                                                             %
8325 %                                                                             %
8326 %   M a g i c k S e g m e n t I m a g e                                       %
8327 %                                                                             %
8328 %                                                                             %
8329 %                                                                             %
8330 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8331 %
8332 %  MagickSegmentImage() segments an image by analyzing the histograms of the
8333 %  color components and identifying units that are homogeneous with the fuzzy
8334 %  C-means technique.
8335 %
8336 %  The format of the SegmentImage method is:
8337 %
8338 %      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8339 %        const ColorspaceType colorspace,const MagickBooleanType verbose,
8340 %        const double cluster_threshold,const double smooth_threshold)
8341 %
8342 %  A description of each parameter follows.
8343 %
8344 %    o wand: the wand.
8345 %
8346 %    o colorspace: the image colorspace.
8347 %
8348 %    o verbose:  Set to MagickTrue to print detailed information about the
8349 %      identified classes.
8350 %
8351 %    o cluster_threshold:  This represents the minimum number of pixels
8352 %      contained in a hexahedra before it can be considered valid (expressed as
8353 %      a percentage).
8354 %
8355 %    o smooth_threshold: the smoothing threshold eliminates noise in the second
8356 %      derivative of the histogram.  As the value is increased, you can expect a
8357 %      smoother second derivative.
8358 %
8359 */
8360 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8361   const ColorspaceType colorspace,const MagickBooleanType verbose,
8362   const double cluster_threshold,const double smooth_threshold)
8363 {
8364   MagickBooleanType
8365     status;
8366
8367   assert(wand != (MagickWand *) NULL);
8368   assert(wand->signature == WandSignature);
8369   if (wand->debug != MagickFalse)
8370     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8371   if (wand->images == (Image *) NULL)
8372     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8373   status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8374     smooth_threshold,wand->exception);
8375   return(status);
8376 }
8377 \f
8378 /*
8379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8380 %                                                                             %
8381 %                                                                             %
8382 %                                                                             %
8383 %   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8384 %                                                                             %
8385 %                                                                             %
8386 %                                                                             %
8387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8388 %
8389 %  MagickSelectiveBlurImage() selectively blur an image within a contrast
8390 %  threshold. It is similar to the unsharpen mask that sharpens everything with
8391 %  contrast above a certain threshold.
8392 %
8393 %  The format of the MagickSelectiveBlurImage method is:
8394 %
8395 %      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8396 %        const double radius,const double sigma,const double threshold,
8397 %        const double bias)
8398 %
8399 %  A description of each parameter follows:
8400 %
8401 %    o wand: the magick wand.
8402 %
8403 %    o radius: the radius of the gaussian, in pixels, not counting the center
8404 %      pixel.
8405 %
8406 %    o sigma: the standard deviation of the gaussian, in pixels.
8407 %
8408 %    o threshold: only pixels within this contrast threshold are included
8409 %      in the blur operation.
8410 %
8411 %    o bias: the bias.
8412 %
8413 */
8414 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8415   const double radius,const double sigma,const double threshold,
8416   const double bias)
8417 {
8418   Image
8419     *blur_image;
8420
8421   assert(wand != (MagickWand *) NULL);
8422   assert(wand->signature == WandSignature);
8423   if (wand->debug != MagickFalse)
8424     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8425   if (wand->images == (Image *) NULL)
8426     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8427   blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,bias,
8428     wand->exception);
8429   if (blur_image == (Image *) NULL)
8430     return(MagickFalse);
8431   ReplaceImageInList(&wand->images,blur_image);
8432   return(MagickTrue);
8433 }
8434 \f
8435 /*
8436 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8437 %                                                                             %
8438 %                                                                             %
8439 %                                                                             %
8440 %   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                       %
8441 %                                                                             %
8442 %                                                                             %
8443 %                                                                             %
8444 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8445 %
8446 %  MagickSeparateImage() separates a channel from the image and returns a
8447 %  grayscale image.  A channel is a particular color component of each pixel
8448 %  in the image.
8449 %
8450 %  The format of the MagickSeparateImage method is:
8451 %
8452 %      MagickBooleanType MagickSeparateImage(MagickWand *wand,
8453 %        const ChannelType channel)
8454 %
8455 %  A description of each parameter follows:
8456 %
8457 %    o wand: the magick wand.
8458 %
8459 %    o channel: the channel.
8460 %
8461 */
8462 WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
8463   const ChannelType channel)
8464 {
8465   Image
8466     *separate_image;
8467
8468   assert(wand != (MagickWand *) NULL);
8469   assert(wand->signature == WandSignature);
8470   if (wand->debug != MagickFalse)
8471     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8472   if (wand->images == (Image *) NULL)
8473     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8474   separate_image=SeparateImage(wand->images,channel,wand->exception);
8475   if (separate_image == (Image *) NULL)
8476     return(MagickFalse);
8477   ReplaceImageInList(&wand->images,separate_image);
8478   return(MagickTrue);
8479 }
8480 \f
8481 /*
8482 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8483 %                                                                             %
8484 %                                                                             %
8485 %                                                                             %
8486 %     M a g i c k S e p i a T o n e I m a g e                                 %
8487 %                                                                             %
8488 %                                                                             %
8489 %                                                                             %
8490 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8491 %
8492 %  MagickSepiaToneImage() applies a special effect to the image, similar to the
8493 %  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8494 %  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8495 %  threshold of 80% is a good starting point for a reasonable tone.
8496 %
8497 %  The format of the MagickSepiaToneImage method is:
8498 %
8499 %      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8500 %        const double threshold)
8501 %
8502 %  A description of each parameter follows:
8503 %
8504 %    o wand: the magick wand.
8505 %
8506 %    o threshold:  Define the extent of the sepia toning.
8507 %
8508 */
8509 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8510   const double threshold)
8511 {
8512   Image
8513     *sepia_image;
8514
8515   assert(wand != (MagickWand *) NULL);
8516   assert(wand->signature == WandSignature);
8517   if (wand->debug != MagickFalse)
8518     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8519   if (wand->images == (Image *) NULL)
8520     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8521   sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8522   if (sepia_image == (Image *) NULL)
8523     return(MagickFalse);
8524   ReplaceImageInList(&wand->images,sepia_image);
8525   return(MagickTrue);
8526 }
8527 \f
8528 /*
8529 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8530 %                                                                             %
8531 %                                                                             %
8532 %                                                                             %
8533 %   M a g i c k S e t I m a g e                                               %
8534 %                                                                             %
8535 %                                                                             %
8536 %                                                                             %
8537 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8538 %
8539 %  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8540 %  MagickNextImage(), MagickPreviousImage() with the images from the specified
8541 %  wand.
8542 %
8543 %  The format of the MagickSetImage method is:
8544 %
8545 %      MagickBooleanType MagickSetImage(MagickWand *wand,
8546 %        const MagickWand *set_wand)
8547 %
8548 %  A description of each parameter follows:
8549 %
8550 %    o wand: the magick wand.
8551 %
8552 %    o set_wand: the set_wand wand.
8553 %
8554 */
8555 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8556   const MagickWand *set_wand)
8557 {
8558   Image
8559     *images;
8560
8561   assert(wand != (MagickWand *) NULL);
8562   assert(wand->signature == WandSignature);
8563   if (wand->debug != MagickFalse)
8564     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8565   assert(set_wand != (MagickWand *) NULL);
8566   assert(set_wand->signature == WandSignature);
8567   if (wand->debug != MagickFalse)
8568     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8569   if (set_wand->images == (Image *) NULL)
8570     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8571   images=CloneImageList(set_wand->images,wand->exception);
8572   if (images == (Image *) NULL)
8573     return(MagickFalse);
8574   ReplaceImageInList(&wand->images,images);
8575   return(MagickTrue);
8576 }
8577 \f
8578 /*
8579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8580 %                                                                             %
8581 %                                                                             %
8582 %                                                                             %
8583 %   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                       %
8584 %                                                                             %
8585 %                                                                             %
8586 %                                                                             %
8587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8588 %
8589 %  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8590 %  alpha channel.
8591 %
8592 %  The format of the MagickSetImageAlphaChannel method is:
8593 %
8594 %      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8595 %        const AlphaChannelType alpha_type)
8596 %
8597 %  A description of each parameter follows:
8598 %
8599 %    o wand: the magick wand.
8600 %
8601 %    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8602 %      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8603 %
8604 */
8605 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8606   const AlphaChannelType alpha_type)
8607 {
8608   assert(wand != (MagickWand *) NULL);
8609   assert(wand->signature == WandSignature);
8610   if (wand->debug != MagickFalse)
8611     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8612   if (wand->images == (Image *) NULL)
8613     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8614   return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
8615 }
8616 \f
8617 /*
8618 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8619 %                                                                             %
8620 %                                                                             %
8621 %                                                                             %
8622 %   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                 %
8623 %                                                                             %
8624 %                                                                             %
8625 %                                                                             %
8626 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8627 %
8628 %  MagickSetImageBackgroundColor() sets the image background color.
8629 %
8630 %  The format of the MagickSetImageBackgroundColor method is:
8631 %
8632 %      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8633 %        const PixelWand *background)
8634 %
8635 %  A description of each parameter follows:
8636 %
8637 %    o wand: the magick wand.
8638 %
8639 %    o background: the background pixel wand.
8640 %
8641 */
8642 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8643   const PixelWand *background)
8644 {
8645   assert(wand != (MagickWand *) NULL);
8646   assert(wand->signature == WandSignature);
8647   if (wand->debug != MagickFalse)
8648     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8649   if (wand->images == (Image *) NULL)
8650     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8651   PixelGetQuantumPacket(background,&wand->images->background_color);
8652   return(MagickTrue);
8653 }
8654 \f
8655 /*
8656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8657 %                                                                             %
8658 %                                                                             %
8659 %                                                                             %
8660 %   M a g i c k S e t I m a g e B i a s                                       %
8661 %                                                                             %
8662 %                                                                             %
8663 %                                                                             %
8664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8665 %
8666 %  MagickSetImageBias() sets the image bias for any method that convolves an
8667 %  image (e.g. MagickConvolveImage()).
8668 %
8669 %  The format of the MagickSetImageBias method is:
8670 %
8671 %      MagickBooleanType MagickSetImageBias(MagickWand *wand,
8672 %        const double bias)
8673 %
8674 %  A description of each parameter follows:
8675 %
8676 %    o wand: the magick wand.
8677 %
8678 %    o bias: the image bias.
8679 %
8680 */
8681 WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
8682   const double bias)
8683 {
8684   assert(wand != (MagickWand *) NULL);
8685   assert(wand->signature == WandSignature);
8686   if (wand->debug != MagickFalse)
8687     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8688   if (wand->images == (Image *) NULL)
8689     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8690   wand->images->bias=bias;
8691   return(MagickTrue);
8692 }
8693 \f
8694 /*
8695 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8696 %                                                                             %
8697 %                                                                             %
8698 %                                                                             %
8699 %   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                         %
8700 %                                                                             %
8701 %                                                                             %
8702 %                                                                             %
8703 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8704 %
8705 %  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8706 %
8707 %  The format of the MagickSetImageBluePrimary method is:
8708 %
8709 %      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8710 %        const double x,const double y)
8711 %
8712 %  A description of each parameter follows:
8713 %
8714 %    o wand: the magick wand.
8715 %
8716 %    o x: the blue primary x-point.
8717 %
8718 %    o y: the blue primary y-point.
8719 %
8720 */
8721 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8722   const double x,const double y)
8723 {
8724   assert(wand != (MagickWand *) NULL);
8725   assert(wand->signature == WandSignature);
8726   if (wand->debug != MagickFalse)
8727     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8728   if (wand->images == (Image *) NULL)
8729     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8730   wand->images->chromaticity.blue_primary.x=x;
8731   wand->images->chromaticity.blue_primary.y=y;
8732   return(MagickTrue);
8733 }
8734 \f
8735 /*
8736 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8737 %                                                                             %
8738 %                                                                             %
8739 %                                                                             %
8740 %   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                         %
8741 %                                                                             %
8742 %                                                                             %
8743 %                                                                             %
8744 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8745 %
8746 %  MagickSetImageBorderColor() sets the image border color.
8747 %
8748 %  The format of the MagickSetImageBorderColor method is:
8749 %
8750 %      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8751 %        const PixelWand *border)
8752 %
8753 %  A description of each parameter follows:
8754 %
8755 %    o wand: the magick wand.
8756 %
8757 %    o border: the border pixel wand.
8758 %
8759 */
8760 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8761   const PixelWand *border)
8762 {
8763   assert(wand != (MagickWand *) NULL);
8764   assert(wand->signature == WandSignature);
8765   if (wand->debug != MagickFalse)
8766     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8767   if (wand->images == (Image *) NULL)
8768     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8769   PixelGetQuantumPacket(border,&wand->images->border_color);
8770   return(MagickTrue);
8771 }
8772 \f
8773 /*
8774 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8775 %                                                                             %
8776 %                                                                             %
8777 %                                                                             %
8778 %   M a g i c k S e t I m a g e C l i p M a s k                               %
8779 %                                                                             %
8780 %                                                                             %
8781 %                                                                             %
8782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8783 %
8784 %  MagickSetImageMask() sets image clip mask.
8785 %
8786 %  The format of the MagickSetImageMask method is:
8787 %
8788 %      MagickBooleanType MagickSetImageMask(MagickWand *wand,
8789 %        const MagickWand *clip_mask)
8790 %
8791 %  A description of each parameter follows:
8792 %
8793 %    o wand: the magick wand.
8794 %
8795 %    o clip_mask: the clip_mask wand.
8796 %
8797 */
8798 WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
8799   const MagickWand *clip_mask)
8800 {
8801   assert(wand != (MagickWand *) NULL);
8802   assert(wand->signature == WandSignature);
8803   if (wand->debug != MagickFalse)
8804     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8805   assert(clip_mask != (MagickWand *) NULL);
8806   assert(clip_mask->signature == WandSignature);
8807   if (clip_mask->debug != MagickFalse)
8808     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
8809   if (clip_mask->images == (Image *) NULL)
8810     ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
8811   return(SetImageMask(wand->images,clip_mask->images,wand->exception));
8812 }
8813 \f
8814 /*
8815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8816 %                                                                             %
8817 %                                                                             %
8818 %                                                                             %
8819 %   M a g i c k S e t I m a g e C o l o r                                     %
8820 %                                                                             %
8821 %                                                                             %
8822 %                                                                             %
8823 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8824 %
8825 %  MagickSetImageColor() set the entire wand canvas to the specified color.
8826 %
8827 %  The format of the MagickSetImageColor method is:
8828 %
8829 %      MagickBooleanType MagickSetImageColor(MagickWand *wand,
8830 %        const PixelWand *color)
8831 %
8832 %  A description of each parameter follows:
8833 %
8834 %    o wand: the magick wand.
8835 %
8836 %    o background: the image color.
8837 %
8838 */
8839 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
8840   const PixelWand *color)
8841 {
8842   PixelInfo
8843     pixel;
8844
8845   assert(wand != (MagickWand *) NULL);
8846   assert(wand->signature == WandSignature);
8847   if (wand->debug != MagickFalse)
8848     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8849   PixelGetMagickColor(color,&pixel);
8850   return(SetImageColor(wand->images,&pixel,wand->exception));
8851 }
8852 \f
8853 /*
8854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8855 %                                                                             %
8856 %                                                                             %
8857 %                                                                             %
8858 %   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                     %
8859 %                                                                             %
8860 %                                                                             %
8861 %                                                                             %
8862 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8863 %
8864 %  MagickSetImageColormapColor() sets the color of the specified colormap
8865 %  index.
8866 %
8867 %  The format of the MagickSetImageColormapColor method is:
8868 %
8869 %      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8870 %        const size_t index,const PixelWand *color)
8871 %
8872 %  A description of each parameter follows:
8873 %
8874 %    o wand: the magick wand.
8875 %
8876 %    o index: the offset into the image colormap.
8877 %
8878 %    o color: Return the colormap color in this wand.
8879 %
8880 */
8881 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8882   const size_t index,const PixelWand *color)
8883 {
8884   assert(wand != (MagickWand *) NULL);
8885   assert(wand->signature == WandSignature);
8886   if (wand->debug != MagickFalse)
8887     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8888   if (wand->images == (Image *) NULL)
8889     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8890   if ((wand->images->colormap == (PixelInfo *) NULL) ||
8891       (index >= wand->images->colors))
8892     ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
8893   PixelGetQuantumPacket(color,wand->images->colormap+index);
8894   return(SyncImage(wand->images,wand->exception));
8895 }
8896 \f
8897 /*
8898 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8899 %                                                                             %
8900 %                                                                             %
8901 %                                                                             %
8902 %   M a g i c k S e t I m a g e C o l o r s p a c e                           %
8903 %                                                                             %
8904 %                                                                             %
8905 %                                                                             %
8906 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8907 %
8908 %  MagickSetImageColorspace() sets the image colorspace.
8909 %
8910 %  The format of the MagickSetImageColorspace method is:
8911 %
8912 %      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8913 %        const ColorspaceType colorspace)
8914 %
8915 %  A description of each parameter follows:
8916 %
8917 %    o wand: the magick wand.
8918 %
8919 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
8920 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
8921 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
8922 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
8923 %      HSLColorspace, or HWBColorspace.
8924 %
8925 */
8926 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8927   const ColorspaceType colorspace)
8928 {
8929   assert(wand != (MagickWand *) NULL);
8930   assert(wand->signature == WandSignature);
8931   if (wand->debug != MagickFalse)
8932     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8933   if (wand->images == (Image *) NULL)
8934     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8935   return(SetImageColorspace(wand->images,colorspace,wand->exception));
8936 }
8937 \f
8938 /*
8939 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8940 %                                                                             %
8941 %                                                                             %
8942 %                                                                             %
8943 %   M a g i c k S e t I m a g e C o m p o s e                                 %
8944 %                                                                             %
8945 %                                                                             %
8946 %                                                                             %
8947 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8948 %
8949 %  MagickSetImageCompose() sets the image composite operator, useful for
8950 %  specifying how to composite the image thumbnail when using the
8951 %  MagickMontageImage() method.
8952 %
8953 %  The format of the MagickSetImageCompose method is:
8954 %
8955 %      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8956 %        const CompositeOperator compose)
8957 %
8958 %  A description of each parameter follows:
8959 %
8960 %    o wand: the magick wand.
8961 %
8962 %    o compose: the image composite operator.
8963 %
8964 */
8965 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8966   const CompositeOperator compose)
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->compose=compose;
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 C o m p r e s s i o n                         %
8984 %                                                                             %
8985 %                                                                             %
8986 %                                                                             %
8987 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8988 %
8989 %  MagickSetImageCompression() sets the image compression.
8990 %
8991 %  The format of the MagickSetImageCompression method is:
8992 %
8993 %      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8994 %        const CompressionType compression)
8995 %
8996 %  A description of each parameter follows:
8997 %
8998 %    o wand: the magick wand.
8999 %
9000 %    o compression: the image compression type.
9001 %
9002 */
9003 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9004   const CompressionType compression)
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->compression=compression;
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 C o m p r e s s i o n Q u a l i t y           %
9022 %                                                                             %
9023 %                                                                             %
9024 %                                                                             %
9025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9026 %
9027 %  MagickSetImageCompressionQuality() sets the image compression quality.
9028 %
9029 %  The format of the MagickSetImageCompressionQuality method is:
9030 %
9031 %      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9032 %        const size_t quality)
9033 %
9034 %  A description of each parameter follows:
9035 %
9036 %    o wand: the magick wand.
9037 %
9038 %    o quality: the image compression tlityype.
9039 %
9040 */
9041 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9042   const size_t quality)
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   wand->images->quality=quality;
9051   return(MagickTrue);
9052 }
9053 \f
9054 /*
9055 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9056 %                                                                             %
9057 %                                                                             %
9058 %                                                                             %
9059 %   M a g i c k S e t I m a g e D e l a y                                     %
9060 %                                                                             %
9061 %                                                                             %
9062 %                                                                             %
9063 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9064 %
9065 %  MagickSetImageDelay() sets the image delay.
9066 %
9067 %  The format of the MagickSetImageDelay method is:
9068 %
9069 %      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9070 %        const size_t delay)
9071 %
9072 %  A description of each parameter follows:
9073 %
9074 %    o wand: the magick wand.
9075 %
9076 %    o delay: the image delay in ticks-per-second units.
9077 %
9078 */
9079 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9080   const size_t delay)
9081 {
9082   assert(wand != (MagickWand *) NULL);
9083   assert(wand->signature == WandSignature);
9084   if (wand->debug != MagickFalse)
9085     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9086   if (wand->images == (Image *) NULL)
9087     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9088   wand->images->delay=delay;
9089   return(MagickTrue);
9090 }
9091 \f
9092 /*
9093 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9094 %                                                                             %
9095 %                                                                             %
9096 %                                                                             %
9097 %   M a g i c k S e t I m a g e D e p t h                                     %
9098 %                                                                             %
9099 %                                                                             %
9100 %                                                                             %
9101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9102 %
9103 %  MagickSetImageDepth() sets the image depth.
9104 %
9105 %  The format of the MagickSetImageDepth method is:
9106 %
9107 %      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9108 %        const size_t depth)
9109 %
9110 %  A description of each parameter follows:
9111 %
9112 %    o wand: the magick wand.
9113 %
9114 %    o depth: the image depth in bits: 8, 16, or 32.
9115 %
9116 */
9117 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9118   const size_t depth)
9119 {
9120   assert(wand != (MagickWand *) NULL);
9121   assert(wand->signature == WandSignature);
9122   if (wand->debug != MagickFalse)
9123     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9124   if (wand->images == (Image *) NULL)
9125     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9126   return(SetImageDepth(wand->images,depth,wand->exception));
9127 }
9128 \f
9129 /*
9130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9131 %                                                                             %
9132 %                                                                             %
9133 %                                                                             %
9134 %   M a g i c k S e t I m a g e D i s p o s e                                 %
9135 %                                                                             %
9136 %                                                                             %
9137 %                                                                             %
9138 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9139 %
9140 %  MagickSetImageDispose() sets the image disposal method.
9141 %
9142 %  The format of the MagickSetImageDispose method is:
9143 %
9144 %      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9145 %        const DisposeType dispose)
9146 %
9147 %  A description of each parameter follows:
9148 %
9149 %    o wand: the magick wand.
9150 %
9151 %    o dispose: the image disposeal type.
9152 %
9153 */
9154 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9155   const DisposeType dispose)
9156 {
9157   assert(wand != (MagickWand *) NULL);
9158   assert(wand->signature == WandSignature);
9159   if (wand->debug != MagickFalse)
9160     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9161   if (wand->images == (Image *) NULL)
9162     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9163   wand->images->dispose=dispose;
9164   return(MagickTrue);
9165 }
9166 \f
9167 /*
9168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9169 %                                                                             %
9170 %                                                                             %
9171 %                                                                             %
9172 %   M a g i c k S e t I m a g e E x t e n t                                   %
9173 %                                                                             %
9174 %                                                                             %
9175 %                                                                             %
9176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9177 %
9178 %  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9179 %
9180 %  The format of the MagickSetImageExtent method is:
9181 %
9182 %      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9183 %        const size_t columns,const unsigned rows)
9184 %
9185 %  A description of each parameter follows:
9186 %
9187 %    o wand: the magick wand.
9188 %
9189 %    o columns:  The image width in pixels.
9190 %
9191 %    o rows:  The image height in pixels.
9192 %
9193 */
9194 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9195   const size_t columns,const size_t rows)
9196 {
9197   assert(wand != (MagickWand *) NULL);
9198   assert(wand->signature == WandSignature);
9199   if (wand->debug != MagickFalse)
9200     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9201   if (wand->images == (Image *) NULL)
9202     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9203   return(SetImageExtent(wand->images,columns,rows,wand->exception));
9204 }
9205 \f
9206 /*
9207 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9208 %                                                                             %
9209 %                                                                             %
9210 %                                                                             %
9211 %   M a g i c k S e t I m a g e F i l e n a m e                               %
9212 %                                                                             %
9213 %                                                                             %
9214 %                                                                             %
9215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9216 %
9217 %  MagickSetImageFilename() sets the filename of a particular image in a
9218 %  sequence.
9219 %
9220 %  The format of the MagickSetImageFilename method is:
9221 %
9222 %      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9223 %        const char *filename)
9224 %
9225 %  A description of each parameter follows:
9226 %
9227 %    o wand: the magick wand.
9228 %
9229 %    o filename: the image filename.
9230 %
9231 */
9232 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9233   const char *filename)
9234 {
9235   assert(wand != (MagickWand *) NULL);
9236   assert(wand->signature == WandSignature);
9237   if (wand->debug != MagickFalse)
9238     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9239   if (wand->images == (Image *) NULL)
9240     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9241   if (filename != (const char *) NULL)
9242     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9243   return(MagickTrue);
9244 }
9245 \f
9246 /*
9247 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9248 %                                                                             %
9249 %                                                                             %
9250 %                                                                             %
9251 %   M a g i c k S e t I m a g e F o r m a t                                   %
9252 %                                                                             %
9253 %                                                                             %
9254 %                                                                             %
9255 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9256 %
9257 %  MagickSetImageFormat() sets the format of a particular image in a
9258 %  sequence.
9259 %
9260 %  The format of the MagickSetImageFormat method is:
9261 %
9262 %      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9263 %        const char *format)
9264 %
9265 %  A description of each parameter follows:
9266 %
9267 %    o wand: the magick wand.
9268 %
9269 %    o format: the image format.
9270 %
9271 */
9272 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9273   const char *format)
9274 {
9275   const MagickInfo
9276     *magick_info;
9277
9278   assert(wand != (MagickWand *) NULL);
9279   assert(wand->signature == WandSignature);
9280   if (wand->debug != MagickFalse)
9281     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9282   if (wand->images == (Image *) NULL)
9283     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9284   if ((format == (char *) NULL) || (*format == '\0'))
9285     {
9286       *wand->images->magick='\0';
9287       return(MagickTrue);
9288     }
9289   magick_info=GetMagickInfo(format,wand->exception);
9290   if (magick_info == (const MagickInfo *) NULL)
9291     return(MagickFalse);
9292   ClearMagickException(wand->exception);
9293   (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
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 F u z z                                       %
9303 %                                                                             %
9304 %                                                                             %
9305 %                                                                             %
9306 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9307 %
9308 %  MagickSetImageFuzz() sets the image fuzz.
9309 %
9310 %  The format of the MagickSetImageFuzz method is:
9311 %
9312 %      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9313 %        const double fuzz)
9314 %
9315 %  A description of each parameter follows:
9316 %
9317 %    o wand: the magick wand.
9318 %
9319 %    o fuzz: the image fuzz.
9320 %
9321 */
9322 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9323   const double fuzz)
9324 {
9325   assert(wand != (MagickWand *) NULL);
9326   assert(wand->signature == WandSignature);
9327   if (wand->debug != MagickFalse)
9328     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9329   if (wand->images == (Image *) NULL)
9330     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9331   wand->images->fuzz=fuzz;
9332   return(MagickTrue);
9333 }
9334 \f
9335 /*
9336 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9337 %                                                                             %
9338 %                                                                             %
9339 %                                                                             %
9340 %   M a g i c k S e t I m a g e G a m m a                                     %
9341 %                                                                             %
9342 %                                                                             %
9343 %                                                                             %
9344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9345 %
9346 %  MagickSetImageGamma() sets the image gamma.
9347 %
9348 %  The format of the MagickSetImageGamma method is:
9349 %
9350 %      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9351 %        const double gamma)
9352 %
9353 %  A description of each parameter follows:
9354 %
9355 %    o wand: the magick wand.
9356 %
9357 %    o gamma: the image gamma.
9358 %
9359 */
9360 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9361   const double gamma)
9362 {
9363   assert(wand != (MagickWand *) NULL);
9364   assert(wand->signature == WandSignature);
9365   if (wand->debug != MagickFalse)
9366     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9367   if (wand->images == (Image *) NULL)
9368     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9369   wand->images->gamma=gamma;
9370   return(MagickTrue);
9371 }
9372 \f
9373 /*
9374 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9375 %                                                                             %
9376 %                                                                             %
9377 %                                                                             %
9378 %   M a g i c k S e t I m a g e G r a v i t y                                 %
9379 %                                                                             %
9380 %                                                                             %
9381 %                                                                             %
9382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9383 %
9384 %  MagickSetImageGravity() sets the image gravity type.
9385 %
9386 %  The format of the MagickSetImageGravity method is:
9387 %
9388 %      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9389 %        const GravityType gravity)
9390 %
9391 %  A description of each parameter follows:
9392 %
9393 %    o wand: the magick wand.
9394 %
9395 %    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9396 %      PlaneInterlace, PartitionInterlace.
9397 %
9398 */
9399 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9400   const GravityType gravity)
9401 {
9402   assert(wand != (MagickWand *) NULL);
9403   assert(wand->signature == WandSignature);
9404   if (wand->debug != MagickFalse)
9405     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9406   if (wand->images == (Image *) NULL)
9407     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9408   wand->images->gravity=gravity;
9409   return(MagickTrue);
9410 }
9411 \f
9412 /*
9413 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9414 %                                                                             %
9415 %                                                                             %
9416 %                                                                             %
9417 %   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                       %
9418 %                                                                             %
9419 %                                                                             %
9420 %                                                                             %
9421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9422 %
9423 %  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9424 %  point.
9425 %
9426 %  The format of the MagickSetImageGreenPrimary method is:
9427 %
9428 %      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9429 %        const double x,const double y)
9430 %
9431 %  A description of each parameter follows:
9432 %
9433 %    o wand: the magick wand.
9434 %
9435 %    o x: the green primary x-point.
9436 %
9437 %    o y: the green primary y-point.
9438 %
9439 %
9440 */
9441 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9442   const double x,const double y)
9443 {
9444   assert(wand != (MagickWand *) NULL);
9445   assert(wand->signature == WandSignature);
9446   if (wand->debug != MagickFalse)
9447     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9448   if (wand->images == (Image *) NULL)
9449     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9450   wand->images->chromaticity.green_primary.x=x;
9451   wand->images->chromaticity.green_primary.y=y;
9452   return(MagickTrue);
9453 }
9454 \f
9455 /*
9456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9457 %                                                                             %
9458 %                                                                             %
9459 %                                                                             %
9460 %   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                 %
9461 %                                                                             %
9462 %                                                                             %
9463 %                                                                             %
9464 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9465 %
9466 %  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9467 %
9468 %  The format of the MagickSetImageInterlaceScheme method is:
9469 %
9470 %      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9471 %        const InterlaceType interlace)
9472 %
9473 %  A description of each parameter follows:
9474 %
9475 %    o wand: the magick wand.
9476 %
9477 %    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9478 %      PlaneInterlace, PartitionInterlace.
9479 %
9480 */
9481 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9482   const InterlaceType interlace)
9483 {
9484   assert(wand != (MagickWand *) NULL);
9485   assert(wand->signature == WandSignature);
9486   if (wand->debug != MagickFalse)
9487     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9488   if (wand->images == (Image *) NULL)
9489     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9490   wand->images->interlace=interlace;
9491   return(MagickTrue);
9492 }
9493 \f
9494 /*
9495 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9496 %                                                                             %
9497 %                                                                             %
9498 %                                                                             %
9499 %   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             %
9500 %                                                                             %
9501 %                                                                             %
9502 %                                                                             %
9503 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9504 %
9505 %  MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel method.
9506 %
9507 %  The format of the MagickSetImagePixelInterpolateMethod method is:
9508 %
9509 %      MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9510 %        const PixelInterpolateMethod method)
9511 %
9512 %  A description of each parameter follows:
9513 %
9514 %    o wand: the magick wand.
9515 %
9516 %    o method: the image interpole pixel methods: choose from Undefined,
9517 %      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9518 %
9519 */
9520 WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9521   const PixelInterpolateMethod method)
9522 {
9523   assert(wand != (MagickWand *) NULL);
9524   assert(wand->signature == WandSignature);
9525   if (wand->debug != MagickFalse)
9526     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9527   if (wand->images == (Image *) NULL)
9528     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9529   wand->images->interpolate=method;
9530   return(MagickTrue);
9531 }
9532 \f
9533 /*
9534 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9535 %                                                                             %
9536 %                                                                             %
9537 %                                                                             %
9538 %   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9539 %                                                                             %
9540 %                                                                             %
9541 %                                                                             %
9542 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9543 %
9544 %  MagickSetImageIterations() sets the image iterations.
9545 %
9546 %  The format of the MagickSetImageIterations method is:
9547 %
9548 %      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9549 %        const size_t iterations)
9550 %
9551 %  A description of each parameter follows:
9552 %
9553 %    o wand: the magick wand.
9554 %
9555 %    o delay: the image delay in 1/100th of a second.
9556 %
9557 */
9558 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9559   const size_t iterations)
9560 {
9561   assert(wand != (MagickWand *) NULL);
9562   assert(wand->signature == WandSignature);
9563   if (wand->debug != MagickFalse)
9564     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9565   if (wand->images == (Image *) NULL)
9566     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9567   wand->images->iterations=iterations;
9568   return(MagickTrue);
9569 }
9570 \f
9571 /*
9572 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9573 %                                                                             %
9574 %                                                                             %
9575 %                                                                             %
9576 %   M a g i c k S e t I m a g e M a t t e                                     %
9577 %                                                                             %
9578 %                                                                             %
9579 %                                                                             %
9580 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9581 %
9582 %  MagickSetImageMatte() sets the image matte channel.
9583 %
9584 %  The format of the MagickSetImageMatteColor method is:
9585 %
9586 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9587 %        const MagickBooleanType *matte)
9588 %
9589 %  A description of each parameter follows:
9590 %
9591 %    o wand: the magick wand.
9592 %
9593 %    o matte: Set to MagickTrue to enable the image matte channel otherwise
9594 %      MagickFalse.
9595 %
9596 */
9597 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9598   const MagickBooleanType matte)
9599 {
9600   assert(wand != (MagickWand *) NULL);
9601   assert(wand->signature == WandSignature);
9602   if (wand->debug != MagickFalse)
9603     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9604   if (wand->images == (Image *) NULL)
9605     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9606   if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
9607     (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
9608   wand->images->matte=matte;
9609   return(MagickTrue);
9610 }
9611 \f
9612 /*
9613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9614 %                                                                             %
9615 %                                                                             %
9616 %                                                                             %
9617 %   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9618 %                                                                             %
9619 %                                                                             %
9620 %                                                                             %
9621 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9622 %
9623 %  MagickSetImageMatteColor() sets the image matte color.
9624 %
9625 %  The format of the MagickSetImageMatteColor method is:
9626 %
9627 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9628 %        const PixelWand *matte)
9629 %
9630 %  A description of each parameter follows:
9631 %
9632 %    o wand: the magick wand.
9633 %
9634 %    o matte: the matte pixel wand.
9635 %
9636 */
9637 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9638   const PixelWand *matte)
9639 {
9640   assert(wand != (MagickWand *) NULL);
9641   assert(wand->signature == WandSignature);
9642   if (wand->debug != MagickFalse)
9643     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9644   if (wand->images == (Image *) NULL)
9645     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9646   PixelGetQuantumPacket(matte,&wand->images->matte_color);
9647   return(MagickTrue);
9648 }
9649 \f
9650 /*
9651 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9652 %                                                                             %
9653 %                                                                             %
9654 %                                                                             %
9655 %   M a g i c k S e t I m a g e O p a c i t y                                 %
9656 %                                                                             %
9657 %                                                                             %
9658 %                                                                             %
9659 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9660 %
9661 %  MagickSetImageAlpha() sets the image to the specified alpha level.
9662 %
9663 %  The format of the MagickSetImageAlpha method is:
9664 %
9665 %      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9666 %        const double alpha)
9667 %
9668 %  A description of each parameter follows:
9669 %
9670 %    o wand: the magick wand.
9671 %
9672 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9673 %      transparent.
9674 %
9675 */
9676 WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9677   const double alpha)
9678 {
9679   MagickBooleanType
9680     status;
9681
9682   assert(wand != (MagickWand *) NULL);
9683   assert(wand->signature == WandSignature);
9684   if (wand->debug != MagickFalse)
9685     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9686   if (wand->images == (Image *) NULL)
9687     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9688   status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
9689     wand->exception);
9690   return(status);
9691 }
9692 \f
9693 /*
9694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9695 %                                                                             %
9696 %                                                                             %
9697 %                                                                             %
9698 %   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                         %
9699 %                                                                             %
9700 %                                                                             %
9701 %                                                                             %
9702 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9703 %
9704 %  MagickSetImageOrientation() sets the image orientation.
9705 %
9706 %  The format of the MagickSetImageOrientation method is:
9707 %
9708 %      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9709 %        const OrientationType orientation)
9710 %
9711 %  A description of each parameter follows:
9712 %
9713 %    o wand: the magick wand.
9714 %
9715 %    o orientation: the image orientation type.
9716 %
9717 */
9718 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9719   const OrientationType orientation)
9720 {
9721   assert(wand != (MagickWand *) NULL);
9722   assert(wand->signature == WandSignature);
9723   if (wand->debug != MagickFalse)
9724     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9725   if (wand->images == (Image *) NULL)
9726     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9727   wand->images->orientation=orientation;
9728   return(MagickTrue);
9729 }
9730 \f
9731 /*
9732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9733 %                                                                             %
9734 %                                                                             %
9735 %                                                                             %
9736 %   M a g i c k S e t I m a g e P a g e                                       %
9737 %                                                                             %
9738 %                                                                             %
9739 %                                                                             %
9740 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9741 %
9742 %  MagickSetImagePage() sets the page geometry of the image.
9743 %
9744 %  The format of the MagickSetImagePage method is:
9745 %
9746 %      MagickBooleanType MagickSetImagePage(MagickWand *wand,
9747 %        const size_t width,const size_t height,const ssize_t x,
9748 %        const ssize_t y)
9749 %
9750 %  A description of each parameter follows:
9751 %
9752 %    o wand: the magick wand.
9753 %
9754 %    o width: the page width.
9755 %
9756 %    o height: the page height.
9757 %
9758 %    o x: the page x-offset.
9759 %
9760 %    o y: the page y-offset.
9761 %
9762 */
9763 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
9764   const size_t width,const size_t height,const ssize_t x,
9765   const ssize_t y)
9766 {
9767   assert(wand != (MagickWand *) NULL);
9768   assert(wand->signature == WandSignature);
9769   if (wand->debug != MagickFalse)
9770     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9771   if (wand->images == (Image *) NULL)
9772     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9773   wand->images->page.width=width;
9774   wand->images->page.height=height;
9775   wand->images->page.x=x;
9776   wand->images->page.y=y;
9777   return(MagickTrue);
9778 }
9779 \f
9780 /*
9781 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9782 %                                                                             %
9783 %                                                                             %
9784 %                                                                             %
9785 %   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                 %
9786 %                                                                             %
9787 %                                                                             %
9788 %                                                                             %
9789 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9790 %
9791 %  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
9792 %  specified method and returns the previous progress monitor if any.  The
9793 %  progress monitor method looks like this:
9794 %
9795 %    MagickBooleanType MagickProgressMonitor(const char *text,
9796 %      const MagickOffsetType offset,const MagickSizeType span,
9797 %      void *client_data)
9798 %
9799 %  If the progress monitor returns MagickFalse, the current operation is
9800 %  interrupted.
9801 %
9802 %  The format of the MagickSetImageProgressMonitor method is:
9803 %
9804 %      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
9805 %        const MagickProgressMonitor progress_monitor,void *client_data)
9806 %
9807 %  A description of each parameter follows:
9808 %
9809 %    o wand: the magick wand.
9810 %
9811 %    o progress_monitor: Specifies a pointer to a method to monitor progress
9812 %      of an image operation.
9813 %
9814 %    o client_data: Specifies a pointer to any client data.
9815 %
9816 */
9817 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
9818   const MagickProgressMonitor progress_monitor,void *client_data)
9819 {
9820   MagickProgressMonitor
9821     previous_monitor;
9822
9823   assert(wand != (MagickWand *) NULL);
9824   assert(wand->signature == WandSignature);
9825   if (wand->debug != MagickFalse)
9826     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9827   if (wand->images == (Image *) NULL)
9828     {
9829       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
9830         "ContainsNoImages","`%s'",wand->name);
9831       return((MagickProgressMonitor) NULL);
9832     }
9833   previous_monitor=SetImageProgressMonitor(wand->images,
9834     progress_monitor,client_data);
9835   return(previous_monitor);
9836 }
9837 \f
9838 /*
9839 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9840 %                                                                             %
9841 %                                                                             %
9842 %                                                                             %
9843 %   M a g i c k S e t I m a g e R e d P r i m a r y                           %
9844 %                                                                             %
9845 %                                                                             %
9846 %                                                                             %
9847 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9848 %
9849 %  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
9850 %
9851 %  The format of the MagickSetImageRedPrimary method is:
9852 %
9853 %      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9854 %        const double x,const double y)
9855 %
9856 %  A description of each parameter follows:
9857 %
9858 %    o wand: the magick wand.
9859 %
9860 %    o x: the red primary x-point.
9861 %
9862 %    o y: the red primary y-point.
9863 %
9864 */
9865 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9866   const double x,const double y)
9867 {
9868   assert(wand != (MagickWand *) NULL);
9869   assert(wand->signature == WandSignature);
9870   if (wand->debug != MagickFalse)
9871     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9872   if (wand->images == (Image *) NULL)
9873     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9874   wand->images->chromaticity.red_primary.x=x;
9875   wand->images->chromaticity.red_primary.y=y;
9876   return(MagickTrue);
9877 }
9878 \f
9879 /*
9880 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9881 %                                                                             %
9882 %                                                                             %
9883 %                                                                             %
9884 %   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                 %
9885 %                                                                             %
9886 %                                                                             %
9887 %                                                                             %
9888 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9889 %
9890 %  MagickSetImageRenderingIntent() sets the image rendering intent.
9891 %
9892 %  The format of the MagickSetImageRenderingIntent method is:
9893 %
9894 %      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9895 %        const RenderingIntent rendering_intent)
9896 %
9897 %  A description of each parameter follows:
9898 %
9899 %    o wand: the magick wand.
9900 %
9901 %    o rendering_intent: the image rendering intent: UndefinedIntent,
9902 %      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
9903 %
9904 */
9905 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9906   const RenderingIntent rendering_intent)
9907 {
9908   assert(wand != (MagickWand *) NULL);
9909   assert(wand->signature == WandSignature);
9910   if (wand->debug != MagickFalse)
9911     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9912   if (wand->images == (Image *) NULL)
9913     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9914   wand->images->rendering_intent=rendering_intent;
9915   return(MagickTrue);
9916 }
9917 \f
9918 /*
9919 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9920 %                                                                             %
9921 %                                                                             %
9922 %                                                                             %
9923 %   M a g i c k S e t I m a g e R e s o l u t i o n                           %
9924 %                                                                             %
9925 %                                                                             %
9926 %                                                                             %
9927 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9928 %
9929 %  MagickSetImageResolution() sets the image resolution.
9930 %
9931 %  The format of the MagickSetImageResolution method is:
9932 %
9933 %      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9934 %        const double x_resolution,const doubtl y_resolution)
9935 %
9936 %  A description of each parameter follows:
9937 %
9938 %    o wand: the magick wand.
9939 %
9940 %    o x_resolution: the image x resolution.
9941 %
9942 %    o y_resolution: the image y resolution.
9943 %
9944 */
9945 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9946   const double x_resolution,const double y_resolution)
9947 {
9948   assert(wand != (MagickWand *) NULL);
9949   assert(wand->signature == WandSignature);
9950   if (wand->debug != MagickFalse)
9951     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9952   if (wand->images == (Image *) NULL)
9953     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9954   wand->images->resolution.x=x_resolution;
9955   wand->images->resolution.y=y_resolution;
9956   return(MagickTrue);
9957 }
9958 \f
9959 /*
9960 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9961 %                                                                             %
9962 %                                                                             %
9963 %                                                                             %
9964 %   M a g i c k S e t I m a g e S c e n e                                     %
9965 %                                                                             %
9966 %                                                                             %
9967 %                                                                             %
9968 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9969 %
9970 %  MagickSetImageScene() sets the image scene.
9971 %
9972 %  The format of the MagickSetImageScene method is:
9973 %
9974 %      MagickBooleanType MagickSetImageScene(MagickWand *wand,
9975 %        const size_t scene)
9976 %
9977 %  A description of each parameter follows:
9978 %
9979 %    o wand: the magick wand.
9980 %
9981 %    o delay: the image scene number.
9982 %
9983 */
9984 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
9985   const size_t scene)
9986 {
9987   assert(wand != (MagickWand *) NULL);
9988   assert(wand->signature == WandSignature);
9989   if (wand->debug != MagickFalse)
9990     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9991   if (wand->images == (Image *) NULL)
9992     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9993   wand->images->scene=scene;
9994   return(MagickTrue);
9995 }
9996 \f
9997 /*
9998 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9999 %                                                                             %
10000 %                                                                             %
10001 %                                                                             %
10002 %   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                   %
10003 %                                                                             %
10004 %                                                                             %
10005 %                                                                             %
10006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10007 %
10008 %  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10009 %
10010 %  The format of the MagickSetImageTicksPerSecond method is:
10011 %
10012 %      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10013 %        const ssize_t ticks_per-second)
10014 %
10015 %  A description of each parameter follows:
10016 %
10017 %    o wand: the magick wand.
10018 %
10019 %    o ticks_per_second: the units to use for the image delay.
10020 %
10021 */
10022 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10023   const ssize_t ticks_per_second)
10024 {
10025   assert(wand != (MagickWand *) NULL);
10026   assert(wand->signature == WandSignature);
10027   if (wand->debug != MagickFalse)
10028     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10029   if (wand->images == (Image *) NULL)
10030     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10031   wand->images->ticks_per_second=ticks_per_second;
10032   return(MagickTrue);
10033 }
10034 \f
10035 /*
10036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10037 %                                                                             %
10038 %                                                                             %
10039 %                                                                             %
10040 %   M a g i c k S e t I m a g e T y p e                                       %
10041 %                                                                             %
10042 %                                                                             %
10043 %                                                                             %
10044 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10045 %
10046 %  MagickSetImageType() sets the image type.
10047 %
10048 %  The format of the MagickSetImageType method is:
10049 %
10050 %      MagickBooleanType MagickSetImageType(MagickWand *wand,
10051 %        const ImageType image_type)
10052 %
10053 %  A description of each parameter follows:
10054 %
10055 %    o wand: the magick wand.
10056 %
10057 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10058 %      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10059 %      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10060 %      or OptimizeType.
10061 %
10062 */
10063 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10064   const ImageType image_type)
10065 {
10066   assert(wand != (MagickWand *) NULL);
10067   assert(wand->signature == WandSignature);
10068   if (wand->debug != MagickFalse)
10069     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10070   if (wand->images == (Image *) NULL)
10071     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10072   return(SetImageType(wand->images,image_type,wand->exception));
10073 }
10074 \f
10075 /*
10076 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10077 %                                                                             %
10078 %                                                                             %
10079 %                                                                             %
10080 %   M a g i c k S e t I m a g e U n i t s                                     %
10081 %                                                                             %
10082 %                                                                             %
10083 %                                                                             %
10084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10085 %
10086 %  MagickSetImageUnits() sets the image units of resolution.
10087 %
10088 %  The format of the MagickSetImageUnits method is:
10089 %
10090 %      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10091 %        const ResolutionType units)
10092 %
10093 %  A description of each parameter follows:
10094 %
10095 %    o wand: the magick wand.
10096 %
10097 %    o units: the image units of resolution : UndefinedResolution,
10098 %      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10099 %
10100 */
10101 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10102   const ResolutionType units)
10103 {
10104   assert(wand != (MagickWand *) NULL);
10105   assert(wand->signature == WandSignature);
10106   if (wand->debug != MagickFalse)
10107     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10108   if (wand->images == (Image *) NULL)
10109     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10110   wand->images->units=units;
10111   return(MagickTrue);
10112 }
10113 \f
10114 /*
10115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10116 %                                                                             %
10117 %                                                                             %
10118 %                                                                             %
10119 %   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           %
10120 %                                                                             %
10121 %                                                                             %
10122 %                                                                             %
10123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10124 %
10125 %  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10126 %
10127 %  The format of the MagickSetImageVirtualPixelMethod method is:
10128 %
10129 %      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10130 %        const VirtualPixelMethod method)
10131 %
10132 %  A description of each parameter follows:
10133 %
10134 %    o wand: the magick wand.
10135 %
10136 %    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10137 %      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10138 %      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10139 %
10140 */
10141 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10142   const VirtualPixelMethod method)
10143 {
10144   assert(wand != (MagickWand *) NULL);
10145   assert(wand->signature == WandSignature);
10146   if (wand->debug != MagickFalse)
10147     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10148   if (wand->images == (Image *) NULL)
10149     return(UndefinedVirtualPixelMethod);
10150   return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
10151 }
10152 \f
10153 /*
10154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10155 %                                                                             %
10156 %                                                                             %
10157 %                                                                             %
10158 %   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10159 %                                                                             %
10160 %                                                                             %
10161 %                                                                             %
10162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10163 %
10164 %  MagickSetImageWhitePoint() sets the image chromaticity white point.
10165 %
10166 %  The format of the MagickSetImageWhitePoint method is:
10167 %
10168 %      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10169 %        const double x,const double y)
10170 %
10171 %  A description of each parameter follows:
10172 %
10173 %    o wand: the magick wand.
10174 %
10175 %    o x: the white x-point.
10176 %
10177 %    o y: the white y-point.
10178 %
10179 */
10180 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10181   const double x,const double y)
10182 {
10183   assert(wand != (MagickWand *) NULL);
10184   assert(wand->signature == WandSignature);
10185   if (wand->debug != MagickFalse)
10186     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10187   if (wand->images == (Image *) NULL)
10188     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10189   wand->images->chromaticity.white_point.x=x;
10190   wand->images->chromaticity.white_point.y=y;
10191   return(MagickTrue);
10192 }
10193 \f
10194 /*
10195 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10196 %                                                                             %
10197 %                                                                             %
10198 %                                                                             %
10199 %   M a g i c k S h a d e I m a g e C h a n n e l                             %
10200 %                                                                             %
10201 %                                                                             %
10202 %                                                                             %
10203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10204 %
10205 %  MagickShadeImage() shines a distant light on an image to create a
10206 %  three-dimensional effect. You control the positioning of the light with
10207 %  azimuth and elevation; azimuth is measured in degrees off the x axis
10208 %  and elevation is measured in pixels above the Z axis.
10209 %
10210 %  The format of the MagickShadeImage method is:
10211 %
10212 %      MagickBooleanType MagickShadeImage(MagickWand *wand,
10213 %        const MagickBooleanType gray,const double azimuth,
10214 %        const double elevation)
10215 %
10216 %  A description of each parameter follows:
10217 %
10218 %    o wand: the magick wand.
10219 %
10220 %    o gray: A value other than zero shades the intensity of each pixel.
10221 %
10222 %    o azimuth, elevation:  Define the light source direction.
10223 %
10224 */
10225 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10226   const MagickBooleanType gray,const double asimuth,const double elevation)
10227 {
10228   Image
10229     *shade_image;
10230
10231   assert(wand != (MagickWand *) NULL);
10232   assert(wand->signature == WandSignature);
10233   if (wand->debug != MagickFalse)
10234     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10235   if (wand->images == (Image *) NULL)
10236     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10237   shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10238   if (shade_image == (Image *) NULL)
10239     return(MagickFalse);
10240   ReplaceImageInList(&wand->images,shade_image);
10241   return(MagickTrue);
10242 }
10243 \f
10244 /*
10245 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10246 %                                                                             %
10247 %                                                                             %
10248 %                                                                             %
10249 %   M a g i c k S h a d o w I m a g e                                         %
10250 %                                                                             %
10251 %                                                                             %
10252 %                                                                             %
10253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10254 %
10255 %  MagickShadowImage() simulates an image shadow.
10256 %
10257 %  The format of the MagickShadowImage method is:
10258 %
10259 %      MagickBooleanType MagickShadowImage(MagickWand *wand,
10260 %        const double alpha,const double sigma,const double bias,
10261 %        const ssize_t x,const ssize_t y)
10262 %
10263 %  A description of each parameter follows:
10264 %
10265 %    o wand: the magick wand.
10266 %
10267 %    o alpha: percentage transparency.
10268 %
10269 %    o sigma: the standard deviation of the Gaussian, in pixels.
10270 %
10271 %    o bias: the bias.
10272 %
10273 %    o x: the shadow x-offset.
10274 %
10275 %    o y: the shadow y-offset.
10276 %
10277 */
10278 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10279   const double alpha,const double sigma,const double bias,const ssize_t x,
10280   const ssize_t y)
10281 {
10282   Image
10283     *shadow_image;
10284
10285   assert(wand != (MagickWand *) NULL);
10286   assert(wand->signature == WandSignature);
10287   if (wand->debug != MagickFalse)
10288     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10289   if (wand->images == (Image *) NULL)
10290     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10291   shadow_image=ShadowImage(wand->images,alpha,sigma,bias,x,y,wand->exception);
10292   if (shadow_image == (Image *) NULL)
10293     return(MagickFalse);
10294   ReplaceImageInList(&wand->images,shadow_image);
10295   return(MagickTrue);
10296 }
10297 \f
10298 /*
10299 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10300 %                                                                             %
10301 %                                                                             %
10302 %                                                                             %
10303 %   M a g i c k S h a r p e n I m a g e                                       %
10304 %                                                                             %
10305 %                                                                             %
10306 %                                                                             %
10307 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10308 %
10309 %  MagickSharpenImage() sharpens an image.  We convolve the image with a
10310 %  Gaussian operator of the given radius and standard deviation (sigma).
10311 %  For reasonable results, the radius should be larger than sigma.  Use a
10312 %  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10313 %
10314 %  The format of the MagickSharpenImage method is:
10315 %
10316 %      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10317 %        const double radius,const double sigma,const double bias)
10318 %
10319 %  A description of each parameter follows:
10320 %
10321 %    o wand: the magick wand.
10322 %
10323 %    o radius: the radius of the Gaussian, in pixels, not counting the center
10324 %      pixel.
10325 %
10326 %    o sigma: the standard deviation of the Gaussian, in pixels.
10327 %
10328 %    o bias: the bias.
10329 %
10330 */
10331 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10332   const double radius,const double sigma,const double bias)
10333 {
10334   Image
10335     *sharp_image;
10336
10337   assert(wand != (MagickWand *) NULL);
10338   assert(wand->signature == WandSignature);
10339   if (wand->debug != MagickFalse)
10340     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10341   if (wand->images == (Image *) NULL)
10342     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10343   sharp_image=SharpenImage(wand->images,radius,sigma,bias,wand->exception);
10344   if (sharp_image == (Image *) NULL)
10345     return(MagickFalse);
10346   ReplaceImageInList(&wand->images,sharp_image);
10347   return(MagickTrue);
10348 }
10349 \f
10350 /*
10351 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10352 %                                                                             %
10353 %                                                                             %
10354 %                                                                             %
10355 %   M a g i c k S h a v e I m a g e                                           %
10356 %                                                                             %
10357 %                                                                             %
10358 %                                                                             %
10359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10360 %
10361 %  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10362 %  memory necessary for the new Image structure and returns a pointer to the
10363 %  new image.
10364 %
10365 %  The format of the MagickShaveImage method is:
10366 %
10367 %      MagickBooleanType MagickShaveImage(MagickWand *wand,
10368 %        const size_t columns,const size_t rows)
10369 %
10370 %  A description of each parameter follows:
10371 %
10372 %    o wand: the magick wand.
10373 %
10374 %    o columns: the number of columns in the scaled image.
10375 %
10376 %    o rows: the number of rows in the scaled image.
10377 %
10378 %
10379 */
10380 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10381   const size_t columns,const size_t rows)
10382 {
10383   Image
10384     *shave_image;
10385
10386   RectangleInfo
10387     shave_info;
10388
10389   assert(wand != (MagickWand *) NULL);
10390   assert(wand->signature == WandSignature);
10391   if (wand->debug != MagickFalse)
10392     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10393   if (wand->images == (Image *) NULL)
10394     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10395   shave_info.width=columns;
10396   shave_info.height=rows;
10397   shave_info.x=0;
10398   shave_info.y=0;
10399   shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10400   if (shave_image == (Image *) NULL)
10401     return(MagickFalse);
10402   ReplaceImageInList(&wand->images,shave_image);
10403   return(MagickTrue);
10404 }
10405 \f
10406 /*
10407 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10408 %                                                                             %
10409 %                                                                             %
10410 %                                                                             %
10411 %   M a g i c k S h e a r I m a g e                                           %
10412 %                                                                             %
10413 %                                                                             %
10414 %                                                                             %
10415 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10416 %
10417 %  MagickShearImage() slides one edge of an image along the X or Y axis,
10418 %  creating a parallelogram.  An X direction shear slides an edge along the X
10419 %  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10420 %  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10421 %  is measured relative to the Y axis, and similarly, for Y direction shears
10422 %  y_shear is measured relative to the X axis.  Empty triangles left over from
10423 %  shearing the image are filled with the background color.
10424 %
10425 %  The format of the MagickShearImage method is:
10426 %
10427 %      MagickBooleanType MagickShearImage(MagickWand *wand,
10428 %        const PixelWand *background,const double x_shear,onst double y_shear)
10429 %
10430 %  A description of each parameter follows:
10431 %
10432 %    o wand: the magick wand.
10433 %
10434 %    o background: the background pixel wand.
10435 %
10436 %    o x_shear: the number of degrees to shear the image.
10437 %
10438 %    o y_shear: the number of degrees to shear the image.
10439 %
10440 */
10441 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10442   const PixelWand *background,const double x_shear,const double y_shear)
10443 {
10444   Image
10445     *shear_image;
10446
10447   assert(wand != (MagickWand *) NULL);
10448   assert(wand->signature == WandSignature);
10449   if (wand->debug != MagickFalse)
10450     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10451   if (wand->images == (Image *) NULL)
10452     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10453   PixelGetQuantumPacket(background,&wand->images->background_color);
10454   shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10455   if (shear_image == (Image *) NULL)
10456     return(MagickFalse);
10457   ReplaceImageInList(&wand->images,shear_image);
10458   return(MagickTrue);
10459 }
10460 \f
10461 /*
10462 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10463 %                                                                             %
10464 %                                                                             %
10465 %                                                                             %
10466 %   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                   %
10467 %                                                                             %
10468 %                                                                             %
10469 %                                                                             %
10470 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10471 %
10472 %  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10473 %  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10474 %  image using a sigmoidal transfer function without saturating highlights or
10475 %  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10476 %  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10477 %  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10478 %  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10479 %  is reduced.
10480 %
10481 %  The format of the MagickSigmoidalContrastImage method is:
10482 %
10483 %      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10484 %        const MagickBooleanType sharpen,const double alpha,const double beta)
10485 %
10486 %  A description of each parameter follows:
10487 %
10488 %    o wand: the magick wand.
10489 %
10490 %    o sharpen: Increase or decrease image contrast.
10491 %
10492 %    o alpha: strength of the contrast, the larger the number the more
10493 %      'threshold-like' it becomes.
10494 %
10495 %    o beta: midpoint of the function as a color value 0 to QuantumRange.
10496 %
10497 */
10498 WandExport MagickBooleanType MagickSigmoidalContrastImage(
10499   MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10500   const double beta)
10501 {
10502   MagickBooleanType
10503     status;
10504
10505   assert(wand != (MagickWand *) NULL);
10506   assert(wand->signature == WandSignature);
10507   if (wand->debug != MagickFalse)
10508     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10509   if (wand->images == (Image *) NULL)
10510     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10511   status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10512     wand->exception);
10513   return(status);
10514 }
10515 \f
10516 /*
10517 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10518 %                                                                             %
10519 %                                                                             %
10520 %                                                                             %
10521 %   M a g i c k S i m i l a r i t y I m a g e                                 %
10522 %                                                                             %
10523 %                                                                             %
10524 %                                                                             %
10525 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10526 %
10527 %  MagickSimilarityImage() compares the reference image of the image and
10528 %  returns the best match offset.  In addition, it returns a similarity image
10529 %  such that an exact match location is completely white and if none of the
10530 %  pixels match, black, otherwise some gray level in-between.
10531 %
10532 %  The format of the MagickSimilarityImage method is:
10533 %
10534 %      MagickWand *MagickSimilarityImage(MagickWand *wand,
10535 %        const MagickWand *reference,const MetricType metric,
10536 %        RectangeInfo *offset,double *similarity)
10537 %
10538 %  A description of each parameter follows:
10539 %
10540 %    o wand: the magick wand.
10541 %
10542 %    o reference: the reference wand.
10543 %
10544 %    o metric: the metric.
10545 %
10546 %    o offset: the best match offset of the reference image within the image.
10547 %
10548 %    o similarity: the computed similarity between the images.
10549 %
10550 */
10551 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10552   const MagickWand *reference,const MetricType metric,RectangleInfo *offset,
10553   double *similarity)
10554 {
10555   Image
10556     *similarity_image;
10557
10558   assert(wand != (MagickWand *) NULL);
10559   assert(wand->signature == WandSignature);
10560   if (wand->debug != MagickFalse)
10561     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10562   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10563     {
10564       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10565         "ContainsNoImages","`%s'",wand->name);
10566       return((MagickWand *) NULL);
10567     }
10568   similarity_image=SimilarityImage(wand->images,reference->images,metric,offset,
10569     similarity,wand->exception);
10570   if (similarity_image == (Image *) NULL)
10571     return((MagickWand *) NULL);
10572   return(CloneMagickWandFromImages(wand,similarity_image));
10573 }
10574 \f
10575 /*
10576 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10577 %                                                                             %
10578 %                                                                             %
10579 %                                                                             %
10580 %   M a g i c k S k e t c h I m a g e                                         %
10581 %                                                                             %
10582 %                                                                             %
10583 %                                                                             %
10584 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10585 %
10586 %  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10587 %  a Gaussian operator of the given radius and standard deviation (sigma).
10588 %  For reasonable results, radius should be larger than sigma.  Use a
10589 %  radius of 0 and SketchImage() selects a suitable radius for you.
10590 %  Angle gives the angle of the blurring motion.
10591 %
10592 %  The format of the MagickSketchImage method is:
10593 %
10594 %      MagickBooleanType MagickSketchImage(MagickWand *wand,
10595 %        const double radius,const double sigma,const double angle,
10596 %        const double bias)
10597 %
10598 %  A description of each parameter follows:
10599 %
10600 %    o wand: the magick wand.
10601 %
10602 %    o radius: the radius of the Gaussian, in pixels, not counting
10603 %      the center pixel.
10604 %
10605 %    o sigma: the standard deviation of the Gaussian, in pixels.
10606 %
10607 %    o angle: apply the effect along this angle.
10608 %
10609 %    o bias: the bias.
10610 %
10611 */
10612 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10613   const double radius,const double sigma,const double angle,const double bias)
10614 {
10615   Image
10616     *sketch_image;
10617
10618   assert(wand != (MagickWand *) NULL);
10619   assert(wand->signature == WandSignature);
10620   if (wand->debug != MagickFalse)
10621     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10622   if (wand->images == (Image *) NULL)
10623     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10624   sketch_image=SketchImage(wand->images,radius,sigma,angle,bias,
10625     wand->exception);
10626   if (sketch_image == (Image *) NULL)
10627     return(MagickFalse);
10628   ReplaceImageInList(&wand->images,sketch_image);
10629   return(MagickTrue);
10630 }
10631 \f
10632 /*
10633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10634 %                                                                             %
10635 %                                                                             %
10636 %                                                                             %
10637 %   M a g i c k S m u s h I m a g e s                                         %
10638 %                                                                             %
10639 %                                                                             %
10640 %                                                                             %
10641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10642 %
10643 %  MagickSmushImages() takes all images from the current image pointer to the
10644 %  end of the image list and smushs them to each other top-to-bottom if the
10645 %  stack parameter is true, otherwise left-to-right.
10646 %
10647 %  The format of the MagickSmushImages method is:
10648 %
10649 %      MagickWand *MagickSmushImages(MagickWand *wand,
10650 %        const MagickBooleanType stack,const ssize_t offset)
10651 %
10652 %  A description of each parameter follows:
10653 %
10654 %    o wand: the magick wand.
10655 %
10656 %    o stack: By default, images are stacked left-to-right. Set stack to
10657 %      MagickTrue to stack them top-to-bottom.
10658 %
10659 %    o offset: minimum distance in pixels between images.
10660 %
10661 */
10662 WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10663   const MagickBooleanType stack,const ssize_t offset)
10664 {
10665   Image
10666     *smush_image;
10667
10668   assert(wand != (MagickWand *) NULL);
10669   assert(wand->signature == WandSignature);
10670   if (wand->debug != MagickFalse)
10671     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10672   if (wand->images == (Image *) NULL)
10673     return((MagickWand *) NULL);
10674   smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10675   if (smush_image == (Image *) NULL)
10676     return((MagickWand *) NULL);
10677   return(CloneMagickWandFromImages(wand,smush_image));
10678 }
10679 \f
10680 /*
10681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10682 %                                                                             %
10683 %                                                                             %
10684 %                                                                             %
10685 %     M a g i c k S o l a r i z e I m a g e                                   %
10686 %                                                                             %
10687 %                                                                             %
10688 %                                                                             %
10689 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10690 %
10691 %  MagickSolarizeImage() applies a special effect to the image, similar to the
10692 %  effect achieved in a photo darkroom by selectively exposing areas of photo
10693 %  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
10694 %  measure of the extent of the solarization.
10695 %
10696 %  The format of the MagickSolarizeImage method is:
10697 %
10698 %      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10699 %        const double threshold)
10700 %
10701 %  A description of each parameter follows:
10702 %
10703 %    o wand: the magick wand.
10704 %
10705 %    o threshold:  Define the extent of the solarization.
10706 %
10707 */
10708 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10709   const double threshold)
10710 {
10711   MagickBooleanType
10712     status;
10713
10714   assert(wand != (MagickWand *) NULL);
10715   assert(wand->signature == WandSignature);
10716   if (wand->debug != MagickFalse)
10717     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10718   if (wand->images == (Image *) NULL)
10719     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10720   status=SolarizeImage(wand->images,threshold,wand->exception);
10721   return(status);
10722 }
10723 \f
10724 /*
10725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10726 %                                                                             %
10727 %                                                                             %
10728 %                                                                             %
10729 %   M a g i c k S p a r s e C o l o r I m a g e                               %
10730 %                                                                             %
10731 %                                                                             %
10732 %                                                                             %
10733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10734 %
10735 %  MagickSparseColorImage(), given a set of coordinates, interpolates the
10736 %  colors found at those coordinates, across the whole image, using various
10737 %  methods.
10738 %
10739 %  The format of the MagickSparseColorImage method is:
10740 %
10741 %      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10742 %        const SparseColorMethod method,const size_t number_arguments,
10743 %        const double *arguments)
10744 %
10745 %  A description of each parameter follows:
10746 %
10747 %    o image: the image to be sparseed.
10748 %
10749 %    o method: the method of image sparseion.
10750 %
10751 %        ArcSparseColorion will always ignore source image offset, and always
10752 %        'bestfit' the destination image with the top left corner offset
10753 %        relative to the polar mapping center.
10754 %
10755 %        Bilinear has no simple inverse mapping so will not allow 'bestfit'
10756 %        style of image sparseion.
10757 %
10758 %        Affine, Perspective, and Bilinear, will do least squares fitting of
10759 %        the distrotion when more than the minimum number of control point
10760 %        pairs are provided.
10761 %
10762 %        Perspective, and Bilinear, will fall back to a Affine sparseion when
10763 %        less than 4 control point pairs are provided. While Affine sparseions
10764 %        will let you use any number of control point pairs, that is Zero pairs
10765 %        is a No-Op (viewport only) distrotion, one pair is a translation and
10766 %        two pairs of control points will do a scale-rotate-translate, without
10767 %        any shearing.
10768 %
10769 %    o number_arguments: the number of arguments given for this sparseion
10770 %      method.
10771 %
10772 %    o arguments: the arguments for this sparseion method.
10773 %
10774 */
10775 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10776   const SparseColorMethod method,const size_t number_arguments,
10777   const double *arguments)
10778 {
10779   Image
10780     *sparse_image;
10781
10782   assert(wand != (MagickWand *) NULL);
10783   assert(wand->signature == WandSignature);
10784   if (wand->debug != MagickFalse)
10785     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10786   if (wand->images == (Image *) NULL)
10787     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10788   sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
10789     wand->exception);
10790   if (sparse_image == (Image *) NULL)
10791     return(MagickFalse);
10792   ReplaceImageInList(&wand->images,sparse_image);
10793   return(MagickTrue);
10794 }
10795 \f
10796 /*
10797 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10798 %                                                                             %
10799 %                                                                             %
10800 %                                                                             %
10801 %   M a g i c k S p l i c e I m a g e                                         %
10802 %                                                                             %
10803 %                                                                             %
10804 %                                                                             %
10805 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10806 %
10807 %  MagickSpliceImage() splices a solid color into the image.
10808 %
10809 %  The format of the MagickSpliceImage method is:
10810 %
10811 %      MagickBooleanType MagickSpliceImage(MagickWand *wand,
10812 %        const size_t width,const size_t height,const ssize_t x,
10813 %        const ssize_t y)
10814 %
10815 %  A description of each parameter follows:
10816 %
10817 %    o wand: the magick wand.
10818 %
10819 %    o width: the region width.
10820 %
10821 %    o height: the region height.
10822 %
10823 %    o x: the region x offset.
10824 %
10825 %    o y: the region y offset.
10826 %
10827 */
10828 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
10829   const size_t width,const size_t height,const ssize_t x,
10830   const ssize_t y)
10831 {
10832   Image
10833     *splice_image;
10834
10835   RectangleInfo
10836     splice;
10837
10838   assert(wand != (MagickWand *) NULL);
10839   assert(wand->signature == WandSignature);
10840   if (wand->debug != MagickFalse)
10841     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10842   if (wand->images == (Image *) NULL)
10843     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10844   splice.width=width;
10845   splice.height=height;
10846   splice.x=x;
10847   splice.y=y;
10848   splice_image=SpliceImage(wand->images,&splice,wand->exception);
10849   if (splice_image == (Image *) NULL)
10850     return(MagickFalse);
10851   ReplaceImageInList(&wand->images,splice_image);
10852   return(MagickTrue);
10853 }
10854 \f
10855 /*
10856 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10857 %                                                                             %
10858 %                                                                             %
10859 %                                                                             %
10860 %   M a g i c k S p r e a d I m a g e                                         %
10861 %                                                                             %
10862 %                                                                             %
10863 %                                                                             %
10864 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10865 %
10866 %  MagickSpreadImage() is a special effects method that randomly displaces each
10867 %  pixel in a block defined by the radius parameter.
10868 %
10869 %  The format of the MagickSpreadImage method is:
10870 %
10871 %      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius,
10872 %        const PixelInterpolateMethod method)
10873 %
10874 %  A description of each parameter follows:
10875 %
10876 %    o wand: the magick wand.
10877 %
10878 %    o radius:  Choose a random pixel in a neighborhood of this extent.
10879 %
10880 %    o method: the pixel interpolation method.
10881 %
10882 */
10883 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
10884   const double radius,const PixelInterpolateMethod method)
10885 {
10886   Image
10887     *spread_image;
10888
10889   assert(wand != (MagickWand *) NULL);
10890   assert(wand->signature == WandSignature);
10891   if (wand->debug != MagickFalse)
10892     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10893   if (wand->images == (Image *) NULL)
10894     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10895   spread_image=SpreadImage(wand->images,radius,method,wand->exception);
10896   if (spread_image == (Image *) NULL)
10897     return(MagickFalse);
10898   ReplaceImageInList(&wand->images,spread_image);
10899   return(MagickTrue);
10900 }
10901 \f
10902 /*
10903 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10904 %                                                                             %
10905 %                                                                             %
10906 %                                                                             %
10907 %   M a g i c k S t a t i s t i c I m a g e                                   %
10908 %                                                                             %
10909 %                                                                             %
10910 %                                                                             %
10911 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10912 %
10913 %  MagickStatisticImage() replace each pixel with corresponding statistic from
10914 %  the neighborhood of the specified width and height.
10915 %
10916 %  The format of the MagickStatisticImage method is:
10917 %
10918 %      MagickBooleanType MagickStatisticImage(MagickWand *wand,
10919 %        const StatisticType type,const double width,const size_t height)
10920 %
10921 %  A description of each parameter follows:
10922 %
10923 %    o wand: the magick wand.
10924 %
10925 %    o type: the statistic type (e.g. median, mode, etc.).
10926 %
10927 %    o width: the width of the pixel neighborhood.
10928 %
10929 %    o height: the height of the pixel neighborhood.
10930 %
10931 */
10932 WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
10933   const StatisticType type,const size_t width,const size_t height)
10934 {
10935   Image
10936     *statistic_image;
10937
10938   assert(wand != (MagickWand *) NULL);
10939   assert(wand->signature == WandSignature);
10940   if (wand->debug != MagickFalse)
10941     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10942   if (wand->images == (Image *) NULL)
10943     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10944   statistic_image=StatisticImage(wand->images,type,width,height,
10945     wand->exception);
10946   if (statistic_image == (Image *) NULL)
10947     return(MagickFalse);
10948   ReplaceImageInList(&wand->images,statistic_image);
10949   return(MagickTrue);
10950 }
10951 \f
10952 /*
10953 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10954 %                                                                             %
10955 %                                                                             %
10956 %                                                                             %
10957 %   M a g i c k S t e g a n o I m a g e                                       %
10958 %                                                                             %
10959 %                                                                             %
10960 %                                                                             %
10961 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10962 %
10963 %  MagickSteganoImage() hides a digital watermark within the image.
10964 %  Recover the hidden watermark later to prove that the authenticity of
10965 %  an image.  Offset defines the start position within the image to hide
10966 %  the watermark.
10967 %
10968 %  The format of the MagickSteganoImage method is:
10969 %
10970 %      MagickWand *MagickSteganoImage(MagickWand *wand,
10971 %        const MagickWand *watermark_wand,const ssize_t offset)
10972 %
10973 %  A description of each parameter follows:
10974 %
10975 %    o wand: the magick wand.
10976 %
10977 %    o watermark_wand: the watermark wand.
10978 %
10979 %    o offset: Start hiding at this offset into the image.
10980 %
10981 */
10982 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
10983   const MagickWand *watermark_wand,const ssize_t offset)
10984 {
10985   Image
10986     *stegano_image;
10987
10988   assert(wand != (MagickWand *) NULL);
10989   assert(wand->signature == WandSignature);
10990   if (wand->debug != MagickFalse)
10991     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10992   if ((wand->images == (Image *) NULL) ||
10993       (watermark_wand->images == (Image *) NULL))
10994     {
10995       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10996         "ContainsNoImages","`%s'",wand->name);
10997       return((MagickWand *) NULL);
10998     }
10999   wand->images->offset=offset;
11000   stegano_image=SteganoImage(wand->images,watermark_wand->images,
11001     wand->exception);
11002   if (stegano_image == (Image *) NULL)
11003     return((MagickWand *) NULL);
11004   return(CloneMagickWandFromImages(wand,stegano_image));
11005 }
11006 \f
11007 /*
11008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11009 %                                                                             %
11010 %                                                                             %
11011 %                                                                             %
11012 %   M a g i c k S t e r e o I m a g e                                         %
11013 %                                                                             %
11014 %                                                                             %
11015 %                                                                             %
11016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11017 %
11018 %  MagickStereoImage() composites two images and produces a single image that
11019 %  is the composite of a left and right image of a stereo pair
11020 %
11021 %  The format of the MagickStereoImage method is:
11022 %
11023 %      MagickWand *MagickStereoImage(MagickWand *wand,
11024 %        const MagickWand *offset_wand)
11025 %
11026 %  A description of each parameter follows:
11027 %
11028 %    o wand: the magick wand.
11029 %
11030 %    o offset_wand: Another image wand.
11031 %
11032 */
11033 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11034   const MagickWand *offset_wand)
11035 {
11036   Image
11037     *stereo_image;
11038
11039   assert(wand != (MagickWand *) NULL);
11040   assert(wand->signature == WandSignature);
11041   if (wand->debug != MagickFalse)
11042     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11043   if ((wand->images == (Image *) NULL) ||
11044       (offset_wand->images == (Image *) NULL))
11045     {
11046       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11047         "ContainsNoImages","`%s'",wand->name);
11048       return((MagickWand *) NULL);
11049     }
11050   stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11051   if (stereo_image == (Image *) NULL)
11052     return((MagickWand *) NULL);
11053   return(CloneMagickWandFromImages(wand,stereo_image));
11054 }
11055 \f
11056 /*
11057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11058 %                                                                             %
11059 %                                                                             %
11060 %                                                                             %
11061 %   M a g i c k S t r i p I m a g e                                           %
11062 %                                                                             %
11063 %                                                                             %
11064 %                                                                             %
11065 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11066 %
11067 %  MagickStripImage() strips an image of all profiles and comments.
11068 %
11069 %  The format of the MagickStripImage method is:
11070 %
11071 %      MagickBooleanType MagickStripImage(MagickWand *wand)
11072 %
11073 %  A description of each parameter follows:
11074 %
11075 %    o wand: the magick wand.
11076 %
11077 */
11078 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11079 {
11080   assert(wand != (MagickWand *) NULL);
11081   assert(wand->signature == WandSignature);
11082   if (wand->debug != MagickFalse)
11083     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11084   if (wand->images == (Image *) NULL)
11085     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11086   return(StripImage(wand->images,wand->exception));
11087 }
11088 \f
11089 /*
11090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11091 %                                                                             %
11092 %                                                                             %
11093 %                                                                             %
11094 %   M a g i c k S w i r l I m a g e                                           %
11095 %                                                                             %
11096 %                                                                             %
11097 %                                                                             %
11098 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11099 %
11100 %  MagickSwirlImage() swirls the pixels about the center of the image, where
11101 %  degrees indicates the sweep of the arc through which each pixel is moved.
11102 %  You get a more dramatic effect as the degrees move from 1 to 360.
11103 %
11104 %  The format of the MagickSwirlImage method is:
11105 %
11106 %      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11107 %        const PixelInterpolateMethod method)
11108 %
11109 %  A description of each parameter follows:
11110 %
11111 %    o wand: the magick wand.
11112 %
11113 %    o degrees: Define the tightness of the swirling effect.
11114 %
11115 %    o method: the pixel interpolation method.
11116 %
11117 */
11118 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11119   const double degrees,const PixelInterpolateMethod method)
11120 {
11121   Image
11122     *swirl_image;
11123
11124   assert(wand != (MagickWand *) NULL);
11125   assert(wand->signature == WandSignature);
11126   if (wand->debug != MagickFalse)
11127     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11128   if (wand->images == (Image *) NULL)
11129     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11130   swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
11131   if (swirl_image == (Image *) NULL)
11132     return(MagickFalse);
11133   ReplaceImageInList(&wand->images,swirl_image);
11134   return(MagickTrue);
11135 }
11136 \f
11137 /*
11138 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11139 %                                                                             %
11140 %                                                                             %
11141 %                                                                             %
11142 %   M a g i c k T e x t u r e I m a g e                                       %
11143 %                                                                             %
11144 %                                                                             %
11145 %                                                                             %
11146 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11147 %
11148 %  MagickTextureImage() repeatedly tiles the texture image across and down the
11149 %  image canvas.
11150 %
11151 %  The format of the MagickTextureImage method is:
11152 %
11153 %      MagickWand *MagickTextureImage(MagickWand *wand,
11154 %        const MagickWand *texture_wand)
11155 %
11156 %  A description of each parameter follows:
11157 %
11158 %    o wand: the magick wand.
11159 %
11160 %    o texture_wand: the texture wand
11161 %
11162 */
11163 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11164   const MagickWand *texture_wand)
11165 {
11166   Image
11167     *texture_image;
11168
11169   MagickBooleanType
11170     status;
11171
11172   assert(wand != (MagickWand *) NULL);
11173   assert(wand->signature == WandSignature);
11174   if (wand->debug != MagickFalse)
11175     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11176   if ((wand->images == (Image *) NULL) ||
11177       (texture_wand->images == (Image *) NULL))
11178     {
11179       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11180         "ContainsNoImages","`%s'",wand->name);
11181       return((MagickWand *) NULL);
11182     }
11183   texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11184   if (texture_image == (Image *) NULL)
11185     return((MagickWand *) NULL);
11186   status=TextureImage(texture_image,texture_wand->images,wand->exception);
11187   if (status == MagickFalse)
11188     {
11189       texture_image=DestroyImage(texture_image);
11190       return((MagickWand *) NULL);
11191     }
11192   return(CloneMagickWandFromImages(wand,texture_image));
11193 }
11194 \f
11195 /*
11196 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11197 %                                                                             %
11198 %                                                                             %
11199 %                                                                             %
11200 %   M a g i c k T h r e s h o l d I m a g e                                   %
11201 %                                                                             %
11202 %                                                                             %
11203 %                                                                             %
11204 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11205 %
11206 %  MagickThresholdImage() changes the value of individual pixels based on
11207 %  the intensity of each pixel compared to threshold.  The result is a
11208 %  high-contrast, two color image.
11209 %
11210 %  The format of the MagickThresholdImage method is:
11211 %
11212 %      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11213 %        const double threshold)
11214 %      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11215 %        const ChannelType channel,const double threshold)
11216 %
11217 %  A description of each parameter follows:
11218 %
11219 %    o wand: the magick wand.
11220 %
11221 %    o channel: the image channel(s).
11222 %
11223 %    o threshold: Define the threshold value.
11224 %
11225 */
11226 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11227   const double threshold)
11228 {
11229   MagickBooleanType
11230     status;
11231
11232   status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11233   return(status);
11234 }
11235
11236 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11237   const ChannelType channel,const double threshold)
11238 {
11239   MagickBooleanType
11240     status;
11241
11242   assert(wand != (MagickWand *) NULL);
11243   assert(wand->signature == WandSignature);
11244   if (wand->debug != MagickFalse)
11245     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11246   if (wand->images == (Image *) NULL)
11247     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11248   status=BilevelImage(wand->images,threshold,wand->exception);
11249   return(status);
11250 }
11251 \f
11252 /*
11253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11254 %                                                                             %
11255 %                                                                             %
11256 %                                                                             %
11257 %   M a g i c k T h u m b n a i l I m a g e                                   %
11258 %                                                                             %
11259 %                                                                             %
11260 %                                                                             %
11261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11262 %
11263 %  MagickThumbnailImage()  changes the size of an image to the given dimensions
11264 %  and removes any associated profiles.  The goal is to produce small low cost
11265 %  thumbnail images suited for display on the Web.
11266 %
11267 %  The format of the MagickThumbnailImage method is:
11268 %
11269 %      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11270 %        const size_t columns,const size_t rows)
11271 %
11272 %  A description of each parameter follows:
11273 %
11274 %    o wand: the magick wand.
11275 %
11276 %    o columns: the number of columns in the scaled image.
11277 %
11278 %    o rows: the number of rows in the scaled image.
11279 %
11280 */
11281 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11282   const size_t columns,const size_t rows)
11283 {
11284   Image
11285     *thumbnail_image;
11286
11287   assert(wand != (MagickWand *) NULL);
11288   assert(wand->signature == WandSignature);
11289   if (wand->debug != MagickFalse)
11290     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11291   if (wand->images == (Image *) NULL)
11292     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11293   thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11294   if (thumbnail_image == (Image *) NULL)
11295     return(MagickFalse);
11296   ReplaceImageInList(&wand->images,thumbnail_image);
11297   return(MagickTrue);
11298 }
11299 \f
11300 /*
11301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11302 %                                                                             %
11303 %                                                                             %
11304 %                                                                             %
11305 %   M a g i c k T i n t I m a g e                                             %
11306 %                                                                             %
11307 %                                                                             %
11308 %                                                                             %
11309 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11310 %
11311 %  MagickTintImage() applies a color vector to each pixel in the image.  The
11312 %  length of the vector is 0 for black and white and at its maximum for the
11313 %  midtones.  The vector weighting function is
11314 %  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11315 %
11316 %  The format of the MagickTintImage method is:
11317 %
11318 %      MagickBooleanType MagickTintImage(MagickWand *wand,
11319 %        const PixelWand *tint,const PixelWand *blend)
11320 %
11321 %  A description of each parameter follows:
11322 %
11323 %    o wand: the magick wand.
11324 %
11325 %    o tint: the tint pixel wand.
11326 %
11327 %    o alpha: the alpha pixel wand.
11328 %
11329 */
11330 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11331   const PixelWand *tint,const PixelWand *blend)
11332 {
11333   char
11334     percent_blend[MaxTextExtent];
11335
11336   Image
11337     *tint_image;
11338
11339   PixelInfo
11340     target;
11341
11342   assert(wand != (MagickWand *) NULL);
11343   assert(wand->signature == WandSignature);
11344   if (wand->debug != MagickFalse)
11345     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11346   if (wand->images == (Image *) NULL)
11347     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11348   if (wand->images->colorspace != CMYKColorspace)
11349     (void) FormatLocaleString(percent_blend,MaxTextExtent,
11350       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11351       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11352       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11353       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11354       PixelGetAlphaQuantum(blend)));
11355   else
11356     (void) FormatLocaleString(percent_blend,MaxTextExtent,
11357       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
11358       PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11359       PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11360       PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11361       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11362       PixelGetAlphaQuantum(blend)));
11363   target=PixelGetPixel(tint);
11364   tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
11365   if (tint_image == (Image *) NULL)
11366     return(MagickFalse);
11367   ReplaceImageInList(&wand->images,tint_image);
11368   return(MagickTrue);
11369 }
11370 \f
11371 /*
11372 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11373 %                                                                             %
11374 %                                                                             %
11375 %                                                                             %
11376 %   M a g i c k T r a n s f o r m I m a g e                                   %
11377 %                                                                             %
11378 %                                                                             %
11379 %                                                                             %
11380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11381 %
11382 %  MagickTransformImage() is a convenience method that behaves like
11383 %  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11384 %  information as a region geometry specification.  If the operation fails,
11385 %  a NULL image handle is returned.
11386 %
11387 %  The format of the MagickTransformImage method is:
11388 %
11389 %      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11390 %        const char *geometry)
11391 %
11392 %  A description of each parameter follows:
11393 %
11394 %    o wand: the magick wand.
11395 %
11396 %    o crop: A crop geometry string.  This geometry defines a subregion of the
11397 %      image to crop.
11398 %
11399 %    o geometry: An image geometry string.  This geometry defines the final
11400 %      size of the image.
11401 %
11402 */
11403 WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11404   const char *crop,const char *geometry)
11405 {
11406   Image
11407     *transform_image;
11408
11409   MagickBooleanType
11410     status;
11411
11412   assert(wand != (MagickWand *) NULL);
11413   assert(wand->signature == WandSignature);
11414   if (wand->debug != MagickFalse)
11415     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11416   if (wand->images == (Image *) NULL)
11417     return((MagickWand *) NULL);
11418   transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11419   if (transform_image == (Image *) NULL)
11420     return((MagickWand *) NULL);
11421   status=TransformImage(&transform_image,crop,geometry,wand->exception);
11422   if (status == MagickFalse)
11423     {
11424       transform_image=DestroyImage(transform_image);
11425       return((MagickWand *) NULL);
11426     }
11427   return(CloneMagickWandFromImages(wand,transform_image));
11428 }
11429 \f
11430 /*
11431 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11432 %                                                                             %
11433 %                                                                             %
11434 %                                                                             %
11435 %   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               %
11436 %                                                                             %
11437 %                                                                             %
11438 %                                                                             %
11439 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11440 %
11441 %  MagickTransformImageColorspace() transform the image colorspace.
11442 %
11443 %  The format of the MagickTransformImageColorspace method is:
11444 %
11445 %      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11446 %        const ColorspaceType colorspace)
11447 %
11448 %  A description of each parameter follows:
11449 %
11450 %    o wand: the magick wand.
11451 %
11452 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
11453 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
11454 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
11455 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
11456 %      HSLColorspace, or HWBColorspace.
11457 %
11458 */
11459 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11460   const ColorspaceType colorspace)
11461 {
11462   assert(wand != (MagickWand *) NULL);
11463   assert(wand->signature == WandSignature);
11464   if (wand->debug != MagickFalse)
11465     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11466   if (wand->images == (Image *) NULL)
11467     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11468   return(TransformImageColorspace(wand->images,colorspace,wand->exception));
11469 }
11470 \f
11471 /*
11472 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11473 %                                                                             %
11474 %                                                                             %
11475 %                                                                             %
11476 %   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                     %
11477 %                                                                             %
11478 %                                                                             %
11479 %                                                                             %
11480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11481 %
11482 %  MagickTransparentPaintImage() changes any pixel that matches color with the
11483 %  color defined by fill.
11484 %
11485 %  The format of the MagickTransparentPaintImage method is:
11486 %
11487 %      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11488 %        const PixelWand *target,const double alpha,const double fuzz,
11489 %        const MagickBooleanType invert)
11490 %
11491 %  A description of each parameter follows:
11492 %
11493 %    o wand: the magick wand.
11494 %
11495 %    o target: Change this target color to specified alpha value within
11496 %      the image.
11497 %
11498 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11499 %      transparent.
11500 %
11501 %    o fuzz: By default target must match a particular pixel color
11502 %      exactly.  However, in many cases two colors may differ by a small amount.
11503 %      The fuzz member of image defines how much tolerance is acceptable to
11504 %      consider two colors as the same.  For example, set fuzz to 10 and the
11505 %      color red at intensities of 100 and 102 respectively are now interpreted
11506 %      as the same color for the purposes of the floodfill.
11507 %
11508 %    o invert: paint any pixel that does not match the target color.
11509 %
11510 */
11511 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11512   const PixelWand *target,const double alpha,const double fuzz,
11513   const MagickBooleanType invert)
11514 {
11515   MagickBooleanType
11516     status;
11517
11518   PixelInfo
11519     target_pixel;
11520
11521   assert(wand != (MagickWand *) NULL);
11522   assert(wand->signature == WandSignature);
11523   if (wand->debug != MagickFalse)
11524     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11525   if (wand->images == (Image *) NULL)
11526     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11527   PixelGetMagickColor(target,&target_pixel);
11528   wand->images->fuzz=fuzz;
11529   status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11530     QuantumRange*alpha),invert,wand->exception);
11531   return(status);
11532 }
11533 \f
11534 /*
11535 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11536 %                                                                             %
11537 %                                                                             %
11538 %                                                                             %
11539 %   M a g i c k T r a n s p o s e I m a g e                                   %
11540 %                                                                             %
11541 %                                                                             %
11542 %                                                                             %
11543 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11544 %
11545 %  MagickTransposeImage() creates a vertical mirror image by reflecting the
11546 %  pixels around the central x-axis while rotating them 90-degrees.
11547 %
11548 %  The format of the MagickTransposeImage method is:
11549 %
11550 %      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11551 %
11552 %  A description of each parameter follows:
11553 %
11554 %    o wand: the magick wand.
11555 %
11556 */
11557 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11558 {
11559   Image
11560     *transpose_image;
11561
11562   assert(wand != (MagickWand *) NULL);
11563   assert(wand->signature == WandSignature);
11564   if (wand->debug != MagickFalse)
11565     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11566   if (wand->images == (Image *) NULL)
11567     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11568   transpose_image=TransposeImage(wand->images,wand->exception);
11569   if (transpose_image == (Image *) NULL)
11570     return(MagickFalse);
11571   ReplaceImageInList(&wand->images,transpose_image);
11572   return(MagickTrue);
11573 }
11574 \f
11575 /*
11576 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11577 %                                                                             %
11578 %                                                                             %
11579 %                                                                             %
11580 %   M a g i c k T r a n s v e r s e I m a g e                                 %
11581 %                                                                             %
11582 %                                                                             %
11583 %                                                                             %
11584 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11585 %
11586 %  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11587 %  pixels around the central y-axis while rotating them 270-degrees.
11588 %
11589 %  The format of the MagickTransverseImage method is:
11590 %
11591 %      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11592 %
11593 %  A description of each parameter follows:
11594 %
11595 %    o wand: the magick wand.
11596 %
11597 */
11598 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11599 {
11600   Image
11601     *transverse_image;
11602
11603   assert(wand != (MagickWand *) NULL);
11604   assert(wand->signature == WandSignature);
11605   if (wand->debug != MagickFalse)
11606     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11607   if (wand->images == (Image *) NULL)
11608     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11609   transverse_image=TransverseImage(wand->images,wand->exception);
11610   if (transverse_image == (Image *) NULL)
11611     return(MagickFalse);
11612   ReplaceImageInList(&wand->images,transverse_image);
11613   return(MagickTrue);
11614 }
11615 \f
11616 /*
11617 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11618 %                                                                             %
11619 %                                                                             %
11620 %                                                                             %
11621 %   M a g i c k T r i m I m a g e                                             %
11622 %                                                                             %
11623 %                                                                             %
11624 %                                                                             %
11625 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11626 %
11627 %  MagickTrimImage() remove edges that are the background color from the image.
11628 %
11629 %  The format of the MagickTrimImage method is:
11630 %
11631 %      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11632 %
11633 %  A description of each parameter follows:
11634 %
11635 %    o wand: the magick wand.
11636 %
11637 %    o fuzz: By default target must match a particular pixel color
11638 %      exactly.  However, in many cases two colors may differ by a small amount.
11639 %      The fuzz member of image defines how much tolerance is acceptable to
11640 %      consider two colors as the same.  For example, set fuzz to 10 and the
11641 %      color red at intensities of 100 and 102 respectively are now interpreted
11642 %      as the same color for the purposes of the floodfill.
11643 %
11644 */
11645 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11646 {
11647   Image
11648     *trim_image;
11649
11650   assert(wand != (MagickWand *) NULL);
11651   assert(wand->signature == WandSignature);
11652   if (wand->debug != MagickFalse)
11653     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11654   if (wand->images == (Image *) NULL)
11655     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11656   wand->images->fuzz=fuzz;
11657   trim_image=TrimImage(wand->images,wand->exception);
11658   if (trim_image == (Image *) NULL)
11659     return(MagickFalse);
11660   ReplaceImageInList(&wand->images,trim_image);
11661   return(MagickTrue);
11662 }
11663 \f
11664 /*
11665 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11666 %                                                                             %
11667 %                                                                             %
11668 %                                                                             %
11669 %   M a g i c k U n i q u e I m a g e C o l o r s                             %
11670 %                                                                             %
11671 %                                                                             %
11672 %                                                                             %
11673 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11674 %
11675 %  MagickUniqueImageColors() discards all but one of any pixel color.
11676 %
11677 %  The format of the MagickUniqueImageColors method is:
11678 %
11679 %      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11680 %
11681 %  A description of each parameter follows:
11682 %
11683 %    o wand: the magick wand.
11684 %
11685 */
11686 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11687 {
11688   Image
11689     *unique_image;
11690
11691   assert(wand != (MagickWand *) NULL);
11692   assert(wand->signature == WandSignature);
11693   if (wand->debug != MagickFalse)
11694     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11695   if (wand->images == (Image *) NULL)
11696     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11697   unique_image=UniqueImageColors(wand->images,wand->exception);
11698   if (unique_image == (Image *) NULL)
11699     return(MagickFalse);
11700   ReplaceImageInList(&wand->images,unique_image);
11701   return(MagickTrue);
11702 }
11703 \f
11704 /*
11705 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11706 %                                                                             %
11707 %                                                                             %
11708 %                                                                             %
11709 %   M a g i c k U n s h a r p M a s k I m a g e                               %
11710 %                                                                             %
11711 %                                                                             %
11712 %                                                                             %
11713 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11714 %
11715 %  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
11716 %  Gaussian operator of the given radius and standard deviation (sigma).
11717 %  For reasonable results, radius should be larger than sigma.  Use a radius
11718 %  of 0 and UnsharpMaskImage() selects a suitable radius for you.
11719 %
11720 %  The format of the MagickUnsharpMaskImage method is:
11721 %
11722 %      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11723 %        const double radius,const double sigma,const double amount,
11724 %        const double threshold)
11725 %
11726 %  A description of each parameter follows:
11727 %
11728 %    o wand: the magick wand.
11729 %
11730 %    o radius: the radius of the Gaussian, in pixels, not counting the center
11731 %      pixel.
11732 %
11733 %    o sigma: the standard deviation of the Gaussian, in pixels.
11734 %
11735 %    o amount: the percentage of the difference between the original and the
11736 %      blur image that is added back into the original.
11737 %
11738 %    o threshold: the threshold in pixels needed to apply the diffence amount.
11739 %
11740 */
11741 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11742   const double radius,const double sigma,const double amount,
11743   const double threshold)
11744 {
11745   Image
11746     *unsharp_image;
11747
11748   assert(wand != (MagickWand *) NULL);
11749   assert(wand->signature == WandSignature);
11750   if (wand->debug != MagickFalse)
11751     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11752   if (wand->images == (Image *) NULL)
11753     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11754   unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
11755     wand->exception);
11756   if (unsharp_image == (Image *) NULL)
11757     return(MagickFalse);
11758   ReplaceImageInList(&wand->images,unsharp_image);
11759   return(MagickTrue);
11760 }
11761 \f
11762 /*
11763 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11764 %                                                                             %
11765 %                                                                             %
11766 %                                                                             %
11767 %   M a g i c k V i g n e t t e I m a g e                                     %
11768 %                                                                             %
11769 %                                                                             %
11770 %                                                                             %
11771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11772 %
11773 %  MagickVignetteImage() softens the edges of the image in vignette style.
11774 %
11775 %  The format of the MagickVignetteImage method is:
11776 %
11777 %      MagickBooleanType MagickVignetteImage(MagickWand *wand,
11778 %        const double radius,const double sigma,const double bias,
11779 %        const ssize_t x,const ssize_t y)
11780 %
11781 %  A description of each parameter follows:
11782 %
11783 %    o wand: the magick wand.
11784 %
11785 %    o radius: the radius.
11786 %
11787 %    o sigma: the sigma.
11788 %
11789 %    o bias: the bias.
11790 %
11791 %    o x, y:  Define the x and y ellipse offset.
11792 %
11793 */
11794 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
11795   const double radius,const double sigma,const double bias,const ssize_t x,
11796   const ssize_t y)
11797 {
11798   Image
11799     *vignette_image;
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   vignette_image=VignetteImage(wand->images,radius,sigma,bias,x,y,
11808     wand->exception);
11809   if (vignette_image == (Image *) NULL)
11810     return(MagickFalse);
11811   ReplaceImageInList(&wand->images,vignette_image);
11812   return(MagickTrue);
11813 }
11814 \f
11815 /*
11816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11817 %                                                                             %
11818 %                                                                             %
11819 %                                                                             %
11820 %   M a g i c k W a v e I m a g e                                             %
11821 %                                                                             %
11822 %                                                                             %
11823 %                                                                             %
11824 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11825 %
11826 %  MagickWaveImage()  creates a "ripple" effect in the image by shifting
11827 %  the pixels vertically along a sine wave whose amplitude and wavelength
11828 %  is specified by the given parameters.
11829 %
11830 %  The format of the MagickWaveImage method is:
11831 %
11832 %      MagickBooleanType MagickWaveImage(MagickWand *wand,
11833 %        const double amplitude,const double wave_length,
11834 %        const PixelInterpolateMethod method)
11835 %
11836 %  A description of each parameter follows:
11837 %
11838 %    o wand: the magick wand.
11839 %
11840 %    o amplitude, wave_length:  Define the amplitude and wave length of the
11841 %      sine wave.
11842 %
11843 %    o method: the pixel interpolation method.
11844 %
11845 */
11846 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
11847   const double amplitude,const double wave_length,
11848   const PixelInterpolateMethod method)
11849 {
11850   Image
11851     *wave_image;
11852
11853   assert(wand != (MagickWand *) NULL);
11854   assert(wand->signature == WandSignature);
11855   if (wand->debug != MagickFalse)
11856     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11857   if (wand->images == (Image *) NULL)
11858     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11859   wave_image=WaveImage(wand->images,amplitude,wave_length,method,
11860     wand->exception);
11861   if (wave_image == (Image *) NULL)
11862     return(MagickFalse);
11863   ReplaceImageInList(&wand->images,wave_image);
11864   return(MagickTrue);
11865 }
11866 \f
11867 /*
11868 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11869 %                                                                             %
11870 %                                                                             %
11871 %                                                                             %
11872 %   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                         %
11873 %                                                                             %
11874 %                                                                             %
11875 %                                                                             %
11876 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11877 %
11878 %  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
11879 %  above the threshold into white while leaving all pixels below the threshold
11880 %  unchanged.
11881 %
11882 %  The format of the MagickWhiteThresholdImage method is:
11883 %
11884 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11885 %        const PixelWand *threshold)
11886 %
11887 %  A description of each parameter follows:
11888 %
11889 %    o wand: the magick wand.
11890 %
11891 %    o threshold: the pixel wand.
11892 %
11893 */
11894 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11895   const PixelWand *threshold)
11896 {
11897   char
11898     thresholds[MaxTextExtent];
11899
11900   assert(wand != (MagickWand *) NULL);
11901   assert(wand->signature == WandSignature);
11902   if (wand->debug != MagickFalse)
11903     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11904   if (wand->images == (Image *) NULL)
11905     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11906   (void) FormatLocaleString(thresholds,MaxTextExtent,
11907     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
11908     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
11909     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
11910   return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
11911 }
11912 \f
11913 /*
11914 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11915 %                                                                             %
11916 %                                                                             %
11917 %                                                                             %
11918 %   M a g i c k W r i t e I m a g e                                           %
11919 %                                                                             %
11920 %                                                                             %
11921 %                                                                             %
11922 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11923 %
11924 %  MagickWriteImage() writes an image to the specified filename.  If the
11925 %  filename parameter is NULL, the image is written to the filename set
11926 %  by MagickReadImage() or MagickSetImageFilename().
11927 %
11928 %  The format of the MagickWriteImage method is:
11929 %
11930 %      MagickBooleanType MagickWriteImage(MagickWand *wand,
11931 %        const char *filename)
11932 %
11933 %  A description of each parameter follows:
11934 %
11935 %    o wand: the magick wand.
11936 %
11937 %    o filename: the image filename.
11938 %
11939 %
11940 */
11941 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
11942   const char *filename)
11943 {
11944   Image
11945     *image;
11946
11947   ImageInfo
11948     *write_info;
11949
11950   MagickBooleanType
11951     status;
11952
11953   assert(wand != (MagickWand *) NULL);
11954   assert(wand->signature == WandSignature);
11955   if (wand->debug != MagickFalse)
11956     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11957   if (wand->images == (Image *) NULL)
11958     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11959   if (filename != (const char *) NULL)
11960     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
11961   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11962   if (image == (Image *) NULL)
11963     return(MagickFalse);
11964   write_info=CloneImageInfo(wand->image_info);
11965   write_info->adjoin=MagickTrue;
11966   status=WriteImage(write_info,image,wand->exception);
11967   image=DestroyImage(image);
11968   write_info=DestroyImageInfo(write_info);
11969   return(status);
11970 }
11971 \f
11972 /*
11973 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11974 %                                                                             %
11975 %                                                                             %
11976 %                                                                             %
11977 %   M a g i c k W r i t e I m a g e F i l e                                   %
11978 %                                                                             %
11979 %                                                                             %
11980 %                                                                             %
11981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11982 %
11983 %  MagickWriteImageFile() writes an image to an open file descriptor.
11984 %
11985 %  The format of the MagickWriteImageFile method is:
11986 %
11987 %      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11988 %
11989 %  A description of each parameter follows:
11990 %
11991 %    o wand: the magick wand.
11992 %
11993 %    o file: the file descriptor.
11994 %
11995 */
11996 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11997 {
11998   Image
11999     *image;
12000
12001   ImageInfo
12002     *write_info;
12003
12004   MagickBooleanType
12005     status;
12006
12007   assert(wand != (MagickWand *) NULL);
12008   assert(wand->signature == WandSignature);
12009   assert(file != (FILE *) NULL);
12010   if (wand->debug != MagickFalse)
12011     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12012   if (wand->images == (Image *) NULL)
12013     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12014   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12015   if (image == (Image *) NULL)
12016     return(MagickFalse);
12017   write_info=CloneImageInfo(wand->image_info);
12018   SetImageInfoFile(write_info,file);
12019   write_info->adjoin=MagickTrue;
12020   status=WriteImage(write_info,image,wand->exception);
12021   write_info=DestroyImageInfo(write_info);
12022   image=DestroyImage(image);
12023   return(status);
12024 }
12025 \f
12026 /*
12027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12028 %                                                                             %
12029 %                                                                             %
12030 %                                                                             %
12031 %   M a g i c k W r i t e I m a g e s                                         %
12032 %                                                                             %
12033 %                                                                             %
12034 %                                                                             %
12035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12036 %
12037 %  MagickWriteImages() writes an image or image sequence.
12038 %
12039 %  The format of the MagickWriteImages method is:
12040 %
12041 %      MagickBooleanType MagickWriteImages(MagickWand *wand,
12042 %        const char *filename,const MagickBooleanType adjoin)
12043 %
12044 %  A description of each parameter follows:
12045 %
12046 %    o wand: the magick wand.
12047 %
12048 %    o filename: the image filename.
12049 %
12050 %    o adjoin: join images into a single multi-image file.
12051 %
12052 */
12053 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12054   const char *filename,const MagickBooleanType adjoin)
12055 {
12056   ImageInfo
12057     *write_info;
12058
12059   MagickBooleanType
12060     status;
12061
12062   assert(wand != (MagickWand *) NULL);
12063   assert(wand->signature == WandSignature);
12064   if (wand->debug != MagickFalse)
12065     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12066   if (wand->images == (Image *) NULL)
12067     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12068   write_info=CloneImageInfo(wand->image_info);
12069   write_info->adjoin=adjoin;
12070   status=WriteImages(write_info,wand->images,filename,wand->exception);
12071   write_info=DestroyImageInfo(write_info);
12072   return(status);
12073 }
12074 \f
12075 /*
12076 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12077 %                                                                             %
12078 %                                                                             %
12079 %                                                                             %
12080 %   M a g i c k W r i t e I m a g e s F i l e                                 %
12081 %                                                                             %
12082 %                                                                             %
12083 %                                                                             %
12084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12085 %
12086 %  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12087 %
12088 %  The format of the MagickWriteImagesFile method is:
12089 %
12090 %      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12091 %
12092 %  A description of each parameter follows:
12093 %
12094 %    o wand: the magick wand.
12095 %
12096 %    o file: the file descriptor.
12097 %
12098 */
12099 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12100 {
12101   ImageInfo
12102     *write_info;
12103
12104   MagickBooleanType
12105     status;
12106
12107   assert(wand != (MagickWand *) NULL);
12108   assert(wand->signature == WandSignature);
12109   if (wand->debug != MagickFalse)
12110     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12111   if (wand->images == (Image *) NULL)
12112     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12113   write_info=CloneImageInfo(wand->image_info);
12114   SetImageInfoFile(write_info,file);
12115   write_info->adjoin=MagickTrue;
12116   status=WriteImages(write_info,wand->images,(const char *) NULL,
12117     wand->exception);
12118   write_info=DestroyImageInfo(write_info);
12119   return(status);
12120 }