]> granicus.if.org Git - imagemagick/blob - MagickWand/magick-image.c
(no commit message)
[imagemagick] / MagickWand / magick-image.c
1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %                                                                             %
4 %                                                                             %
5 %                                                                             %
6 %                 M   M   AAA    GGGG  IIIII   CCCC  K   K                    %
7 %                 MM MM  A   A  G        I    C      K  K                     %
8 %                 M M M  AAAAA  G GGG    I    C      KKK                      %
9 %                 M   M  A   A  G   G    I    C      K  K                     %
10 %                 M   M  A   A   GGGG  IIIII   CCCC  K   K                    %
11 %                                                                             %
12 %                     IIIII  M   M   AAA    GGGG  EEEEE                       %
13 %                       I    MM MM  A   A  G      E                           %
14 %                       I    M M M  AAAAA  G  GG  EEE                         %
15 %                       I    M   M  A   A  G   G  E                           %
16 %                     IIIII  M   M  A   A   GGGG  EEEEE                       %
17 %                                                                             %
18 %                                                                             %
19 %                          MagickWand Image Methods                           %
20 %                                                                             %
21 %                               Software Design                               %
22 %                                 John Cristy                                 %
23 %                                 August 2003                                 %
24 %                                                                             %
25 %                                                                             %
26 %  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
27 %  dedicated to making software imaging solutions freely available.           %
28 %                                                                             %
29 %  You may not use this file except in compliance with the License.  You may  %
30 %  obtain a copy of the License at                                            %
31 %                                                                             %
32 %    http://www.imagemagick.org/script/license.php                            %
33 %                                                                             %
34 %  Unless required by applicable law or agreed to in writing, software        %
35 %  distributed under the License is distributed on an "AS IS" BASIS,          %
36 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
37 %  See the License for the specific language governing permissions and        %
38 %  limitations under the License.                                             %
39 %                                                                             %
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 %
42 %
43 %
44 */
45 \f
46 /*
47   Include declarations.
48 */
49 #include "MagickWand/studio.h"
50 #include "MagickWand/MagickWand.h"
51 #include "MagickWand/magick-wand-private.h"
52 #include "MagickWand/wand.h"
53 #include "MagickWand/pixel-wand-private.h"
54 \f
55 /*
56   Define declarations.
57 */
58 #define ThrowWandException(severity,tag,context) \
59 { \
60   (void) ThrowMagickException(wand->exception,GetMagickModule(),severity, \
61     tag,"`%s'",context); \
62   return(MagickFalse); \
63 }
64 #define MagickWandId  "MagickWand"
65 \f
66 /*
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68 %                                                                             %
69 %                                                                             %
70 %                                                                             %
71 +   C l o n e M a g i c k W a n d F r o m I m a g e s                         %
72 %                                                                             %
73 %                                                                             %
74 %                                                                             %
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76 %
77 %  CloneMagickWandFromImages() clones the magick wand and inserts a new image
78 %  list.
79 %
80 %  The format of the CloneMagickWandFromImages method is:
81 %
82 %      MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
83 %        Image *images)
84 %
85 %  A description of each parameter follows:
86 %
87 %    o wand: the magick wand.
88 %
89 %    o images: replace the image list with these image(s).
90 %
91 */
92 static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
93   Image *images)
94 {
95   MagickWand
96     *clone_wand;
97
98   assert(wand != (MagickWand *) NULL);
99   assert(wand->signature == WandSignature);
100   if (wand->debug != MagickFalse)
101     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
102   clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
103   if (clone_wand == (MagickWand *) NULL)
104     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
105       images->filename);
106   (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
107   clone_wand->id=AcquireWandId();
108   (void) FormatLocaleString(clone_wand->name,MaxTextExtent,"%s-%.20g",
109     MagickWandId,(double) clone_wand->id);
110   clone_wand->exception=AcquireExceptionInfo();
111   InheritException(clone_wand->exception,wand->exception);
112   clone_wand->image_info=CloneImageInfo(wand->image_info);
113   clone_wand->quantize_info=CloneQuantizeInfo(wand->quantize_info);
114   clone_wand->images=images;
115   clone_wand->debug=IsEventLogging();
116   if (clone_wand->debug != MagickFalse)
117     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
118   clone_wand->signature=WandSignature;
119   return(clone_wand);
120 }
121 \f
122 /*
123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
124 %                                                                             %
125 %                                                                             %
126 %                                                                             %
127 %   G e t I m a g e F r o m M a g i c k W a n d                               %
128 %                                                                             %
129 %                                                                             %
130 %                                                                             %
131 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
132 %
133 %  GetImageFromMagickWand() returns the current image from the magick wand.
134 %
135 %  The format of the GetImageFromMagickWand method is:
136 %
137 %      Image *GetImageFromMagickWand(const MagickWand *wand)
138 %
139 %  A description of each parameter follows:
140 %
141 %    o wand: the magick wand.
142 %
143 */
144 WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
145 {
146   assert(wand != (MagickWand *) NULL);
147   assert(wand->signature == WandSignature);
148   if (wand->debug != MagickFalse)
149     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
150   if (wand->images == (Image *) NULL)
151     {
152       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
153         "ContainsNoImages","`%s'",wand->name);
154       return((Image *) NULL);
155     }
156   return(wand->images);
157 }
158 \f
159 /*
160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
161 %                                                                             %
162 %                                                                             %
163 %                                                                             %
164 %   M a g i c k A d a p t i v e S h a r p e n I m a g e                       %
165 %                                                                             %
166 %                                                                             %
167 %                                                                             %
168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
169 %
170 %  MagickAdaptiveBlurImage() adaptively blurs the image by blurring
171 %  less intensely near image edges and more intensely far from edges. We
172 %  blur the image with a Gaussian operator of the given radius and standard
173 %  deviation (sigma).  For reasonable results, radius should be larger than
174 %  sigma.  Use a radius of 0 and MagickAdaptiveBlurImage() selects a
175 %  suitable radius for you.
176 %
177 %  The format of the MagickAdaptiveBlurImage method is:
178 %
179 %      MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
180 %        const double radius,const double sigma,const double bias)
181 %
182 %  A description of each parameter follows:
183 %
184 %    o wand: the magick wand.
185 %
186 %    o radius: the radius of the Gaussian, in pixels, not counting the center
187 %      pixel.
188 %
189 %    o sigma: the standard deviation of the Gaussian, in pixels.
190 %
191 %    o bias: the bias.
192 %
193 */
194 WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
195   const double radius,const double sigma,const double bias)
196 {
197   Image
198     *sharp_image;
199
200   assert(wand != (MagickWand *) NULL);
201   assert(wand->signature == WandSignature);
202   if (wand->debug != MagickFalse)
203     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
204   if (wand->images == (Image *) NULL)
205     ThrowWandException(WandError,"ContainsNoImages",wand->name);
206   sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,bias,wand->exception);
207   if (sharp_image == (Image *) NULL)
208     return(MagickFalse);
209   ReplaceImageInList(&wand->images,sharp_image);
210   return(MagickTrue);
211 }
212 \f
213 /*
214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
215 %                                                                             %
216 %                                                                             %
217 %                                                                             %
218 %   M a g i c k A d a p t i v e R e s i z e I m a g e                         %
219 %                                                                             %
220 %                                                                             %
221 %                                                                             %
222 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
223 %
224 %  MagickAdaptiveResizeImage() adaptively resize image with data dependent
225 %  triangulation.
226 %
227 %      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
228 %        const size_t columns,const size_t rows,
229 %        const PixelInterpolateMethod method)
230 %
231 %  A description of each parameter follows:
232 %
233 %    o wand: the magick wand.
234 %
235 %    o columns: the number of columns in the scaled image.
236 %
237 %    o rows: the number of rows in the scaled image.
238 %
239 %    o interpolate: the pixel interpolation method.
240 %
241 */
242 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
243   const size_t columns,const size_t rows,const PixelInterpolateMethod method)
244 {
245   Image
246     *resize_image;
247
248   assert(wand != (MagickWand *) NULL);
249   assert(wand->signature == WandSignature);
250   if (wand->debug != MagickFalse)
251     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
252   if (wand->images == (Image *) NULL)
253     ThrowWandException(WandError,"ContainsNoImages",wand->name);
254   resize_image=AdaptiveResizeImage(wand->images,columns,rows,method,
255     wand->exception);
256   if (resize_image == (Image *) NULL)
257     return(MagickFalse);
258   ReplaceImageInList(&wand->images,resize_image);
259   return(MagickTrue);
260 }
261 \f
262 /*
263 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
264 %                                                                             %
265 %                                                                             %
266 %                                                                             %
267 %   M a g i c k A d a p t i v e S h a r p e n I m a g e                       %
268 %                                                                             %
269 %                                                                             %
270 %                                                                             %
271 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
272 %
273 %  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
274 %  more intensely near image edges and less intensely far from edges. We
275 %  sharpen the image with a Gaussian operator of the given radius and standard
276 %  deviation (sigma).  For reasonable results, radius should be larger than
277 %  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
278 %  suitable radius for you.
279 %
280 %  The format of the MagickAdaptiveSharpenImage method is:
281 %
282 %      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
283 %        const double radius,const double sigma,const double bias)
284 %
285 %  A description of each parameter follows:
286 %
287 %    o wand: the magick wand.
288 %
289 %    o radius: the radius of the Gaussian, in pixels, not counting the center
290 %      pixel.
291 %
292 %    o sigma: the standard deviation of the Gaussian, in pixels.
293 %
294 %    o bias: the bias.
295 %
296 */
297 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
298   const double radius,const double sigma,const double bias)
299 {
300   Image
301     *sharp_image;
302
303   assert(wand != (MagickWand *) NULL);
304   assert(wand->signature == WandSignature);
305   if (wand->debug != MagickFalse)
306     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
307   if (wand->images == (Image *) NULL)
308     ThrowWandException(WandError,"ContainsNoImages",wand->name);
309   sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,bias,
310     wand->exception);
311   if (sharp_image == (Image *) NULL)
312     return(MagickFalse);
313   ReplaceImageInList(&wand->images,sharp_image);
314   return(MagickTrue);
315 }
316 \f
317 /*
318 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
319 %                                                                             %
320 %                                                                             %
321 %                                                                             %
322 %   M a g i c k A d a p t i v e T h r e s h o l d I m a g e                   %
323 %                                                                             %
324 %                                                                             %
325 %                                                                             %
326 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
327 %
328 %  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
329 %  based on the range of intensity values in its local neighborhood.  This
330 %  allows for thresholding of an image whose global intensity histogram
331 %  doesn't contain distinctive peaks.
332 %
333 %  The format of the AdaptiveThresholdImage method is:
334 %
335 %      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
336 %        const size_t width,const size_t height,const double bias)
337 %
338 %  A description of each parameter follows:
339 %
340 %    o wand: the magick wand.
341 %
342 %    o width: the width of the local neighborhood.
343 %
344 %    o height: the height of the local neighborhood.
345 %
346 %    o offset: the mean bias.
347 %
348 */
349 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
350   const size_t width,const size_t height,const double bias)
351 {
352   Image
353     *threshold_image;
354
355   assert(wand != (MagickWand *) NULL);
356   assert(wand->signature == WandSignature);
357   if (wand->debug != MagickFalse)
358     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
359   if (wand->images == (Image *) NULL)
360     ThrowWandException(WandError,"ContainsNoImages",wand->name);
361   threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
362     wand->exception);
363   if (threshold_image == (Image *) NULL)
364     return(MagickFalse);
365   ReplaceImageInList(&wand->images,threshold_image);
366   return(MagickTrue);
367 }
368 \f
369 /*
370 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
371 %                                                                             %
372 %                                                                             %
373 %                                                                             %
374 %   M a g i c k A d d I m a g e                                               %
375 %                                                                             %
376 %                                                                             %
377 %                                                                             %
378 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
379 %
380 %  MagickAddImage() adds a clone of the images in the second wand and
381 %  inserts them into the first wand, at the current image location.
382 %
383 %  Use MagickSetFirstIterator(), to insert new images before all the current
384 %  images in the wand, otherwise image is placed after the current image.
385 %
386 %  The format of the MagickAddImage method is:
387 %
388 %      MagickBooleanType MagickAddImage(MagickWand *wand,
389 %        const MagickWand *add_wand)
390 %
391 %  A description of each parameter follows:
392 %
393 %    o wand: the magick wand.
394 %
395 %    o add_wand: A wand that contains images to add at the current image
396 %      location.
397 %
398 */
399
400 static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
401   Image *images)
402 {
403   Image
404     *current;
405
406   current=wand->images;  /* note the current image */
407
408   /* if no images in wand, just add them and set first image as current */
409   if (current == (Image *) NULL)
410     {
411       wand->images=GetFirstImageInList(images);
412       return(MagickTrue);
413     }
414
415   /* user jumped to first image, so prepend new images - remain active */
416   if ((wand->set_first != MagickFalse) &&
417        (current->previous == (Image *) NULL) )
418     {
419       PrependImageToList(&current,images);
420       wand->images=GetFirstImageInList(images);
421       return(MagickTrue);
422     }
423   wand->set_first = MagickFalse; /* flag no longer valid */
424
425   /* Current image was flaged as 'pending' iterative processing. */
426   if (wand->image_pending != MagickFalse)
427     {
428       /* current pending image is the last, append new images */
429       if (current->next == (Image *) NULL)
430         {
431           AppendImageToList(&current,images);
432           wand->images=GetLastImageInList(images);
433           return(MagickTrue);
434         }
435       /* current pending image is the first image, prepend it */
436       if (current->previous == (Image *) NULL)
437         {
438           PrependImageToList(&current,images);
439           wand->images=GetFirstImageInList(images);
440           return(MagickTrue);
441         }
442     }
443
444   /* if at last image append new images */
445   if (current->next == (Image *) NULL)
446     {
447       InsertImageInList(&current,images);
448       wand->images=GetLastImageInList(images);
449       return(MagickTrue);
450     }
451   /* otherwise just insert image, just after the current image */
452   InsertImageInList(&current,images);
453   wand->images=GetFirstImageInList(images);
454   return(MagickTrue);
455 }
456
457 WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
458   const MagickWand *add_wand)
459 {
460   Image
461     *images;
462
463   assert(wand != (MagickWand *) NULL);
464   assert(wand->signature == WandSignature);
465   if (wand->debug != MagickFalse)
466     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
467   assert(add_wand != (MagickWand *) NULL);
468   assert(add_wand->signature == WandSignature);
469   if (add_wand->images == (Image *) NULL)
470     ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
471
472   /* clone images in second wand, and insert into first */
473   images=CloneImageList(add_wand->images,wand->exception);
474   if (images == (Image *) NULL)
475     return(MagickFalse);
476   return(InsertImageInWand(wand,images));
477 }
478 \f
479 /*
480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
481 %                                                                             %
482 %                                                                             %
483 %                                                                             %
484 %     M a g i c k A d d N o i s e I m a g e                                   %
485 %                                                                             %
486 %                                                                             %
487 %                                                                             %
488 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
489 %
490 %  MagickAddNoiseImage() adds random noise to the image.
491 %
492 %  The format of the MagickAddNoiseImage method is:
493 %
494 %      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
495 %        const NoiseType noise_type,const double attenuate)
496 %
497 %  A description of each parameter follows:
498 %
499 %    o wand: the magick wand.
500 %
501 %    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
502 %      Impulse, Laplacian, or Poisson.
503 %
504 %    o attenuate:  attenuate the random distribution.
505 %
506 */
507 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
508   const NoiseType noise_type,const double attenuate)
509 {
510   Image
511     *noise_image;
512
513   assert(wand != (MagickWand *) NULL);
514   assert(wand->signature == WandSignature);
515   if (wand->debug != MagickFalse)
516     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
517   if (wand->images == (Image *) NULL)
518     ThrowWandException(WandError,"ContainsNoImages",wand->name);
519   noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
520   if (noise_image == (Image *) NULL)
521     return(MagickFalse);
522   ReplaceImageInList(&wand->images,noise_image);
523   return(MagickTrue);
524 }
525 \f
526 /*
527 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
528 %                                                                             %
529 %                                                                             %
530 %                                                                             %
531 %   M a g i c k A f f i n e T r a n s f o r m I m a g e                       %
532 %                                                                             %
533 %                                                                             %
534 %                                                                             %
535 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
536 %
537 %  MagickAffineTransformImage() transforms an image as dictated by the affine
538 %  matrix of the drawing wand.
539 %
540 %  The format of the MagickAffineTransformImage method is:
541 %
542 %      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
543 %        const DrawingWand *drawing_wand)
544 %
545 %  A description of each parameter follows:
546 %
547 %    o wand: the magick wand.
548 %
549 %    o drawing_wand: the draw wand.
550 %
551 */
552 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
553   const DrawingWand *drawing_wand)
554 {
555   DrawInfo
556     *draw_info;
557
558   Image
559     *affine_image;
560
561   assert(wand != (MagickWand *) NULL);
562   assert(wand->signature == WandSignature);
563   if (wand->debug != MagickFalse)
564     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
565   if (wand->images == (Image *) NULL)
566     ThrowWandException(WandError,"ContainsNoImages",wand->name);
567   draw_info=PeekDrawingWand(drawing_wand);
568   if (draw_info == (DrawInfo *) NULL)
569     return(MagickFalse);
570   affine_image=AffineTransformImage(wand->images,&draw_info->affine,
571     wand->exception);
572   draw_info=DestroyDrawInfo(draw_info);
573   if (affine_image == (Image *) NULL)
574     return(MagickFalse);
575   ReplaceImageInList(&wand->images,affine_image);
576   return(MagickTrue);
577 }
578 \f
579 /*
580 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
581 %                                                                             %
582 %                                                                             %
583 %                                                                             %
584 %   M a g i c k A n n o t a t e I m a g e                                     %
585 %                                                                             %
586 %                                                                             %
587 %                                                                             %
588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
589 %
590 %  MagickAnnotateImage() annotates an image with text.
591 %
592 %  The format of the MagickAnnotateImage method is:
593 %
594 %      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
595 %        const DrawingWand *drawing_wand,const double x,const double y,
596 %        const double angle,const char *text)
597 %
598 %  A description of each parameter follows:
599 %
600 %    o wand: the magick wand.
601 %
602 %    o drawing_wand: the draw wand.
603 %
604 %    o x: x ordinate to left of text
605 %
606 %    o y: y ordinate to text baseline
607 %
608 %    o angle: rotate text relative to this angle.
609 %
610 %    o text: text to draw
611 %
612 */
613 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
614   const DrawingWand *drawing_wand,const double x,const double y,
615   const double angle,const char *text)
616 {
617   char
618     geometry[MaxTextExtent];
619
620   DrawInfo
621     *draw_info;
622
623   MagickBooleanType
624     status;
625
626   assert(wand != (MagickWand *) NULL);
627   assert(wand->signature == WandSignature);
628   if (wand->debug != MagickFalse)
629     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
630   if (wand->images == (Image *) NULL)
631     ThrowWandException(WandError,"ContainsNoImages",wand->name);
632   draw_info=PeekDrawingWand(drawing_wand);
633   if (draw_info == (DrawInfo *) NULL)
634     return(MagickFalse);
635   (void) CloneString(&draw_info->text,text);
636   (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",x,y);
637   draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0)));
638   draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0)));
639   draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0))));
640   draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0)));
641   (void) CloneString(&draw_info->geometry,geometry);
642   status=AnnotateImage(wand->images,draw_info,wand->exception);
643   draw_info=DestroyDrawInfo(draw_info);
644   return(status);
645 }
646 \f
647 /*
648 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
649 %                                                                             %
650 %                                                                             %
651 %                                                                             %
652 %   M a g i c k A n i m a t e I m a g e s                                     %
653 %                                                                             %
654 %                                                                             %
655 %                                                                             %
656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
657 %
658 %  MagickAnimateImages() animates an image or image sequence.
659 %
660 %  The format of the MagickAnimateImages method is:
661 %
662 %      MagickBooleanType MagickAnimateImages(MagickWand *wand,
663 %        const char *server_name)
664 %
665 %  A description of each parameter follows:
666 %
667 %    o wand: the magick wand.
668 %
669 %    o server_name: the X server name.
670 %
671 */
672 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
673   const char *server_name)
674 {
675   MagickBooleanType
676     status;
677
678   assert(wand != (MagickWand *) NULL);
679   assert(wand->signature == WandSignature);
680   if (wand->debug != MagickFalse)
681     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
682   (void) CloneString(&wand->image_info->server_name,server_name);
683   status=AnimateImages(wand->image_info,wand->images,wand->exception);
684   return(status);
685 }
686 \f
687 /*
688 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
689 %                                                                             %
690 %                                                                             %
691 %                                                                             %
692 %   M a g i c k A p p e n d I m a g e s                                       %
693 %                                                                             %
694 %                                                                             %
695 %                                                                             %
696 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
697 %
698 %  MagickAppendImages() append a set of images.
699 %
700 %  The format of the MagickAppendImages method is:
701 %
702 %      MagickWand *MagickAppendImages(MagickWand *wand,
703 %        const MagickBooleanType stack)
704 %
705 %  A description of each parameter follows:
706 %
707 %    o wand: the magick wand.
708 %
709 %    o stack: By default, images are stacked left-to-right. Set stack to
710 %      MagickTrue to stack them top-to-bottom.
711 %
712 */
713 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
714   const MagickBooleanType stack)
715 {
716   Image
717     *append_image;
718
719   assert(wand != (MagickWand *) NULL);
720   assert(wand->signature == WandSignature);
721   if (wand->debug != MagickFalse)
722     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
723   if (wand->images == (Image *) NULL)
724     return((MagickWand *) NULL);
725   append_image=AppendImages(wand->images,stack,wand->exception);
726   if (append_image == (Image *) NULL)
727     return((MagickWand *) NULL);
728   return(CloneMagickWandFromImages(wand,append_image));
729 }
730 \f
731 /*
732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
733 %                                                                             %
734 %                                                                             %
735 %                                                                             %
736 %   M a g i c k A u t o G a m m a I m a g e                                   %
737 %                                                                             %
738 %                                                                             %
739 %                                                                             %
740 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
741 %
742 %  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
743 %  image to try make set its gamma appropriatally.
744 %
745 %  The format of the MagickAutoGammaImage method is:
746 %
747 %      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
748 %
749 %  A description of each parameter follows:
750 %
751 %    o wand: the magick wand.
752 %
753 */
754 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
755 {
756   MagickBooleanType
757     status;
758
759   assert(wand != (MagickWand *) NULL);
760   assert(wand->signature == WandSignature);
761   if (wand->debug != MagickFalse)
762     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
763   if (wand->images == (Image *) NULL)
764     ThrowWandException(WandError,"ContainsNoImages",wand->name);
765   status=AutoGammaImage(wand->images,wand->exception);
766   return(status);
767 }
768 \f
769 /*
770 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
771 %                                                                             %
772 %                                                                             %
773 %                                                                             %
774 %   M a g i c k A u t o L e v e l I m a g e                                   %
775 %                                                                             %
776 %                                                                             %
777 %                                                                             %
778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
779 %
780 %  MagickAutoLevelImage() adjusts the levels of a particular image channel by
781 %  scaling the minimum and maximum values to the full quantum range.
782 %
783 %  The format of the MagickAutoLevelImage method is:
784 %
785 %      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
786 %
787 %  A description of each parameter follows:
788 %
789 %    o wand: the magick wand.
790 %
791 */
792 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
793 {
794   MagickBooleanType
795     status;
796
797   assert(wand != (MagickWand *) NULL);
798   assert(wand->signature == WandSignature);
799   if (wand->debug != MagickFalse)
800     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
801   if (wand->images == (Image *) NULL)
802     ThrowWandException(WandError,"ContainsNoImages",wand->name);
803   status=AutoLevelImage(wand->images,wand->exception);
804   return(status);
805 }
806 \f
807 /*
808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
809 %                                                                             %
810 %                                                                             %
811 %                                                                             %
812 %   M a g i c k B l a c k T h r e s h o l d I m a g e                         %
813 %                                                                             %
814 %                                                                             %
815 %                                                                             %
816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
817 %
818 %  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
819 %  pixels below the threshold into black while leaving all pixels above the
820 %  threshold unchanged.
821 %
822 %  The format of the MagickBlackThresholdImage method is:
823 %
824 %      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
825 %        const PixelWand *threshold)
826 %
827 %  A description of each parameter follows:
828 %
829 %    o wand: the magick wand.
830 %
831 %    o threshold: the pixel wand.
832 %
833 */
834 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
835   const PixelWand *threshold)
836 {
837   char
838     thresholds[MaxTextExtent];
839
840   MagickBooleanType
841     status;
842
843   assert(wand != (MagickWand *) NULL);
844   assert(wand->signature == WandSignature);
845   if (wand->debug != MagickFalse)
846     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
847   if (wand->images == (Image *) NULL)
848     ThrowWandException(WandError,"ContainsNoImages",wand->name);
849   (void) FormatLocaleString(thresholds,MaxTextExtent,
850     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
851     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
852     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
853   status=BlackThresholdImage(wand->images,thresholds,wand->exception);
854   return(status);
855 }
856 \f
857 /*
858 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
859 %                                                                             %
860 %                                                                             %
861 %                                                                             %
862 %   M a g i c k B l u e S h i f t I m a g e                                   %
863 %                                                                             %
864 %                                                                             %
865 %                                                                             %
866 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
867 %
868 %  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
869 %  nighttime in the moonlight.
870 %
871 %  The format of the MagickBlueShiftImage method is:
872 %
873 %      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
874 %        const double factor)
875 %
876 %  A description of each parameter follows:
877 %
878 %    o wand: the magick wand.
879 %
880 %    o factor: the blue shift factor (default 1.5)
881 %
882 */
883 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
884   const double factor)
885 {
886   Image
887     *shift_image;
888
889   assert(wand != (MagickWand *) NULL);
890   assert(wand->signature == WandSignature);
891   if (wand->debug != MagickFalse)
892     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
893   if (wand->images == (Image *) NULL)
894     ThrowWandException(WandError,"ContainsNoImages",wand->name);
895   shift_image=BlueShiftImage(wand->images,factor,wand->exception);
896   if (shift_image == (Image *) NULL)
897     return(MagickFalse);
898   ReplaceImageInList(&wand->images,shift_image);
899   return(MagickTrue);
900 }
901 \f
902 /*
903 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
904 %                                                                             %
905 %                                                                             %
906 %                                                                             %
907 %   M a g i c k B l u r I m a g e                                             %
908 %                                                                             %
909 %                                                                             %
910 %                                                                             %
911 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
912 %
913 %  MagickBlurImage() blurs an image.  We convolve the image with a
914 %  gaussian operator of the given radius and standard deviation (sigma).
915 %  For reasonable results, the radius should be larger than sigma.  Use a
916 %  radius of 0 and BlurImage() selects a suitable radius for you.
917 %
918 %  The format of the MagickBlurImage method is:
919 %
920 %      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
921 %        const double sigmaconst double bias)
922 %
923 %  A description of each parameter follows:
924 %
925 %    o wand: the magick wand.
926 %
927 %    o radius: the radius of the , in pixels, not counting the center
928 %      pixel.
929 %
930 %    o sigma: the standard deviation of the , in pixels.
931 %
932 %    o bias: the bias.
933 %
934 */
935 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
936   const double radius,const double sigma,const double bias)
937 {
938   Image
939     *blur_image;
940
941   assert(wand != (MagickWand *) NULL);
942   assert(wand->signature == WandSignature);
943   if (wand->debug != MagickFalse)
944     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
945   if (wand->images == (Image *) NULL)
946     ThrowWandException(WandError,"ContainsNoImages",wand->name);
947   blur_image=BlurImage(wand->images,radius,sigma,bias,wand->exception);
948   if (blur_image == (Image *) NULL)
949     return(MagickFalse);
950   ReplaceImageInList(&wand->images,blur_image);
951   return(MagickTrue);
952 }
953 \f
954 /*
955 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
956 %                                                                             %
957 %                                                                             %
958 %                                                                             %
959 %   M a g i c k B o r d e r I m a g e                                         %
960 %                                                                             %
961 %                                                                             %
962 %                                                                             %
963 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
964 %
965 %  MagickBorderImage() surrounds the image with a border of the color defined
966 %  by the bordercolor pixel wand.
967 %
968 %  The format of the MagickBorderImage method is:
969 %
970 %      MagickBooleanType MagickBorderImage(MagickWand *wand,
971 %        const PixelWand *bordercolor,const size_t width,
972 %        const size_t height,const CompositeOperator compose)
973 %
974 %  A description of each parameter follows:
975 %
976 %    o wand: the magick wand.
977 %
978 %    o bordercolor: the border color pixel wand.
979 %
980 %    o width: the border width.
981 %
982 %    o height: the border height.
983 %
984 %    o compose: the composite operator.
985 %
986 */
987 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
988   const PixelWand *bordercolor,const size_t width,const size_t height,
989   const CompositeOperator compose)
990 {
991   Image
992     *border_image;
993
994   RectangleInfo
995     border_info;
996
997   assert(wand != (MagickWand *) NULL);
998   assert(wand->signature == WandSignature);
999   if (wand->debug != MagickFalse)
1000     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1001   if (wand->images == (Image *) NULL)
1002     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1003   border_info.width=width;
1004   border_info.height=height;
1005   border_info.x=0;
1006   border_info.y=0;
1007   PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
1008   border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
1009   if (border_image == (Image *) NULL)
1010     return(MagickFalse);
1011   ReplaceImageInList(&wand->images,border_image);
1012   return(MagickTrue);
1013 }
1014 \f
1015 /*
1016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1017 %                                                                             %
1018 %                                                                             %
1019 %                                                                             %
1020 %   M a g i c k B r i g h t n e s s C o n t r a s t S t r e t c h I m a g e   %
1021 %                                                                             %
1022 %                                                                             %
1023 %                                                                             %
1024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1025 %
1026 %  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1027 %  of an image.  It converts the brightness and contrast parameters into slope
1028 %  and intercept and calls a polynomical function to apply to the image.
1029
1030 %
1031 %  The format of the MagickBrightnessContrastImage method is:
1032 %
1033 %      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1034 %        const double brightness,const double contrast)
1035 %
1036 %  A description of each parameter follows:
1037 %
1038 %    o wand: the magick wand.
1039 %
1040 %    o brightness: the brightness percent (-100 .. 100).
1041 %
1042 %    o contrast: the contrast percent (-100 .. 100).
1043 %
1044 */
1045 WandExport MagickBooleanType MagickBrightnessContrastImage(
1046   MagickWand *wand,const double brightness,const double contrast)
1047 {
1048   MagickBooleanType
1049     status;
1050
1051   assert(wand != (MagickWand *) NULL);
1052   assert(wand->signature == WandSignature);
1053   if (wand->debug != MagickFalse)
1054     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1055   if (wand->images == (Image *) NULL)
1056     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1057   status=BrightnessContrastImage(wand->images,brightness,contrast,
1058     wand->exception);
1059   return(status);
1060 }
1061 \f
1062 /*
1063 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1064 %                                                                             %
1065 %                                                                             %
1066 %                                                                             %
1067 %   M a g i c k C h a r c o a l I m a g e                                     %
1068 %                                                                             %
1069 %                                                                             %
1070 %                                                                             %
1071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1072 %
1073 %  MagickCharcoalImage() simulates a charcoal drawing.
1074 %
1075 %  The format of the MagickCharcoalImage method is:
1076 %
1077 %      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1078 %        const double radius,const double sigma,const double bias)
1079 %
1080 %  A description of each parameter follows:
1081 %
1082 %    o wand: the magick wand.
1083 %
1084 %    o radius: the radius of the Gaussian, in pixels, not counting the center
1085 %      pixel.
1086 %
1087 %    o sigma: the standard deviation of the Gaussian, in pixels.
1088 %
1089 %    o bias: the bias.
1090 %
1091 */
1092 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1093   const double radius,const double sigma,const double bias)
1094 {
1095   Image
1096     *charcoal_image;
1097
1098   assert(wand != (MagickWand *) NULL);
1099   assert(wand->signature == WandSignature);
1100   if (wand->debug != MagickFalse)
1101     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1102   if (wand->images == (Image *) NULL)
1103     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1104   charcoal_image=CharcoalImage(wand->images,radius,sigma,bias,wand->exception);
1105   if (charcoal_image == (Image *) NULL)
1106     return(MagickFalse);
1107   ReplaceImageInList(&wand->images,charcoal_image);
1108   return(MagickTrue);
1109 }
1110 \f
1111 /*
1112 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1113 %                                                                             %
1114 %                                                                             %
1115 %                                                                             %
1116 %   M a g i c k C h o p I m a g e                                             %
1117 %                                                                             %
1118 %                                                                             %
1119 %                                                                             %
1120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1121 %
1122 %  MagickChopImage() removes a region of an image and collapses the image to
1123 %  occupy the removed portion
1124 %
1125 %  The format of the MagickChopImage method is:
1126 %
1127 %      MagickBooleanType MagickChopImage(MagickWand *wand,
1128 %        const size_t width,const size_t height,const ssize_t x,
1129 %        const ssize_t y)
1130 %
1131 %  A description of each parameter follows:
1132 %
1133 %    o wand: the magick wand.
1134 %
1135 %    o width: the region width.
1136 %
1137 %    o height: the region height.
1138 %
1139 %    o x: the region x offset.
1140 %
1141 %    o y: the region y offset.
1142 %
1143 %
1144 */
1145 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1146   const size_t width,const size_t height,const ssize_t x,
1147   const ssize_t y)
1148 {
1149   Image
1150     *chop_image;
1151
1152   RectangleInfo
1153     chop;
1154
1155   assert(wand != (MagickWand *) NULL);
1156   assert(wand->signature == WandSignature);
1157   if (wand->debug != MagickFalse)
1158     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1159   if (wand->images == (Image *) NULL)
1160     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1161   chop.width=width;
1162   chop.height=height;
1163   chop.x=x;
1164   chop.y=y;
1165   chop_image=ChopImage(wand->images,&chop,wand->exception);
1166   if (chop_image == (Image *) NULL)
1167     return(MagickFalse);
1168   ReplaceImageInList(&wand->images,chop_image);
1169   return(MagickTrue);
1170 }
1171 \f
1172 /*
1173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1174 %                                                                             %
1175 %                                                                             %
1176 %                                                                             %
1177 %   M a g i c k C l a m p I m a g e                                           %
1178 %                                                                             %
1179 %                                                                             %
1180 %                                                                             %
1181 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1182 %
1183 %  MagickClampImage() restricts the color range from 0 to the quantum depth.
1184 %
1185 %  The format of the MagickClampImage method is:
1186 %
1187 %      MagickBooleanType MagickClampImage(MagickWand *wand)
1188 %
1189 %  A description of each parameter follows:
1190 %
1191 %    o wand: the magick wand.
1192 %
1193 %    o channel: the channel.
1194 %
1195 */
1196 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1197 {
1198   assert(wand != (MagickWand *) NULL);
1199   assert(wand->signature == WandSignature);
1200   if (wand->debug != MagickFalse)
1201     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1202   if (wand->images == (Image *) NULL)
1203     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1204   return(ClampImage(wand->images,wand->exception));
1205 }
1206 \f
1207 /*
1208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1209 %                                                                             %
1210 %                                                                             %
1211 %                                                                             %
1212 %   M a g i c k C l i p I m a g e                                             %
1213 %                                                                             %
1214 %                                                                             %
1215 %                                                                             %
1216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1217 %
1218 %  MagickClipImage() clips along the first path from the 8BIM profile, if
1219 %  present.
1220 %
1221 %  The format of the MagickClipImage method is:
1222 %
1223 %      MagickBooleanType MagickClipImage(MagickWand *wand)
1224 %
1225 %  A description of each parameter follows:
1226 %
1227 %    o wand: the magick wand.
1228 %
1229 */
1230 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1231 {
1232   MagickBooleanType
1233     status;
1234
1235   assert(wand != (MagickWand *) NULL);
1236   assert(wand->signature == WandSignature);
1237   if (wand->debug != MagickFalse)
1238     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1239   if (wand->images == (Image *) NULL)
1240     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1241   status=ClipImage(wand->images,wand->exception);
1242   return(status);
1243 }
1244 \f
1245 /*
1246 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1247 %                                                                             %
1248 %                                                                             %
1249 %                                                                             %
1250 %   M a g i c k C l i p I m a g e P a t h                                     %
1251 %                                                                             %
1252 %                                                                             %
1253 %                                                                             %
1254 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1255 %
1256 %  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1257 %  present. Later operations take effect inside the path.  Id may be a number
1258 %  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1259 %  path.
1260 %
1261 %  The format of the MagickClipImagePath method is:
1262 %
1263 %      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1264 %        const char *pathname,const MagickBooleanType inside)
1265 %
1266 %  A description of each parameter follows:
1267 %
1268 %    o wand: the magick wand.
1269 %
1270 %    o pathname: name of clipping path resource. If name is preceded by #, use
1271 %      clipping path numbered by name.
1272 %
1273 %    o inside: if non-zero, later operations take effect inside clipping path.
1274 %      Otherwise later operations take effect outside clipping path.
1275 %
1276 */
1277 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1278   const char *pathname,const MagickBooleanType inside)
1279 {
1280   MagickBooleanType
1281     status;
1282
1283   assert(wand != (MagickWand *) NULL);
1284   assert(wand->signature == WandSignature);
1285   if (wand->debug != MagickFalse)
1286     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1287   if (wand->images == (Image *) NULL)
1288     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1289   status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1290   return(status);
1291 }
1292 \f
1293 /*
1294 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1295 %                                                                             %
1296 %                                                                             %
1297 %                                                                             %
1298 %   M a g i c k C l u t I m a g e                                             %
1299 %                                                                             %
1300 %                                                                             %
1301 %                                                                             %
1302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1303 %
1304 %  MagickClutImage() replaces colors in the image from a color lookup table.
1305 %
1306 %  The format of the MagickClutImage method is:
1307 %
1308 %      MagickBooleanType MagickClutImage(MagickWand *wand,
1309 %        const MagickWand *clut_wand,const PixelInterpolateMethod method)
1310 %
1311 %  A description of each parameter follows:
1312 %
1313 %    o wand: the magick wand.
1314 %
1315 %    o clut_image: the clut image.
1316 %
1317 %    o method: the pixel interpolation method.
1318 %
1319 */
1320 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1321   const MagickWand *clut_wand,const PixelInterpolateMethod method)
1322 {
1323   MagickBooleanType
1324     status;
1325
1326   assert(wand != (MagickWand *) NULL);
1327   assert(wand->signature == WandSignature);
1328   if (wand->debug != MagickFalse)
1329     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1330   if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1331     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1332   status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1333   return(status);
1334 }
1335 \f
1336 /*
1337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1338 %                                                                             %
1339 %                                                                             %
1340 %                                                                             %
1341 %   M a g i c k C o a l e s c e I m a g e s                                   %
1342 %                                                                             %
1343 %                                                                             %
1344 %                                                                             %
1345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1346 %
1347 %  MagickCoalesceImages() composites a set of images while respecting any page
1348 %  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1349 %  typically start with an image background and each subsequent image
1350 %  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1351 %  where each image in the sequence is the same size as the first and
1352 %  composited with the next image in the sequence.
1353 %
1354 %  The format of the MagickCoalesceImages method is:
1355 %
1356 %      MagickWand *MagickCoalesceImages(MagickWand *wand)
1357 %
1358 %  A description of each parameter follows:
1359 %
1360 %    o wand: the magick wand.
1361 %
1362 */
1363 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1364 {
1365   Image
1366     *coalesce_image;
1367
1368   assert(wand != (MagickWand *) NULL);
1369   assert(wand->signature == WandSignature);
1370   if (wand->debug != MagickFalse)
1371     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1372   if (wand->images == (Image *) NULL)
1373     return((MagickWand *) NULL);
1374   coalesce_image=CoalesceImages(wand->images,wand->exception);
1375   if (coalesce_image == (Image *) NULL)
1376     return((MagickWand *) NULL);
1377   return(CloneMagickWandFromImages(wand,coalesce_image));
1378 }
1379 \f
1380 /*
1381 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1382 %                                                                             %
1383 %                                                                             %
1384 %                                                                             %
1385 %   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1386 %                                                                             %
1387 %                                                                             %
1388 %                                                                             %
1389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1390 %
1391 %  MagickColorDecisionListImage() accepts a lightweight Color Correction
1392 %  Collection (CCC) file which solely contains one or more color corrections
1393 %  and applies the color correction to the image.  Here is a sample CCC file:
1394 %
1395 %    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1396 %          <ColorCorrection id="cc03345">
1397 %                <SOPNode>
1398 %                     <Slope> 0.9 1.2 0.5 </Slope>
1399 %                     <Offset> 0.4 -0.5 0.6 </Offset>
1400 %                     <Power> 1.0 0.8 1.5 </Power>
1401 %                </SOPNode>
1402 %                <SATNode>
1403 %                     <Saturation> 0.85 </Saturation>
1404 %                </SATNode>
1405 %          </ColorCorrection>
1406 %    </ColorCorrectionCollection>
1407 %
1408 %  which includes the offset, slope, and power for each of the RGB channels
1409 %  as well as the saturation.
1410 %
1411 %  The format of the MagickColorDecisionListImage method is:
1412 %
1413 %      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1414 %        const double gamma)
1415 %
1416 %  A description of each parameter follows:
1417 %
1418 %    o wand: the magick wand.
1419 %
1420 %    o color_correction_collection: the color correction collection in XML.
1421 %
1422 */
1423 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1424   const char *color_correction_collection)
1425 {
1426   MagickBooleanType
1427     status;
1428
1429   assert(wand != (MagickWand *) NULL);
1430   assert(wand->signature == WandSignature);
1431   if (wand->debug != MagickFalse)
1432     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1433   if (wand->images == (Image *) NULL)
1434     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1435   status=ColorDecisionListImage(wand->images,color_correction_collection,
1436     wand->exception);
1437   return(status);
1438 }
1439 \f
1440 /*
1441 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1442 %                                                                             %
1443 %                                                                             %
1444 %                                                                             %
1445 %   M a g i c k C o l o r i z e I m a g e                                     %
1446 %                                                                             %
1447 %                                                                             %
1448 %                                                                             %
1449 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1450 %
1451 %  MagickColorizeImage() blends the fill color with each pixel in the image.
1452 %
1453 %  The format of the MagickColorizeImage method is:
1454 %
1455 %      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1456 %        const PixelWand *colorize,const PixelWand *blend)
1457 %
1458 %  A description of each parameter follows:
1459 %
1460 %    o wand: the magick wand.
1461 %
1462 %    o colorize: the colorize pixel wand.
1463 %
1464 %    o alpha: the alpha pixel wand.
1465 %
1466 */
1467 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1468   const PixelWand *colorize,const PixelWand *blend)
1469 {
1470   char
1471     percent_blend[MaxTextExtent];
1472
1473   Image
1474     *colorize_image;
1475
1476   PixelInfo
1477     target;
1478
1479   assert(wand != (MagickWand *) NULL);
1480   assert(wand->signature == WandSignature);
1481   if (wand->debug != MagickFalse)
1482     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1483   if (wand->images == (Image *) NULL)
1484     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1485   GetPixelInfo(wand->images,&target);
1486   if (target.colorspace != CMYKColorspace)
1487     (void) FormatLocaleString(percent_blend,MaxTextExtent,
1488       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1489       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1490       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1491       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1492       PixelGetAlphaQuantum(blend)));
1493   else
1494     (void) FormatLocaleString(percent_blend,MaxTextExtent,
1495       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1496       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1497       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1498       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1499       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1500       PixelGetAlphaQuantum(blend)));
1501   target=PixelGetPixel(colorize);
1502   colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1503     wand->exception);
1504   if (colorize_image == (Image *) NULL)
1505     return(MagickFalse);
1506   ReplaceImageInList(&wand->images,colorize_image);
1507   return(MagickTrue);
1508 }
1509 \f
1510 /*
1511 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1512 %                                                                             %
1513 %                                                                             %
1514 %                                                                             %
1515 %   M a g i c k C o l o r M a t r i x I m a g e                               %
1516 %                                                                             %
1517 %                                                                             %
1518 %                                                                             %
1519 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1520 %
1521 %  MagickColorMatrixImage() apply color transformation to an image. The method
1522 %  permits saturation changes, hue rotation, luminance to alpha, and various
1523 %  other effects.  Although variable-sized transformation matrices can be used,
1524 %  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1525 %  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1526 %  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1527 %  and offsets are normalized (divide Flash offset by 255).
1528 %
1529 %  The format of the MagickColorMatrixImage method is:
1530 %
1531 %      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1532 %        const KernelInfo *color_matrix)
1533 %
1534 %  A description of each parameter follows:
1535 %
1536 %    o wand: the magick wand.
1537 %
1538 %    o color_matrix:  the color matrix.
1539 %
1540 */
1541 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1542   const KernelInfo *color_matrix)
1543 {
1544   Image
1545     *color_image;
1546
1547   assert(wand != (MagickWand *) NULL);
1548   assert(wand->signature == WandSignature);
1549   if (wand->debug != MagickFalse)
1550     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1551   if (color_matrix == (const KernelInfo *) NULL)
1552     return(MagickFalse);
1553   if (wand->images == (Image *) NULL)
1554     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1555   color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1556   if (color_image == (Image *) NULL)
1557     return(MagickFalse);
1558   ReplaceImageInList(&wand->images,color_image);
1559   return(MagickTrue);
1560 }
1561 \f
1562 /*
1563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1564 %                                                                             %
1565 %                                                                             %
1566 %                                                                             %
1567 %   M a g i c k C o m b i n e I m a g e s                                     %
1568 %                                                                             %
1569 %                                                                             %
1570 %                                                                             %
1571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1572 %
1573 %  MagickCombineImages() combines one or more images into a single image.  The
1574 %  grayscale value of the pixels of each image in the sequence is assigned in
1575 %  order to the specified  hannels of the combined image.   The typical
1576 %  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1577 %
1578 %  The format of the MagickCombineImages method is:
1579 %
1580 %      MagickWand *MagickCombineImages(MagickWand *wand)
1581 %
1582 %  A description of each parameter follows:
1583 %
1584 %    o wand: the magick wand.
1585 %
1586 */
1587 WandExport MagickWand *MagickCombineImages(MagickWand *wand)
1588 {
1589   Image
1590     *combine_image;
1591
1592   assert(wand != (MagickWand *) NULL);
1593   assert(wand->signature == WandSignature);
1594   if (wand->debug != MagickFalse)
1595     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1596   if (wand->images == (Image *) NULL)
1597     return((MagickWand *) NULL);
1598   combine_image=CombineImages(wand->images,wand->exception);
1599   if (combine_image == (Image *) NULL)
1600     return((MagickWand *) NULL);
1601   return(CloneMagickWandFromImages(wand,combine_image));
1602 }
1603 \f
1604 /*
1605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1606 %                                                                             %
1607 %                                                                             %
1608 %                                                                             %
1609 %   M a g i c k C o m m e n t I m a g e                                       %
1610 %                                                                             %
1611 %                                                                             %
1612 %                                                                             %
1613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1614 %
1615 %  MagickCommentImage() adds a comment to your image.
1616 %
1617 %  The format of the MagickCommentImage method is:
1618 %
1619 %      MagickBooleanType MagickCommentImage(MagickWand *wand,
1620 %        const char *comment)
1621 %
1622 %  A description of each parameter follows:
1623 %
1624 %    o wand: the magick wand.
1625 %
1626 %    o comment: the image comment.
1627 %
1628 */
1629 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1630   const char *comment)
1631 {
1632   MagickBooleanType
1633     status;
1634
1635   assert(wand != (MagickWand *) NULL);
1636   assert(wand->signature == WandSignature);
1637   if (wand->debug != MagickFalse)
1638     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1639   if (wand->images == (Image *) NULL)
1640     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1641   status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1642   return(status);
1643 }
1644 \f
1645 /*
1646 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1647 %                                                                             %
1648 %                                                                             %
1649 %                                                                             %
1650 %   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1651 %                                                                             %
1652 %                                                                             %
1653 %                                                                             %
1654 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1655 %
1656 %  MagickCompareImagesLayers() compares each image with the next in a sequence
1657 %  and returns the maximum bounding region of any pixel differences it
1658 %  discovers.
1659 %
1660 %  The format of the MagickCompareImagesLayers method is:
1661 %
1662 %      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1663 %        const ImageLayerMethod method)
1664 %
1665 %  A description of each parameter follows:
1666 %
1667 %    o wand: the magick wand.
1668 %
1669 %    o method: the compare method.
1670 %
1671 */
1672 WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1673   const ImageLayerMethod method)
1674 {
1675   Image
1676     *layers_image;
1677
1678   assert(wand != (MagickWand *) NULL);
1679   assert(wand->signature == WandSignature);
1680   if (wand->debug != MagickFalse)
1681     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1682   if (wand->images == (Image *) NULL)
1683     return((MagickWand *) NULL);
1684   layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1685   if (layers_image == (Image *) NULL)
1686     return((MagickWand *) NULL);
1687   return(CloneMagickWandFromImages(wand,layers_image));
1688 }
1689 \f
1690 /*
1691 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1692 %                                                                             %
1693 %                                                                             %
1694 %                                                                             %
1695 %   M a g i c k C o m p a r e I m a g e s                                     %
1696 %                                                                             %
1697 %                                                                             %
1698 %                                                                             %
1699 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1700 %
1701 %  MagickCompareImages() compares an image to a reconstructed image and returns
1702 %  the specified difference image.
1703 %
1704 %  The format of the MagickCompareImages method is:
1705 %
1706 %      MagickWand *MagickCompareImages(MagickWand *wand,
1707 %        const MagickWand *reference,const MetricType metric,
1708 %        double *distortion)
1709 %
1710 %  A description of each parameter follows:
1711 %
1712 %    o wand: the magick wand.
1713 %
1714 %    o reference: the reference wand.
1715 %
1716 %    o metric: the metric.
1717 %
1718 %    o distortion: the computed distortion between the images.
1719 %
1720 */
1721 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1722   const MagickWand *reference,const MetricType metric,double *distortion)
1723 {
1724   Image
1725     *compare_image;
1726
1727
1728   assert(wand != (MagickWand *) NULL);
1729   assert(wand->signature == WandSignature);
1730   if (wand->debug != MagickFalse)
1731     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1732   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1733     {
1734       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1735         "ContainsNoImages","`%s'",wand->name);
1736       return((MagickWand *) NULL);
1737     }
1738   compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1739     wand->exception);
1740   if (compare_image == (Image *) NULL)
1741     return((MagickWand *) NULL);
1742   return(CloneMagickWandFromImages(wand,compare_image));
1743 }
1744 \f
1745 /*
1746 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1747 %                                                                             %
1748 %                                                                             %
1749 %                                                                             %
1750 %   M a g i c k C o m p o s i t e I m a g e                                   %
1751 %                                                                             %
1752 %                                                                             %
1753 %                                                                             %
1754 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1755 %
1756 %  MagickCompositeImage() composite one image onto another at the specified
1757 %  offset.
1758 %
1759 %  The format of the MagickCompositeImage method is:
1760 %
1761 %      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1762 %        const MagickWand *composite_wand,const CompositeOperator compose,
1763 %        const ssize_t x,const ssize_t y)
1764 %
1765 %  A description of each parameter follows:
1766 %
1767 %    o wand: the magick wand.
1768 %
1769 %    o composite_image: the composite image.
1770 %
1771 %    o compose: This operator affects how the composite is applied to the
1772 %      image.  The default is Over.  Choose from these operators:
1773 %
1774 %        OverCompositeOp       InCompositeOp         OutCompositeOp
1775 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1776 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1777 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1778 %        DisplaceCompositeOp
1779 %
1780 %    o x: the column offset of the composited image.
1781 %
1782 %    o y: the row offset of the composited image.
1783 %
1784 */
1785 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1786   const MagickWand *composite_wand,const CompositeOperator compose,
1787   const ssize_t x,const ssize_t y)
1788 {
1789   MagickBooleanType
1790     status;
1791
1792   assert(wand != (MagickWand *) NULL);
1793   assert(wand->signature == WandSignature);
1794   if (wand->debug != MagickFalse)
1795     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1796   if ((wand->images == (Image *) NULL) ||
1797       (composite_wand->images == (Image *) NULL))
1798     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1799   status=CompositeImage(wand->images,compose,composite_wand->images,x,y,
1800     wand->exception);
1801   return(status);
1802 }
1803 \f
1804 /*
1805 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1806 %                                                                             %
1807 %                                                                             %
1808 %                                                                             %
1809 %   M a g i c k C o n t r a s t I m a g e                                     %
1810 %                                                                             %
1811 %                                                                             %
1812 %                                                                             %
1813 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1814 %
1815 %  MagickContrastImage() enhances the intensity differences between the lighter
1816 %  and darker elements of the image.  Set sharpen to a value other than 0 to
1817 %  increase the image contrast otherwise the contrast is reduced.
1818 %
1819 %  The format of the MagickContrastImage method is:
1820 %
1821 %      MagickBooleanType MagickContrastImage(MagickWand *wand,
1822 %        const MagickBooleanType sharpen)
1823 %
1824 %  A description of each parameter follows:
1825 %
1826 %    o wand: the magick wand.
1827 %
1828 %    o sharpen: Increase or decrease image contrast.
1829 %
1830 %
1831 */
1832 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1833   const MagickBooleanType sharpen)
1834 {
1835   MagickBooleanType
1836     status;
1837
1838   assert(wand != (MagickWand *) NULL);
1839   assert(wand->signature == WandSignature);
1840   if (wand->debug != MagickFalse)
1841     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1842   if (wand->images == (Image *) NULL)
1843     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1844   status=ContrastImage(wand->images,sharpen,wand->exception);
1845   return(status);
1846 }
1847 \f
1848 /*
1849 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1850 %                                                                             %
1851 %                                                                             %
1852 %                                                                             %
1853 %   M a g i c k C o n t r a s t S t r e t c h I m a g e                       %
1854 %                                                                             %
1855 %                                                                             %
1856 %                                                                             %
1857 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1858 %
1859 %  MagickContrastStretchImage() enhances the contrast of a color image by
1860 %  adjusting the pixels color to span the entire range of colors available.
1861 %  You can also reduce the influence of a particular channel with a gamma
1862 %  value of 0.
1863 %
1864 %  The format of the MagickContrastStretchImage method is:
1865 %
1866 %      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1867 %        const double black_point,const double white_point)
1868 %
1869 %  A description of each parameter follows:
1870 %
1871 %    o wand: the magick wand.
1872 %
1873 %    o black_point: the black point.
1874 %
1875 %    o white_point: the white point.
1876 %
1877 */
1878 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1879   const double black_point,const double white_point)
1880 {
1881   MagickBooleanType
1882     status;
1883
1884   assert(wand != (MagickWand *) NULL);
1885   assert(wand->signature == WandSignature);
1886   if (wand->debug != MagickFalse)
1887     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1888   if (wand->images == (Image *) NULL)
1889     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1890   status=ContrastStretchImage(wand->images,black_point,white_point,
1891     wand->exception);
1892   return(status);
1893 }
1894 \f
1895 /*
1896 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1897 %                                                                             %
1898 %                                                                             %
1899 %                                                                             %
1900 %   M a g i c k C o n v o l v e I m a g e                                     %
1901 %                                                                             %
1902 %                                                                             %
1903 %                                                                             %
1904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1905 %
1906 %  MagickConvolveImage() applies a custom convolution kernel to the image.
1907 %
1908 %  The format of the MagickConvolveImage method is:
1909 %
1910 %      MagickBooleanType MagickConvolveImage(MagickWand *wand,
1911 %        const KernelInfo *kernel)
1912 %
1913 %  A description of each parameter follows:
1914 %
1915 %    o wand: the magick wand.
1916 %
1917 %    o kernel: An array of doubles representing the convolution kernel.
1918 %
1919 */
1920 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
1921   const KernelInfo *kernel)
1922 {
1923   Image
1924     *filter_image;
1925
1926   assert(wand != (MagickWand *) NULL);
1927   assert(wand->signature == WandSignature);
1928   if (wand->debug != MagickFalse)
1929     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1930   if (kernel == (const KernelInfo *) NULL)
1931     return(MagickFalse);
1932   if (wand->images == (Image *) NULL)
1933     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1934   filter_image=ConvolveImage(wand->images,kernel,wand->exception);
1935   if (filter_image == (Image *) NULL)
1936     return(MagickFalse);
1937   ReplaceImageInList(&wand->images,filter_image);
1938   return(MagickTrue);
1939 }
1940 \f
1941 /*
1942 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1943 %                                                                             %
1944 %                                                                             %
1945 %                                                                             %
1946 %   M a g i c k C r o p I m a g e                                             %
1947 %                                                                             %
1948 %                                                                             %
1949 %                                                                             %
1950 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1951 %
1952 %  MagickCropImage() extracts a region of the image.
1953 %
1954 %  The format of the MagickCropImage method is:
1955 %
1956 %      MagickBooleanType MagickCropImage(MagickWand *wand,
1957 %        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1958 %
1959 %  A description of each parameter follows:
1960 %
1961 %    o wand: the magick wand.
1962 %
1963 %    o width: the region width.
1964 %
1965 %    o height: the region height.
1966 %
1967 %    o x: the region x-offset.
1968 %
1969 %    o y: the region y-offset.
1970 %
1971 */
1972 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
1973   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1974 {
1975   Image
1976     *crop_image;
1977
1978   RectangleInfo
1979     crop;
1980
1981   assert(wand != (MagickWand *) NULL);
1982   assert(wand->signature == WandSignature);
1983   if (wand->debug != MagickFalse)
1984     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1985   if (wand->images == (Image *) NULL)
1986     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1987   crop.width=width;
1988   crop.height=height;
1989   crop.x=x;
1990   crop.y=y;
1991   crop_image=CropImage(wand->images,&crop,wand->exception);
1992   if (crop_image == (Image *) NULL)
1993     return(MagickFalse);
1994   ReplaceImageInList(&wand->images,crop_image);
1995   return(MagickTrue);
1996 }
1997 \f
1998 /*
1999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2000 %                                                                             %
2001 %                                                                             %
2002 %                                                                             %
2003 %   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2004 %                                                                             %
2005 %                                                                             %
2006 %                                                                             %
2007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2008 %
2009 %  MagickCycleColormapImage() displaces an image's colormap by a given number
2010 %  of positions.  If you cycle the colormap a number of times you can produce
2011 %  a psychodelic effect.
2012 %
2013 %  The format of the MagickCycleColormapImage method is:
2014 %
2015 %      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2016 %        const ssize_t displace)
2017 %
2018 %  A description of each parameter follows:
2019 %
2020 %    o wand: the magick wand.
2021 %
2022 %    o pixel_wand: the pixel wand.
2023 %
2024 */
2025 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2026   const ssize_t displace)
2027 {
2028   MagickBooleanType
2029     status;
2030
2031   assert(wand != (MagickWand *) NULL);
2032   assert(wand->signature == WandSignature);
2033   if (wand->debug != MagickFalse)
2034     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2035   if (wand->images == (Image *) NULL)
2036     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2037   status=CycleColormapImage(wand->images,displace,wand->exception);
2038   return(status);
2039 }
2040 \f
2041 /*
2042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2043 %                                                                             %
2044 %                                                                             %
2045 %                                                                             %
2046 %   M a g i c k C o n s t i t u t e I m a g e                                 %
2047 %                                                                             %
2048 %                                                                             %
2049 %                                                                             %
2050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2051 %
2052 %  MagickConstituteImage() adds an image to the wand comprised of the pixel
2053 %  data you supply.  The pixel data must be in scanline order top-to-bottom.
2054 %  The data can be char, short int, int, float, or double.  Float and double
2055 %  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2056 %  is the maximum value the type can accomodate (e.g. 255 for char).  For
2057 %  example, to create a 640x480 image from unsigned red-green-blue character
2058 %  data, use
2059 %
2060 %      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2061 %
2062 %  The format of the MagickConstituteImage method is:
2063 %
2064 %      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2065 %        const size_t columns,const size_t rows,const char *map,
2066 %        const StorageType storage,void *pixels)
2067 %
2068 %  A description of each parameter follows:
2069 %
2070 %    o wand: the magick wand.
2071 %
2072 %    o columns: width in pixels of the image.
2073 %
2074 %    o rows: height in pixels of the image.
2075 %
2076 %    o map:  This string reflects the expected ordering of the pixel array.
2077 %      It can be any combination or order of R = red, G = green, B = blue,
2078 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2079 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2080 %      P = pad.
2081 %
2082 %    o storage: Define the data type of the pixels.  Float and double types are
2083 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2084 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2085 %      LongPixel, QuantumPixel, or ShortPixel.
2086 %
2087 %    o pixels: This array of values contain the pixel components as defined by
2088 %      map and type.  You must preallocate this array where the expected
2089 %      length varies depending on the values of width, height, map, and type.
2090 %
2091 %
2092 */
2093 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2094   const size_t columns,const size_t rows,const char *map,
2095   const StorageType storage,const void *pixels)
2096 {
2097   Image
2098     *images;
2099
2100   assert(wand != (MagickWand *) NULL);
2101   assert(wand->signature == WandSignature);
2102   if (wand->debug != MagickFalse)
2103     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2104   images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2105   if (images == (Image *) NULL)
2106     return(MagickFalse);
2107   return(InsertImageInWand(wand,images));
2108 }
2109 \f
2110 /*
2111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2112 %                                                                             %
2113 %                                                                             %
2114 %                                                                             %
2115 %   M a g i c k D e c i p h e r I m a g e                                     %
2116 %                                                                             %
2117 %                                                                             %
2118 %                                                                             %
2119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2120 %
2121 %  MagickDecipherImage() converts cipher pixels to plain pixels.
2122 %
2123 %  The format of the MagickDecipherImage method is:
2124 %
2125 %      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2126 %        const char *passphrase)
2127 %
2128 %  A description of each parameter follows:
2129 %
2130 %    o wand: the magick wand.
2131 %
2132 %    o passphrase: the passphrase.
2133 %
2134 */
2135 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2136   const char *passphrase)
2137 {
2138   assert(wand != (MagickWand *) NULL);
2139   assert(wand->signature == WandSignature);
2140   if (wand->debug != MagickFalse)
2141     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2142   if (wand->images == (Image *) NULL)
2143     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2144   return(DecipherImage(wand->images,passphrase,wand->exception));
2145 }
2146 \f
2147 /*
2148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2149 %                                                                             %
2150 %                                                                             %
2151 %                                                                             %
2152 %   M a g i c k D e c o n s t r u c t I m a g e s                             %
2153 %                                                                             %
2154 %                                                                             %
2155 %                                                                             %
2156 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2157 %
2158 %  MagickDeconstructImages() compares each image with the next in a sequence
2159 %  and returns the maximum bounding region of any pixel differences it
2160 %  discovers.
2161 %
2162 %  The format of the MagickDeconstructImages method is:
2163 %
2164 %      MagickWand *MagickDeconstructImages(MagickWand *wand)
2165 %
2166 %  A description of each parameter follows:
2167 %
2168 %    o wand: the magick wand.
2169 %
2170 */
2171 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2172 {
2173   Image
2174     *deconstruct_image;
2175
2176   assert(wand != (MagickWand *) NULL);
2177   assert(wand->signature == WandSignature);
2178   if (wand->debug != MagickFalse)
2179     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2180   if (wand->images == (Image *) NULL)
2181     return((MagickWand *) NULL);
2182   deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2183     wand->exception);
2184   if (deconstruct_image == (Image *) NULL)
2185     return((MagickWand *) NULL);
2186   return(CloneMagickWandFromImages(wand,deconstruct_image));
2187 }
2188 \f
2189 /*
2190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2191 %                                                                             %
2192 %                                                                             %
2193 %                                                                             %
2194 %     M a g i c k D e s k e w I m a g e                                       %
2195 %                                                                             %
2196 %                                                                             %
2197 %                                                                             %
2198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2199 %
2200 %  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2201 %  occurs in scanned images because of the camera being misaligned,
2202 %  imperfections in the scanning or surface, or simply because the paper was
2203 %  not placed completely flat when scanned.
2204 %
2205 %  The format of the MagickDeskewImage method is:
2206 %
2207 %      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2208 %        const double threshold)
2209 %
2210 %  A description of each parameter follows:
2211 %
2212 %    o wand: the magick wand.
2213 %
2214 %    o threshold: separate background from foreground.
2215 %
2216 */
2217 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2218   const double threshold)
2219 {
2220   Image
2221     *sepia_image;
2222
2223   assert(wand != (MagickWand *) NULL);
2224   assert(wand->signature == WandSignature);
2225   if (wand->debug != MagickFalse)
2226     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2227   if (wand->images == (Image *) NULL)
2228     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2229   sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2230   if (sepia_image == (Image *) NULL)
2231     return(MagickFalse);
2232   ReplaceImageInList(&wand->images,sepia_image);
2233   return(MagickTrue);
2234 }
2235 \f
2236 /*
2237 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2238 %                                                                             %
2239 %                                                                             %
2240 %                                                                             %
2241 %     M a g i c k D e s p e c k l e I m a g e                                 %
2242 %                                                                             %
2243 %                                                                             %
2244 %                                                                             %
2245 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2246 %
2247 %  MagickDespeckleImage() reduces the speckle noise in an image while
2248 %  perserving the edges of the original image.
2249 %
2250 %  The format of the MagickDespeckleImage method is:
2251 %
2252 %      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2253 %
2254 %  A description of each parameter follows:
2255 %
2256 %    o wand: the magick wand.
2257 %
2258 */
2259 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2260 {
2261   Image
2262     *despeckle_image;
2263
2264   assert(wand != (MagickWand *) NULL);
2265   assert(wand->signature == WandSignature);
2266   if (wand->debug != MagickFalse)
2267     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2268   if (wand->images == (Image *) NULL)
2269     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2270   despeckle_image=DespeckleImage(wand->images,wand->exception);
2271   if (despeckle_image == (Image *) NULL)
2272     return(MagickFalse);
2273   ReplaceImageInList(&wand->images,despeckle_image);
2274   return(MagickTrue);
2275 }
2276 \f
2277 /*
2278 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2279 %                                                                             %
2280 %                                                                             %
2281 %                                                                             %
2282 %   M a g i c k D e s t r o y I m a g e                                       %
2283 %                                                                             %
2284 %                                                                             %
2285 %                                                                             %
2286 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2287 %
2288 %  MagickDestroyImage() dereferences an image, deallocating memory associated
2289 %  with the image if the reference count becomes zero.
2290 %
2291 %  The format of the MagickDestroyImage method is:
2292 %
2293 %      Image *MagickDestroyImage(Image *image)
2294 %
2295 %  A description of each parameter follows:
2296 %
2297 %    o image: the image.
2298 %
2299 */
2300 WandExport Image *MagickDestroyImage(Image *image)
2301 {
2302   return(DestroyImage(image));
2303 }
2304 \f
2305 /*
2306 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2307 %                                                                             %
2308 %                                                                             %
2309 %                                                                             %
2310 %   M a g i c k D i s p l a y I m a g e                                       %
2311 %                                                                             %
2312 %                                                                             %
2313 %                                                                             %
2314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2315 %
2316 %  MagickDisplayImage() displays an image.
2317 %
2318 %  The format of the MagickDisplayImage method is:
2319 %
2320 %      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2321 %        const char *server_name)
2322 %
2323 %  A description of each parameter follows:
2324 %
2325 %    o wand: the magick wand.
2326 %
2327 %    o server_name: the X server name.
2328 %
2329 */
2330 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2331   const char *server_name)
2332 {
2333   Image
2334     *image;
2335
2336   MagickBooleanType
2337     status;
2338
2339   assert(wand != (MagickWand *) NULL);
2340   assert(wand->signature == WandSignature);
2341   if (wand->debug != MagickFalse)
2342     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2343   if (wand->images == (Image *) NULL)
2344     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2345   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2346   if (image == (Image *) NULL)
2347     return(MagickFalse);
2348   (void) CloneString(&wand->image_info->server_name,server_name);
2349   status=DisplayImages(wand->image_info,image,wand->exception);
2350   image=DestroyImage(image);
2351   return(status);
2352 }
2353 \f
2354 /*
2355 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2356 %                                                                             %
2357 %                                                                             %
2358 %                                                                             %
2359 %   M a g i c k D i s p l a y I m a g e s                                     %
2360 %                                                                             %
2361 %                                                                             %
2362 %                                                                             %
2363 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2364 %
2365 %  MagickDisplayImages() displays an image or image sequence.
2366 %
2367 %  The format of the MagickDisplayImages method is:
2368 %
2369 %      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2370 %        const char *server_name)
2371 %
2372 %  A description of each parameter follows:
2373 %
2374 %    o wand: the magick wand.
2375 %
2376 %    o server_name: the X server name.
2377 %
2378 */
2379 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2380   const char *server_name)
2381 {
2382   MagickBooleanType
2383     status;
2384
2385   assert(wand != (MagickWand *) NULL);
2386   assert(wand->signature == WandSignature);
2387   if (wand->debug != MagickFalse)
2388     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2389   (void) CloneString(&wand->image_info->server_name,server_name);
2390   status=DisplayImages(wand->image_info,wand->images,wand->exception);
2391   return(status);
2392 }
2393 \f
2394 /*
2395 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2396 %                                                                             %
2397 %                                                                             %
2398 %                                                                             %
2399 %   M a g i c k D i s t o r t I m a g e                                       %
2400 %                                                                             %
2401 %                                                                             %
2402 %                                                                             %
2403 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2404 %
2405 %  MagickDistortImage() distorts an image using various distortion methods, by
2406 %  mapping color lookups of the source image to a new destination image
2407 %  usally of the same size as the source image, unless 'bestfit' is set to
2408 %  true.
2409 %
2410 %  If 'bestfit' is enabled, and distortion allows it, the destination image is
2411 %  adjusted to ensure the whole source 'image' will just fit within the final
2412 %  destination image, which will be sized and offset accordingly.  Also in
2413 %  many cases the virtual offset of the source image will be taken into
2414 %  account in the mapping.
2415 %
2416 %  The format of the MagickDistortImage method is:
2417 %
2418 %      MagickBooleanType MagickDistortImage(MagickWand *wand,
2419 %        const DistortImageMethod method,const size_t number_arguments,
2420 %        const double *arguments,const MagickBooleanType bestfit)
2421 %
2422 %  A description of each parameter follows:
2423 %
2424 %    o image: the image to be distorted.
2425 %
2426 %    o method: the method of image distortion.
2427 %
2428 %        ArcDistortion always ignores the source image offset, and always
2429 %        'bestfit' the destination image with the top left corner offset
2430 %        relative to the polar mapping center.
2431 %
2432 %        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2433 %        style of image distortion.
2434 %
2435 %        Affine, Perspective, and Bilinear, do least squares fitting of the
2436 %        distortion when more than the minimum number of control point pairs
2437 %        are provided.
2438 %
2439 %        Perspective, and Bilinear, falls back to a Affine distortion when less
2440 %        that 4 control point pairs are provided. While Affine distortions let
2441 %        you use any number of control point pairs, that is Zero pairs is a
2442 %        no-Op (viewport only) distrotion, one pair is a translation and two
2443 %        pairs of control points do a scale-rotate-translate, without any
2444 %        shearing.
2445 %
2446 %    o number_arguments: the number of arguments given for this distortion
2447 %      method.
2448 %
2449 %    o arguments: the arguments for this distortion method.
2450 %
2451 %    o bestfit: Attempt to resize destination to fit distorted source.
2452 %
2453 */
2454 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2455   const DistortImageMethod method,const size_t number_arguments,
2456   const double *arguments,const MagickBooleanType bestfit)
2457 {
2458   Image
2459     *distort_image;
2460
2461   assert(wand != (MagickWand *) NULL);
2462   assert(wand->signature == WandSignature);
2463   if (wand->debug != MagickFalse)
2464     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2465   if (wand->images == (Image *) NULL)
2466     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2467   distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2468     bestfit,wand->exception);
2469   if (distort_image == (Image *) NULL)
2470     return(MagickFalse);
2471   ReplaceImageInList(&wand->images,distort_image);
2472   return(MagickTrue);
2473 }
2474 \f
2475 /*
2476 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2477 %                                                                             %
2478 %                                                                             %
2479 %                                                                             %
2480 %   M a g i c k D r a w I m a g e                                             %
2481 %                                                                             %
2482 %                                                                             %
2483 %                                                                             %
2484 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2485 %
2486 %  MagickDrawImage() renders the drawing wand on the current image.
2487 %
2488 %  The format of the MagickDrawImage method is:
2489 %
2490 %      MagickBooleanType MagickDrawImage(MagickWand *wand,
2491 %        const DrawingWand *drawing_wand)
2492 %
2493 %  A description of each parameter follows:
2494 %
2495 %    o wand: the magick wand.
2496 %
2497 %    o drawing_wand: the draw wand.
2498 %
2499 */
2500 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2501   const DrawingWand *drawing_wand)
2502 {
2503   char
2504     *primitive;
2505
2506   DrawInfo
2507     *draw_info;
2508
2509   MagickBooleanType
2510     status;
2511
2512   assert(wand != (MagickWand *) NULL);
2513   assert(wand->signature == WandSignature);
2514   if (wand->debug != MagickFalse)
2515     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2516   if (wand->images == (Image *) NULL)
2517     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2518   draw_info=PeekDrawingWand(drawing_wand);
2519   if ((draw_info == (DrawInfo *) NULL) ||
2520       (draw_info->primitive == (char *) NULL))
2521     return(MagickFalse);
2522   primitive=AcquireString(draw_info->primitive);
2523   draw_info=DestroyDrawInfo(draw_info);
2524   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2525   draw_info->primitive=primitive;
2526   status=DrawImage(wand->images,draw_info,wand->exception);
2527   draw_info=DestroyDrawInfo(draw_info);
2528   return(status);
2529 }
2530 \f
2531 /*
2532 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2533 %                                                                             %
2534 %                                                                             %
2535 %                                                                             %
2536 %   M a g i c k E d g e I m a g e                                             %
2537 %                                                                             %
2538 %                                                                             %
2539 %                                                                             %
2540 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2541 %
2542 %  MagickEdgeImage() enhance edges within the image with a convolution filter
2543 %  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2544 %  radius for you.
2545 %
2546 %  The format of the MagickEdgeImage method is:
2547 %
2548 %      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius,
2549 %        const double sigma)
2550 %
2551 %  A description of each parameter follows:
2552 %
2553 %    o wand: the magick wand.
2554 %
2555 %    o radius: the radius of the pixel neighborhood.
2556 %
2557 %    o sigma: the standard deviation of the Gaussian, in pixels.
2558 %
2559 */
2560 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2561   const double radius,const double sigma)
2562 {
2563   Image
2564     *edge_image;
2565
2566   assert(wand != (MagickWand *) NULL);
2567   assert(wand->signature == WandSignature);
2568   if (wand->debug != MagickFalse)
2569     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2570   if (wand->images == (Image *) NULL)
2571     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2572   edge_image=EdgeImage(wand->images,radius,sigma,wand->exception);
2573   if (edge_image == (Image *) NULL)
2574     return(MagickFalse);
2575   ReplaceImageInList(&wand->images,edge_image);
2576   return(MagickTrue);
2577 }
2578 \f
2579 /*
2580 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2581 %                                                                             %
2582 %                                                                             %
2583 %                                                                             %
2584 %   M a g i c k E m b o s s I m a g e                                         %
2585 %                                                                             %
2586 %                                                                             %
2587 %                                                                             %
2588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2589 %
2590 %  MagickEmbossImage() returns a grayscale image with a three-dimensional
2591 %  effect.  We convolve the image with a Gaussian operator of the given radius
2592 %  and standard deviation (sigma).  For reasonable results, radius should be
2593 %  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2594 %  radius for you.
2595 %
2596 %  The format of the MagickEmbossImage method is:
2597 %
2598 %      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2599 %        const double sigma)
2600 %
2601 %  A description of each parameter follows:
2602 %
2603 %    o wand: the magick wand.
2604 %
2605 %    o radius: the radius of the Gaussian, in pixels, not counting the center
2606 %      pixel.
2607 %
2608 %    o sigma: the standard deviation of the Gaussian, in pixels.
2609 %
2610 */
2611 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2612   const double radius,const double sigma)
2613 {
2614   Image
2615     *emboss_image;
2616
2617   assert(wand != (MagickWand *) NULL);
2618   assert(wand->signature == WandSignature);
2619   if (wand->debug != MagickFalse)
2620     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2621   if (wand->images == (Image *) NULL)
2622     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2623   emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2624   if (emboss_image == (Image *) NULL)
2625     return(MagickFalse);
2626   ReplaceImageInList(&wand->images,emboss_image);
2627   return(MagickTrue);
2628 }
2629 \f
2630 /*
2631 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2632 %                                                                             %
2633 %                                                                             %
2634 %                                                                             %
2635 %   M a g i c k E n c i p h e r I m a g e                                     %
2636 %                                                                             %
2637 %                                                                             %
2638 %                                                                             %
2639 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2640 %
2641 %  MagickEncipherImage() converts plaint pixels to cipher pixels.
2642 %
2643 %  The format of the MagickEncipherImage method is:
2644 %
2645 %      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2646 %        const char *passphrase)
2647 %
2648 %  A description of each parameter follows:
2649 %
2650 %    o wand: the magick wand.
2651 %
2652 %    o passphrase: the passphrase.
2653 %
2654 */
2655 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2656   const char *passphrase)
2657 {
2658   assert(wand != (MagickWand *) NULL);
2659   assert(wand->signature == WandSignature);
2660   if (wand->debug != MagickFalse)
2661     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2662   if (wand->images == (Image *) NULL)
2663     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2664   return(EncipherImage(wand->images,passphrase,wand->exception));
2665 }
2666 \f
2667 /*
2668 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2669 %                                                                             %
2670 %                                                                             %
2671 %                                                                             %
2672 %   M a g i c k E n h a n c e I m a g e                                       %
2673 %                                                                             %
2674 %                                                                             %
2675 %                                                                             %
2676 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2677 %
2678 %  MagickEnhanceImage() applies a digital filter that improves the quality of a
2679 %  noisy image.
2680 %
2681 %  The format of the MagickEnhanceImage method is:
2682 %
2683 %      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2684 %
2685 %  A description of each parameter follows:
2686 %
2687 %    o wand: the magick wand.
2688 %
2689 */
2690 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2691 {
2692   Image
2693     *enhance_image;
2694
2695   assert(wand != (MagickWand *) NULL);
2696   assert(wand->signature == WandSignature);
2697   if (wand->debug != MagickFalse)
2698     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2699   if (wand->images == (Image *) NULL)
2700     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2701   enhance_image=EnhanceImage(wand->images,wand->exception);
2702   if (enhance_image == (Image *) NULL)
2703     return(MagickFalse);
2704   ReplaceImageInList(&wand->images,enhance_image);
2705   return(MagickTrue);
2706 }
2707 \f
2708 /*
2709 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2710 %                                                                             %
2711 %                                                                             %
2712 %                                                                             %
2713 %   M a g i c k E q u a l i z e I m a g e                                     %
2714 %                                                                             %
2715 %                                                                             %
2716 %                                                                             %
2717 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2718 %
2719 %  MagickEqualizeImage() equalizes the image histogram.
2720 %
2721 %  The format of the MagickEqualizeImage method is:
2722 %
2723 %      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2724 %
2725 %  A description of each parameter follows:
2726 %
2727 %    o wand: the magick wand.
2728 %
2729 %    o channel: the image channel(s).
2730 %
2731 */
2732 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2733 {
2734   MagickBooleanType
2735     status;
2736
2737   assert(wand != (MagickWand *) NULL);
2738   assert(wand->signature == WandSignature);
2739   if (wand->debug != MagickFalse)
2740     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2741   if (wand->images == (Image *) NULL)
2742     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2743   status=EqualizeImage(wand->images,wand->exception);
2744   return(status);
2745 }
2746 \f
2747 /*
2748 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2749 %                                                                             %
2750 %                                                                             %
2751 %                                                                             %
2752 %   M a g i c k E v a l u a t e I m a g e                                     %
2753 %                                                                             %
2754 %                                                                             %
2755 %                                                                             %
2756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2757 %
2758 %  MagickEvaluateImage() applys an arithmetic, relational, or logical
2759 %  expression to an image.  Use these operators to lighten or darken an image,
2760 %  to increase or decrease contrast in an image, or to produce the "negative"
2761 %  of an image.
2762 %
2763 %  The format of the MagickEvaluateImage method is:
2764 %
2765 %      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2766 %        const MagickEvaluateOperator operator,const double value)
2767 %      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2768 %        const MagickEvaluateOperator operator)
2769 %
2770 %  A description of each parameter follows:
2771 %
2772 %    o wand: the magick wand.
2773 %
2774 %    o op: A channel operator.
2775 %
2776 %    o value: A value value.
2777 %
2778 */
2779
2780 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2781   const MagickEvaluateOperator op)
2782 {
2783   Image
2784     *evaluate_image;
2785
2786   assert(wand != (MagickWand *) NULL);
2787   assert(wand->signature == WandSignature);
2788   if (wand->debug != MagickFalse)
2789     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2790   if (wand->images == (Image *) NULL)
2791     return((MagickWand *) NULL);
2792   evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2793   if (evaluate_image == (Image *) NULL)
2794     return((MagickWand *) NULL);
2795   return(CloneMagickWandFromImages(wand,evaluate_image));
2796 }
2797
2798 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2799   const MagickEvaluateOperator op,const double value)
2800 {
2801   MagickBooleanType
2802     status;
2803
2804   assert(wand != (MagickWand *) NULL);
2805   assert(wand->signature == WandSignature);
2806   if (wand->debug != MagickFalse)
2807     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2808   if (wand->images == (Image *) NULL)
2809     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2810   status=EvaluateImage(wand->images,op,value,wand->exception);
2811   return(status);
2812 }
2813 \f
2814 /*
2815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2816 %                                                                             %
2817 %                                                                             %
2818 %                                                                             %
2819 %   M a g i c k E x p o r t I m a g e P i x e l s                             %
2820 %                                                                             %
2821 %                                                                             %
2822 %                                                                             %
2823 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2824 %
2825 %  MagickExportImagePixels() extracts pixel data from an image and returns it
2826 %  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2827 %  an error is encountered.  The data is returned as char, short int, int,
2828 %  ssize_t, float, or double in the order specified by map.
2829 %
2830 %  Suppose you want to extract the first scanline of a 640x480 image as
2831 %  character data in red-green-blue order:
2832 %
2833 %      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
2834 %
2835 %  The format of the MagickExportImagePixels method is:
2836 %
2837 %      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2838 %        const ssize_t x,const ssize_t y,const size_t columns,
2839 %        const size_t rows,const char *map,const StorageType storage,
2840 %        void *pixels)
2841 %
2842 %  A description of each parameter follows:
2843 %
2844 %    o wand: the magick wand.
2845 %
2846 %    o x, y, columns, rows:  These values define the perimeter
2847 %      of a region of pixels you want to extract.
2848 %
2849 %    o map:  This string reflects the expected ordering of the pixel array.
2850 %      It can be any combination or order of R = red, G = green, B = blue,
2851 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2852 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2853 %      P = pad.
2854 %
2855 %    o storage: Define the data type of the pixels.  Float and double types are
2856 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2857 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2858 %      LongPixel, QuantumPixel, or ShortPixel.
2859 %
2860 %    o pixels: This array of values contain the pixel components as defined by
2861 %      map and type.  You must preallocate this array where the expected
2862 %      length varies depending on the values of width, height, map, and type.
2863 %
2864 */
2865 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2866   const ssize_t x,const ssize_t y,const size_t columns,
2867   const size_t rows,const char *map,const StorageType storage,
2868   void *pixels)
2869 {
2870   MagickBooleanType
2871     status;
2872
2873   assert(wand != (MagickWand *) NULL);
2874   assert(wand->signature == WandSignature);
2875   if (wand->debug != MagickFalse)
2876     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2877   if (wand->images == (Image *) NULL)
2878     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2879   status=ExportImagePixels(wand->images,x,y,columns,rows,map,
2880     storage,pixels,wand->exception);
2881   return(status);
2882 }
2883 \f
2884 /*
2885 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2886 %                                                                             %
2887 %                                                                             %
2888 %                                                                             %
2889 %   M a g i c k E x t e n t I m a g e                                         %
2890 %                                                                             %
2891 %                                                                             %
2892 %                                                                             %
2893 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2894 %
2895 %  MagickExtentImage() extends the image as defined by the geometry, gravity,
2896 %  and wand background color.  Set the (x,y) offset of the geometry to move
2897 %  the original wand relative to the extended wand.
2898 %
2899 %  The format of the MagickExtentImage method is:
2900 %
2901 %      MagickBooleanType MagickExtentImage(MagickWand *wand,
2902 %        const size_t width,const size_t height,const ssize_t x,
2903 %        const ssize_t y)
2904 %
2905 %  A description of each parameter follows:
2906 %
2907 %    o wand: the magick wand.
2908 %
2909 %    o width: the region width.
2910 %
2911 %    o height: the region height.
2912 %
2913 %    o x: the region x offset.
2914 %
2915 %    o y: the region y offset.
2916 %
2917 */
2918 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
2919   const size_t width,const size_t height,const ssize_t x,
2920   const ssize_t y)
2921 {
2922   Image
2923     *extent_image;
2924
2925   RectangleInfo
2926     extent;
2927
2928   assert(wand != (MagickWand *) NULL);
2929   assert(wand->signature == WandSignature);
2930   if (wand->debug != MagickFalse)
2931     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2932   if (wand->images == (Image *) NULL)
2933     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2934   extent.width=width;
2935   extent.height=height;
2936   extent.x=x;
2937   extent.y=y;
2938   extent_image=ExtentImage(wand->images,&extent,wand->exception);
2939   if (extent_image == (Image *) NULL)
2940     return(MagickFalse);
2941   ReplaceImageInList(&wand->images,extent_image);
2942   return(MagickTrue);
2943 }
2944 \f
2945 /*
2946 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2947 %                                                                             %
2948 %                                                                             %
2949 %                                                                             %
2950 %   M a g i c k F l i p I m a g e                                             %
2951 %                                                                             %
2952 %                                                                             %
2953 %                                                                             %
2954 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2955 %
2956 %  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
2957 %  around the central x-axis.
2958 %
2959 %  The format of the MagickFlipImage method is:
2960 %
2961 %      MagickBooleanType MagickFlipImage(MagickWand *wand)
2962 %
2963 %  A description of each parameter follows:
2964 %
2965 %    o wand: the magick wand.
2966 %
2967 */
2968 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
2969 {
2970   Image
2971     *flip_image;
2972
2973   assert(wand != (MagickWand *) NULL);
2974   assert(wand->signature == WandSignature);
2975   if (wand->debug != MagickFalse)
2976     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2977   if (wand->images == (Image *) NULL)
2978     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2979   flip_image=FlipImage(wand->images,wand->exception);
2980   if (flip_image == (Image *) NULL)
2981     return(MagickFalse);
2982   ReplaceImageInList(&wand->images,flip_image);
2983   return(MagickTrue);
2984 }
2985 \f
2986 /*
2987 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2988 %                                                                             %
2989 %                                                                             %
2990 %                                                                             %
2991 %   M a g i c k F l o o d f i l l P a i n t I m a g e                         %
2992 %                                                                             %
2993 %                                                                             %
2994 %                                                                             %
2995 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2996 %
2997 %  MagickFloodfillPaintImage() changes the color value of any pixel that matches
2998 %  target and is an immediate neighbor.  If the method FillToBorderMethod is
2999 %  specified, the color value is changed for any neighbor pixel that does not
3000 %  match the bordercolor member of image.
3001 %
3002 %  The format of the MagickFloodfillPaintImage method is:
3003 %
3004 %      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3005 %        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3006 %        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3007 %
3008 %  A description of each parameter follows:
3009 %
3010 %    o wand: the magick wand.
3011 %
3012 %    o fill: the floodfill color pixel wand.
3013 %
3014 %    o fuzz: By default target must match a particular pixel color
3015 %      exactly.  However, in many cases two colors may differ by a small amount.
3016 %      The fuzz member of image defines how much tolerance is acceptable to
3017 %      consider two colors as the same.  For example, set fuzz to 10 and the
3018 %      color red at intensities of 100 and 102 respectively are now interpreted
3019 %      as the same color for the purposes of the floodfill.
3020 %
3021 %    o bordercolor: the border color pixel wand.
3022 %
3023 %    o x,y: the starting location of the operation.
3024 %
3025 %    o invert: paint any pixel that does not match the target color.
3026 %
3027 */
3028 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3029   const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3030   const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3031 {
3032   DrawInfo
3033     *draw_info;
3034
3035   MagickBooleanType
3036     status;
3037
3038   PixelInfo
3039     target;
3040
3041   assert(wand != (MagickWand *) NULL);
3042   assert(wand->signature == WandSignature);
3043   if (wand->debug != MagickFalse)
3044     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3045   if (wand->images == (Image *) NULL)
3046     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3047   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3048   PixelGetQuantumPacket(fill,&draw_info->fill);
3049   (void) GetOneVirtualMagickPixel(wand->images,TileVirtualPixelMethod,x %
3050     wand->images->columns,y % wand->images->rows,&target,wand->exception);
3051   if (bordercolor != (PixelWand *) NULL)
3052     PixelGetMagickColor(bordercolor,&target);
3053   wand->images->fuzz=fuzz;
3054   status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3055     wand->exception);
3056   draw_info=DestroyDrawInfo(draw_info);
3057   return(status);
3058 }
3059 \f
3060 /*
3061 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3062 %                                                                             %
3063 %                                                                             %
3064 %                                                                             %
3065 %   M a g i c k F l o p I m a g e                                             %
3066 %                                                                             %
3067 %                                                                             %
3068 %                                                                             %
3069 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3070 %
3071 %  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3072 %  around the central y-axis.
3073 %
3074 %  The format of the MagickFlopImage method is:
3075 %
3076 %      MagickBooleanType MagickFlopImage(MagickWand *wand)
3077 %
3078 %  A description of each parameter follows:
3079 %
3080 %    o wand: the magick wand.
3081 %
3082 */
3083 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3084 {
3085   Image
3086     *flop_image;
3087
3088   assert(wand != (MagickWand *) NULL);
3089   assert(wand->signature == WandSignature);
3090   if (wand->debug != MagickFalse)
3091     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3092   if (wand->images == (Image *) NULL)
3093     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3094   flop_image=FlopImage(wand->images,wand->exception);
3095   if (flop_image == (Image *) NULL)
3096     return(MagickFalse);
3097   ReplaceImageInList(&wand->images,flop_image);
3098   return(MagickTrue);
3099 }
3100 \f
3101 /*
3102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3103 %                                                                             %
3104 %                                                                             %
3105 %                                                                             %
3106 %   M a g i c k F o u r i e r T r a n s f o r m I m a g e                     %
3107 %                                                                             %
3108 %                                                                             %
3109 %                                                                             %
3110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3111 %
3112 %  MagickForwardFourierTransformImage() implements the discrete Fourier
3113 %  transform (DFT) of the image either as a magnitude / phase or real /
3114 %  imaginary image pair.
3115 %
3116 %  The format of the MagickForwardFourierTransformImage method is:
3117 %
3118 %      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3119 %        const MagickBooleanType magnitude)
3120 %
3121 %  A description of each parameter follows:
3122 %
3123 %    o wand: the magick wand.
3124 %
3125 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3126 %      imaginary image pair.
3127 %
3128 */
3129 WandExport MagickBooleanType MagickForwardFourierTransformImage(
3130   MagickWand *wand,const MagickBooleanType magnitude)
3131 {
3132   Image
3133     *forward_image;
3134
3135   assert(wand != (MagickWand *) NULL);
3136   assert(wand->signature == WandSignature);
3137   if (wand->debug != MagickFalse)
3138     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3139   if (wand->images == (Image *) NULL)
3140     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3141   forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3142     wand->exception);
3143   if (forward_image == (Image *) NULL)
3144     return(MagickFalse);
3145   ReplaceImageInList(&wand->images,forward_image);
3146   return(MagickTrue);
3147 }
3148 \f
3149 /*
3150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3151 %                                                                             %
3152 %                                                                             %
3153 %                                                                             %
3154 %   M a g i c k F r a m e I m a g e                                           %
3155 %                                                                             %
3156 %                                                                             %
3157 %                                                                             %
3158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3159 %
3160 %  MagickFrameImage() adds a simulated three-dimensional border around the
3161 %  image.  The width and height specify the border width of the vertical and
3162 %  horizontal sides of the frame.  The inner and outer bevels indicate the
3163 %  width of the inner and outer shadows of the frame.
3164 %
3165 %  The format of the MagickFrameImage method is:
3166 %
3167 %      MagickBooleanType MagickFrameImage(MagickWand *wand,
3168 %        const PixelWand *matte_color,const size_t width,
3169 %        const size_t height,const ssize_t inner_bevel,
3170 %        const ssize_t outer_bevel,const CompositeOperator compose)
3171 %
3172 %  A description of each parameter follows:
3173 %
3174 %    o wand: the magick wand.
3175 %
3176 %    o matte_color: the frame color pixel wand.
3177 %
3178 %    o width: the border width.
3179 %
3180 %    o height: the border height.
3181 %
3182 %    o inner_bevel: the inner bevel width.
3183 %
3184 %    o outer_bevel: the outer bevel width.
3185 %
3186 %    o compose: the composite operator.
3187 %
3188 */
3189 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3190   const PixelWand *matte_color,const size_t width,const size_t height,
3191   const ssize_t inner_bevel,const ssize_t outer_bevel,
3192   const CompositeOperator compose)
3193 {
3194   Image
3195     *frame_image;
3196
3197   FrameInfo
3198     frame_info;
3199
3200   assert(wand != (MagickWand *) NULL);
3201   assert(wand->signature == WandSignature);
3202   if (wand->debug != MagickFalse)
3203     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3204   if (wand->images == (Image *) NULL)
3205     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3206   (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3207   frame_info.width=wand->images->columns+2*width;
3208   frame_info.height=wand->images->rows+2*height;
3209   frame_info.x=(ssize_t) width;
3210   frame_info.y=(ssize_t) height;
3211   frame_info.inner_bevel=inner_bevel;
3212   frame_info.outer_bevel=outer_bevel;
3213   PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3214   frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3215   if (frame_image == (Image *) NULL)
3216     return(MagickFalse);
3217   ReplaceImageInList(&wand->images,frame_image);
3218   return(MagickTrue);
3219 }
3220 \f
3221 /*
3222 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3223 %                                                                             %
3224 %                                                                             %
3225 %                                                                             %
3226 %   M a g i c k F u n c t i o n I m a g e                                     %
3227 %                                                                             %
3228 %                                                                             %
3229 %                                                                             %
3230 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3231 %
3232 %  MagickFunctionImage() applys an arithmetic, relational, or logical
3233 %  expression to an image.  Use these operators to lighten or darken an image,
3234 %  to increase or decrease contrast in an image, or to produce the "negative"
3235 %  of an image.
3236 %
3237 %  The format of the MagickFunctionImage method is:
3238 %
3239 %      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3240 %        const MagickFunction function,const size_t number_arguments,
3241 %        const double *arguments)
3242 %
3243 %  A description of each parameter follows:
3244 %
3245 %    o wand: the magick wand.
3246 %
3247 %    o function: the image function.
3248 %
3249 %    o number_arguments: the number of function arguments.
3250 %
3251 %    o arguments: the function arguments.
3252 %
3253 */
3254 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3255   const MagickFunction function,const size_t number_arguments,
3256   const double *arguments)
3257 {
3258   MagickBooleanType
3259     status;
3260
3261   assert(wand != (MagickWand *) NULL);
3262   assert(wand->signature == WandSignature);
3263   if (wand->debug != MagickFalse)
3264     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3265   if (wand->images == (Image *) NULL)
3266     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3267   status=FunctionImage(wand->images,function,number_arguments,arguments,
3268     wand->exception);
3269   return(status);
3270 }
3271 \f
3272 /*
3273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3274 %                                                                             %
3275 %                                                                             %
3276 %                                                                             %
3277 %   M a g i c k F x I m a g e                                                 %
3278 %                                                                             %
3279 %                                                                             %
3280 %                                                                             %
3281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3282 %
3283 %  MagickFxImage() evaluate expression for each pixel in the image.
3284 %
3285 %  The format of the MagickFxImage method is:
3286 %
3287 %      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3288 %
3289 %  A description of each parameter follows:
3290 %
3291 %    o wand: the magick wand.
3292 %
3293 %    o expression: the expression.
3294 %
3295 */
3296 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3297 {
3298   Image
3299     *fx_image;
3300
3301   assert(wand != (MagickWand *) NULL);
3302   assert(wand->signature == WandSignature);
3303   if (wand->debug != MagickFalse)
3304     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3305   if (wand->images == (Image *) NULL)
3306     return((MagickWand *) NULL);
3307   fx_image=FxImage(wand->images,expression,wand->exception);
3308   if (fx_image == (Image *) NULL)
3309     return((MagickWand *) NULL);
3310   return(CloneMagickWandFromImages(wand,fx_image));
3311 }
3312 \f
3313 /*
3314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3315 %                                                                             %
3316 %                                                                             %
3317 %                                                                             %
3318 %   M a g i c k G a m m a I m a g e                                           %
3319 %                                                                             %
3320 %                                                                             %
3321 %                                                                             %
3322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3323 %
3324 %  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3325 %  different devices will have perceptual differences in the way the image's
3326 %  intensities are represented on the screen.  Specify individual gamma levels
3327 %  for the red, green, and blue channels, or adjust all three with the gamma
3328 %  parameter.  Values typically range from 0.8 to 2.3.
3329 %
3330 %  You can also reduce the influence of a particular channel with a gamma
3331 %  value of 0.
3332 %
3333 %  The format of the MagickGammaImage method is:
3334 %
3335 %      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3336 %
3337 %  A description of each parameter follows:
3338 %
3339 %    o wand: the magick wand.
3340 %
3341 %    o level: Define the level of gamma correction.
3342 %
3343 */
3344 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3345   const double gamma)
3346 {
3347   MagickBooleanType
3348     status;
3349
3350   assert(wand != (MagickWand *) NULL);
3351   assert(wand->signature == WandSignature);
3352   if (wand->debug != MagickFalse)
3353     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3354   if (wand->images == (Image *) NULL)
3355     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3356   status=GammaImage(wand->images,gamma,wand->exception);
3357   return(status);
3358 }
3359 \f
3360 /*
3361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3362 %                                                                             %
3363 %                                                                             %
3364 %                                                                             %
3365 %   M a g i c k G a u s s i a n B l u r I m a g e                             %
3366 %                                                                             %
3367 %                                                                             %
3368 %                                                                             %
3369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3370 %
3371 %  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3372 %  Gaussian operator of the given radius and standard deviation (sigma).
3373 %  For reasonable results, the radius should be larger than sigma.  Use a
3374 %  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3375 %
3376 %  The format of the MagickGaussianBlurImage method is:
3377 %
3378 %      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3379 %        const double radius,const double sigma,const double bias)
3380 %
3381 %  A description of each parameter follows:
3382 %
3383 %    o wand: the magick wand.
3384 %
3385 %    o radius: the radius of the Gaussian, in pixels, not counting the center
3386 %      pixel.
3387 %
3388 %    o sigma: the standard deviation of the Gaussian, in pixels.
3389 %
3390 %    o bias: the bias.
3391 %
3392 */
3393 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3394   const double radius,const double sigma,const double bias)
3395 {
3396   Image
3397     *blur_image;
3398
3399   assert(wand != (MagickWand *) NULL);
3400   assert(wand->signature == WandSignature);
3401   if (wand->debug != MagickFalse)
3402     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3403   if (wand->images == (Image *) NULL)
3404     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3405   blur_image=GaussianBlurImage(wand->images,radius,sigma,bias,wand->exception);
3406   if (blur_image == (Image *) NULL)
3407     return(MagickFalse);
3408   ReplaceImageInList(&wand->images,blur_image);
3409   return(MagickTrue);
3410 }
3411 \f
3412 /*
3413 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3414 %                                                                             %
3415 %                                                                             %
3416 %                                                                             %
3417 %   M a g i c k G e t I m a g e                                               %
3418 %                                                                             %
3419 %                                                                             %
3420 %                                                                             %
3421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3422 %
3423 %  MagickGetImage() gets the image at the current image index.
3424 %
3425 %  The format of the MagickGetImage method is:
3426 %
3427 %      MagickWand *MagickGetImage(MagickWand *wand)
3428 %
3429 %  A description of each parameter follows:
3430 %
3431 %    o wand: the magick wand.
3432 %
3433 */
3434 WandExport MagickWand *MagickGetImage(MagickWand *wand)
3435 {
3436   Image
3437     *image;
3438
3439   assert(wand != (MagickWand *) NULL);
3440   assert(wand->signature == WandSignature);
3441   if (wand->debug != MagickFalse)
3442     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3443   if (wand->images == (Image *) NULL)
3444     {
3445       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3446         "ContainsNoImages","`%s'",wand->name);
3447       return((MagickWand *) NULL);
3448     }
3449   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3450   if (image == (Image *) NULL)
3451     return((MagickWand *) NULL);
3452   return(CloneMagickWandFromImages(wand,image));
3453 }
3454 \f
3455 /*
3456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3457 %                                                                             %
3458 %                                                                             %
3459 %                                                                             %
3460 %   M a g i c k G e t I m a g e A l p h a C h a n n e l                       %
3461 %                                                                             %
3462 %                                                                             %
3463 %                                                                             %
3464 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3465 %
3466 %  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3467 %  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3468 %  than CMYKA.
3469 %
3470 %  The format of the MagickGetImageAlphaChannel method is:
3471 %
3472 %      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3473 %
3474 %  A description of each parameter follows:
3475 %
3476 %    o wand: the magick wand.
3477 %
3478 */
3479 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3480 {
3481   assert(wand != (MagickWand *) NULL);
3482   assert(wand->signature == WandSignature);
3483   if (wand->debug != MagickFalse)
3484     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3485   if (wand->images == (Image *) NULL)
3486     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3487   return(GetImageAlphaChannel(wand->images));
3488 }
3489 \f
3490 /*
3491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3492 %                                                                             %
3493 %                                                                             %
3494 %                                                                             %
3495 %   M a g i c k G e t I m a g e C l i p M a s k                               %
3496 %                                                                             %
3497 %                                                                             %
3498 %                                                                             %
3499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3500 %
3501 %  MagickGetImageClipMask() gets the image clip mask at the current image index.
3502 %
3503 %  The format of the MagickGetImageClipMask method is:
3504 %
3505 %      MagickWand *MagickGetImageClipMask(MagickWand *wand)
3506 %
3507 %  A description of each parameter follows:
3508 %
3509 %    o wand: the magick wand.
3510 %
3511 */
3512 WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
3513 {
3514   Image
3515     *image;
3516
3517   assert(wand != (MagickWand *) NULL);
3518   assert(wand->signature == WandSignature);
3519   if (wand->debug != MagickFalse)
3520     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3521   if (wand->images == (Image *) NULL)
3522     {
3523       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3524         "ContainsNoImages","`%s'",wand->name);
3525       return((MagickWand *) NULL);
3526     }
3527   image=GetImageClipMask(wand->images,wand->exception);
3528   if (image == (Image *) NULL)
3529     return((MagickWand *) NULL);
3530   return(CloneMagickWandFromImages(wand,image));
3531 }
3532 \f
3533 /*
3534 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3535 %                                                                             %
3536 %                                                                             %
3537 %                                                                             %
3538 %   M a g i c k G e t I m a g e B a c k g r o u n d C o l o r                 %
3539 %                                                                             %
3540 %                                                                             %
3541 %                                                                             %
3542 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3543 %
3544 %  MagickGetImageBackgroundColor() returns the image background color.
3545 %
3546 %  The format of the MagickGetImageBackgroundColor method is:
3547 %
3548 %      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3549 %        PixelWand *background_color)
3550 %
3551 %  A description of each parameter follows:
3552 %
3553 %    o wand: the magick wand.
3554 %
3555 %    o background_color: Return the background color.
3556 %
3557 */
3558 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3559   PixelWand *background_color)
3560 {
3561   assert(wand != (MagickWand *) NULL);
3562   assert(wand->signature == WandSignature);
3563   if (wand->debug != MagickFalse)
3564     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3565   if (wand->images == (Image *) NULL)
3566     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3567   PixelSetQuantumPacket(background_color,&wand->images->background_color);
3568   return(MagickTrue);
3569 }
3570 \f
3571 /*
3572 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3573 %                                                                             %
3574 %                                                                             %
3575 %                                                                             %
3576 %   M a g i c k G e t I m a g e B l o b                                       %
3577 %                                                                             %
3578 %                                                                             %
3579 %                                                                             %
3580 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3581 %
3582 %  MagickGetImageBlob() implements direct to memory image formats.  It returns
3583 %  the image as a blob (a formatted "file" in memory) and its length, starting
3584 %  from the current position in the image sequence.  Use MagickSetImageFormat()
3585 %  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3586 %
3587 %  Utilize MagickResetIterator() to ensure the write is from the beginning of
3588 %  the image sequence.
3589 %
3590 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
3591 %
3592 %  The format of the MagickGetImageBlob method is:
3593 %
3594 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3595 %
3596 %  A description of each parameter follows:
3597 %
3598 %    o wand: the magick wand.
3599 %
3600 %    o length: the length of the blob.
3601 %
3602 */
3603 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3604 {
3605   assert(wand != (MagickWand *) NULL);
3606   assert(wand->signature == WandSignature);
3607   if (wand->debug != MagickFalse)
3608     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3609   if (wand->images == (Image *) NULL)
3610     {
3611       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3612         "ContainsNoImages","`%s'",wand->name);
3613       return((unsigned char *) NULL);
3614     }
3615   return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3616 }
3617 \f
3618 /*
3619 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3620 %                                                                             %
3621 %                                                                             %
3622 %                                                                             %
3623 %   M a g i c k G e t I m a g e s B l o b                                     %
3624 %                                                                             %
3625 %                                                                             %
3626 %                                                                             %
3627 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3628 %
3629 %  MagickGetImageBlob() implements direct to memory image formats.  It
3630 %  returns the image sequence as a blob and its length.  The format of the image
3631 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3632 %  return a different image format, use MagickSetImageFormat().
3633 %
3634 %  Note, some image formats do not permit multiple images to the same image
3635 %  stream (e.g. JPEG).  in this instance, just the first image of the
3636 %  sequence is returned as a blob.
3637 %
3638 %  The format of the MagickGetImagesBlob method is:
3639 %
3640 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3641 %
3642 %  A description of each parameter follows:
3643 %
3644 %    o wand: the magick wand.
3645 %
3646 %    o length: the length of the blob.
3647 %
3648 */
3649 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3650 {
3651   unsigned char
3652     *blob;
3653
3654   assert(wand != (MagickWand *) NULL);
3655   assert(wand->signature == WandSignature);
3656   if (wand->debug != MagickFalse)
3657     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3658   if (wand->images == (Image *) NULL)
3659     {
3660       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3661         "ContainsNoImages","`%s'",wand->name);
3662       return((unsigned char *) NULL);
3663     }
3664   blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3665     wand->exception);
3666   return(blob);
3667 }
3668 \f
3669 /*
3670 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3671 %                                                                             %
3672 %                                                                             %
3673 %                                                                             %
3674 %   M a g i c k G e t I m a g e B l u e P r i m a r y                         %
3675 %                                                                             %
3676 %                                                                             %
3677 %                                                                             %
3678 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3679 %
3680 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3681 %  image.
3682 %
3683 %  The format of the MagickGetImageBluePrimary method is:
3684 %
3685 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3686 %        double *y)
3687 %
3688 %  A description of each parameter follows:
3689 %
3690 %    o wand: the magick wand.
3691 %
3692 %    o x: the chromaticity blue primary x-point.
3693 %
3694 %    o y: the chromaticity blue primary y-point.
3695 %
3696 */
3697 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3698   double *x,double *y)
3699 {
3700   assert(wand != (MagickWand *) NULL);
3701   assert(wand->signature == WandSignature);
3702   if (wand->debug != MagickFalse)
3703     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3704   if (wand->images == (Image *) NULL)
3705     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3706   *x=wand->images->chromaticity.blue_primary.x;
3707   *y=wand->images->chromaticity.blue_primary.y;
3708   return(MagickTrue);
3709 }
3710 \f
3711 /*
3712 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3713 %                                                                             %
3714 %                                                                             %
3715 %                                                                             %
3716 %   M a g i c k G e t I m a g e B o r d e r C o l o r                         %
3717 %                                                                             %
3718 %                                                                             %
3719 %                                                                             %
3720 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3721 %
3722 %  MagickGetImageBorderColor() returns the image border color.
3723 %
3724 %  The format of the MagickGetImageBorderColor method is:
3725 %
3726 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3727 %        PixelWand *border_color)
3728 %
3729 %  A description of each parameter follows:
3730 %
3731 %    o wand: the magick wand.
3732 %
3733 %    o border_color: Return the border color.
3734 %
3735 */
3736 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3737   PixelWand *border_color)
3738 {
3739   assert(wand != (MagickWand *) NULL);
3740   assert(wand->signature == WandSignature);
3741   if (wand->debug != MagickFalse)
3742     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3743   if (wand->images == (Image *) NULL)
3744     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3745   PixelSetQuantumPacket(border_color,&wand->images->border_color);
3746   return(MagickTrue);
3747 }
3748 \f
3749 /*
3750 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3751 %                                                                             %
3752 %                                                                             %
3753 %                                                                             %
3754 %   M a g i c k G e t I m a g e F e a t u r e s                               %
3755 %                                                                             %
3756 %                                                                             %
3757 %                                                                             %
3758 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3759 %
3760 %  MagickGetImageFeatures() returns features for each channel in the
3761 %  image in each of four directions (horizontal, vertical, left and right
3762 %  diagonals) for the specified distance.  The features include the angular
3763 %  second moment, contrast, correlation, sum of squares: variance, inverse
3764 %  difference moment, sum average, sum varience, sum entropy, entropy,
3765 %  difference variance, difference entropy, information measures of
3766 %  correlation 1, information measures of correlation 2, and maximum
3767 %  correlation coefficient.  You can access the red channel contrast, for
3768 %  example, like this:
3769 %
3770 %      channel_features=MagickGetImageFeatures(wand,1);
3771 %      contrast=channel_features[RedPixelChannel].contrast[0];
3772 %
3773 %  Use MagickRelinquishMemory() to free the statistics buffer.
3774 %
3775 %  The format of the MagickGetImageFeatures method is:
3776 %
3777 %      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3778 %        const size_t distance)
3779 %
3780 %  A description of each parameter follows:
3781 %
3782 %    o wand: the magick wand.
3783 %
3784 %    o distance: the distance.
3785 %
3786 */
3787 WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3788   const size_t distance)
3789 {
3790   assert(wand != (MagickWand *) NULL);
3791   assert(wand->signature == WandSignature);
3792   if (wand->debug != MagickFalse)
3793     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3794   if (wand->images == (Image *) NULL)
3795     {
3796       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3797         "ContainsNoImages","`%s'",wand->name);
3798       return((ChannelFeatures *) NULL);
3799     }
3800   return(GetImageFeatures(wand->images,distance,wand->exception));
3801 }
3802 \f
3803 /*
3804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3805 %                                                                             %
3806 %                                                                             %
3807 %                                                                             %
3808 %   M a g i c k G e t I m a g e K u r t o s i s                               %
3809 %                                                                             %
3810 %                                                                             %
3811 %                                                                             %
3812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3813 %
3814 %  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
3815 %  more image channels.
3816 %
3817 %  The format of the MagickGetImageKurtosis method is:
3818 %
3819 %      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3820 %        double *kurtosis,double *skewness)
3821 %
3822 %  A description of each parameter follows:
3823 %
3824 %    o wand: the magick wand.
3825 %
3826 %    o kurtosis:  The kurtosis for the specified channel(s).
3827 %
3828 %    o skewness:  The skewness for the specified channel(s).
3829 %
3830 */
3831 WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3832   double *kurtosis,double *skewness)
3833 {
3834   MagickBooleanType
3835     status;
3836
3837   assert(wand != (MagickWand *) NULL);
3838   assert(wand->signature == WandSignature);
3839   if (wand->debug != MagickFalse)
3840     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3841   if (wand->images == (Image *) NULL)
3842     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3843   status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
3844   return(status);
3845 }
3846 \f
3847 /*
3848 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3849 %                                                                             %
3850 %                                                                             %
3851 %                                                                             %
3852 %   M a g i c k G e t I m a g e M e a n                                       %
3853 %                                                                             %
3854 %                                                                             %
3855 %                                                                             %
3856 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3857 %
3858 %  MagickGetImageMean() gets the mean and standard deviation of one or more
3859 %  image channels.
3860 %
3861 %  The format of the MagickGetImageMean method is:
3862 %
3863 %      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3864 %        double *standard_deviation)
3865 %
3866 %  A description of each parameter follows:
3867 %
3868 %    o wand: the magick wand.
3869 %
3870 %    o channel: the image channel(s).
3871 %
3872 %    o mean:  The mean pixel value for the specified channel(s).
3873 %
3874 %    o standard_deviation:  The standard deviation for the specified channel(s).
3875 %
3876 */
3877 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3878   double *standard_deviation)
3879 {
3880   MagickBooleanType
3881     status;
3882
3883   assert(wand != (MagickWand *) NULL);
3884   assert(wand->signature == WandSignature);
3885   if (wand->debug != MagickFalse)
3886     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3887   if (wand->images == (Image *) NULL)
3888     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3889   status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
3890   return(status);
3891 }
3892 \f
3893 /*
3894 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3895 %                                                                             %
3896 %                                                                             %
3897 %                                                                             %
3898 %   M a g i c k G e t I m a g e R a n g e                                     %
3899 %                                                                             %
3900 %                                                                             %
3901 %                                                                             %
3902 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3903 %
3904 %  MagickGetImageRange() gets the range for one or more image channels.
3905 %
3906 %  The format of the MagickGetImageRange method is:
3907 %
3908 %      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
3909 %        double *maxima)
3910 %
3911 %  A description of each parameter follows:
3912 %
3913 %    o wand: the magick wand.
3914 %
3915 %    o minima:  The minimum pixel value for the specified channel(s).
3916 %
3917 %    o maxima:  The maximum pixel value for the specified channel(s).
3918 %
3919 */
3920 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
3921   double *minima,double *maxima)
3922 {
3923   MagickBooleanType
3924     status;
3925
3926   assert(wand != (MagickWand *) NULL);
3927   assert(wand->signature == WandSignature);
3928   if (wand->debug != MagickFalse)
3929     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3930   if (wand->images == (Image *) NULL)
3931     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3932   status=GetImageRange(wand->images,minima,maxima,wand->exception);
3933   return(status);
3934 }
3935 \f
3936 /*
3937 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3938 %                                                                             %
3939 %                                                                             %
3940 %                                                                             %
3941 %   M a g i c k G e t I m a g e S t a t i s t i c s                           %
3942 %                                                                             %
3943 %                                                                             %
3944 %                                                                             %
3945 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3946 %
3947 %  MagickGetImageStatistics() returns statistics for each channel in the
3948 %  image.  The statistics include the channel depth, its minima and
3949 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
3950 %  You can access the red channel mean, for example, like this:
3951 %
3952 %      channel_statistics=MagickGetImageStatistics(wand);
3953 %      red_mean=channel_statistics[RedPixelChannel].mean;
3954 %
3955 %  Use MagickRelinquishMemory() to free the statistics buffer.
3956 %
3957 %  The format of the MagickGetImageStatistics method is:
3958 %
3959 %      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3960 %
3961 %  A description of each parameter follows:
3962 %
3963 %    o wand: the magick wand.
3964 %
3965 */
3966 WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3967 {
3968   assert(wand != (MagickWand *) NULL);
3969   assert(wand->signature == WandSignature);
3970   if (wand->debug != MagickFalse)
3971     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3972   if (wand->images == (Image *) NULL)
3973     {
3974       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3975         "ContainsNoImages","`%s'",wand->name);
3976       return((ChannelStatistics *) NULL);
3977     }
3978   return(GetImageStatistics(wand->images,wand->exception));
3979 }
3980 \f
3981 /*
3982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3983 %                                                                             %
3984 %                                                                             %
3985 %                                                                             %
3986 %   M a g i c k G e t I m a g e C o l o r m a p C o l o r                     %
3987 %                                                                             %
3988 %                                                                             %
3989 %                                                                             %
3990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3991 %
3992 %  MagickGetImageColormapColor() returns the color of the specified colormap
3993 %  index.
3994 %
3995 %  The format of the MagickGetImageColormapColor method is:
3996 %
3997 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
3998 %        const size_t index,PixelWand *color)
3999 %
4000 %  A description of each parameter follows:
4001 %
4002 %    o wand: the magick wand.
4003 %
4004 %    o index: the offset into the image colormap.
4005 %
4006 %    o color: Return the colormap color in this wand.
4007 %
4008 */
4009 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4010   const size_t index,PixelWand *color)
4011 {
4012   assert(wand != (MagickWand *) NULL);
4013   assert(wand->signature == WandSignature);
4014   if (wand->debug != MagickFalse)
4015     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4016   if (wand->images == (Image *) NULL)
4017     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4018   if ((wand->images->colormap == (PixelInfo *) NULL) ||
4019       (index >= wand->images->colors))
4020     {
4021       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4022         "InvalidColormapIndex","`%s'",wand->name);
4023       return(MagickFalse);
4024     }
4025   PixelSetQuantumPacket(color,wand->images->colormap+index);
4026   return(MagickTrue);
4027 }
4028 \f
4029 /*
4030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4031 %                                                                             %
4032 %                                                                             %
4033 %                                                                             %
4034 %   M a g i c k G e t I m a g e C o l o r s                                   %
4035 %                                                                             %
4036 %                                                                             %
4037 %                                                                             %
4038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4039 %
4040 %  MagickGetImageColors() gets the number of unique colors in the image.
4041 %
4042 %  The format of the MagickGetImageColors method is:
4043 %
4044 %      size_t MagickGetImageColors(MagickWand *wand)
4045 %
4046 %  A description of each parameter follows:
4047 %
4048 %    o wand: the magick wand.
4049 %
4050 */
4051 WandExport size_t MagickGetImageColors(MagickWand *wand)
4052 {
4053   assert(wand != (MagickWand *) NULL);
4054   assert(wand->signature == WandSignature);
4055   if (wand->debug != MagickFalse)
4056     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4057   if (wand->images == (Image *) NULL)
4058     {
4059       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4060         "ContainsNoImages","`%s'",wand->name);
4061       return(0);
4062     }
4063   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4064 }
4065 \f
4066 /*
4067 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4068 %                                                                             %
4069 %                                                                             %
4070 %                                                                             %
4071 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4072 %                                                                             %
4073 %                                                                             %
4074 %                                                                             %
4075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4076 %
4077 %  MagickGetImageColorspace() gets the image colorspace.
4078 %
4079 %  The format of the MagickGetImageColorspace method is:
4080 %
4081 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4082 %
4083 %  A description of each parameter follows:
4084 %
4085 %    o wand: the magick wand.
4086 %
4087 */
4088 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4089 {
4090   assert(wand != (MagickWand *) NULL);
4091   assert(wand->signature == WandSignature);
4092   if (wand->debug != MagickFalse)
4093     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4094   if (wand->images == (Image *) NULL)
4095     {
4096       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4097         "ContainsNoImages","`%s'",wand->name);
4098       return(UndefinedColorspace);
4099     }
4100   return(wand->images->colorspace);
4101 }
4102 \f
4103 /*
4104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4105 %                                                                             %
4106 %                                                                             %
4107 %                                                                             %
4108 %   M a g i c k G e t I m a g e C o m p o s e                                 %
4109 %                                                                             %
4110 %                                                                             %
4111 %                                                                             %
4112 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4113 %
4114 %  MagickGetImageCompose() returns the composite operator associated with the
4115 %  image.
4116 %
4117 %  The format of the MagickGetImageCompose method is:
4118 %
4119 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4120 %
4121 %  A description of each parameter follows:
4122 %
4123 %    o wand: the magick wand.
4124 %
4125 */
4126 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4127 {
4128   assert(wand != (MagickWand *) NULL);
4129   assert(wand->signature == WandSignature);
4130   if (wand->debug != MagickFalse)
4131     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4132   if (wand->images == (Image *) NULL)
4133     {
4134       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4135         "ContainsNoImages","`%s'",wand->name);
4136       return(UndefinedCompositeOp);
4137     }
4138   return(wand->images->compose);
4139 }
4140 \f
4141 /*
4142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4143 %                                                                             %
4144 %                                                                             %
4145 %                                                                             %
4146 %   M a g i c k G e t I m a g e C o m p r e s s i o n                         %
4147 %                                                                             %
4148 %                                                                             %
4149 %                                                                             %
4150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4151 %
4152 %  MagickGetImageCompression() gets the image compression.
4153 %
4154 %  The format of the MagickGetImageCompression method is:
4155 %
4156 %      CompressionType MagickGetImageCompression(MagickWand *wand)
4157 %
4158 %  A description of each parameter follows:
4159 %
4160 %    o wand: the magick wand.
4161 %
4162 */
4163 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4164 {
4165   assert(wand != (MagickWand *) NULL);
4166   assert(wand->signature == WandSignature);
4167   if (wand->debug != MagickFalse)
4168     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4169   if (wand->images == (Image *) NULL)
4170     {
4171       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4172         "ContainsNoImages","`%s'",wand->name);
4173       return(UndefinedCompression);
4174     }
4175   return(wand->images->compression);
4176 }
4177 \f
4178 /*
4179 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4180 %                                                                             %
4181 %                                                                             %
4182 %                                                                             %
4183 %   M a g i c k G e t I m a g e C o m p r e s s i o n Q u a l i t y           %
4184 %                                                                             %
4185 %                                                                             %
4186 %                                                                             %
4187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4188 %
4189 %  MagickGetImageCompression() gets the image compression quality.
4190 %
4191 %  The format of the MagickGetImageCompression method is:
4192 %
4193 %      size_t MagickGetImageCompression(MagickWand *wand)
4194 %
4195 %  A description of each parameter follows:
4196 %
4197 %    o wand: the magick wand.
4198 %
4199 */
4200 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4201 {
4202   assert(wand != (MagickWand *) NULL);
4203   assert(wand->signature == WandSignature);
4204   if (wand->debug != MagickFalse)
4205     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4206   if (wand->images == (Image *) NULL)
4207     {
4208       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4209         "ContainsNoImages","`%s'",wand->name);
4210       return(0UL);
4211     }
4212   return(wand->images->quality);
4213 }
4214 \f
4215 /*
4216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4217 %                                                                             %
4218 %                                                                             %
4219 %                                                                             %
4220 %   M a g i c k G e t I m a g e D e l a y                                     %
4221 %                                                                             %
4222 %                                                                             %
4223 %                                                                             %
4224 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4225 %
4226 %  MagickGetImageDelay() gets the image delay.
4227 %
4228 %  The format of the MagickGetImageDelay method is:
4229 %
4230 %      size_t MagickGetImageDelay(MagickWand *wand)
4231 %
4232 %  A description of each parameter follows:
4233 %
4234 %    o wand: the magick wand.
4235 %
4236 */
4237 WandExport size_t MagickGetImageDelay(MagickWand *wand)
4238 {
4239   assert(wand != (MagickWand *) NULL);
4240   assert(wand->signature == WandSignature);
4241   if (wand->debug != MagickFalse)
4242     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4243   if (wand->images == (Image *) NULL)
4244     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4245   return(wand->images->delay);
4246 }
4247 \f
4248 /*
4249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4250 %                                                                             %
4251 %                                                                             %
4252 %                                                                             %
4253 %   M a g i c k G e t I m a g e D e p t h                                     %
4254 %                                                                             %
4255 %                                                                             %
4256 %                                                                             %
4257 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4258 %
4259 %  MagickGetImageDepth() gets the image depth.
4260 %
4261 %  The format of the MagickGetImageDepth method is:
4262 %
4263 %      size_t MagickGetImageDepth(MagickWand *wand)
4264 %
4265 %  A description of each parameter follows:
4266 %
4267 %    o wand: the magick wand.
4268 %
4269 */
4270 WandExport size_t MagickGetImageDepth(MagickWand *wand)
4271 {
4272   assert(wand != (MagickWand *) NULL);
4273   assert(wand->signature == WandSignature);
4274   if (wand->debug != MagickFalse)
4275     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4276   if (wand->images == (Image *) NULL)
4277     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4278   return(GetImageDepth(wand->images,wand->exception));
4279 }
4280 \f
4281 /*
4282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4283 %                                                                             %
4284 %                                                                             %
4285 %                                                                             %
4286 %   M a g i c k G e t I m a g e D i s p o s e                                 %
4287 %                                                                             %
4288 %                                                                             %
4289 %                                                                             %
4290 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4291 %
4292 %  MagickGetImageDispose() gets the image disposal method.
4293 %
4294 %  The format of the MagickGetImageDispose method is:
4295 %
4296 %      DisposeType MagickGetImageDispose(MagickWand *wand)
4297 %
4298 %  A description of each parameter follows:
4299 %
4300 %    o wand: the magick wand.
4301 %
4302 */
4303 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4304 {
4305   assert(wand != (MagickWand *) NULL);
4306   assert(wand->signature == WandSignature);
4307   if (wand->debug != MagickFalse)
4308     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4309   if (wand->images == (Image *) NULL)
4310     {
4311       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4312         "ContainsNoImages","`%s'",wand->name);
4313       return(UndefinedDispose);
4314     }
4315   return((DisposeType) wand->images->dispose);
4316 }
4317 \f
4318 /*
4319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4320 %                                                                             %
4321 %                                                                             %
4322 %                                                                             %
4323 %   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4324 %                                                                             %
4325 %                                                                             %
4326 %                                                                             %
4327 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4328 %
4329 %  MagickGetImageDistortion() compares an image to a reconstructed image and
4330 %  returns the specified distortion metric.
4331 %
4332 %  The format of the MagickGetImageDistortion method is:
4333 %
4334 %      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4335 %        const MagickWand *reference,const MetricType metric,
4336 %        double *distortion)
4337 %
4338 %  A description of each parameter follows:
4339 %
4340 %    o wand: the magick wand.
4341 %
4342 %    o reference: the reference wand.
4343 %
4344 %    o metric: the metric.
4345 %
4346 %    o distortion: the computed distortion between the images.
4347 %
4348 */
4349 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4350   const MagickWand *reference,const MetricType metric,double *distortion)
4351 {
4352   MagickBooleanType
4353     status;
4354
4355   assert(wand != (MagickWand *) NULL);
4356   assert(wand->signature == WandSignature);
4357   if (wand->debug != MagickFalse)
4358     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4359   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4360     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4361   status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4362     wand->exception);
4363   return(status);
4364 }
4365 \f
4366 /*
4367 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4368 %                                                                             %
4369 %                                                                             %
4370 %                                                                             %
4371 %   M a g i c k G e t I m a g e D i s t o r t i o n s                         %
4372 %                                                                             %
4373 %                                                                             %
4374 %                                                                             %
4375 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4376 %
4377 %  MagickGetImageDistortions() compares one or more pixel channels of an
4378 %  image to a reconstructed image and returns the specified distortion metrics.
4379 %
4380 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4381 %
4382 %  The format of the MagickGetImageDistortion method is:
4383 %
4384 %      double *MagickGetImageDistortion(MagickWand *wand,
4385 %        const MagickWand *reference,const MetricType metric)
4386 %
4387 %  A description of each parameter follows:
4388 %
4389 %    o wand: the magick wand.
4390 %
4391 %    o reference: the reference wand.
4392 %
4393 %    o metric: the metric.
4394 %
4395 */
4396 WandExport double *MagickGetImageDistortions(MagickWand *wand,
4397   const MagickWand *reference,const MetricType metric)
4398 {
4399   double
4400     *channel_distortion;
4401
4402   assert(wand != (MagickWand *) NULL);
4403   assert(wand->signature == WandSignature);
4404   if (wand->debug != MagickFalse)
4405     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4406   assert(reference != (MagickWand *) NULL);
4407   assert(reference->signature == WandSignature);
4408   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4409     {
4410       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4411         "ContainsNoImages","`%s'",wand->name);
4412       return((double *) NULL);
4413     }
4414   channel_distortion=GetImageDistortions(wand->images,reference->images,
4415     metric,wand->exception);
4416   return(channel_distortion);
4417 }
4418 \f
4419 /*
4420 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4421 %                                                                             %
4422 %                                                                             %
4423 %                                                                             %
4424 %   M a g i c k G e t I m a g e F i l e n a m e                               %
4425 %                                                                             %
4426 %                                                                             %
4427 %                                                                             %
4428 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4429 %
4430 %  MagickGetImageFilename() returns the filename of a particular image in a
4431 %  sequence.
4432 %
4433 %  The format of the MagickGetImageFilename method is:
4434 %
4435 %      char *MagickGetImageFilename(MagickWand *wand)
4436 %
4437 %  A description of each parameter follows:
4438 %
4439 %    o wand: the magick wand.
4440 %
4441 */
4442 WandExport char *MagickGetImageFilename(MagickWand *wand)
4443 {
4444   assert(wand != (MagickWand *) NULL);
4445   assert(wand->signature == WandSignature);
4446   if (wand->debug != MagickFalse)
4447     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4448   if (wand->images == (Image *) NULL)
4449     {
4450       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4451         "ContainsNoImages","`%s'",wand->name);
4452       return((char *) NULL);
4453     }
4454   return(AcquireString(wand->images->filename));
4455 }
4456 \f
4457 /*
4458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4459 %                                                                             %
4460 %                                                                             %
4461 %                                                                             %
4462 %   M a g i c k G e t I m a g e F o r m a t                                   %
4463 %                                                                             %
4464 %                                                                             %
4465 %                                                                             %
4466 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4467 %
4468 %  MagickGetImageFormat() returns the format of a particular image in a
4469 %  sequence.
4470 %
4471 %  The format of the MagickGetImageFormat method is:
4472 %
4473 %      const char *MagickGetImageFormat(MagickWand *wand)
4474 %
4475 %  A description of each parameter follows:
4476 %
4477 %    o wand: the magick wand.
4478 %
4479 */
4480 WandExport char *MagickGetImageFormat(MagickWand *wand)
4481 {
4482   assert(wand != (MagickWand *) NULL);
4483   assert(wand->signature == WandSignature);
4484   if (wand->debug != MagickFalse)
4485     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4486   if (wand->images == (Image *) NULL)
4487     {
4488       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4489         "ContainsNoImages","`%s'",wand->name);
4490       return((char *) NULL);
4491     }
4492   return(AcquireString(wand->images->magick));
4493 }
4494 \f
4495 /*
4496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4497 %                                                                             %
4498 %                                                                             %
4499 %                                                                             %
4500 %   M a g i c k G e t I m a g e F u z z                                       %
4501 %                                                                             %
4502 %                                                                             %
4503 %                                                                             %
4504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4505 %
4506 %  MagickGetImageFuzz() gets the image fuzz.
4507 %
4508 %  The format of the MagickGetImageFuzz method is:
4509 %
4510 %      double MagickGetImageFuzz(MagickWand *wand)
4511 %
4512 %  A description of each parameter follows:
4513 %
4514 %    o wand: the magick wand.
4515 %
4516 */
4517 WandExport double MagickGetImageFuzz(MagickWand *wand)
4518 {
4519   assert(wand != (MagickWand *) NULL);
4520   assert(wand->signature == WandSignature);
4521   if (wand->debug != MagickFalse)
4522     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4523   if (wand->images == (Image *) NULL)
4524     {
4525       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4526         "ContainsNoImages","`%s'",wand->name);
4527       return(0.0);
4528     }
4529   return(wand->images->fuzz);
4530 }
4531 \f
4532 /*
4533 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4534 %                                                                             %
4535 %                                                                             %
4536 %                                                                             %
4537 %   M a g i c k G e t I m a g e G a m m a                                     %
4538 %                                                                             %
4539 %                                                                             %
4540 %                                                                             %
4541 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4542 %
4543 %  MagickGetImageGamma() gets the image gamma.
4544 %
4545 %  The format of the MagickGetImageGamma method is:
4546 %
4547 %      double MagickGetImageGamma(MagickWand *wand)
4548 %
4549 %  A description of each parameter follows:
4550 %
4551 %    o wand: the magick wand.
4552 %
4553 */
4554 WandExport double MagickGetImageGamma(MagickWand *wand)
4555 {
4556   assert(wand != (MagickWand *) NULL);
4557   assert(wand->signature == WandSignature);
4558   if (wand->debug != MagickFalse)
4559     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4560   if (wand->images == (Image *) NULL)
4561     {
4562       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4563         "ContainsNoImages","`%s'",wand->name);
4564       return(0.0);
4565     }
4566   return(wand->images->gamma);
4567 }
4568 \f
4569 /*
4570 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4571 %                                                                             %
4572 %                                                                             %
4573 %                                                                             %
4574 %   M a g i c k G e t I m a g e I n t e r l a c e S c h e m e                 %
4575 %                                                                             %
4576 %                                                                             %
4577 %                                                                             %
4578 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4579 %
4580 %  MagickGetImageGravity() gets the image gravity.
4581 %
4582 %  The format of the MagickGetImageGravity method is:
4583 %
4584 %      GravityType MagickGetImageGravity(MagickWand *wand)
4585 %
4586 %  A description of each parameter follows:
4587 %
4588 %    o wand: the magick wand.
4589 %
4590 */
4591 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4592 {
4593   assert(wand != (MagickWand *) NULL);
4594   assert(wand->signature == WandSignature);
4595   if (wand->debug != MagickFalse)
4596     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4597   if (wand->images == (Image *) NULL)
4598     {
4599       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4600         "ContainsNoImages","`%s'",wand->name);
4601       return(UndefinedGravity);
4602     }
4603   return(wand->images->gravity);
4604 }
4605 \f
4606 /*
4607 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4608 %                                                                             %
4609 %                                                                             %
4610 %                                                                             %
4611 %   M a g i c k G e t I m a g e G r e e n P r i m a r y                       %
4612 %                                                                             %
4613 %                                                                             %
4614 %                                                                             %
4615 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4616 %
4617 %  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4618 %
4619 %  The format of the MagickGetImageGreenPrimary method is:
4620 %
4621 %      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4622 %        double *y)
4623 %
4624 %  A description of each parameter follows:
4625 %
4626 %    o wand: the magick wand.
4627 %
4628 %    o x: the chromaticity green primary x-point.
4629 %
4630 %    o y: the chromaticity green primary y-point.
4631 %
4632 */
4633 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4634   double *x,double *y)
4635 {
4636   assert(wand != (MagickWand *) NULL);
4637   assert(wand->signature == WandSignature);
4638   if (wand->debug != MagickFalse)
4639     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4640   if (wand->images == (Image *) NULL)
4641     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4642   *x=wand->images->chromaticity.green_primary.x;
4643   *y=wand->images->chromaticity.green_primary.y;
4644   return(MagickTrue);
4645 }
4646 \f
4647 /*
4648 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4649 %                                                                             %
4650 %                                                                             %
4651 %                                                                             %
4652 %   M a g i c k G e t I m a g e H e i g h t                                   %
4653 %                                                                             %
4654 %                                                                             %
4655 %                                                                             %
4656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4657 %
4658 %  MagickGetImageHeight() returns the image height.
4659 %
4660 %  The format of the MagickGetImageHeight method is:
4661 %
4662 %      size_t MagickGetImageHeight(MagickWand *wand)
4663 %
4664 %  A description of each parameter follows:
4665 %
4666 %    o wand: the magick wand.
4667 %
4668 */
4669 WandExport size_t MagickGetImageHeight(MagickWand *wand)
4670 {
4671   assert(wand != (MagickWand *) NULL);
4672   assert(wand->signature == WandSignature);
4673   if (wand->debug != MagickFalse)
4674     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4675   if (wand->images == (Image *) NULL)
4676     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4677   return(wand->images->rows);
4678 }
4679 \f
4680 /*
4681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4682 %                                                                             %
4683 %                                                                             %
4684 %                                                                             %
4685 %   M a g i c k G e t I m a g e H i s t o g r a m                             %
4686 %                                                                             %
4687 %                                                                             %
4688 %                                                                             %
4689 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4690 %
4691 %  MagickGetImageHistogram() returns the image histogram as an array of
4692 %  PixelWand wands.
4693 %
4694 %  The format of the MagickGetImageHistogram method is:
4695 %
4696 %      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4697 %        size_t *number_colors)
4698 %
4699 %  A description of each parameter follows:
4700 %
4701 %    o wand: the magick wand.
4702 %
4703 %    o number_colors: the number of unique colors in the image and the number
4704 %      of pixel wands returned.
4705 %
4706 */
4707 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4708   size_t *number_colors)
4709 {
4710   PixelInfo
4711     *histogram;
4712
4713   PixelWand
4714     **pixel_wands;
4715
4716   register ssize_t
4717     i;
4718
4719   assert(wand != (MagickWand *) NULL);
4720   assert(wand->signature == WandSignature);
4721   if (wand->debug != MagickFalse)
4722     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4723   if (wand->images == (Image *) NULL)
4724     {
4725       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4726         "ContainsNoImages","`%s'",wand->name);
4727       return((PixelWand **) NULL);
4728     }
4729   histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4730   if (histogram == (PixelInfo *) NULL)
4731     return((PixelWand **) NULL);
4732   pixel_wands=NewPixelWands(*number_colors);
4733   for (i=0; i < (ssize_t) *number_colors; i++)
4734   {
4735     PixelSetQuantumPacket(pixel_wands[i],&histogram[i]);
4736     PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4737   }
4738   histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
4739   return(pixel_wands);
4740 }
4741 \f
4742 /*
4743 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4744 %                                                                             %
4745 %                                                                             %
4746 %                                                                             %
4747 %   M a g i c k G e t I m a g e I n t e r l a c e S c h e m e                 %
4748 %                                                                             %
4749 %                                                                             %
4750 %                                                                             %
4751 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4752 %
4753 %  MagickGetImageInterlaceScheme() gets the image interlace scheme.
4754 %
4755 %  The format of the MagickGetImageInterlaceScheme method is:
4756 %
4757 %      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4758 %
4759 %  A description of each parameter follows:
4760 %
4761 %    o wand: the magick wand.
4762 %
4763 */
4764 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4765 {
4766   assert(wand != (MagickWand *) NULL);
4767   assert(wand->signature == WandSignature);
4768   if (wand->debug != MagickFalse)
4769     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4770   if (wand->images == (Image *) NULL)
4771     {
4772       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4773         "ContainsNoImages","`%s'",wand->name);
4774       return(UndefinedInterlace);
4775     }
4776   return(wand->images->interlace);
4777 }
4778 \f
4779 /*
4780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4781 %                                                                             %
4782 %                                                                             %
4783 %                                                                             %
4784 %   M a g i c k G e t I m a g e I n t e r p o l a t e M e t h o d             %
4785 %                                                                             %
4786 %                                                                             %
4787 %                                                                             %
4788 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4789 %
4790 %  MagickGetImageInterpolateMethod() returns the interpolation method for the
4791 %  sepcified image.
4792 %
4793 %  The format of the MagickGetImageInterpolateMethod method is:
4794 %
4795 %      PixelInterpolateMethod MagickGetImagePixelInterpolateMethod(
4796 %        MagickWand *wand)
4797 %
4798 %  A description of each parameter follows:
4799 %
4800 %    o wand: the magick wand.
4801 %
4802 */
4803 WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
4804   MagickWand *wand)
4805 {
4806   assert(wand != (MagickWand *) NULL);
4807   assert(wand->signature == WandSignature);
4808   if (wand->debug != MagickFalse)
4809     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4810   if (wand->images == (Image *) NULL)
4811     {
4812       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4813         "ContainsNoImages","`%s'",wand->name);
4814       return(UndefinedInterpolatePixel);
4815     }
4816   return(wand->images->interpolate);
4817 }
4818 \f
4819 /*
4820 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4821 %                                                                             %
4822 %                                                                             %
4823 %                                                                             %
4824 %   M a g i c k G e t I m a g e I t e r a t i o n s                           %
4825 %                                                                             %
4826 %                                                                             %
4827 %                                                                             %
4828 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4829 %
4830 %  MagickGetImageIterations() gets the image iterations.
4831 %
4832 %  The format of the MagickGetImageIterations method is:
4833 %
4834 %      size_t MagickGetImageIterations(MagickWand *wand)
4835 %
4836 %  A description of each parameter follows:
4837 %
4838 %    o wand: the magick wand.
4839 %
4840 */
4841 WandExport size_t MagickGetImageIterations(MagickWand *wand)
4842 {
4843   assert(wand != (MagickWand *) NULL);
4844   assert(wand->signature == WandSignature);
4845   if (wand->debug != MagickFalse)
4846     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4847   if (wand->images == (Image *) NULL)
4848     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4849   return(wand->images->iterations);
4850 }
4851 \f
4852 /*
4853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4854 %                                                                             %
4855 %                                                                             %
4856 %                                                                             %
4857 %   M a g i c k G e t I m a g e L e n g t h                                   %
4858 %                                                                             %
4859 %                                                                             %
4860 %                                                                             %
4861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4862 %
4863 %  MagickGetImageLength() returns the image length in bytes.
4864 %
4865 %  The format of the MagickGetImageLength method is:
4866 %
4867 %      MagickBooleanType MagickGetImageLength(MagickWand *wand,
4868 %        MagickSizeType *length)
4869 %
4870 %  A description of each parameter follows:
4871 %
4872 %    o wand: the magick wand.
4873 %
4874 %    o length: the image length in bytes.
4875 %
4876 */
4877 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
4878   MagickSizeType *length)
4879 {
4880   assert(wand != (MagickWand *) NULL);
4881   assert(wand->signature == WandSignature);
4882   if (wand->debug != MagickFalse)
4883     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4884   if (wand->images == (Image *) NULL)
4885     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4886   *length=GetBlobSize(wand->images);
4887   return(MagickTrue);
4888 }
4889 \f
4890 /*
4891 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4892 %                                                                             %
4893 %                                                                             %
4894 %                                                                             %
4895 %   M a g i c k G e t I m a g e M a t t e C o l o r                           %
4896 %                                                                             %
4897 %                                                                             %
4898 %                                                                             %
4899 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4900 %
4901 %  MagickGetImageMatteColor() returns the image matte color.
4902 %
4903 %  The format of the MagickGetImageMatteColor method is:
4904 %
4905 %      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
4906 %        PixelWand *matte_color)
4907 %
4908 %  A description of each parameter follows:
4909 %
4910 %    o wand: the magick wand.
4911 %
4912 %    o matte_color: Return the matte color.
4913 %
4914 */
4915 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
4916   PixelWand *matte_color)
4917 {
4918   assert(wand != (MagickWand *) NULL);
4919   assert(wand->signature == WandSignature);
4920   if (wand->debug != MagickFalse)
4921     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4922   if (wand->images == (Image *) NULL)
4923     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4924   PixelSetQuantumPacket(matte_color,&wand->images->matte_color);
4925   return(MagickTrue);
4926 }
4927 \f
4928 /*
4929 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4930 %                                                                             %
4931 %                                                                             %
4932 %                                                                             %
4933 %   M a g i c k G e t I m a g e O r i e n t a t i o n                         %
4934 %                                                                             %
4935 %                                                                             %
4936 %                                                                             %
4937 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4938 %
4939 %  MagickGetImageOrientation() returns the image orientation.
4940 %
4941 %  The format of the MagickGetImageOrientation method is:
4942 %
4943 %      OrientationType MagickGetImageOrientation(MagickWand *wand)
4944 %
4945 %  A description of each parameter follows:
4946 %
4947 %    o wand: the magick wand.
4948 %
4949 */
4950 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
4951 {
4952   assert(wand != (MagickWand *) NULL);
4953   assert(wand->signature == WandSignature);
4954   if (wand->debug != MagickFalse)
4955     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4956   if (wand->images == (Image *) NULL)
4957     {
4958       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4959         "ContainsNoImages","`%s'",wand->name);
4960       return(UndefinedOrientation);
4961     }
4962   return(wand->images->orientation);
4963 }
4964 \f
4965 /*
4966 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4967 %                                                                             %
4968 %                                                                             %
4969 %                                                                             %
4970 %   M a g i c k G e t I m a g e P a g e                                       %
4971 %                                                                             %
4972 %                                                                             %
4973 %                                                                             %
4974 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4975 %
4976 %  MagickGetImagePage() returns the page geometry associated with the image.
4977 %
4978 %  The format of the MagickGetImagePage method is:
4979 %
4980 %      MagickBooleanType MagickGetImagePage(MagickWand *wand,
4981 %        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4982 %
4983 %  A description of each parameter follows:
4984 %
4985 %    o wand: the magick wand.
4986 %
4987 %    o width: the page width.
4988 %
4989 %    o height: the page height.
4990 %
4991 %    o x: the page x-offset.
4992 %
4993 %    o y: the page y-offset.
4994 %
4995 */
4996 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
4997   size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4998 {
4999   assert(wand != (const MagickWand *) NULL);
5000   assert(wand->signature == WandSignature);
5001   if (wand->debug != MagickFalse)
5002     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5003   if (wand->images == (Image *) NULL)
5004     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5005   *width=wand->images->page.width;
5006   *height=wand->images->page.height;
5007   *x=wand->images->page.x;
5008   *y=wand->images->page.y;
5009   return(MagickTrue);
5010 }
5011 \f
5012 /*
5013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5014 %                                                                             %
5015 %                                                                             %
5016 %                                                                             %
5017 %   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5018 %                                                                             %
5019 %                                                                             %
5020 %                                                                             %
5021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5022 %
5023 %  MagickGetImagePixelColor() returns the color of the specified pixel.
5024 %
5025 %  The format of the MagickGetImagePixelColor method is:
5026 %
5027 %      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5028 %        const ssize_t x,const ssize_t y,PixelWand *color)
5029 %
5030 %  A description of each parameter follows:
5031 %
5032 %    o wand: the magick wand.
5033 %
5034 %    o x,y: the pixel offset into the image.
5035 %
5036 %    o color: Return the colormap color in this wand.
5037 %
5038 */
5039 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5040   const ssize_t x,const ssize_t y,PixelWand *color)
5041 {
5042   register const Quantum
5043     *p;
5044
5045   CacheView
5046     *image_view;
5047
5048   assert(wand != (MagickWand *) NULL);
5049   assert(wand->signature == WandSignature);
5050   if (wand->debug != MagickFalse)
5051     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5052   if (wand->images == (Image *) NULL)
5053     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5054   image_view=AcquireCacheView(wand->images);
5055   p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5056   if (p == (const Quantum *) NULL)
5057     {
5058       image_view=DestroyCacheView(image_view);
5059       return(MagickFalse);
5060     }
5061   PixelSetQuantumPixel(wand->images,p,color);
5062   image_view=DestroyCacheView(image_view);
5063   return(MagickTrue);
5064 }
5065 \f
5066 /*
5067 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5068 %                                                                             %
5069 %                                                                             %
5070 %                                                                             %
5071 %   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5072 %                                                                             %
5073 %                                                                             %
5074 %                                                                             %
5075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5076 %
5077 %  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5078 %
5079 %  The format of the MagickGetImageRedPrimary method is:
5080 %
5081 %      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5082 %        double *y)
5083 %
5084 %  A description of each parameter follows:
5085 %
5086 %    o wand: the magick wand.
5087 %
5088 %    o x: the chromaticity red primary x-point.
5089 %
5090 %    o y: the chromaticity red primary y-point.
5091 %
5092 */
5093 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5094   double *x,double *y)
5095 {
5096   assert(wand != (MagickWand *) NULL);
5097   assert(wand->signature == WandSignature);
5098   if (wand->debug != MagickFalse)
5099     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5100   if (wand->images == (Image *) NULL)
5101     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5102   *x=wand->images->chromaticity.red_primary.x;
5103   *y=wand->images->chromaticity.red_primary.y;
5104   return(MagickTrue);
5105 }
5106 \f
5107 /*
5108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5109 %                                                                             %
5110 %                                                                             %
5111 %                                                                             %
5112 %   M a g i c k G e t I m a g e R e g i o n                                   %
5113 %                                                                             %
5114 %                                                                             %
5115 %                                                                             %
5116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5117 %
5118 %  MagickGetImageRegion() extracts a region of the image and returns it as a
5119 %  a new wand.
5120 %
5121 %  The format of the MagickGetImageRegion method is:
5122 %
5123 %      MagickWand *MagickGetImageRegion(MagickWand *wand,
5124 %        const size_t width,const size_t height,const ssize_t x,
5125 %        const ssize_t y)
5126 %
5127 %  A description of each parameter follows:
5128 %
5129 %    o wand: the magick wand.
5130 %
5131 %    o width: the region width.
5132 %
5133 %    o height: the region height.
5134 %
5135 %    o x: the region x offset.
5136 %
5137 %    o y: the region y offset.
5138 %
5139 */
5140 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5141   const size_t width,const size_t height,const ssize_t x,
5142   const ssize_t y)
5143 {
5144   Image
5145     *region_image;
5146
5147   RectangleInfo
5148     region;
5149
5150   assert(wand != (MagickWand *) NULL);
5151   assert(wand->signature == WandSignature);
5152   if (wand->debug != MagickFalse)
5153     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5154   if (wand->images == (Image *) NULL)
5155     return((MagickWand *) NULL);
5156   region.width=width;
5157   region.height=height;
5158   region.x=x;
5159   region.y=y;
5160   region_image=CropImage(wand->images,&region,wand->exception);
5161   if (region_image == (Image *) NULL)
5162     return((MagickWand *) NULL);
5163   return(CloneMagickWandFromImages(wand,region_image));
5164 }
5165 \f
5166 /*
5167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5168 %                                                                             %
5169 %                                                                             %
5170 %                                                                             %
5171 %   M a g i c k G e t I m a g e R e n d e r i n g I n t e n t                 %
5172 %                                                                             %
5173 %                                                                             %
5174 %                                                                             %
5175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5176 %
5177 %  MagickGetImageRenderingIntent() gets the image rendering intent.
5178 %
5179 %  The format of the MagickGetImageRenderingIntent method is:
5180 %
5181 %      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5182 %
5183 %  A description of each parameter follows:
5184 %
5185 %    o wand: the magick wand.
5186 %
5187 */
5188 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5189 {
5190   assert(wand != (MagickWand *) NULL);
5191   assert(wand->signature == WandSignature);
5192   if (wand->debug != MagickFalse)
5193     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5194   if (wand->images == (Image *) NULL)
5195     {
5196       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5197         "ContainsNoImages","`%s'",wand->name);
5198       return(UndefinedIntent);
5199     }
5200   return((RenderingIntent) wand->images->rendering_intent);
5201 }
5202 \f
5203 /*
5204 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5205 %                                                                             %
5206 %                                                                             %
5207 %                                                                             %
5208 %   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5209 %                                                                             %
5210 %                                                                             %
5211 %                                                                             %
5212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5213 %
5214 %  MagickGetImageResolution() gets the image X and Y resolution.
5215 %
5216 %  The format of the MagickGetImageResolution method is:
5217 %
5218 %      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5219 %        double *y)
5220 %
5221 %  A description of each parameter follows:
5222 %
5223 %    o wand: the magick wand.
5224 %
5225 %    o x: the image x-resolution.
5226 %
5227 %    o y: the image y-resolution.
5228 %
5229 */
5230 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5231   double *x,double *y)
5232 {
5233   assert(wand != (MagickWand *) NULL);
5234   assert(wand->signature == WandSignature);
5235   if (wand->debug != MagickFalse)
5236     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5237   if (wand->images == (Image *) NULL)
5238     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5239   *x=wand->images->resolution.x;
5240   *y=wand->images->resolution.y;
5241   return(MagickTrue);
5242 }
5243 \f
5244 /*
5245 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5246 %                                                                             %
5247 %                                                                             %
5248 %                                                                             %
5249 %   M a g i c k G e t I m a g e S c e n e                                     %
5250 %                                                                             %
5251 %                                                                             %
5252 %                                                                             %
5253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5254 %
5255 %  MagickGetImageScene() gets the image scene.
5256 %
5257 %  The format of the MagickGetImageScene method is:
5258 %
5259 %      size_t MagickGetImageScene(MagickWand *wand)
5260 %
5261 %  A description of each parameter follows:
5262 %
5263 %    o wand: the magick wand.
5264 %
5265 */
5266 WandExport size_t MagickGetImageScene(MagickWand *wand)
5267 {
5268   assert(wand != (MagickWand *) NULL);
5269   assert(wand->signature == WandSignature);
5270   if (wand->debug != MagickFalse)
5271     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5272   if (wand->images == (Image *) NULL)
5273     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5274   return(wand->images->scene);
5275 }
5276 \f
5277 /*
5278 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5279 %                                                                             %
5280 %                                                                             %
5281 %                                                                             %
5282 %   M a g i c k G e t I m a g e S i g n a t u r e                             %
5283 %                                                                             %
5284 %                                                                             %
5285 %                                                                             %
5286 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5287 %
5288 %  MagickGetImageSignature() generates an SHA-256 message digest for the image
5289 %  pixel stream.
5290 %
5291 %  The format of the MagickGetImageSignature method is:
5292 %
5293 %      const char MagickGetImageSignature(MagickWand *wand)
5294 %
5295 %  A description of each parameter follows:
5296 %
5297 %    o wand: the magick wand.
5298 %
5299 */
5300 WandExport char *MagickGetImageSignature(MagickWand *wand)
5301 {
5302   const char
5303     *value;
5304
5305   MagickBooleanType
5306     status;
5307
5308   assert(wand != (MagickWand *) NULL);
5309   assert(wand->signature == WandSignature);
5310   if (wand->debug != MagickFalse)
5311     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5312   if (wand->images == (Image *) NULL)
5313     {
5314       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5315         "ContainsNoImages","`%s'",wand->name);
5316       return((char *) NULL);
5317     }
5318   status=SignatureImage(wand->images,wand->exception);
5319   if (status == MagickFalse)
5320     return((char *) NULL);
5321   value=GetImageProperty(wand->images,"signature",wand->exception);
5322   if (value == (const char *) NULL)
5323     return((char *) NULL);
5324   return(AcquireString(value));
5325 }
5326 \f
5327 /*
5328 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5329 %                                                                             %
5330 %                                                                             %
5331 %                                                                             %
5332 %   M a g i c k G e t I m a g e T i c k s P e r S e c o n d                   %
5333 %                                                                             %
5334 %                                                                             %
5335 %                                                                             %
5336 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5337 %
5338 %  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5339 %
5340 %  The format of the MagickGetImageTicksPerSecond method is:
5341 %
5342 %      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5343 %
5344 %  A description of each parameter follows:
5345 %
5346 %    o wand: the magick wand.
5347 %
5348 */
5349 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5350 {
5351   assert(wand != (MagickWand *) NULL);
5352   assert(wand->signature == WandSignature);
5353   if (wand->debug != MagickFalse)
5354     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5355   if (wand->images == (Image *) NULL)
5356     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5357   return((size_t) wand->images->ticks_per_second);
5358 }
5359 \f
5360 /*
5361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5362 %                                                                             %
5363 %                                                                             %
5364 %                                                                             %
5365 %   M a g i c k G e t I m a g e T y p e                                       %
5366 %                                                                             %
5367 %                                                                             %
5368 %                                                                             %
5369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5370 %
5371 %  MagickGetImageType() gets the potential image type:
5372 %
5373 %        Bilevel        Grayscale       GrayscaleMatte
5374 %        Palette        PaletteMatte    TrueColor
5375 %        TrueColorMatte ColorSeparation ColorSeparationMatte
5376 %
5377 %  To ensure the image type matches its potential, use MagickSetImageType():
5378 %
5379 %    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5380 %
5381 %  The format of the MagickGetImageType method is:
5382 %
5383 %      ImageType MagickGetImageType(MagickWand *wand)
5384 %
5385 %  A description of each parameter follows:
5386 %
5387 %    o wand: the magick wand.
5388 %
5389 */
5390 WandExport ImageType MagickGetImageType(MagickWand *wand)
5391 {
5392   assert(wand != (MagickWand *) NULL);
5393   assert(wand->signature == WandSignature);
5394   if (wand->debug != MagickFalse)
5395     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5396   if (wand->images == (Image *) NULL)
5397     {
5398       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5399         "ContainsNoImages","`%s'",wand->name);
5400       return(UndefinedType);
5401     }
5402   return(GetImageType(wand->images,wand->exception));
5403 }
5404 \f
5405 /*
5406 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5407 %                                                                             %
5408 %                                                                             %
5409 %                                                                             %
5410 %   M a g i c k G e t I m a g e U n i t s                                     %
5411 %                                                                             %
5412 %                                                                             %
5413 %                                                                             %
5414 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5415 %
5416 %  MagickGetImageUnits() gets the image units of resolution.
5417 %
5418 %  The format of the MagickGetImageUnits method is:
5419 %
5420 %      ResolutionType MagickGetImageUnits(MagickWand *wand)
5421 %
5422 %  A description of each parameter follows:
5423 %
5424 %    o wand: the magick wand.
5425 %
5426 */
5427 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5428 {
5429   assert(wand != (MagickWand *) NULL);
5430   assert(wand->signature == WandSignature);
5431   if (wand->debug != MagickFalse)
5432     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5433   if (wand->images == (Image *) NULL)
5434     {
5435       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5436         "ContainsNoImages","`%s'",wand->name);
5437       return(UndefinedResolution);
5438     }
5439   return(wand->images->units);
5440 }
5441 \f
5442 /*
5443 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5444 %                                                                             %
5445 %                                                                             %
5446 %                                                                             %
5447 %   M a g i c k G e t I m a g e V i r t u a l P i x e l M e t h o d           %
5448 %                                                                             %
5449 %                                                                             %
5450 %                                                                             %
5451 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5452 %
5453 %  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5454 %  sepcified image.
5455 %
5456 %  The format of the MagickGetImageVirtualPixelMethod method is:
5457 %
5458 %      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5459 %
5460 %  A description of each parameter follows:
5461 %
5462 %    o wand: the magick wand.
5463 %
5464 */
5465 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5466 {
5467   assert(wand != (MagickWand *) NULL);
5468   assert(wand->signature == WandSignature);
5469   if (wand->debug != MagickFalse)
5470     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5471   if (wand->images == (Image *) NULL)
5472     {
5473       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5474         "ContainsNoImages","`%s'",wand->name);
5475       return(UndefinedVirtualPixelMethod);
5476     }
5477   return(GetImageVirtualPixelMethod(wand->images));
5478 }
5479 \f
5480 /*
5481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5482 %                                                                             %
5483 %                                                                             %
5484 %                                                                             %
5485 %   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5486 %                                                                             %
5487 %                                                                             %
5488 %                                                                             %
5489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5490 %
5491 %  MagickGetImageWhitePoint() returns the chromaticy white point.
5492 %
5493 %  The format of the MagickGetImageWhitePoint method is:
5494 %
5495 %      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5496 %        double *y)
5497 %
5498 %  A description of each parameter follows:
5499 %
5500 %    o wand: the magick wand.
5501 %
5502 %    o x: the chromaticity white x-point.
5503 %
5504 %    o y: the chromaticity white y-point.
5505 %
5506 */
5507 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5508   double *x,double *y)
5509 {
5510   assert(wand != (MagickWand *) NULL);
5511   assert(wand->signature == WandSignature);
5512   if (wand->debug != MagickFalse)
5513     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5514   if (wand->images == (Image *) NULL)
5515     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5516   *x=wand->images->chromaticity.white_point.x;
5517   *y=wand->images->chromaticity.white_point.y;
5518   return(MagickTrue);
5519 }
5520 \f
5521 /*
5522 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5523 %                                                                             %
5524 %                                                                             %
5525 %                                                                             %
5526 %   M a g i c k G e t I m a g e W i d t h                                     %
5527 %                                                                             %
5528 %                                                                             %
5529 %                                                                             %
5530 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5531 %
5532 %  MagickGetImageWidth() returns the image width.
5533 %
5534 %  The format of the MagickGetImageWidth method is:
5535 %
5536 %      size_t MagickGetImageWidth(MagickWand *wand)
5537 %
5538 %  A description of each parameter follows:
5539 %
5540 %    o wand: the magick wand.
5541 %
5542 */
5543 WandExport size_t MagickGetImageWidth(MagickWand *wand)
5544 {
5545   assert(wand != (MagickWand *) NULL);
5546   assert(wand->signature == WandSignature);
5547   if (wand->debug != MagickFalse)
5548     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5549   if (wand->images == (Image *) NULL)
5550     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5551   return(wand->images->columns);
5552 }
5553 \f
5554 /*
5555 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5556 %                                                                             %
5557 %                                                                             %
5558 %                                                                             %
5559 %   M a g i c k G e t N u m b e r I m a g e s                                 %
5560 %                                                                             %
5561 %                                                                             %
5562 %                                                                             %
5563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5564 %
5565 %  MagickGetNumberImages() returns the number of images associated with a
5566 %  magick wand.
5567 %
5568 %  The format of the MagickGetNumberImages method is:
5569 %
5570 %      size_t MagickGetNumberImages(MagickWand *wand)
5571 %
5572 %  A description of each parameter follows:
5573 %
5574 %    o wand: the magick wand.
5575 %
5576 */
5577 WandExport size_t MagickGetNumberImages(MagickWand *wand)
5578 {
5579   assert(wand != (MagickWand *) NULL);
5580   assert(wand->signature == WandSignature);
5581   if (wand->debug != MagickFalse)
5582     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5583   return(GetImageListLength(wand->images));
5584 }
5585 \f
5586 /*
5587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5588 %                                                                             %
5589 %                                                                             %
5590 %                                                                             %
5591 %   M a g i c k I m a g e G e t T o t a l I n k D e n s i t y                 %
5592 %                                                                             %
5593 %                                                                             %
5594 %                                                                             %
5595 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5596 %
5597 %  MagickGetImageTotalInkDensity() gets the image total ink density.
5598 %
5599 %  The format of the MagickGetImageTotalInkDensity method is:
5600 %
5601 %      double MagickGetImageTotalInkDensity(MagickWand *wand)
5602 %
5603 %  A description of each parameter follows:
5604 %
5605 %    o wand: the magick wand.
5606 %
5607 */
5608 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5609 {
5610   assert(wand != (MagickWand *) NULL);
5611   assert(wand->signature == WandSignature);
5612   if (wand->debug != MagickFalse)
5613     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5614   if (wand->images == (Image *) NULL)
5615     {
5616       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5617         "ContainsNoImages","`%s'",wand->name);
5618       return(0.0);
5619     }
5620   return(GetImageTotalInkDensity(wand->images,wand->exception));
5621 }
5622 \f
5623 /*
5624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5625 %                                                                             %
5626 %                                                                             %
5627 %                                                                             %
5628 %   M a g i c k H a l d C l u t I m a g e                                     %
5629 %                                                                             %
5630 %                                                                             %
5631 %                                                                             %
5632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5633 %
5634 %  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5635 %  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5636 %  dimensions.  Create it with the HALD coder.  You can apply any color
5637 %  transformation to the Hald image and then use this method to apply the
5638 %  transform to the image.
5639 %
5640 %  The format of the MagickHaldClutImage method is:
5641 %
5642 %      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5643 %        const MagickWand *hald_wand)
5644 %
5645 %  A description of each parameter follows:
5646 %
5647 %    o wand: the magick wand.
5648 %
5649 %    o hald_image: the hald CLUT image.
5650 %
5651 */
5652 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5653   const MagickWand *hald_wand)
5654 {
5655   MagickBooleanType
5656     status;
5657
5658   assert(wand != (MagickWand *) NULL);
5659   assert(wand->signature == WandSignature);
5660   if (wand->debug != MagickFalse)
5661     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5662   if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5663     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5664   status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
5665   return(status);
5666 }
5667 \f
5668 /*
5669 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5670 %                                                                             %
5671 %                                                                             %
5672 %                                                                             %
5673 %   M a g i c k H a s N e x t I m a g e                                       %
5674 %                                                                             %
5675 %                                                                             %
5676 %                                                                             %
5677 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5678 %
5679 %  MagickHasNextImage() returns MagickTrue if the wand has more images when
5680 %  traversing the list in the forward direction
5681 %
5682 %  The format of the MagickHasNextImage method is:
5683 %
5684 %      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5685 %
5686 %  A description of each parameter follows:
5687 %
5688 %    o wand: the magick wand.
5689 %
5690 */
5691 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5692 {
5693   assert(wand != (MagickWand *) NULL);
5694   assert(wand->signature == WandSignature);
5695   if (wand->debug != MagickFalse)
5696     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5697   if (wand->images == (Image *) NULL)
5698     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5699   if (GetNextImageInList(wand->images) == (Image *) NULL)
5700     return(MagickFalse);
5701   return(MagickTrue);
5702 }
5703 \f
5704 /*
5705 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5706 %                                                                             %
5707 %                                                                             %
5708 %                                                                             %
5709 %   M a g i c k H a s P r e v i o u s I m a g e                               %
5710 %                                                                             %
5711 %                                                                             %
5712 %                                                                             %
5713 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5714 %
5715 %  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5716 %  traversing the list in the reverse direction
5717 %
5718 %  The format of the MagickHasPreviousImage method is:
5719 %
5720 %      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5721 %
5722 %  A description of each parameter follows:
5723 %
5724 %    o wand: the magick wand.
5725 %
5726 */
5727 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5728 {
5729   assert(wand != (MagickWand *) NULL);
5730   assert(wand->signature == WandSignature);
5731   if (wand->debug != MagickFalse)
5732     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5733   if (wand->images == (Image *) NULL)
5734     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5735   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5736     return(MagickFalse);
5737   return(MagickTrue);
5738 }
5739 \f
5740 /*
5741 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5742 %                                                                             %
5743 %                                                                             %
5744 %                                                                             %
5745 %   M a g i c k I d e n t i f y I m a g e                                     %
5746 %                                                                             %
5747 %                                                                             %
5748 %                                                                             %
5749 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5750 %
5751 %  MagickIdentifyImage() identifies an image by printing its attributes to the
5752 %  file.  Attributes include the image width, height, size, and others.
5753 %
5754 %  The format of the MagickIdentifyImage method is:
5755 %
5756 %      const char *MagickIdentifyImage(MagickWand *wand)
5757 %
5758 %  A description of each parameter follows:
5759 %
5760 %    o wand: the magick wand.
5761 %
5762 */
5763 WandExport char *MagickIdentifyImage(MagickWand *wand)
5764 {
5765   char
5766     *description,
5767     filename[MaxTextExtent];
5768
5769   FILE
5770     *file;
5771
5772   int
5773     unique_file;
5774
5775   assert(wand != (MagickWand *) NULL);
5776   assert(wand->signature == WandSignature);
5777   if (wand->debug != MagickFalse)
5778     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5779   if (wand->images == (Image *) NULL)
5780     {
5781       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5782         "ContainsNoImages","`%s'",wand->name);
5783       return((char *) NULL);
5784     }
5785   description=(char *) NULL;
5786   unique_file=AcquireUniqueFileResource(filename);
5787   file=(FILE *) NULL;
5788   if (unique_file != -1)
5789     file=fdopen(unique_file,"wb");
5790   if ((unique_file == -1) || (file == (FILE *) NULL))
5791     {
5792       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5793         "UnableToCreateTemporaryFile","`%s'",wand->name);
5794       return((char *) NULL);
5795     }
5796   (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
5797   (void) fclose(file);
5798   description=FileToString(filename,~0,wand->exception);
5799   (void) RelinquishUniqueFileResource(filename);
5800   return(description);
5801 }
5802 \f
5803 /*
5804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5805 %                                                                             %
5806 %                                                                             %
5807 %                                                                             %
5808 %   M a g i c k I m p l o d e I m a g e                                       %
5809 %                                                                             %
5810 %                                                                             %
5811 %                                                                             %
5812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5813 %
5814 %  MagickImplodeImage() creates a new image that is a copy of an existing
5815 %  one with the image pixels "implode" by the specified percentage.  It
5816 %  allocates the memory necessary for the new Image structure and returns a
5817 %  pointer to the new image.
5818 %
5819 %  The format of the MagickImplodeImage method is:
5820 %
5821 %      MagickBooleanType MagickImplodeImage(MagickWand *wand,
5822 %        const double radius,const PixelInterpolateMethod method)
5823 %
5824 %  A description of each parameter follows:
5825 %
5826 %    o wand: the magick wand.
5827 %
5828 %    o amount: Define the extent of the implosion.
5829 %
5830 %    o method: the pixel interpolation method.
5831 %
5832 */
5833 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
5834   const double amount,const PixelInterpolateMethod method)
5835 {
5836   Image
5837     *implode_image;
5838
5839   assert(wand != (MagickWand *) NULL);
5840   assert(wand->signature == WandSignature);
5841   if (wand->debug != MagickFalse)
5842     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5843   if (wand->images == (Image *) NULL)
5844     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5845   implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
5846   if (implode_image == (Image *) NULL)
5847     return(MagickFalse);
5848   ReplaceImageInList(&wand->images,implode_image);
5849   return(MagickTrue);
5850 }
5851 \f
5852 /*
5853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5854 %                                                                             %
5855 %                                                                             %
5856 %                                                                             %
5857 %   M a g i c k I m p o r t I m a g e P i x e l s                             %
5858 %                                                                             %
5859 %                                                                             %
5860 %                                                                             %
5861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5862 %
5863 %  MagickImportImagePixels() accepts pixel datand stores it in the image at the
5864 %  location you specify.  The method returns MagickFalse on success otherwise
5865 %  MagickTrue if an error is encountered.  The pixel data can be either char,
5866 %  short int, int, ssize_t, float, or double in the order specified by map.
5867 %
5868 %  Suppose your want to upload the first scanline of a 640x480 image from
5869 %  character data in red-green-blue order:
5870 %
5871 %      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
5872 %
5873 %  The format of the MagickImportImagePixels method is:
5874 %
5875 %      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5876 %        const ssize_t x,const ssize_t y,const size_t columns,
5877 %        const size_t rows,const char *map,const StorageType storage,
5878 %        const void *pixels)
5879 %
5880 %  A description of each parameter follows:
5881 %
5882 %    o wand: the magick wand.
5883 %
5884 %    o x, y, columns, rows:  These values define the perimeter of a region
5885 %      of pixels you want to define.
5886 %
5887 %    o map:  This string reflects the expected ordering of the pixel array.
5888 %      It can be any combination or order of R = red, G = green, B = blue,
5889 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
5890 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
5891 %      P = pad.
5892 %
5893 %    o storage: Define the data type of the pixels.  Float and double types are
5894 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
5895 %      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
5896 %      or DoublePixel.
5897 %
5898 %    o pixels: This array of values contain the pixel components as defined by
5899 %      map and type.  You must preallocate this array where the expected
5900 %      length varies depending on the values of width, height, map, and type.
5901 %
5902 */
5903 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5904   const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
5905   const char *map,const StorageType storage,const void *pixels)
5906 {
5907   MagickBooleanType
5908     status;
5909
5910   assert(wand != (MagickWand *) NULL);
5911   assert(wand->signature == WandSignature);
5912   if (wand->debug != MagickFalse)
5913     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5914   if (wand->images == (Image *) NULL)
5915     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5916   status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
5917     wand->exception);
5918   return(status);
5919 }
5920 \f
5921 /*
5922 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5923 %                                                                             %
5924 %                                                                             %
5925 %                                                                             %
5926 %   M a g i c k I n v e r s e F o u r i e r T r a n s f o r m I m a g e       %
5927 %                                                                             %
5928 %                                                                             %
5929 %                                                                             %
5930 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5931 %
5932 %  MagickInverseFourierTransformImage() implements the inverse discrete
5933 %  Fourier transform (DFT) of the image either as a magnitude / phase or real /
5934 %  imaginary image pair.
5935 %
5936 %  The format of the MagickInverseFourierTransformImage method is:
5937 %
5938 %      MagickBooleanType MagickInverseFourierTransformImage(
5939 %        MagickWand *magnitude_wand,MagickWand *phase_wand,
5940 %        const MagickBooleanType magnitude)
5941 %
5942 %  A description of each parameter follows:
5943 %
5944 %    o magnitude_wand: the magnitude or real wand.
5945 %
5946 %    o phase_wand: the phase or imaginary wand.
5947 %
5948 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
5949 %      imaginary image pair.
5950 %
5951 */
5952 WandExport MagickBooleanType MagickInverseFourierTransformImage(
5953   MagickWand *magnitude_wand,MagickWand *phase_wand,
5954   const MagickBooleanType magnitude)
5955 {
5956   Image
5957     *inverse_image;
5958
5959   MagickWand
5960     *wand;
5961
5962   assert(magnitude_wand != (MagickWand *) NULL);
5963   assert(magnitude_wand->signature == WandSignature);
5964   if (magnitude_wand->debug != MagickFalse)
5965     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
5966       magnitude_wand->name);
5967   wand=magnitude_wand;
5968   if (magnitude_wand->images == (Image *) NULL)
5969     ThrowWandException(WandError,"ContainsNoImages",
5970       magnitude_wand->name);
5971   assert(phase_wand != (MagickWand *) NULL);
5972   assert(phase_wand->signature == WandSignature);
5973   inverse_image=InverseFourierTransformImage(magnitude_wand->images,
5974     phase_wand->images,magnitude,wand->exception);
5975   if (inverse_image == (Image *) NULL)
5976     return(MagickFalse);
5977   ReplaceImageInList(&wand->images,inverse_image);
5978   return(MagickTrue);
5979 }
5980 \f
5981 /*
5982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5983 %                                                                             %
5984 %                                                                             %
5985 %                                                                             %
5986 %   M a g i c k L a b e l I m a g e                                           %
5987 %                                                                             %
5988 %                                                                             %
5989 %                                                                             %
5990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5991 %
5992 %  MagickLabelImage() adds a label to your image.
5993 %
5994 %  The format of the MagickLabelImage method is:
5995 %
5996 %      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
5997 %
5998 %  A description of each parameter follows:
5999 %
6000 %    o wand: the magick wand.
6001 %
6002 %    o label: the image label.
6003 %
6004 */
6005 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6006   const char *label)
6007 {
6008   MagickBooleanType
6009     status;
6010
6011   assert(wand != (MagickWand *) NULL);
6012   assert(wand->signature == WandSignature);
6013   if (wand->debug != MagickFalse)
6014     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6015   if (wand->images == (Image *) NULL)
6016     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6017   status=SetImageProperty(wand->images,"label",label,wand->exception);
6018   return(status);
6019 }
6020 \f
6021 /*
6022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6023 %                                                                             %
6024 %                                                                             %
6025 %                                                                             %
6026 %   M a g i c k L e v e l I m a g e                                           %
6027 %                                                                             %
6028 %                                                                             %
6029 %                                                                             %
6030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6031 %
6032 %  MagickLevelImage() adjusts the levels of an image by scaling the colors
6033 %  falling between specified white and black points to the full available
6034 %  quantum range. The parameters provided represent the black, mid, and white
6035 %  points. The black point specifies the darkest color in the image. Colors
6036 %  darker than the black point are set to zero. Mid point specifies a gamma
6037 %  correction to apply to the image.  White point specifies the lightest color
6038 %  in the image. Colors brighter than the white point are set to the maximum
6039 %  quantum value.
6040 %
6041 %  The format of the MagickLevelImage method is:
6042 %
6043 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6044 %        const double black_point,const double gamma,const double white_point)
6045 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6046 %        const ChannelType channel,const double black_point,const double gamma,
6047 %        const double white_point)
6048 %
6049 %  A description of each parameter follows:
6050 %
6051 %    o wand: the magick wand.
6052 %
6053 %    o channel: Identify which channel to level: RedPixelChannel,
6054 %      GreenPixelChannel, etc.
6055 %
6056 %    o black_point: the black point.
6057 %
6058 %    o gamma: the gamma.
6059 %
6060 %    o white_point: the white point.
6061 %
6062 */
6063 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6064   const double black_point,const double gamma,const double white_point)
6065 {
6066   MagickBooleanType
6067     status;
6068
6069   assert(wand != (MagickWand *) NULL);
6070   assert(wand->signature == WandSignature);
6071   if (wand->debug != MagickFalse)
6072     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6073   if (wand->images == (Image *) NULL)
6074     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6075   status=LevelImage(wand->images,black_point,white_point,gamma,
6076     wand->exception);
6077   return(status);
6078 }
6079 \f
6080 /*
6081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6082 %                                                                             %
6083 %                                                                             %
6084 %                                                                             %
6085 %   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6086 %                                                                             %
6087 %                                                                             %
6088 %                                                                             %
6089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6090 %
6091 %  MagickLinearStretchImage() stretches with saturation the image intensity.
6092 %
6093 %  You can also reduce the influence of a particular channel with a gamma
6094 %  value of 0.
6095 %
6096 %  The format of the MagickLinearStretchImage method is:
6097 %
6098 %      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6099 %        const double black_point,const double white_point)
6100 %
6101 %  A description of each parameter follows:
6102 %
6103 %    o wand: the magick wand.
6104 %
6105 %    o black_point: the black point.
6106 %
6107 %    o white_point: the white point.
6108 %
6109 */
6110 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6111   const double black_point,const double white_point)
6112 {
6113   MagickBooleanType
6114     status;
6115
6116   assert(wand != (MagickWand *) NULL);
6117   assert(wand->signature == WandSignature);
6118   if (wand->debug != MagickFalse)
6119     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6120   if (wand->images == (Image *) NULL)
6121     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6122   status=LinearStretchImage(wand->images,black_point,white_point,
6123     wand->exception);
6124   return(status);
6125 }
6126 \f
6127 /*
6128 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6129 %                                                                             %
6130 %                                                                             %
6131 %                                                                             %
6132 %   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6133 %                                                                             %
6134 %                                                                             %
6135 %                                                                             %
6136 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6137 %
6138 %  MagickLiquidRescaleImage() rescales image with seam carving.
6139 %
6140 %      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6141 %        const size_t columns,const size_t rows,
6142 %        const double delta_x,const double rigidity)
6143 %
6144 %  A description of each parameter follows:
6145 %
6146 %    o wand: the magick wand.
6147 %
6148 %    o columns: the number of columns in the scaled image.
6149 %
6150 %    o rows: the number of rows in the scaled image.
6151 %
6152 %    o delta_x: maximum seam transversal step (0 means straight seams).
6153 %
6154 %    o rigidity: introduce a bias for non-straight seams (typically 0).
6155 %
6156 */
6157 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6158   const size_t columns,const size_t rows,const double delta_x,
6159   const double rigidity)
6160 {
6161   Image
6162     *rescale_image;
6163
6164   assert(wand != (MagickWand *) NULL);
6165   assert(wand->signature == WandSignature);
6166   if (wand->debug != MagickFalse)
6167     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6168   if (wand->images == (Image *) NULL)
6169     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6170   rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6171     rigidity,wand->exception);
6172   if (rescale_image == (Image *) NULL)
6173     return(MagickFalse);
6174   ReplaceImageInList(&wand->images,rescale_image);
6175   return(MagickTrue);
6176 }
6177 \f
6178 /*
6179 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6180 %                                                                             %
6181 %                                                                             %
6182 %                                                                             %
6183 %   M a g i c k M a g n i f y I m a g e                                       %
6184 %                                                                             %
6185 %                                                                             %
6186 %                                                                             %
6187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6188 %
6189 %  MagickMagnifyImage() is a convenience method that scales an image
6190 %  proportionally to twice its original size.
6191 %
6192 %  The format of the MagickMagnifyImage method is:
6193 %
6194 %      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6195 %
6196 %  A description of each parameter follows:
6197 %
6198 %    o wand: the magick wand.
6199 %
6200 */
6201 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6202 {
6203   Image
6204     *magnify_image;
6205
6206   assert(wand != (MagickWand *) NULL);
6207   assert(wand->signature == WandSignature);
6208   if (wand->debug != MagickFalse)
6209     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6210   if (wand->images == (Image *) NULL)
6211     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6212   magnify_image=MagnifyImage(wand->images,wand->exception);
6213   if (magnify_image == (Image *) NULL)
6214     return(MagickFalse);
6215   ReplaceImageInList(&wand->images,magnify_image);
6216   return(MagickTrue);
6217 }
6218 \f
6219 /*
6220 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6221 %                                                                             %
6222 %                                                                             %
6223 %                                                                             %
6224 %   M a g i c k M e r g e I m a g e L a y e r s                               %
6225 %                                                                             %
6226 %                                                                             %
6227 %                                                                             %
6228 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6229 %
6230 %  MagickMergeImageLayers() composes all the image layers from the current
6231 %  given image onward to produce a single image of the merged layers.
6232 %
6233 %  The inital canvas's size depends on the given ImageLayerMethod, and is
6234 %  initialized using the first images background color.  The images
6235 %  are then compositied onto that image in sequence using the given
6236 %  composition that has been assigned to each individual image.
6237 %
6238 %  The format of the MagickMergeImageLayers method is:
6239 %
6240 %      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6241 %        const ImageLayerMethod method)
6242 %
6243 %  A description of each parameter follows:
6244 %
6245 %    o wand: the magick wand.
6246 %
6247 %    o method: the method of selecting the size of the initial canvas.
6248 %
6249 %        MergeLayer: Merge all layers onto a canvas just large enough
6250 %           to hold all the actual images. The virtual canvas of the
6251 %           first image is preserved but otherwise ignored.
6252 %
6253 %        FlattenLayer: Use the virtual canvas size of first image.
6254 %           Images which fall outside this canvas is clipped.
6255 %           This can be used to 'fill out' a given virtual canvas.
6256 %
6257 %        MosaicLayer: Start with the virtual canvas of the first image,
6258 %           enlarging left and right edges to contain all images.
6259 %           Images with negative offsets will be clipped.
6260 %
6261 */
6262 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6263   const ImageLayerMethod method)
6264 {
6265   Image
6266     *mosaic_image;
6267
6268   assert(wand != (MagickWand *) NULL);
6269   assert(wand->signature == WandSignature);
6270   if (wand->debug != MagickFalse)
6271     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6272   if (wand->images == (Image *) NULL)
6273     return((MagickWand *) NULL);
6274   mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6275   if (mosaic_image == (Image *) NULL)
6276     return((MagickWand *) NULL);
6277   return(CloneMagickWandFromImages(wand,mosaic_image));
6278 }
6279 \f
6280 /*
6281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6282 %                                                                             %
6283 %                                                                             %
6284 %                                                                             %
6285 %   M a g i c k M i n i f y I m a g e                                         %
6286 %                                                                             %
6287 %                                                                             %
6288 %                                                                             %
6289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6290 %
6291 %  MagickMinifyImage() is a convenience method that scales an image
6292 %  proportionally to one-half its original size
6293 %
6294 %  The format of the MagickMinifyImage method is:
6295 %
6296 %      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6297 %
6298 %  A description of each parameter follows:
6299 %
6300 %    o wand: the magick wand.
6301 %
6302 */
6303 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6304 {
6305   Image
6306     *minify_image;
6307
6308   assert(wand != (MagickWand *) NULL);
6309   assert(wand->signature == WandSignature);
6310   if (wand->debug != MagickFalse)
6311     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6312   if (wand->images == (Image *) NULL)
6313     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6314   minify_image=MinifyImage(wand->images,wand->exception);
6315   if (minify_image == (Image *) NULL)
6316     return(MagickFalse);
6317   ReplaceImageInList(&wand->images,minify_image);
6318   return(MagickTrue);
6319 }
6320 \f
6321 /*
6322 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6323 %                                                                             %
6324 %                                                                             %
6325 %                                                                             %
6326 %   M a g i c k M o d u l a t e I m a g e                                     %
6327 %                                                                             %
6328 %                                                                             %
6329 %                                                                             %
6330 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6331 %
6332 %  MagickModulateImage() lets you control the brightness, saturation, and hue
6333 %  of an image.  Hue is the percentage of absolute rotation from the current
6334 %  position.  For example 50 results in a counter-clockwise rotation of 90
6335 %  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6336 %  both resulting in a rotation of 180 degrees.
6337 %
6338 %  To increase the color brightness by 20% and decrease the color saturation by
6339 %  10% and leave the hue unchanged, use: 120,90,100.
6340 %
6341 %  The format of the MagickModulateImage method is:
6342 %
6343 %      MagickBooleanType MagickModulateImage(MagickWand *wand,
6344 %        const double brightness,const double saturation,const double hue)
6345 %
6346 %  A description of each parameter follows:
6347 %
6348 %    o wand: the magick wand.
6349 %
6350 %    o brightness: the percent change in brighness.
6351 %
6352 %    o saturation: the percent change in saturation.
6353 %
6354 %    o hue: the percent change in hue.
6355 %
6356 */
6357 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6358   const double brightness,const double saturation,const double hue)
6359 {
6360   char
6361     modulate[MaxTextExtent];
6362
6363   MagickBooleanType
6364     status;
6365
6366   assert(wand != (MagickWand *) NULL);
6367   assert(wand->signature == WandSignature);
6368   if (wand->debug != MagickFalse)
6369     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6370   if (wand->images == (Image *) NULL)
6371     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6372   (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6373     brightness,saturation,hue);
6374   status=ModulateImage(wand->images,modulate,wand->exception);
6375   return(status);
6376 }
6377 \f
6378 /*
6379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6380 %                                                                             %
6381 %                                                                             %
6382 %                                                                             %
6383 %   M a g i c k M o n t a g e I m a g e                                       %
6384 %                                                                             %
6385 %                                                                             %
6386 %                                                                             %
6387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6388 %
6389 %  MagickMontageImage() creates a composite image by combining several
6390 %  separate images. The images are tiled on the composite image with the name
6391 %  of the image optionally appearing just below the individual tile.
6392 %
6393 %  The format of the MagickMontageImage method is:
6394 %
6395 %      MagickWand *MagickMontageImage(MagickWand *wand,
6396 %        const DrawingWand drawing_wand,const char *tile_geometry,
6397 %        const char *thumbnail_geometry,const MontageMode mode,
6398 %        const char *frame)
6399 %
6400 %  A description of each parameter follows:
6401 %
6402 %    o wand: the magick wand.
6403 %
6404 %    o drawing_wand: the drawing wand.  The font name, size, and color are
6405 %      obtained from this wand.
6406 %
6407 %    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6408 %
6409 %    o thumbnail_geometry: Preferred image size and border size of each
6410 %      thumbnail (e.g. 120x120+4+3>).
6411 %
6412 %    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6413 %
6414 %    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6415 %      The frame color is that of the thumbnail's matte color.
6416 %
6417 */
6418 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6419   const DrawingWand *drawing_wand,const char *tile_geometry,
6420   const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6421 {
6422   char
6423     *font;
6424
6425   Image
6426     *montage_image;
6427
6428   MontageInfo
6429     *montage_info;
6430
6431   PixelWand
6432     *pixel_wand;
6433
6434   assert(wand != (MagickWand *) NULL);
6435   assert(wand->signature == WandSignature);
6436   if (wand->debug != MagickFalse)
6437     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6438   if (wand->images == (Image *) NULL)
6439     return((MagickWand *) NULL);
6440   montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6441   switch (mode)
6442   {
6443     case FrameMode:
6444     {
6445       (void) CloneString(&montage_info->frame,"15x15+3+3");
6446       montage_info->shadow=MagickTrue;
6447       break;
6448     }
6449     case UnframeMode:
6450     {
6451       montage_info->frame=(char *) NULL;
6452       montage_info->shadow=MagickFalse;
6453       montage_info->border_width=0;
6454       break;
6455     }
6456     case ConcatenateMode:
6457     {
6458       montage_info->frame=(char *) NULL;
6459       montage_info->shadow=MagickFalse;
6460       (void) CloneString(&montage_info->geometry,"+0+0");
6461       montage_info->border_width=0;
6462       break;
6463     }
6464     default:
6465       break;
6466   }
6467   font=DrawGetFont(drawing_wand);
6468   if (font != (char *) NULL)
6469     (void) CloneString(&montage_info->font,font);
6470   if (frame != (char *) NULL)
6471     (void) CloneString(&montage_info->frame,frame);
6472   montage_info->pointsize=DrawGetFontSize(drawing_wand);
6473   pixel_wand=NewPixelWand();
6474   DrawGetFillColor(drawing_wand,pixel_wand);
6475   PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6476   DrawGetStrokeColor(drawing_wand,pixel_wand);
6477   PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6478   pixel_wand=DestroyPixelWand(pixel_wand);
6479   if (thumbnail_geometry != (char *) NULL)
6480     (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6481   if (tile_geometry != (char *) NULL)
6482     (void) CloneString(&montage_info->tile,tile_geometry);
6483   montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6484     wand->exception);
6485   montage_info=DestroyMontageInfo(montage_info);
6486   if (montage_image == (Image *) NULL)
6487     return((MagickWand *) NULL);
6488   return(CloneMagickWandFromImages(wand,montage_image));
6489 }
6490 \f
6491 /*
6492 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6493 %                                                                             %
6494 %                                                                             %
6495 %                                                                             %
6496 %   M a g i c k M o r p h I m a g e s                                         %
6497 %                                                                             %
6498 %                                                                             %
6499 %                                                                             %
6500 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6501 %
6502 %  MagickMorphImages() method morphs a set of images.  Both the image pixels
6503 %  and size are linearly interpolated to give the appearance of a
6504 %  meta-morphosis from one image to the next.
6505 %
6506 %  The format of the MagickMorphImages method is:
6507 %
6508 %      MagickWand *MagickMorphImages(MagickWand *wand,
6509 %        const size_t number_frames)
6510 %
6511 %  A description of each parameter follows:
6512 %
6513 %    o wand: the magick wand.
6514 %
6515 %    o number_frames: the number of in-between images to generate.
6516 %
6517 */
6518 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6519   const size_t number_frames)
6520 {
6521   Image
6522     *morph_image;
6523
6524   assert(wand != (MagickWand *) NULL);
6525   assert(wand->signature == WandSignature);
6526   if (wand->debug != MagickFalse)
6527     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6528   if (wand->images == (Image *) NULL)
6529     return((MagickWand *) NULL);
6530   morph_image=MorphImages(wand->images,number_frames,wand->exception);
6531   if (morph_image == (Image *) NULL)
6532     return((MagickWand *) NULL);
6533   return(CloneMagickWandFromImages(wand,morph_image));
6534 }
6535 \f
6536 /*
6537 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6538 %                                                                             %
6539 %                                                                             %
6540 %                                                                             %
6541 %   M a g i c k M o r p h o l o g y I m a g e                                 %
6542 %                                                                             %
6543 %                                                                             %
6544 %                                                                             %
6545 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6546 %
6547 %  MagickMorphologyImage() applies a user supplied kernel to the image
6548 %  according to the given mophology method.
6549 %
6550 %  The format of the MagickMorphologyImage method is:
6551 %
6552 %      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6553 %        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6554 %
6555 %  A description of each parameter follows:
6556 %
6557 %    o wand: the magick wand.
6558 %
6559 %    o method: the morphology method to be applied.
6560 %
6561 %    o iterations: apply the operation this many times (or no change).
6562 %      A value of -1 means loop until no change found.  How this is applied
6563 %      may depend on the morphology method.  Typically this is a value of 1.
6564 %
6565 %    o kernel: An array of doubles representing the morphology kernel.
6566 %
6567 */
6568 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6569   MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6570 {
6571   Image
6572     *morphology_image;
6573
6574   assert(wand != (MagickWand *) NULL);
6575   assert(wand->signature == WandSignature);
6576   if (wand->debug != MagickFalse)
6577     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6578   if (kernel == (const KernelInfo *) NULL)
6579     return(MagickFalse);
6580   if (wand->images == (Image *) NULL)
6581     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6582   morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6583     wand->exception);
6584   if (morphology_image == (Image *) NULL)
6585     return(MagickFalse);
6586   ReplaceImageInList(&wand->images,morphology_image);
6587   return(MagickTrue);
6588 }
6589 \f
6590 /*
6591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6592 %                                                                             %
6593 %                                                                             %
6594 %                                                                             %
6595 %   M a g i c k M o t i o n B l u r I m a g e                                 %
6596 %                                                                             %
6597 %                                                                             %
6598 %                                                                             %
6599 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6600 %
6601 %  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6602 %  Gaussian operator of the given radius and standard deviation (sigma).
6603 %  For reasonable results, radius should be larger than sigma.  Use a
6604 %  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6605 %  Angle gives the angle of the blurring motion.
6606 %
6607 %  The format of the MagickMotionBlurImage method is:
6608 %
6609 %      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6610 %        const double radius,const double sigma,const double angle,
6611 %        const double bias)
6612 %
6613 %  A description of each parameter follows:
6614 %
6615 %    o wand: the magick wand.
6616 %
6617 %    o radius: the radius of the Gaussian, in pixels, not counting
6618 %      the center pixel.
6619 %
6620 %    o sigma: the standard deviation of the Gaussian, in pixels.
6621 %
6622 %    o angle: Apply the effect along this angle.
6623 %
6624 */
6625 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6626   const double radius,const double sigma,const double angle,const double bias)
6627 {
6628   Image
6629     *blur_image;
6630
6631   assert(wand != (MagickWand *) NULL);
6632   assert(wand->signature == WandSignature);
6633   if (wand->debug != MagickFalse)
6634     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6635   if (wand->images == (Image *) NULL)
6636     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6637   blur_image=MotionBlurImage(wand->images,radius,sigma,angle,bias,
6638     wand->exception);
6639   if (blur_image == (Image *) NULL)
6640     return(MagickFalse);
6641   ReplaceImageInList(&wand->images,blur_image);
6642   return(MagickTrue);
6643 }
6644 \f
6645 /*
6646 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6647 %                                                                             %
6648 %                                                                             %
6649 %                                                                             %
6650 %   M a g i c k N e g a t e I m a g e                                         %
6651 %                                                                             %
6652 %                                                                             %
6653 %                                                                             %
6654 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6655 %
6656 %  MagickNegateImage() negates the colors in the reference image.  The
6657 %  Grayscale option means that only grayscale values within the image are
6658 %  negated.
6659 %
6660 %  You can also reduce the influence of a particular channel with a gamma
6661 %  value of 0.
6662 %
6663 %  The format of the MagickNegateImage method is:
6664 %
6665 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
6666 %        const MagickBooleanType gray)
6667 %
6668 %  A description of each parameter follows:
6669 %
6670 %    o wand: the magick wand.
6671 %
6672 %    o gray: If MagickTrue, only negate grayscale pixels within the image.
6673 %
6674 */
6675 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6676   const MagickBooleanType gray)
6677 {
6678   MagickBooleanType
6679     status;
6680
6681   assert(wand != (MagickWand *) NULL);
6682   assert(wand->signature == WandSignature);
6683   if (wand->debug != MagickFalse)
6684     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6685   if (wand->images == (Image *) NULL)
6686     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6687   status=NegateImage(wand->images,gray,wand->exception);
6688   return(status);
6689 }
6690 \f
6691 /*
6692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6693 %                                                                             %
6694 %                                                                             %
6695 %                                                                             %
6696 %   M a g i c k N e w I m a g e                                               %
6697 %                                                                             %
6698 %                                                                             %
6699 %                                                                             %
6700 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6701 %
6702 %  MagickNewImage() adds a blank image canvas of the specified size and
6703 %  background color to the wand.
6704 %
6705 %  The format of the MagickNewImage method is:
6706 %
6707 %      MagickBooleanType MagickNewImage(MagickWand *wand,
6708 %        const size_t columns,const size_t rows,
6709 %        const PixelWand *background)
6710 %
6711 %  A description of each parameter follows:
6712 %
6713 %    o wand: the magick wand.
6714 %
6715 %    o width: the image width.
6716 %
6717 %    o height: the image height.
6718 %
6719 %    o background: the image color.
6720 %
6721 */
6722 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
6723   const size_t height,const PixelWand *background)
6724 {
6725   Image
6726     *images;
6727
6728   PixelInfo
6729     pixel;
6730
6731   assert(wand != (MagickWand *) NULL);
6732   assert(wand->signature == WandSignature);
6733   if (wand->debug != MagickFalse)
6734     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6735   PixelGetMagickColor(background,&pixel);
6736   images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
6737   if (images == (Image *) NULL)
6738     return(MagickFalse);
6739   return(InsertImageInWand(wand,images));
6740 }
6741 \f
6742 /*
6743 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6744 %                                                                             %
6745 %                                                                             %
6746 %                                                                             %
6747 %   M a g i c k N e x t I m a g e                                             %
6748 %                                                                             %
6749 %                                                                             %
6750 %                                                                             %
6751 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6752 %
6753 %  MagickNextImage() associates the next image in the image list with a magick
6754 %  wand.  It returns true if the it succeeds, meaning the current image is the
6755 %  next image to be iterated over.
6756 %
6757 %  The format of the MagickNextImage method is:
6758 %
6759 %      MagickBooleanType MagickNextImage(MagickWand *wand)
6760 %
6761 %  A description of each parameter follows:
6762 %
6763 %    o wand: the magick wand.
6764 %
6765 */
6766 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
6767 {
6768   assert(wand != (MagickWand *) NULL);
6769   assert(wand->signature == WandSignature);
6770   if (wand->debug != MagickFalse)
6771     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6772   if (wand->images == (Image *) NULL)
6773     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6774   /* If current image is 'pending' just return true.  */
6775   if (wand->image_pending != MagickFalse)
6776     {
6777       wand->image_pending=MagickFalse;
6778       return(MagickTrue);
6779     }
6780   /* If there is no next image, (Iterator is finished) */
6781   if (GetNextImageInList(wand->images) == (Image *) NULL)
6782       return(MagickFalse);
6783   /* just move to next image - current image is not 'pending' */
6784   wand->images=GetNextImageInList(wand->images);
6785   return(MagickTrue);
6786 }
6787 \f
6788 /*
6789 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6790 %                                                                             %
6791 %                                                                             %
6792 %                                                                             %
6793 %   M a g i c k N o r m a l i z e I m a g e                                   %
6794 %                                                                             %
6795 %                                                                             %
6796 %                                                                             %
6797 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6798 %
6799 %  MagickNormalizeImage() enhances the contrast of a color image by adjusting
6800 %  the pixels color to span the entire range of colors available
6801 %
6802 %  You can also reduce the influence of a particular channel with a gamma
6803 %  value of 0.
6804 %
6805 %  The format of the MagickNormalizeImage method is:
6806 %
6807 %      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6808 %
6809 %  A description of each parameter follows:
6810 %
6811 %    o wand: the magick wand.
6812 %
6813 */
6814 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6815 {
6816   MagickBooleanType
6817     status;
6818
6819   assert(wand != (MagickWand *) NULL);
6820   assert(wand->signature == WandSignature);
6821   if (wand->debug != MagickFalse)
6822     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6823   if (wand->images == (Image *) NULL)
6824     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6825   status=NormalizeImage(wand->images,wand->exception);
6826   return(status);
6827 }
6828 \f
6829 /*
6830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6831 %                                                                             %
6832 %                                                                             %
6833 %                                                                             %
6834 %   M a g i c k O i l P a i n t I m a g e                                     %
6835 %                                                                             %
6836 %                                                                             %
6837 %                                                                             %
6838 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6839 %
6840 %  MagickOilPaintImage() applies a special effect filter that simulates an oil
6841 %  painting.  Each pixel is replaced by the most frequent color occurring
6842 %  in a circular region defined by radius.
6843 %
6844 %  The format of the MagickOilPaintImage method is:
6845 %
6846 %      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6847 %        const double radius,const double sigma)
6848 %
6849 %  A description of each parameter follows:
6850 %
6851 %    o wand: the magick wand.
6852 %
6853 %    o radius: the radius of the circular neighborhood.
6854 %
6855 %    o sigma: the standard deviation of the Gaussian, in pixels.
6856 %
6857 */
6858 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6859   const double radius,const double sigma)
6860 {
6861   Image
6862     *paint_image;
6863
6864   assert(wand != (MagickWand *) NULL);
6865   assert(wand->signature == WandSignature);
6866   if (wand->debug != MagickFalse)
6867     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6868   if (wand->images == (Image *) NULL)
6869     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6870   paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
6871   if (paint_image == (Image *) NULL)
6872     return(MagickFalse);
6873   ReplaceImageInList(&wand->images,paint_image);
6874   return(MagickTrue);
6875 }
6876 \f
6877 /*
6878 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6879 %                                                                             %
6880 %                                                                             %
6881 %                                                                             %
6882 %   M a g i c k O p a q u e P a i n t I m a g e                               %
6883 %                                                                             %
6884 %                                                                             %
6885 %                                                                             %
6886 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6887 %
6888 %  MagickOpaquePaintImage() changes any pixel that matches color with the color
6889 %  defined by fill.
6890 %
6891 %  The format of the MagickOpaquePaintImage method is:
6892 %
6893 %      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6894 %        const PixelWand *target,const PixelWand *fill,const double fuzz,
6895 %        const MagickBooleanType invert)
6896 %
6897 %  A description of each parameter follows:
6898 %
6899 %    o wand: the magick wand.
6900 %
6901 %    o target: Change this target color to the fill color within the image.
6902 %
6903 %    o fill: the fill pixel wand.
6904 %
6905 %    o fuzz: By default target must match a particular pixel color
6906 %      exactly.  However, in many cases two colors may differ by a small amount.
6907 %      The fuzz member of image defines how much tolerance is acceptable to
6908 %      consider two colors as the same.  For example, set fuzz to 10 and the
6909 %      color red at intensities of 100 and 102 respectively are now interpreted
6910 %      as the same color for the purposes of the floodfill.
6911 %
6912 %    o invert: paint any pixel that does not match the target color.
6913 %
6914 */
6915 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6916   const PixelWand *target,const PixelWand *fill,const double fuzz,
6917   const MagickBooleanType invert)
6918 {
6919   MagickBooleanType
6920     status;
6921
6922   PixelInfo
6923     fill_pixel,
6924     target_pixel;
6925
6926   assert(wand != (MagickWand *) NULL);
6927   assert(wand->signature == WandSignature);
6928   if (wand->debug != MagickFalse)
6929     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6930   if (wand->images == (Image *) NULL)
6931     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6932   PixelGetMagickColor(target,&target_pixel);
6933   PixelGetMagickColor(fill,&fill_pixel);
6934   wand->images->fuzz=fuzz;
6935   status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
6936     wand->exception);
6937   return(status);
6938 }
6939 \f
6940 /*
6941 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6942 %                                                                             %
6943 %                                                                             %
6944 %                                                                             %
6945 %   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                         %
6946 %                                                                             %
6947 %                                                                             %
6948 %                                                                             %
6949 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6950 %
6951 %  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
6952 %  previous image in the sequence.  From this it attempts to select the
6953 %  smallest cropped image to replace each frame, while preserving the results
6954 %  of the animation.
6955 %
6956 %  The format of the MagickOptimizeImageLayers method is:
6957 %
6958 %      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6959 %
6960 %  A description of each parameter follows:
6961 %
6962 %    o wand: the magick wand.
6963 %
6964 */
6965 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6966 {
6967   Image
6968     *optimize_image;
6969
6970   assert(wand != (MagickWand *) NULL);
6971   assert(wand->signature == WandSignature);
6972   if (wand->debug != MagickFalse)
6973     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6974   if (wand->images == (Image *) NULL)
6975     return((MagickWand *) NULL);
6976   optimize_image=OptimizeImageLayers(wand->images,wand->exception);
6977   if (optimize_image == (Image *) NULL)
6978     return((MagickWand *) NULL);
6979   return(CloneMagickWandFromImages(wand,optimize_image));
6980 }
6981 \f
6982 /*
6983 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6984 %                                                                             %
6985 %                                                                             %
6986 %                                                                             %
6987 %     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                   %
6988 %                                                                             %
6989 %                                                                             %
6990 %                                                                             %
6991 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6992 %
6993 %  MagickOrderedPosterizeImage() performs an ordered dither based on a number
6994 %  of pre-defined dithering threshold maps, but over multiple intensity levels,
6995 %  which can be different for different channels, according to the input
6996 %  arguments.
6997 %
6998 %  The format of the MagickOrderedPosterizeImage method is:
6999 %
7000 %      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7001 %        const char *threshold_map)
7002 %
7003 %  A description of each parameter follows:
7004 %
7005 %    o image: the image.
7006 %
7007 %    o threshold_map: A string containing the name of the threshold dither
7008 %      map to use, followed by zero or more numbers representing the number of
7009 %      color levels tho dither between.
7010 %
7011 %      Any level number less than 2 is equivalent to 2, and means only binary
7012 %      dithering will be applied to each color channel.
7013 %
7014 %      No numbers also means a 2 level (bitmap) dither will be applied to all
7015 %      channels, while a single number is the number of levels applied to each
7016 %      channel in sequence.  More numbers will be applied in turn to each of
7017 %      the color channels.
7018 %
7019 %      For example: "o3x3,6" generates a 6 level posterization of the image
7020 %      with a ordered 3x3 diffused pixel dither being applied between each
7021 %      level. While checker,8,8,4 will produce a 332 colormaped image with
7022 %      only a single checkerboard hash pattern (50% grey) between each color
7023 %      level, to basically double the number of color levels with a bare
7024 %      minimim of dithering.
7025 %
7026 */
7027 WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7028   const char *threshold_map)
7029 {
7030   MagickBooleanType
7031     status;
7032
7033   assert(wand != (MagickWand *) NULL);
7034   assert(wand->signature == WandSignature);
7035   if (wand->debug != MagickFalse)
7036     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7037   if (wand->images == (Image *) NULL)
7038     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7039   status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7040   return(status);
7041 }
7042 \f
7043 /*
7044 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7045 %                                                                             %
7046 %                                                                             %
7047 %                                                                             %
7048 %   M a g i c k P i n g I m a g e                                             %
7049 %                                                                             %
7050 %                                                                             %
7051 %                                                                             %
7052 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7053 %
7054 %  MagickPingImage() is the same as MagickReadImage() except the only valid
7055 %  information returned is the image width, height, size, and format.  It
7056 %  is designed to efficiently obtain this information from a file without
7057 %  reading the entire image sequence into memory.
7058 %
7059 %  The format of the MagickPingImage method is:
7060 %
7061 %      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7062 %
7063 %  A description of each parameter follows:
7064 %
7065 %    o wand: the magick wand.
7066 %
7067 %    o filename: the image filename.
7068 %
7069 */
7070 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7071   const char *filename)
7072 {
7073   Image
7074     *images;
7075
7076   ImageInfo
7077     *ping_info;
7078
7079   assert(wand != (MagickWand *) NULL);
7080   assert(wand->signature == WandSignature);
7081   if (wand->debug != MagickFalse)
7082     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7083   ping_info=CloneImageInfo(wand->image_info);
7084   if (filename != (const char *) NULL)
7085     (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7086   images=PingImage(ping_info,wand->exception);
7087   ping_info=DestroyImageInfo(ping_info);
7088   if (images == (Image *) NULL)
7089     return(MagickFalse);
7090   return(InsertImageInWand(wand,images));
7091 }
7092 \f
7093 /*
7094 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7095 %                                                                             %
7096 %                                                                             %
7097 %                                                                             %
7098 %   M a g i c k P i n g I m a g e B l o b                                     %
7099 %                                                                             %
7100 %                                                                             %
7101 %                                                                             %
7102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7103 %
7104 %  MagickPingImageBlob() pings an image or image sequence from a blob.
7105 %
7106 %  The format of the MagickPingImageBlob method is:
7107 %
7108 %      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7109 %        const void *blob,const size_t length)
7110 %
7111 %  A description of each parameter follows:
7112 %
7113 %    o wand: the magick wand.
7114 %
7115 %    o blob: the blob.
7116 %
7117 %    o length: the blob length.
7118 %
7119 */
7120 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7121   const void *blob,const size_t length)
7122 {
7123   Image
7124     *images;
7125
7126   ImageInfo
7127     *read_info;
7128
7129   assert(wand != (MagickWand *) NULL);
7130   assert(wand->signature == WandSignature);
7131   if (wand->debug != MagickFalse)
7132     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7133   read_info=CloneImageInfo(wand->image_info);
7134   SetImageInfoBlob(read_info,blob,length);
7135   images=PingImage(read_info,wand->exception);
7136   read_info=DestroyImageInfo(read_info);
7137   if (images == (Image *) NULL)
7138     return(MagickFalse);
7139   return(InsertImageInWand(wand,images));
7140 }
7141 \f
7142 /*
7143 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7144 %                                                                             %
7145 %                                                                             %
7146 %                                                                             %
7147 %   M a g i c k P i n g I m a g e F i l e                                     %
7148 %                                                                             %
7149 %                                                                             %
7150 %                                                                             %
7151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7152 %
7153 %  MagickPingImageFile() pings an image or image sequence from an open file
7154 %  descriptor.
7155 %
7156 %  The format of the MagickPingImageFile method is:
7157 %
7158 %      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7159 %
7160 %  A description of each parameter follows:
7161 %
7162 %    o wand: the magick wand.
7163 %
7164 %    o file: the file descriptor.
7165 %
7166 */
7167 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7168 {
7169   Image
7170     *images;
7171
7172   ImageInfo
7173     *read_info;
7174
7175   assert(wand != (MagickWand *) NULL);
7176   assert(wand->signature == WandSignature);
7177   assert(file != (FILE *) NULL);
7178   if (wand->debug != MagickFalse)
7179     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7180   read_info=CloneImageInfo(wand->image_info);
7181   SetImageInfoFile(read_info,file);
7182   images=PingImage(read_info,wand->exception);
7183   read_info=DestroyImageInfo(read_info);
7184   if (images == (Image *) NULL)
7185     return(MagickFalse);
7186   return(InsertImageInWand(wand,images));
7187 }
7188 \f
7189 /*
7190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7191 %                                                                             %
7192 %                                                                             %
7193 %                                                                             %
7194 %   M a g i c k P o l a r o i d I m a g e                                     %
7195 %                                                                             %
7196 %                                                                             %
7197 %                                                                             %
7198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7199 %
7200 %  MagickPolaroidImage() simulates a Polaroid picture.
7201 %
7202 %  The format of the MagickPolaroidImage method is:
7203 %
7204 %      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7205 %        const DrawingWand *drawing_wand,const double angle,
7206 %        const PixelInterpolateMethod method)
7207 %
7208 %  A description of each parameter follows:
7209 %
7210 %    o wand: the magick wand.
7211 %
7212 %    o drawing_wand: the draw wand.
7213 %
7214 %    o angle: Apply the effect along this angle.
7215 %
7216 %    o method: the pixel interpolation method.
7217 %
7218 */
7219 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7220   const DrawingWand *drawing_wand,const double angle,
7221   const PixelInterpolateMethod method)
7222 {
7223   DrawInfo
7224     *draw_info;
7225
7226   Image
7227     *polaroid_image;
7228
7229   assert(wand != (MagickWand *) NULL);
7230   assert(wand->signature == WandSignature);
7231   if (wand->debug != MagickFalse)
7232     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7233   if (wand->images == (Image *) NULL)
7234     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7235   draw_info=PeekDrawingWand(drawing_wand);
7236   if (draw_info == (DrawInfo *) NULL)
7237     return(MagickFalse);
7238   polaroid_image=PolaroidImage(wand->images,draw_info,angle,method,
7239     wand->exception);
7240   if (polaroid_image == (Image *) NULL)
7241     return(MagickFalse);
7242   ReplaceImageInList(&wand->images,polaroid_image);
7243   return(MagickTrue);
7244 }
7245 \f
7246 /*
7247 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7248 %                                                                             %
7249 %                                                                             %
7250 %                                                                             %
7251 %   M a g i c k P o s t e r i z e I m a g e                                   %
7252 %                                                                             %
7253 %                                                                             %
7254 %                                                                             %
7255 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7256 %
7257 %  MagickPosterizeImage() reduces the image to a limited number of color level.
7258 %
7259 %  The format of the MagickPosterizeImage method is:
7260 %
7261 %      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7262 %        const unsigned levels,const MagickBooleanType dither)
7263 %
7264 %  A description of each parameter follows:
7265 %
7266 %    o wand: the magick wand.
7267 %
7268 %    o levels: Number of color levels allowed in each channel.  Very low values
7269 %      (2, 3, or 4) have the most visible effect.
7270 %
7271 %    o dither: Set this integer value to something other than zero to dither
7272 %      the mapped image.
7273 %
7274 */
7275 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7276   const size_t levels,const MagickBooleanType dither)
7277 {
7278   MagickBooleanType
7279     status;
7280
7281   assert(wand != (MagickWand *) NULL);
7282   assert(wand->signature == WandSignature);
7283   if (wand->debug != MagickFalse)
7284     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7285   if (wand->images == (Image *) NULL)
7286     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7287   status=PosterizeImage(wand->images,levels,dither,wand->exception);
7288   return(status);
7289 }
7290 \f
7291 /*
7292 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7293 %                                                                             %
7294 %                                                                             %
7295 %                                                                             %
7296 %   M a g i c k P r e v i e w I m a g e s                                     %
7297 %                                                                             %
7298 %                                                                             %
7299 %                                                                             %
7300 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7301 %
7302 %  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7303 %  image processing operation applied at varying strengths.  This helpful
7304 %  to quickly pin-point an appropriate parameter for an image processing
7305 %  operation.
7306 %
7307 %  The format of the MagickPreviewImages method is:
7308 %
7309 %      MagickWand *MagickPreviewImages(MagickWand *wand,
7310 %        const PreviewType preview)
7311 %
7312 %  A description of each parameter follows:
7313 %
7314 %    o wand: the magick wand.
7315 %
7316 %    o preview: the preview type.
7317 %
7318 */
7319 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7320   const PreviewType preview)
7321 {
7322   Image
7323     *preview_image;
7324
7325   assert(wand != (MagickWand *) NULL);
7326   assert(wand->signature == WandSignature);
7327   if (wand->debug != MagickFalse)
7328     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7329   if (wand->images == (Image *) NULL)
7330     return((MagickWand *) NULL);
7331   preview_image=PreviewImage(wand->images,preview,wand->exception);
7332   if (preview_image == (Image *) NULL)
7333     return((MagickWand *) NULL);
7334   return(CloneMagickWandFromImages(wand,preview_image));
7335 }
7336 \f
7337 /*
7338 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7339 %                                                                             %
7340 %                                                                             %
7341 %                                                                             %
7342 %   M a g i c k P r e v i o u s I m a g e                                     %
7343 %                                                                             %
7344 %                                                                             %
7345 %                                                                             %
7346 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7347 %
7348 %  MagickPreviousImage() assocates the previous image in an image list with
7349 %  the magick wand.
7350 %
7351 %  The format of the MagickPreviousImage method is:
7352 %
7353 %      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7354 %
7355 %  A description of each parameter follows:
7356 %
7357 %    o wand: the magick wand.
7358 %
7359 */
7360 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7361 {
7362   assert(wand != (MagickWand *) NULL);
7363   assert(wand->signature == WandSignature);
7364   if (wand->debug != MagickFalse)
7365     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7366   if (wand->images == (Image *) NULL)
7367     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7368
7369   wand->image_pending=MagickFalse;  /* pending status has no meaning */
7370   /* If there is no prev image, return false (Iterator is finished) */
7371   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7372       return(MagickFalse);
7373   /* just do it - current image is not 'pending' */
7374   wand->images=GetPreviousImageInList(wand->images);
7375   return(MagickTrue);
7376 }
7377 \f
7378 /*
7379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7380 %                                                                             %
7381 %                                                                             %
7382 %                                                                             %
7383 %   M a g i c k Q u a n t i z e I m a g e                                     %
7384 %                                                                             %
7385 %                                                                             %
7386 %                                                                             %
7387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7388 %
7389 %  MagickQuantizeImage() analyzes the colors within a reference image and
7390 %  chooses a fixed number of colors to represent the image.  The goal of the
7391 %  algorithm is to minimize the color difference between the input and output
7392 %  image while minimizing the processing time.
7393 %
7394 %  The format of the MagickQuantizeImage method is:
7395 %
7396 %      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7397 %        const size_t number_colors,const ColorspaceType colorspace,
7398 %        const size_t treedepth,const MagickBooleanType dither,
7399 %        const MagickBooleanType measure_error)
7400 %
7401 %  A description of each parameter follows:
7402 %
7403 %    o wand: the magick wand.
7404 %
7405 %    o number_colors: the number of colors.
7406 %
7407 %    o colorspace: Perform color reduction in this colorspace, typically
7408 %      RGBColorspace.
7409 %
7410 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7411 %      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
7412 %      reference image with the least amount of memory and the fastest
7413 %      computational speed.  In some cases, such as an image with low color
7414 %      dispersion (a few number of colors), a value other than
7415 %      Log4(number_colors) is required.  To expand the color tree completely,
7416 %      use a value of 8.
7417 %
7418 %    o dither: A value other than zero distributes the difference between an
7419 %      original image and the corresponding color reduced image to
7420 %      neighboring pixels along a Hilbert curve.
7421 %
7422 %    o measure_error: A value other than zero measures the difference between
7423 %      the original and quantized images.  This difference is the total
7424 %      quantization error.  The error is computed by summing over all pixels
7425 %      in an image the distance squared in RGB space between each reference
7426 %      pixel value and its quantized value.
7427 %
7428 */
7429 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7430   const size_t number_colors,const ColorspaceType colorspace,
7431   const size_t treedepth,const MagickBooleanType dither,
7432   const MagickBooleanType measure_error)
7433 {
7434   MagickBooleanType
7435     status;
7436
7437   QuantizeInfo
7438     *quantize_info;
7439
7440   assert(wand != (MagickWand *) NULL);
7441   assert(wand->signature == WandSignature);
7442   if (wand->debug != MagickFalse)
7443     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7444   if (wand->images == (Image *) NULL)
7445     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7446   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7447   quantize_info->number_colors=number_colors;
7448   quantize_info->dither=dither;
7449   quantize_info->tree_depth=treedepth;
7450   quantize_info->colorspace=colorspace;
7451   quantize_info->measure_error=measure_error;
7452   status=QuantizeImage(quantize_info,wand->images,wand->exception);
7453   quantize_info=DestroyQuantizeInfo(quantize_info);
7454   return(status);
7455 }
7456 \f
7457 /*
7458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7459 %                                                                             %
7460 %                                                                             %
7461 %                                                                             %
7462 %   M a g i c k Q u a n t i z e I m a g e s                                   %
7463 %                                                                             %
7464 %                                                                             %
7465 %                                                                             %
7466 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7467 %
7468 %  MagickQuantizeImages() analyzes the colors within a sequence of images and
7469 %  chooses a fixed number of colors to represent the image.  The goal of the
7470 %  algorithm is to minimize the color difference between the input and output
7471 %  image while minimizing the processing time.
7472 %
7473 %  The format of the MagickQuantizeImages method is:
7474 %
7475 %      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7476 %        const size_t number_colors,const ColorspaceType colorspace,
7477 %        const size_t treedepth,const MagickBooleanType dither,
7478 %        const MagickBooleanType measure_error)
7479 %
7480 %  A description of each parameter follows:
7481 %
7482 %    o wand: the magick wand.
7483 %
7484 %    o number_colors: the number of colors.
7485 %
7486 %    o colorspace: Perform color reduction in this colorspace, typically
7487 %      RGBColorspace.
7488 %
7489 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7490 %      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
7491 %      reference image with the least amount of memory and the fastest
7492 %      computational speed.  In some cases, such as an image with low color
7493 %      dispersion (a few number of colors), a value other than
7494 %      Log4(number_colors) is required.  To expand the color tree completely,
7495 %      use a value of 8.
7496 %
7497 %    o dither: A value other than zero distributes the difference between an
7498 %      original image and the corresponding color reduced algorithm to
7499 %      neighboring pixels along a Hilbert curve.
7500 %
7501 %    o measure_error: A value other than zero measures the difference between
7502 %      the original and quantized images.  This difference is the total
7503 %      quantization error.  The error is computed by summing over all pixels
7504 %      in an image the distance squared in RGB space between each reference
7505 %      pixel value and its quantized value.
7506 %
7507 */
7508 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7509   const size_t number_colors,const ColorspaceType colorspace,
7510   const size_t treedepth,const MagickBooleanType dither,
7511   const MagickBooleanType measure_error)
7512 {
7513   MagickBooleanType
7514     status;
7515
7516   QuantizeInfo
7517     *quantize_info;
7518
7519   assert(wand != (MagickWand *) NULL);
7520   assert(wand->signature == WandSignature);
7521   if (wand->debug != MagickFalse)
7522     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7523   if (wand->images == (Image *) NULL)
7524     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7525   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7526   quantize_info->number_colors=number_colors;
7527   quantize_info->dither=dither;
7528   quantize_info->tree_depth=treedepth;
7529   quantize_info->colorspace=colorspace;
7530   quantize_info->measure_error=measure_error;
7531   status=QuantizeImages(quantize_info,wand->images,wand->exception);
7532   quantize_info=DestroyQuantizeInfo(quantize_info);
7533   return(status);
7534 }
7535 \f
7536 /*
7537 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7538 %                                                                             %
7539 %                                                                             %
7540 %                                                                             %
7541 %   M a g i c k R a d i a l B l u r I m a g e                                 %
7542 %                                                                             %
7543 %                                                                             %
7544 %                                                                             %
7545 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7546 %
7547 %  MagickRadialBlurImage() radial blurs an image.
7548 %
7549 %  The format of the MagickRadialBlurImage method is:
7550 %
7551 %      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7552 %        const double angle,const double bias)
7553 %
7554 %  A description of each parameter follows:
7555 %
7556 %    o wand: the magick wand.
7557 %
7558 %    o angle: the angle of the blur in degrees.
7559 %
7560 %    o bias: the bias.
7561 %
7562 */
7563 WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7564   const double angle,const double bias)
7565 {
7566   Image
7567     *blur_image;
7568
7569   assert(wand != (MagickWand *) NULL);
7570   assert(wand->signature == WandSignature);
7571   if (wand->debug != MagickFalse)
7572     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7573   if (wand->images == (Image *) NULL)
7574     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7575   blur_image=RadialBlurImage(wand->images,angle,bias,wand->exception);
7576   if (blur_image == (Image *) NULL)
7577     return(MagickFalse);
7578   ReplaceImageInList(&wand->images,blur_image);
7579   return(MagickTrue);
7580 }
7581 \f
7582 /*
7583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7584 %                                                                             %
7585 %                                                                             %
7586 %                                                                             %
7587 %   M a g i c k R a i s e I m a g e                                           %
7588 %                                                                             %
7589 %                                                                             %
7590 %                                                                             %
7591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7592 %
7593 %  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7594 %  by lightening and darkening the edges of the image.  Members width and
7595 %  height of raise_info define the width of the vertical and horizontal
7596 %  edge of the effect.
7597 %
7598 %  The format of the MagickRaiseImage method is:
7599 %
7600 %      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7601 %        const size_t width,const size_t height,const ssize_t x,
7602 %        const ssize_t y,const MagickBooleanType raise)
7603 %
7604 %  A description of each parameter follows:
7605 %
7606 %    o wand: the magick wand.
7607 %
7608 %    o width,height,x,y:  Define the dimensions of the area to raise.
7609 %
7610 %    o raise: A value other than zero creates a 3-D raise effect,
7611 %      otherwise it has a lowered effect.
7612 %
7613 */
7614 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7615   const size_t width,const size_t height,const ssize_t x,
7616   const ssize_t y,const MagickBooleanType raise)
7617 {
7618   MagickBooleanType
7619     status;
7620
7621   RectangleInfo
7622     raise_info;
7623
7624   assert(wand != (MagickWand *) NULL);
7625   assert(wand->signature == WandSignature);
7626   if (wand->debug != MagickFalse)
7627     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7628   if (wand->images == (Image *) NULL)
7629     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7630   raise_info.width=width;
7631   raise_info.height=height;
7632   raise_info.x=x;
7633   raise_info.y=y;
7634   status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
7635   return(status);
7636 }
7637 \f
7638 /*
7639 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7640 %                                                                             %
7641 %                                                                             %
7642 %                                                                             %
7643 %   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                       %
7644 %                                                                             %
7645 %                                                                             %
7646 %                                                                             %
7647 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7648 %
7649 %  MagickRandomThresholdImage() changes the value of individual pixels based on
7650 %  the intensity of each pixel compared to threshold.  The result is a
7651 %  high-contrast, two color image.
7652 %
7653 %  The format of the MagickRandomThresholdImage method is:
7654 %
7655 %      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7656 %        const double low,const double high)
7657 %
7658 %  A description of each parameter follows:
7659 %
7660 %    o wand: the magick wand.
7661 %
7662 %    o low,high: Specify the high and low thresholds.  These values range from
7663 %      0 to QuantumRange.
7664 %
7665 */
7666 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7667   const double low,const double high)
7668 {
7669   char
7670     threshold[MaxTextExtent];
7671
7672   assert(wand != (MagickWand *) NULL);
7673   assert(wand->signature == WandSignature);
7674   if (wand->debug != MagickFalse)
7675     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7676   if (wand->images == (Image *) NULL)
7677     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7678   (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
7679   return(RandomThresholdImage(wand->images,threshold,wand->exception));
7680 }
7681 \f
7682 /*
7683 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7684 %                                                                             %
7685 %                                                                             %
7686 %                                                                             %
7687 %   M a g i c k R e a d I m a g e                                             %
7688 %                                                                             %
7689 %                                                                             %
7690 %                                                                             %
7691 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7692 %
7693 %  MagickReadImage() reads an image or image sequence.  The images are inserted
7694 %  at the current image pointer position.
7695 %
7696 %  Use MagickSetFirstIterator(), to insert new images before all the current
7697 %  images in the wand, MagickSetLastIterator() to append add to the end,
7698 %  MagickSetImageIndex() to place images just after the given index.
7699 %
7700 %  The format of the MagickReadImage method is:
7701 %
7702 %      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
7703 %
7704 %  A description of each parameter follows:
7705 %
7706 %    o wand: the magick wand.
7707 %
7708 %    o filename: the image filename.
7709 %
7710 */
7711 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
7712   const char *filename)
7713 {
7714   Image
7715     *images;
7716
7717   ImageInfo
7718     *read_info;
7719
7720   assert(wand != (MagickWand *) NULL);
7721   assert(wand->signature == WandSignature);
7722   if (wand->debug != MagickFalse)
7723     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7724   read_info=CloneImageInfo(wand->image_info);
7725   if (filename != (const char *) NULL)
7726     (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
7727   images=ReadImage(read_info,wand->exception);
7728   read_info=DestroyImageInfo(read_info);
7729   if (images == (Image *) NULL)
7730     return(MagickFalse);
7731   return(InsertImageInWand(wand,images));
7732 }
7733 \f
7734 /*
7735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7736 %                                                                             %
7737 %                                                                             %
7738 %                                                                             %
7739 %   M a g i c k R e a d I m a g e B l o b                                     %
7740 %                                                                             %
7741 %                                                                             %
7742 %                                                                             %
7743 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7744 %
7745 %  MagickReadImageBlob() reads an image or image sequence from a blob.
7746 %  In all other respects it is like MagickReadImage().
7747 %
7748 %  The format of the MagickReadImageBlob method is:
7749 %
7750 %      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7751 %        const void *blob,const size_t length)
7752 %
7753 %  A description of each parameter follows:
7754 %
7755 %    o wand: the magick wand.
7756 %
7757 %    o blob: the blob.
7758 %
7759 %    o length: the blob length.
7760 %
7761 */
7762 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7763   const void *blob,const size_t length)
7764 {
7765   Image
7766     *images;
7767
7768   assert(wand != (MagickWand *) NULL);
7769   assert(wand->signature == WandSignature);
7770   if (wand->debug != MagickFalse)
7771     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7772   images=BlobToImage(wand->image_info,blob,length,wand->exception);
7773   if (images == (Image *) NULL)
7774     return(MagickFalse);
7775   return(InsertImageInWand(wand,images));
7776 }
7777 \f
7778 /*
7779 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7780 %                                                                             %
7781 %                                                                             %
7782 %                                                                             %
7783 %   M a g i c k R e a d I m a g e F i l e                                     %
7784 %                                                                             %
7785 %                                                                             %
7786 %                                                                             %
7787 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7788 %
7789 %  MagickReadImageFile() reads an image or image sequence from an already
7790 %  opened file descriptor.  Otherwise it is like MagickReadImage().
7791 %
7792 %  The format of the MagickReadImageFile method is:
7793 %
7794 %      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7795 %
7796 %  A description of each parameter follows:
7797 %
7798 %    o wand: the magick wand.
7799 %
7800 %    o file: the file descriptor.
7801 %
7802 */
7803 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7804 {
7805   Image
7806     *images;
7807
7808   ImageInfo
7809     *read_info;
7810
7811   assert(wand != (MagickWand *) NULL);
7812   assert(wand->signature == WandSignature);
7813   assert(file != (FILE *) NULL);
7814   if (wand->debug != MagickFalse)
7815     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7816   read_info=CloneImageInfo(wand->image_info);
7817   SetImageInfoFile(read_info,file);
7818   images=ReadImage(read_info,wand->exception);
7819   read_info=DestroyImageInfo(read_info);
7820   if (images == (Image *) NULL)
7821     return(MagickFalse);
7822   return(InsertImageInWand(wand,images));
7823 }
7824 \f
7825 /*
7826 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7827 %                                                                             %
7828 %                                                                             %
7829 %                                                                             %
7830 %   M a g i c k R e m a p I m a g e                                           %
7831 %                                                                             %
7832 %                                                                             %
7833 %                                                                             %
7834 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7835 %
7836 %  MagickRemapImage() replaces the colors of an image with the closest color
7837 %  from a reference image.
7838 %
7839 %  The format of the MagickRemapImage method is:
7840 %
7841 %      MagickBooleanType MagickRemapImage(MagickWand *wand,
7842 %        const MagickWand *remap_wand,const DitherMethod method)
7843 %
7844 %  A description of each parameter follows:
7845 %
7846 %    o wand: the magick wand.
7847 %
7848 %    o affinity: the affinity wand.
7849 %
7850 %    o method: choose from these dither methods: NoDitherMethod,
7851 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7852 %
7853 */
7854 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
7855   const MagickWand *remap_wand,const DitherMethod method)
7856 {
7857   MagickBooleanType
7858     status;
7859
7860   QuantizeInfo
7861     *quantize_info;
7862
7863   assert(wand != (MagickWand *) NULL);
7864   assert(wand->signature == WandSignature);
7865   if (wand->debug != MagickFalse)
7866     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7867   if ((wand->images == (Image *) NULL) ||
7868       (remap_wand->images == (Image *) NULL))
7869     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7870   quantize_info=AcquireQuantizeInfo(wand->image_info);
7871   quantize_info->dither_method=method;
7872   if (method == NoDitherMethod)
7873     quantize_info->dither=MagickFalse;
7874   status=RemapImage(quantize_info,wand->images,remap_wand->images,
7875     wand->exception);
7876   quantize_info=DestroyQuantizeInfo(quantize_info);
7877   return(status);
7878 }
7879 \f
7880 /*
7881 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7882 %                                                                             %
7883 %                                                                             %
7884 %                                                                             %
7885 %   M a g i c k R e m o v e I m a g e                                         %
7886 %                                                                             %
7887 %                                                                             %
7888 %                                                                             %
7889 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7890 %
7891 %  MagickRemoveImage() removes an image from the image list.
7892 %
7893 %  The format of the MagickRemoveImage method is:
7894 %
7895 %      MagickBooleanType MagickRemoveImage(MagickWand *wand)
7896 %
7897 %  A description of each parameter follows:
7898 %
7899 %    o wand: the magick wand.
7900 %
7901 %    o insert: the splice wand.
7902 %
7903 */
7904 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
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     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7912   DeleteImageFromList(&wand->images);
7913   return(MagickTrue);
7914 }
7915 \f
7916 /*
7917 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7918 %                                                                             %
7919 %                                                                             %
7920 %                                                                             %
7921 %   M a g i c k R e s a m p l e I m a g e                                     %
7922 %                                                                             %
7923 %                                                                             %
7924 %                                                                             %
7925 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7926 %
7927 %  MagickResampleImage() resample image to desired resolution.
7928 %
7929 %    Bessel   Blackman   Box
7930 %    Catrom   Cubic      Gaussian
7931 %    Hanning  Hermite    Lanczos
7932 %    Mitchell Point      Quandratic
7933 %    Sinc     Triangle
7934 %
7935 %  Most of the filters are FIR (finite impulse response), however, Bessel,
7936 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
7937 %  are windowed (brought down to zero) with the Blackman filter.
7938 %
7939 %  The format of the MagickResampleImage method is:
7940 %
7941 %      MagickBooleanType MagickResampleImage(MagickWand *wand,
7942 %        const double x_resolution,const double y_resolution,
7943 %        const FilterTypes filter,const double blur)
7944 %
7945 %  A description of each parameter follows:
7946 %
7947 %    o wand: the magick wand.
7948 %
7949 %    o x_resolution: the new image x resolution.
7950 %
7951 %    o y_resolution: the new image y resolution.
7952 %
7953 %    o filter: Image filter to use.
7954 %
7955 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
7956 %
7957 */
7958 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
7959   const double x_resolution,const double y_resolution,const FilterTypes filter,
7960   const double blur)
7961 {
7962   Image
7963     *resample_image;
7964
7965   assert(wand != (MagickWand *) NULL);
7966   assert(wand->signature == WandSignature);
7967   if (wand->debug != MagickFalse)
7968     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7969   if (wand->images == (Image *) NULL)
7970     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7971   resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
7972     blur,wand->exception);
7973   if (resample_image == (Image *) NULL)
7974     return(MagickFalse);
7975   ReplaceImageInList(&wand->images,resample_image);
7976   return(MagickTrue);
7977 }
7978 \f
7979 /*
7980 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7981 %                                                                             %
7982 %                                                                             %
7983 %                                                                             %
7984 %   M a g i c k R e s e t I m a g e P a g e                                   %
7985 %                                                                             %
7986 %                                                                             %
7987 %                                                                             %
7988 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7989 %
7990 %  MagickResetImagePage() resets the Wand page canvas and position.
7991 %
7992 %  The format of the MagickResetImagePage method is:
7993 %
7994 %      MagickBooleanType MagickResetImagePage(MagickWand *wand,
7995 %        const char *page)
7996 %
7997 %  A description of each parameter follows:
7998 %
7999 %    o wand: the magick wand.
8000 %
8001 %    o page: the relative page specification.
8002 %
8003 */
8004 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8005   const char *page)
8006 {
8007   assert(wand != (MagickWand *) NULL);
8008   assert(wand->signature == WandSignature);
8009   if (wand->debug != MagickFalse)
8010     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8011   if (wand->images == (Image *) NULL)
8012     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8013   if ((page == (char *) NULL) || (*page == '\0'))
8014     {
8015       (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8016       return(MagickTrue);
8017     }
8018   return(ResetImagePage(wand->images,page));
8019 }
8020 \f
8021 /*
8022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8023 %                                                                             %
8024 %                                                                             %
8025 %                                                                             %
8026 %   M a g i c k R e s i z e I m a g e                                         %
8027 %                                                                             %
8028 %                                                                             %
8029 %                                                                             %
8030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8031 %
8032 %  MagickResizeImage() scales an image to the desired dimensions with one of
8033 %  these filters:
8034 %
8035 %    Bessel   Blackman   Box
8036 %    Catrom   Cubic      Gaussian
8037 %    Hanning  Hermite    Lanczos
8038 %    Mitchell Point      Quandratic
8039 %    Sinc     Triangle
8040 %
8041 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8042 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8043 %  are windowed (brought down to zero) with the Blackman filter.
8044 %
8045 %  The format of the MagickResizeImage method is:
8046 %
8047 %      MagickBooleanType MagickResizeImage(MagickWand *wand,
8048 %        const size_t columns,const size_t rows,
8049 %        const FilterTypes filter,const double blur)
8050 %
8051 %  A description of each parameter follows:
8052 %
8053 %    o wand: the magick wand.
8054 %
8055 %    o columns: the number of columns in the scaled image.
8056 %
8057 %    o rows: the number of rows in the scaled image.
8058 %
8059 %    o filter: Image filter to use.
8060 %
8061 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8062 %
8063 */
8064 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8065   const size_t columns,const size_t rows,const FilterTypes filter,
8066   const double blur)
8067 {
8068   Image
8069     *resize_image;
8070
8071   assert(wand != (MagickWand *) NULL);
8072   assert(wand->signature == WandSignature);
8073   if (wand->debug != MagickFalse)
8074     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8075   if (wand->images == (Image *) NULL)
8076     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8077   resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8078     wand->exception);
8079   if (resize_image == (Image *) NULL)
8080     return(MagickFalse);
8081   ReplaceImageInList(&wand->images,resize_image);
8082   return(MagickTrue);
8083 }
8084 \f
8085 /*
8086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8087 %                                                                             %
8088 %                                                                             %
8089 %                                                                             %
8090 %   M a g i c k R o l l I m a g e                                             %
8091 %                                                                             %
8092 %                                                                             %
8093 %                                                                             %
8094 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8095 %
8096 %  MagickRollImage() offsets an image as defined by x and y.
8097 %
8098 %  The format of the MagickRollImage method is:
8099 %
8100 %      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8101 %        const size_t y)
8102 %
8103 %  A description of each parameter follows:
8104 %
8105 %    o wand: the magick wand.
8106 %
8107 %    o x: the x offset.
8108 %
8109 %    o y: the y offset.
8110 %
8111 %
8112 */
8113 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8114   const ssize_t x,const ssize_t y)
8115 {
8116   Image
8117     *roll_image;
8118
8119   assert(wand != (MagickWand *) NULL);
8120   assert(wand->signature == WandSignature);
8121   if (wand->debug != MagickFalse)
8122     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8123   if (wand->images == (Image *) NULL)
8124     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8125   roll_image=RollImage(wand->images,x,y,wand->exception);
8126   if (roll_image == (Image *) NULL)
8127     return(MagickFalse);
8128   ReplaceImageInList(&wand->images,roll_image);
8129   return(MagickTrue);
8130 }
8131 \f
8132 /*
8133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8134 %                                                                             %
8135 %                                                                             %
8136 %                                                                             %
8137 %   M a g i c k R o t a t e I m a g e                                         %
8138 %                                                                             %
8139 %                                                                             %
8140 %                                                                             %
8141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8142 %
8143 %  MagickRotateImage() rotates an image the specified number of degrees. Empty
8144 %  triangles left over from rotating the image are filled with the
8145 %  background color.
8146 %
8147 %  The format of the MagickRotateImage method is:
8148 %
8149 %      MagickBooleanType MagickRotateImage(MagickWand *wand,
8150 %        const PixelWand *background,const double degrees)
8151 %
8152 %  A description of each parameter follows:
8153 %
8154 %    o wand: the magick wand.
8155 %
8156 %    o background: the background pixel wand.
8157 %
8158 %    o degrees: the number of degrees to rotate the image.
8159 %
8160 %
8161 */
8162 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8163   const PixelWand *background,const double degrees)
8164 {
8165   Image
8166     *rotate_image;
8167
8168   assert(wand != (MagickWand *) NULL);
8169   assert(wand->signature == WandSignature);
8170   if (wand->debug != MagickFalse)
8171     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8172   if (wand->images == (Image *) NULL)
8173     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8174   PixelGetQuantumPacket(background,&wand->images->background_color);
8175   rotate_image=RotateImage(wand->images,degrees,wand->exception);
8176   if (rotate_image == (Image *) NULL)
8177     return(MagickFalse);
8178   ReplaceImageInList(&wand->images,rotate_image);
8179   return(MagickTrue);
8180 }
8181 \f
8182 /*
8183 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8184 %                                                                             %
8185 %                                                                             %
8186 %                                                                             %
8187 %   M a g i c k S a m p l e I m a g e                                         %
8188 %                                                                             %
8189 %                                                                             %
8190 %                                                                             %
8191 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8192 %
8193 %  MagickSampleImage() scales an image to the desired dimensions with pixel
8194 %  sampling.  Unlike other scaling methods, this method does not introduce
8195 %  any additional color into the scaled image.
8196 %
8197 %  The format of the MagickSampleImage method is:
8198 %
8199 %      MagickBooleanType MagickSampleImage(MagickWand *wand,
8200 %        const size_t columns,const size_t rows)
8201 %
8202 %  A description of each parameter follows:
8203 %
8204 %    o wand: the magick wand.
8205 %
8206 %    o columns: the number of columns in the scaled image.
8207 %
8208 %    o rows: the number of rows in the scaled image.
8209 %
8210 %
8211 */
8212 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8213   const size_t columns,const size_t rows)
8214 {
8215   Image
8216     *sample_image;
8217
8218   assert(wand != (MagickWand *) NULL);
8219   assert(wand->signature == WandSignature);
8220   if (wand->debug != MagickFalse)
8221     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8222   if (wand->images == (Image *) NULL)
8223     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8224   sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8225   if (sample_image == (Image *) NULL)
8226     return(MagickFalse);
8227   ReplaceImageInList(&wand->images,sample_image);
8228   return(MagickTrue);
8229 }
8230 \f
8231 /*
8232 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8233 %                                                                             %
8234 %                                                                             %
8235 %                                                                             %
8236 %   M a g i c k S c a l e I m a g e                                           %
8237 %                                                                             %
8238 %                                                                             %
8239 %                                                                             %
8240 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8241 %
8242 %  MagickScaleImage() scales the size of an image to the given dimensions.
8243 %
8244 %  The format of the MagickScaleImage method is:
8245 %
8246 %      MagickBooleanType MagickScaleImage(MagickWand *wand,
8247 %        const size_t columns,const size_t rows)
8248 %
8249 %  A description of each parameter follows:
8250 %
8251 %    o wand: the magick wand.
8252 %
8253 %    o columns: the number of columns in the scaled image.
8254 %
8255 %    o rows: the number of rows in the scaled image.
8256 %
8257 %
8258 */
8259 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8260   const size_t columns,const size_t rows)
8261 {
8262   Image
8263     *scale_image;
8264
8265   assert(wand != (MagickWand *) NULL);
8266   assert(wand->signature == WandSignature);
8267   if (wand->debug != MagickFalse)
8268     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8269   if (wand->images == (Image *) NULL)
8270     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8271   scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8272   if (scale_image == (Image *) NULL)
8273     return(MagickFalse);
8274   ReplaceImageInList(&wand->images,scale_image);
8275   return(MagickTrue);
8276 }
8277 \f
8278 /*
8279 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8280 %                                                                             %
8281 %                                                                             %
8282 %                                                                             %
8283 %   M a g i c k S e g m e n t I m a g e                                       %
8284 %                                                                             %
8285 %                                                                             %
8286 %                                                                             %
8287 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8288 %
8289 %  MagickSegmentImage() segments an image by analyzing the histograms of the
8290 %  color components and identifying units that are homogeneous with the fuzzy
8291 %  C-means technique.
8292 %
8293 %  The format of the SegmentImage method is:
8294 %
8295 %      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8296 %        const ColorspaceType colorspace,const MagickBooleanType verbose,
8297 %        const double cluster_threshold,const double smooth_threshold)
8298 %
8299 %  A description of each parameter follows.
8300 %
8301 %    o wand: the wand.
8302 %
8303 %    o colorspace: the image colorspace.
8304 %
8305 %    o verbose:  Set to MagickTrue to print detailed information about the
8306 %      identified classes.
8307 %
8308 %    o cluster_threshold:  This represents the minimum number of pixels
8309 %      contained in a hexahedra before it can be considered valid (expressed as
8310 %      a percentage).
8311 %
8312 %    o smooth_threshold: the smoothing threshold eliminates noise in the second
8313 %      derivative of the histogram.  As the value is increased, you can expect a
8314 %      smoother second derivative.
8315 %
8316 */
8317 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8318   const ColorspaceType colorspace,const MagickBooleanType verbose,
8319   const double cluster_threshold,const double smooth_threshold)
8320 {
8321   MagickBooleanType
8322     status;
8323
8324   assert(wand != (MagickWand *) NULL);
8325   assert(wand->signature == WandSignature);
8326   if (wand->debug != MagickFalse)
8327     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8328   if (wand->images == (Image *) NULL)
8329     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8330   status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8331     smooth_threshold,wand->exception);
8332   return(status);
8333 }
8334 \f
8335 /*
8336 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8337 %                                                                             %
8338 %                                                                             %
8339 %                                                                             %
8340 %   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8341 %                                                                             %
8342 %                                                                             %
8343 %                                                                             %
8344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8345 %
8346 %  MagickSelectiveBlurImage() selectively blur an image within a contrast
8347 %  threshold. It is similar to the unsharpen mask that sharpens everything with
8348 %  contrast above a certain threshold.
8349 %
8350 %  The format of the MagickSelectiveBlurImage method is:
8351 %
8352 %      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8353 %        const double radius,const double sigma,const double threshold,
8354 %        const double bias)
8355 %
8356 %  A description of each parameter follows:
8357 %
8358 %    o wand: the magick wand.
8359 %
8360 %    o radius: the radius of the gaussian, in pixels, not counting the center
8361 %      pixel.
8362 %
8363 %    o sigma: the standard deviation of the gaussian, in pixels.
8364 %
8365 %    o threshold: only pixels within this contrast threshold are included
8366 %      in the blur operation.
8367 %
8368 %    o bias: the bias.
8369 %
8370 */
8371 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8372   const double radius,const double sigma,const double threshold,
8373   const double bias)
8374 {
8375   Image
8376     *blur_image;
8377
8378   assert(wand != (MagickWand *) NULL);
8379   assert(wand->signature == WandSignature);
8380   if (wand->debug != MagickFalse)
8381     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8382   if (wand->images == (Image *) NULL)
8383     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8384   blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,bias,
8385     wand->exception);
8386   if (blur_image == (Image *) NULL)
8387     return(MagickFalse);
8388   ReplaceImageInList(&wand->images,blur_image);
8389   return(MagickTrue);
8390 }
8391 \f
8392 /*
8393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8394 %                                                                             %
8395 %                                                                             %
8396 %                                                                             %
8397 %   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                       %
8398 %                                                                             %
8399 %                                                                             %
8400 %                                                                             %
8401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8402 %
8403 %  MagickSeparateImage() separates a channel from the image and returns a
8404 %  grayscale image.  A channel is a particular color component of each pixel
8405 %  in the image.
8406 %
8407 %  The format of the MagickSeparateImage method is:
8408 %
8409 %      MagickBooleanType MagickSeparateImage(MagickWand *wand)
8410 %
8411 %  A description of each parameter follows:
8412 %
8413 %    o wand: the magick wand.
8414 %
8415 */
8416 WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand)
8417 {
8418   assert(wand != (MagickWand *) NULL);
8419   assert(wand->signature == WandSignature);
8420   if (wand->debug != MagickFalse)
8421     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8422   if (wand->images == (Image *) NULL)
8423     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8424   return(SeparateImage(wand->images,wand->exception));
8425 }
8426 \f
8427 /*
8428 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8429 %                                                                             %
8430 %                                                                             %
8431 %                                                                             %
8432 %     M a g i c k S e p i a T o n e I m a g e                                 %
8433 %                                                                             %
8434 %                                                                             %
8435 %                                                                             %
8436 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8437 %
8438 %  MagickSepiaToneImage() applies a special effect to the image, similar to the
8439 %  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8440 %  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8441 %  threshold of 80% is a good starting point for a reasonable tone.
8442 %
8443 %  The format of the MagickSepiaToneImage method is:
8444 %
8445 %      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8446 %        const double threshold)
8447 %
8448 %  A description of each parameter follows:
8449 %
8450 %    o wand: the magick wand.
8451 %
8452 %    o threshold:  Define the extent of the sepia toning.
8453 %
8454 */
8455 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8456   const double threshold)
8457 {
8458   Image
8459     *sepia_image;
8460
8461   assert(wand != (MagickWand *) NULL);
8462   assert(wand->signature == WandSignature);
8463   if (wand->debug != MagickFalse)
8464     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8465   if (wand->images == (Image *) NULL)
8466     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8467   sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8468   if (sepia_image == (Image *) NULL)
8469     return(MagickFalse);
8470   ReplaceImageInList(&wand->images,sepia_image);
8471   return(MagickTrue);
8472 }
8473 \f
8474 /*
8475 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8476 %                                                                             %
8477 %                                                                             %
8478 %                                                                             %
8479 %   M a g i c k S e t I m a g e                                               %
8480 %                                                                             %
8481 %                                                                             %
8482 %                                                                             %
8483 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8484 %
8485 %  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8486 %  MagickNextImage(), MagickPreviousImage() with the images from the specified
8487 %  wand.
8488 %
8489 %  The format of the MagickSetImage method is:
8490 %
8491 %      MagickBooleanType MagickSetImage(MagickWand *wand,
8492 %        const MagickWand *set_wand)
8493 %
8494 %  A description of each parameter follows:
8495 %
8496 %    o wand: the magick wand.
8497 %
8498 %    o set_wand: the set_wand wand.
8499 %
8500 */
8501 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8502   const MagickWand *set_wand)
8503 {
8504   Image
8505     *images;
8506
8507   assert(wand != (MagickWand *) NULL);
8508   assert(wand->signature == WandSignature);
8509   if (wand->debug != MagickFalse)
8510     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8511   assert(set_wand != (MagickWand *) NULL);
8512   assert(set_wand->signature == WandSignature);
8513   if (wand->debug != MagickFalse)
8514     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8515   if (set_wand->images == (Image *) NULL)
8516     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8517   images=CloneImageList(set_wand->images,wand->exception);
8518   if (images == (Image *) NULL)
8519     return(MagickFalse);
8520   ReplaceImageInList(&wand->images,images);
8521   return(MagickTrue);
8522 }
8523 \f
8524 /*
8525 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8526 %                                                                             %
8527 %                                                                             %
8528 %                                                                             %
8529 %   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                       %
8530 %                                                                             %
8531 %                                                                             %
8532 %                                                                             %
8533 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8534 %
8535 %  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8536 %  alpha channel.
8537 %
8538 %  The format of the MagickSetImageAlphaChannel method is:
8539 %
8540 %      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8541 %        const AlphaChannelType alpha_type)
8542 %
8543 %  A description of each parameter follows:
8544 %
8545 %    o wand: the magick wand.
8546 %
8547 %    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8548 %      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8549 %
8550 */
8551 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8552   const AlphaChannelType alpha_type)
8553 {
8554   assert(wand != (MagickWand *) NULL);
8555   assert(wand->signature == WandSignature);
8556   if (wand->debug != MagickFalse)
8557     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8558   if (wand->images == (Image *) NULL)
8559     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8560   return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
8561 }
8562 \f
8563 /*
8564 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8565 %                                                                             %
8566 %                                                                             %
8567 %                                                                             %
8568 %   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                 %
8569 %                                                                             %
8570 %                                                                             %
8571 %                                                                             %
8572 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8573 %
8574 %  MagickSetImageBackgroundColor() sets the image background color.
8575 %
8576 %  The format of the MagickSetImageBackgroundColor method is:
8577 %
8578 %      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8579 %        const PixelWand *background)
8580 %
8581 %  A description of each parameter follows:
8582 %
8583 %    o wand: the magick wand.
8584 %
8585 %    o background: the background pixel wand.
8586 %
8587 */
8588 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8589   const PixelWand *background)
8590 {
8591   assert(wand != (MagickWand *) NULL);
8592   assert(wand->signature == WandSignature);
8593   if (wand->debug != MagickFalse)
8594     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8595   if (wand->images == (Image *) NULL)
8596     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8597   PixelGetQuantumPacket(background,&wand->images->background_color);
8598   return(MagickTrue);
8599 }
8600 \f
8601 /*
8602 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8603 %                                                                             %
8604 %                                                                             %
8605 %                                                                             %
8606 %   M a g i c k S e t I m a g e B i a s                                       %
8607 %                                                                             %
8608 %                                                                             %
8609 %                                                                             %
8610 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8611 %
8612 %  MagickSetImageBias() sets the image bias for any method that convolves an
8613 %  image (e.g. MagickConvolveImage()).
8614 %
8615 %  The format of the MagickSetImageBias method is:
8616 %
8617 %      MagickBooleanType MagickSetImageBias(MagickWand *wand,
8618 %        const double bias)
8619 %
8620 %  A description of each parameter follows:
8621 %
8622 %    o wand: the magick wand.
8623 %
8624 %    o bias: the image bias.
8625 %
8626 */
8627 WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
8628   const double bias)
8629 {
8630   assert(wand != (MagickWand *) NULL);
8631   assert(wand->signature == WandSignature);
8632   if (wand->debug != MagickFalse)
8633     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8634   if (wand->images == (Image *) NULL)
8635     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8636   wand->images->bias=bias;
8637   return(MagickTrue);
8638 }
8639 \f
8640 /*
8641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8642 %                                                                             %
8643 %                                                                             %
8644 %                                                                             %
8645 %   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                         %
8646 %                                                                             %
8647 %                                                                             %
8648 %                                                                             %
8649 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8650 %
8651 %  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8652 %
8653 %  The format of the MagickSetImageBluePrimary method is:
8654 %
8655 %      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8656 %        const double x,const double y)
8657 %
8658 %  A description of each parameter follows:
8659 %
8660 %    o wand: the magick wand.
8661 %
8662 %    o x: the blue primary x-point.
8663 %
8664 %    o y: the blue primary y-point.
8665 %
8666 */
8667 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8668   const double x,const double y)
8669 {
8670   assert(wand != (MagickWand *) NULL);
8671   assert(wand->signature == WandSignature);
8672   if (wand->debug != MagickFalse)
8673     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8674   if (wand->images == (Image *) NULL)
8675     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8676   wand->images->chromaticity.blue_primary.x=x;
8677   wand->images->chromaticity.blue_primary.y=y;
8678   return(MagickTrue);
8679 }
8680 \f
8681 /*
8682 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8683 %                                                                             %
8684 %                                                                             %
8685 %                                                                             %
8686 %   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                         %
8687 %                                                                             %
8688 %                                                                             %
8689 %                                                                             %
8690 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8691 %
8692 %  MagickSetImageBorderColor() sets the image border color.
8693 %
8694 %  The format of the MagickSetImageBorderColor method is:
8695 %
8696 %      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8697 %        const PixelWand *border)
8698 %
8699 %  A description of each parameter follows:
8700 %
8701 %    o wand: the magick wand.
8702 %
8703 %    o border: the border pixel wand.
8704 %
8705 */
8706 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8707   const PixelWand *border)
8708 {
8709   assert(wand != (MagickWand *) NULL);
8710   assert(wand->signature == WandSignature);
8711   if (wand->debug != MagickFalse)
8712     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8713   if (wand->images == (Image *) NULL)
8714     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8715   PixelGetQuantumPacket(border,&wand->images->border_color);
8716   return(MagickTrue);
8717 }
8718 \f
8719 /*
8720 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8721 %                                                                             %
8722 %                                                                             %
8723 %                                                                             %
8724 %   M a g i c k S e t I m a g e C l i p M a s k                               %
8725 %                                                                             %
8726 %                                                                             %
8727 %                                                                             %
8728 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8729 %
8730 %  MagickSetImageClipMask() sets image clip mask.
8731 %
8732 %  The format of the MagickSetImageClipMask method is:
8733 %
8734 %      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8735 %        const MagickWand *clip_mask)
8736 %
8737 %  A description of each parameter follows:
8738 %
8739 %    o wand: the magick wand.
8740 %
8741 %    o clip_mask: the clip_mask wand.
8742 %
8743 */
8744 WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8745   const MagickWand *clip_mask)
8746 {
8747   assert(wand != (MagickWand *) NULL);
8748   assert(wand->signature == WandSignature);
8749   if (wand->debug != MagickFalse)
8750     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8751   assert(clip_mask != (MagickWand *) NULL);
8752   assert(clip_mask->signature == WandSignature);
8753   if (clip_mask->debug != MagickFalse)
8754     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
8755   if (clip_mask->images == (Image *) NULL)
8756     ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
8757   return(SetImageClipMask(wand->images,clip_mask->images,wand->exception));
8758 }
8759 \f
8760 /*
8761 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8762 %                                                                             %
8763 %                                                                             %
8764 %                                                                             %
8765 %   M a g i c k S e t I m a g e C o l o r                                     %
8766 %                                                                             %
8767 %                                                                             %
8768 %                                                                             %
8769 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8770 %
8771 %  MagickSetImageColor() set the entire wand canvas to the specified color.
8772 %
8773 %  The format of the MagickSetImageColor method is:
8774 %
8775 %      MagickBooleanType MagickSetImageColor(MagickWand *wand,
8776 %        const PixelWand *color)
8777 %
8778 %  A description of each parameter follows:
8779 %
8780 %    o wand: the magick wand.
8781 %
8782 %    o background: the image color.
8783 %
8784 */
8785 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
8786   const PixelWand *color)
8787 {
8788   PixelInfo
8789     pixel;
8790
8791   assert(wand != (MagickWand *) NULL);
8792   assert(wand->signature == WandSignature);
8793   if (wand->debug != MagickFalse)
8794     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8795   PixelGetMagickColor(color,&pixel);
8796   return(SetImageColor(wand->images,&pixel,wand->exception));
8797 }
8798 \f
8799 /*
8800 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8801 %                                                                             %
8802 %                                                                             %
8803 %                                                                             %
8804 %   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                     %
8805 %                                                                             %
8806 %                                                                             %
8807 %                                                                             %
8808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8809 %
8810 %  MagickSetImageColormapColor() sets the color of the specified colormap
8811 %  index.
8812 %
8813 %  The format of the MagickSetImageColormapColor method is:
8814 %
8815 %      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8816 %        const size_t index,const PixelWand *color)
8817 %
8818 %  A description of each parameter follows:
8819 %
8820 %    o wand: the magick wand.
8821 %
8822 %    o index: the offset into the image colormap.
8823 %
8824 %    o color: Return the colormap color in this wand.
8825 %
8826 */
8827 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8828   const size_t index,const PixelWand *color)
8829 {
8830   assert(wand != (MagickWand *) NULL);
8831   assert(wand->signature == WandSignature);
8832   if (wand->debug != MagickFalse)
8833     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8834   if (wand->images == (Image *) NULL)
8835     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8836   if ((wand->images->colormap == (PixelInfo *) NULL) ||
8837       (index >= wand->images->colors))
8838     ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
8839   PixelGetQuantumPacket(color,wand->images->colormap+index);
8840   return(SyncImage(wand->images,wand->exception));
8841 }
8842 \f
8843 /*
8844 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8845 %                                                                             %
8846 %                                                                             %
8847 %                                                                             %
8848 %   M a g i c k S e t I m a g e C o l o r s p a c e                           %
8849 %                                                                             %
8850 %                                                                             %
8851 %                                                                             %
8852 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8853 %
8854 %  MagickSetImageColorspace() sets the image colorspace.
8855 %
8856 %  The format of the MagickSetImageColorspace method is:
8857 %
8858 %      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8859 %        const ColorspaceType colorspace)
8860 %
8861 %  A description of each parameter follows:
8862 %
8863 %    o wand: the magick wand.
8864 %
8865 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
8866 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
8867 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
8868 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
8869 %      HSLColorspace, or HWBColorspace.
8870 %
8871 */
8872 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8873   const ColorspaceType colorspace)
8874 {
8875   assert(wand != (MagickWand *) NULL);
8876   assert(wand->signature == WandSignature);
8877   if (wand->debug != MagickFalse)
8878     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8879   if (wand->images == (Image *) NULL)
8880     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8881   return(SetImageColorspace(wand->images,colorspace,wand->exception));
8882 }
8883 \f
8884 /*
8885 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8886 %                                                                             %
8887 %                                                                             %
8888 %                                                                             %
8889 %   M a g i c k S e t I m a g e C o m p o s e                                 %
8890 %                                                                             %
8891 %                                                                             %
8892 %                                                                             %
8893 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8894 %
8895 %  MagickSetImageCompose() sets the image composite operator, useful for
8896 %  specifying how to composite the image thumbnail when using the
8897 %  MagickMontageImage() method.
8898 %
8899 %  The format of the MagickSetImageCompose method is:
8900 %
8901 %      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8902 %        const CompositeOperator compose)
8903 %
8904 %  A description of each parameter follows:
8905 %
8906 %    o wand: the magick wand.
8907 %
8908 %    o compose: the image composite operator.
8909 %
8910 */
8911 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8912   const CompositeOperator compose)
8913 {
8914   assert(wand != (MagickWand *) NULL);
8915   assert(wand->signature == WandSignature);
8916   if (wand->debug != MagickFalse)
8917     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8918   if (wand->images == (Image *) NULL)
8919     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8920   wand->images->compose=compose;
8921   return(MagickTrue);
8922 }
8923 \f
8924 /*
8925 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8926 %                                                                             %
8927 %                                                                             %
8928 %                                                                             %
8929 %   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                         %
8930 %                                                                             %
8931 %                                                                             %
8932 %                                                                             %
8933 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8934 %
8935 %  MagickSetImageCompression() sets the image compression.
8936 %
8937 %  The format of the MagickSetImageCompression method is:
8938 %
8939 %      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8940 %        const CompressionType compression)
8941 %
8942 %  A description of each parameter follows:
8943 %
8944 %    o wand: the magick wand.
8945 %
8946 %    o compression: the image compression type.
8947 %
8948 */
8949 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8950   const CompressionType compression)
8951 {
8952   assert(wand != (MagickWand *) NULL);
8953   assert(wand->signature == WandSignature);
8954   if (wand->debug != MagickFalse)
8955     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8956   if (wand->images == (Image *) NULL)
8957     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8958   wand->images->compression=compression;
8959   return(MagickTrue);
8960 }
8961 \f
8962 /*
8963 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8964 %                                                                             %
8965 %                                                                             %
8966 %                                                                             %
8967 %   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           %
8968 %                                                                             %
8969 %                                                                             %
8970 %                                                                             %
8971 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8972 %
8973 %  MagickSetImageCompressionQuality() sets the image compression quality.
8974 %
8975 %  The format of the MagickSetImageCompressionQuality method is:
8976 %
8977 %      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
8978 %        const size_t quality)
8979 %
8980 %  A description of each parameter follows:
8981 %
8982 %    o wand: the magick wand.
8983 %
8984 %    o quality: the image compression tlityype.
8985 %
8986 */
8987 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
8988   const size_t quality)
8989 {
8990   assert(wand != (MagickWand *) NULL);
8991   assert(wand->signature == WandSignature);
8992   if (wand->debug != MagickFalse)
8993     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8994   if (wand->images == (Image *) NULL)
8995     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8996   wand->images->quality=quality;
8997   return(MagickTrue);
8998 }
8999 \f
9000 /*
9001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9002 %                                                                             %
9003 %                                                                             %
9004 %                                                                             %
9005 %   M a g i c k S e t I m a g e D e l a y                                     %
9006 %                                                                             %
9007 %                                                                             %
9008 %                                                                             %
9009 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9010 %
9011 %  MagickSetImageDelay() sets the image delay.
9012 %
9013 %  The format of the MagickSetImageDelay method is:
9014 %
9015 %      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9016 %        const size_t delay)
9017 %
9018 %  A description of each parameter follows:
9019 %
9020 %    o wand: the magick wand.
9021 %
9022 %    o delay: the image delay in ticks-per-second units.
9023 %
9024 */
9025 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9026   const size_t delay)
9027 {
9028   assert(wand != (MagickWand *) NULL);
9029   assert(wand->signature == WandSignature);
9030   if (wand->debug != MagickFalse)
9031     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9032   if (wand->images == (Image *) NULL)
9033     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9034   wand->images->delay=delay;
9035   return(MagickTrue);
9036 }
9037 \f
9038 /*
9039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9040 %                                                                             %
9041 %                                                                             %
9042 %                                                                             %
9043 %   M a g i c k S e t I m a g e D e p t h                                     %
9044 %                                                                             %
9045 %                                                                             %
9046 %                                                                             %
9047 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9048 %
9049 %  MagickSetImageDepth() sets the image depth.
9050 %
9051 %  The format of the MagickSetImageDepth method is:
9052 %
9053 %      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9054 %        const size_t depth)
9055 %
9056 %  A description of each parameter follows:
9057 %
9058 %    o wand: the magick wand.
9059 %
9060 %    o depth: the image depth in bits: 8, 16, or 32.
9061 %
9062 */
9063 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9064   const size_t depth)
9065 {
9066   assert(wand != (MagickWand *) NULL);
9067   assert(wand->signature == WandSignature);
9068   if (wand->debug != MagickFalse)
9069     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9070   if (wand->images == (Image *) NULL)
9071     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9072   return(SetImageDepth(wand->images,depth,wand->exception));
9073 }
9074 \f
9075 /*
9076 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9077 %                                                                             %
9078 %                                                                             %
9079 %                                                                             %
9080 %   M a g i c k S e t I m a g e D i s p o s e                                 %
9081 %                                                                             %
9082 %                                                                             %
9083 %                                                                             %
9084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9085 %
9086 %  MagickSetImageDispose() sets the image disposal method.
9087 %
9088 %  The format of the MagickSetImageDispose method is:
9089 %
9090 %      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9091 %        const DisposeType dispose)
9092 %
9093 %  A description of each parameter follows:
9094 %
9095 %    o wand: the magick wand.
9096 %
9097 %    o dispose: the image disposeal type.
9098 %
9099 */
9100 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9101   const DisposeType dispose)
9102 {
9103   assert(wand != (MagickWand *) NULL);
9104   assert(wand->signature == WandSignature);
9105   if (wand->debug != MagickFalse)
9106     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9107   if (wand->images == (Image *) NULL)
9108     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9109   wand->images->dispose=dispose;
9110   return(MagickTrue);
9111 }
9112 \f
9113 /*
9114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9115 %                                                                             %
9116 %                                                                             %
9117 %                                                                             %
9118 %   M a g i c k S e t I m a g e E x t e n t                                   %
9119 %                                                                             %
9120 %                                                                             %
9121 %                                                                             %
9122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9123 %
9124 %  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9125 %
9126 %  The format of the MagickSetImageExtent method is:
9127 %
9128 %      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9129 %        const size_t columns,const unsigned rows)
9130 %
9131 %  A description of each parameter follows:
9132 %
9133 %    o wand: the magick wand.
9134 %
9135 %    o columns:  The image width in pixels.
9136 %
9137 %    o rows:  The image height in pixels.
9138 %
9139 */
9140 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9141   const size_t columns,const size_t rows)
9142 {
9143   assert(wand != (MagickWand *) NULL);
9144   assert(wand->signature == WandSignature);
9145   if (wand->debug != MagickFalse)
9146     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9147   if (wand->images == (Image *) NULL)
9148     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9149   return(SetImageExtent(wand->images,columns,rows,wand->exception));
9150 }
9151 \f
9152 /*
9153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9154 %                                                                             %
9155 %                                                                             %
9156 %                                                                             %
9157 %   M a g i c k S e t I m a g e F i l e n a m e                               %
9158 %                                                                             %
9159 %                                                                             %
9160 %                                                                             %
9161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9162 %
9163 %  MagickSetImageFilename() sets the filename of a particular image in a
9164 %  sequence.
9165 %
9166 %  The format of the MagickSetImageFilename method is:
9167 %
9168 %      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9169 %        const char *filename)
9170 %
9171 %  A description of each parameter follows:
9172 %
9173 %    o wand: the magick wand.
9174 %
9175 %    o filename: the image filename.
9176 %
9177 */
9178 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9179   const char *filename)
9180 {
9181   assert(wand != (MagickWand *) NULL);
9182   assert(wand->signature == WandSignature);
9183   if (wand->debug != MagickFalse)
9184     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9185   if (wand->images == (Image *) NULL)
9186     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9187   if (filename != (const char *) NULL)
9188     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9189   return(MagickTrue);
9190 }
9191 \f
9192 /*
9193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9194 %                                                                             %
9195 %                                                                             %
9196 %                                                                             %
9197 %   M a g i c k S e t I m a g e F o r m a t                                   %
9198 %                                                                             %
9199 %                                                                             %
9200 %                                                                             %
9201 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9202 %
9203 %  MagickSetImageFormat() sets the format of a particular image in a
9204 %  sequence.
9205 %
9206 %  The format of the MagickSetImageFormat method is:
9207 %
9208 %      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9209 %        const char *format)
9210 %
9211 %  A description of each parameter follows:
9212 %
9213 %    o wand: the magick wand.
9214 %
9215 %    o format: the image format.
9216 %
9217 */
9218 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9219   const char *format)
9220 {
9221   const MagickInfo
9222     *magick_info;
9223
9224   assert(wand != (MagickWand *) NULL);
9225   assert(wand->signature == WandSignature);
9226   if (wand->debug != MagickFalse)
9227     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9228   if (wand->images == (Image *) NULL)
9229     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9230   if ((format == (char *) NULL) || (*format == '\0'))
9231     {
9232       *wand->images->magick='\0';
9233       return(MagickTrue);
9234     }
9235   magick_info=GetMagickInfo(format,wand->exception);
9236   if (magick_info == (const MagickInfo *) NULL)
9237     return(MagickFalse);
9238   ClearMagickException(wand->exception);
9239   (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9240   return(MagickTrue);
9241 }
9242 \f
9243 /*
9244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9245 %                                                                             %
9246 %                                                                             %
9247 %                                                                             %
9248 %   M a g i c k S e t I m a g e F u z z                                       %
9249 %                                                                             %
9250 %                                                                             %
9251 %                                                                             %
9252 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9253 %
9254 %  MagickSetImageFuzz() sets the image fuzz.
9255 %
9256 %  The format of the MagickSetImageFuzz method is:
9257 %
9258 %      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9259 %        const double fuzz)
9260 %
9261 %  A description of each parameter follows:
9262 %
9263 %    o wand: the magick wand.
9264 %
9265 %    o fuzz: the image fuzz.
9266 %
9267 */
9268 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9269   const double fuzz)
9270 {
9271   assert(wand != (MagickWand *) NULL);
9272   assert(wand->signature == WandSignature);
9273   if (wand->debug != MagickFalse)
9274     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9275   if (wand->images == (Image *) NULL)
9276     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9277   wand->images->fuzz=fuzz;
9278   return(MagickTrue);
9279 }
9280 \f
9281 /*
9282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9283 %                                                                             %
9284 %                                                                             %
9285 %                                                                             %
9286 %   M a g i c k S e t I m a g e G a m m a                                     %
9287 %                                                                             %
9288 %                                                                             %
9289 %                                                                             %
9290 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9291 %
9292 %  MagickSetImageGamma() sets the image gamma.
9293 %
9294 %  The format of the MagickSetImageGamma method is:
9295 %
9296 %      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9297 %        const double gamma)
9298 %
9299 %  A description of each parameter follows:
9300 %
9301 %    o wand: the magick wand.
9302 %
9303 %    o gamma: the image gamma.
9304 %
9305 */
9306 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9307   const double gamma)
9308 {
9309   assert(wand != (MagickWand *) NULL);
9310   assert(wand->signature == WandSignature);
9311   if (wand->debug != MagickFalse)
9312     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9313   if (wand->images == (Image *) NULL)
9314     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9315   wand->images->gamma=gamma;
9316   return(MagickTrue);
9317 }
9318 \f
9319 /*
9320 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9321 %                                                                             %
9322 %                                                                             %
9323 %                                                                             %
9324 %   M a g i c k S e t I m a g e G r a v i t y                                 %
9325 %                                                                             %
9326 %                                                                             %
9327 %                                                                             %
9328 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9329 %
9330 %  MagickSetImageGravity() sets the image gravity type.
9331 %
9332 %  The format of the MagickSetImageGravity method is:
9333 %
9334 %      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9335 %        const GravityType gravity)
9336 %
9337 %  A description of each parameter follows:
9338 %
9339 %    o wand: the magick wand.
9340 %
9341 %    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9342 %      PlaneInterlace, PartitionInterlace.
9343 %
9344 */
9345 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9346   const GravityType gravity)
9347 {
9348   assert(wand != (MagickWand *) NULL);
9349   assert(wand->signature == WandSignature);
9350   if (wand->debug != MagickFalse)
9351     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9352   if (wand->images == (Image *) NULL)
9353     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9354   wand->images->gravity=gravity;
9355   return(MagickTrue);
9356 }
9357 \f
9358 /*
9359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9360 %                                                                             %
9361 %                                                                             %
9362 %                                                                             %
9363 %   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                       %
9364 %                                                                             %
9365 %                                                                             %
9366 %                                                                             %
9367 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9368 %
9369 %  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9370 %  point.
9371 %
9372 %  The format of the MagickSetImageGreenPrimary method is:
9373 %
9374 %      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9375 %        const double x,const double y)
9376 %
9377 %  A description of each parameter follows:
9378 %
9379 %    o wand: the magick wand.
9380 %
9381 %    o x: the green primary x-point.
9382 %
9383 %    o y: the green primary y-point.
9384 %
9385 %
9386 */
9387 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9388   const double x,const double y)
9389 {
9390   assert(wand != (MagickWand *) NULL);
9391   assert(wand->signature == WandSignature);
9392   if (wand->debug != MagickFalse)
9393     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9394   if (wand->images == (Image *) NULL)
9395     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9396   wand->images->chromaticity.green_primary.x=x;
9397   wand->images->chromaticity.green_primary.y=y;
9398   return(MagickTrue);
9399 }
9400 \f
9401 /*
9402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9403 %                                                                             %
9404 %                                                                             %
9405 %                                                                             %
9406 %   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                 %
9407 %                                                                             %
9408 %                                                                             %
9409 %                                                                             %
9410 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9411 %
9412 %  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9413 %
9414 %  The format of the MagickSetImageInterlaceScheme method is:
9415 %
9416 %      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9417 %        const InterlaceType interlace)
9418 %
9419 %  A description of each parameter follows:
9420 %
9421 %    o wand: the magick wand.
9422 %
9423 %    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9424 %      PlaneInterlace, PartitionInterlace.
9425 %
9426 */
9427 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9428   const InterlaceType interlace)
9429 {
9430   assert(wand != (MagickWand *) NULL);
9431   assert(wand->signature == WandSignature);
9432   if (wand->debug != MagickFalse)
9433     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9434   if (wand->images == (Image *) NULL)
9435     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9436   wand->images->interlace=interlace;
9437   return(MagickTrue);
9438 }
9439 \f
9440 /*
9441 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9442 %                                                                             %
9443 %                                                                             %
9444 %                                                                             %
9445 %   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             %
9446 %                                                                             %
9447 %                                                                             %
9448 %                                                                             %
9449 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9450 %
9451 %  MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel method.
9452 %
9453 %  The format of the MagickSetImagePixelInterpolateMethod method is:
9454 %
9455 %      MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9456 %        const PixelInterpolateMethod method)
9457 %
9458 %  A description of each parameter follows:
9459 %
9460 %    o wand: the magick wand.
9461 %
9462 %    o method: the image interpole pixel methods: choose from Undefined,
9463 %      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9464 %
9465 */
9466 WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9467   const PixelInterpolateMethod method)
9468 {
9469   assert(wand != (MagickWand *) NULL);
9470   assert(wand->signature == WandSignature);
9471   if (wand->debug != MagickFalse)
9472     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9473   if (wand->images == (Image *) NULL)
9474     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9475   wand->images->interpolate=method;
9476   return(MagickTrue);
9477 }
9478 \f
9479 /*
9480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9481 %                                                                             %
9482 %                                                                             %
9483 %                                                                             %
9484 %   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9485 %                                                                             %
9486 %                                                                             %
9487 %                                                                             %
9488 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9489 %
9490 %  MagickSetImageIterations() sets the image iterations.
9491 %
9492 %  The format of the MagickSetImageIterations method is:
9493 %
9494 %      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9495 %        const size_t iterations)
9496 %
9497 %  A description of each parameter follows:
9498 %
9499 %    o wand: the magick wand.
9500 %
9501 %    o delay: the image delay in 1/100th of a second.
9502 %
9503 */
9504 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9505   const size_t iterations)
9506 {
9507   assert(wand != (MagickWand *) NULL);
9508   assert(wand->signature == WandSignature);
9509   if (wand->debug != MagickFalse)
9510     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9511   if (wand->images == (Image *) NULL)
9512     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9513   wand->images->iterations=iterations;
9514   return(MagickTrue);
9515 }
9516 \f
9517 /*
9518 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9519 %                                                                             %
9520 %                                                                             %
9521 %                                                                             %
9522 %   M a g i c k S e t I m a g e M a t t e                                     %
9523 %                                                                             %
9524 %                                                                             %
9525 %                                                                             %
9526 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9527 %
9528 %  MagickSetImageMatte() sets the image matte channel.
9529 %
9530 %  The format of the MagickSetImageMatteColor method is:
9531 %
9532 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9533 %        const MagickBooleanType *matte)
9534 %
9535 %  A description of each parameter follows:
9536 %
9537 %    o wand: the magick wand.
9538 %
9539 %    o matte: Set to MagickTrue to enable the image matte channel otherwise
9540 %      MagickFalse.
9541 %
9542 */
9543 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9544   const MagickBooleanType matte)
9545 {
9546   assert(wand != (MagickWand *) NULL);
9547   assert(wand->signature == WandSignature);
9548   if (wand->debug != MagickFalse)
9549     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9550   if (wand->images == (Image *) NULL)
9551     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9552   if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
9553     (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
9554   wand->images->matte=matte;
9555   return(MagickTrue);
9556 }
9557 \f
9558 /*
9559 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9560 %                                                                             %
9561 %                                                                             %
9562 %                                                                             %
9563 %   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9564 %                                                                             %
9565 %                                                                             %
9566 %                                                                             %
9567 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9568 %
9569 %  MagickSetImageMatteColor() sets the image matte color.
9570 %
9571 %  The format of the MagickSetImageMatteColor method is:
9572 %
9573 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9574 %        const PixelWand *matte)
9575 %
9576 %  A description of each parameter follows:
9577 %
9578 %    o wand: the magick wand.
9579 %
9580 %    o matte: the matte pixel wand.
9581 %
9582 */
9583 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9584   const PixelWand *matte)
9585 {
9586   assert(wand != (MagickWand *) NULL);
9587   assert(wand->signature == WandSignature);
9588   if (wand->debug != MagickFalse)
9589     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9590   if (wand->images == (Image *) NULL)
9591     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9592   PixelGetQuantumPacket(matte,&wand->images->matte_color);
9593   return(MagickTrue);
9594 }
9595 \f
9596 /*
9597 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9598 %                                                                             %
9599 %                                                                             %
9600 %                                                                             %
9601 %   M a g i c k S e t I m a g e O p a c i t y                                 %
9602 %                                                                             %
9603 %                                                                             %
9604 %                                                                             %
9605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9606 %
9607 %  MagickSetImageAlpha() sets the image to the specified alpha level.
9608 %
9609 %  The format of the MagickSetImageAlpha method is:
9610 %
9611 %      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9612 %        const double alpha)
9613 %
9614 %  A description of each parameter follows:
9615 %
9616 %    o wand: the magick wand.
9617 %
9618 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9619 %      transparent.
9620 %
9621 */
9622 WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9623   const double alpha)
9624 {
9625   MagickBooleanType
9626     status;
9627
9628   assert(wand != (MagickWand *) NULL);
9629   assert(wand->signature == WandSignature);
9630   if (wand->debug != MagickFalse)
9631     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9632   if (wand->images == (Image *) NULL)
9633     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9634   status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
9635     wand->exception);
9636   return(status);
9637 }
9638 \f
9639 /*
9640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9641 %                                                                             %
9642 %                                                                             %
9643 %                                                                             %
9644 %   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                         %
9645 %                                                                             %
9646 %                                                                             %
9647 %                                                                             %
9648 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9649 %
9650 %  MagickSetImageOrientation() sets the image orientation.
9651 %
9652 %  The format of the MagickSetImageOrientation method is:
9653 %
9654 %      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9655 %        const OrientationType orientation)
9656 %
9657 %  A description of each parameter follows:
9658 %
9659 %    o wand: the magick wand.
9660 %
9661 %    o orientation: the image orientation type.
9662 %
9663 */
9664 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9665   const OrientationType orientation)
9666 {
9667   assert(wand != (MagickWand *) NULL);
9668   assert(wand->signature == WandSignature);
9669   if (wand->debug != MagickFalse)
9670     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9671   if (wand->images == (Image *) NULL)
9672     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9673   wand->images->orientation=orientation;
9674   return(MagickTrue);
9675 }
9676 \f
9677 /*
9678 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9679 %                                                                             %
9680 %                                                                             %
9681 %                                                                             %
9682 %   M a g i c k S e t I m a g e P a g e                                       %
9683 %                                                                             %
9684 %                                                                             %
9685 %                                                                             %
9686 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9687 %
9688 %  MagickSetImagePage() sets the page geometry of the image.
9689 %
9690 %  The format of the MagickSetImagePage method is:
9691 %
9692 %      MagickBooleanType MagickSetImagePage(MagickWand *wand,
9693 %        const size_t width,const size_t height,const ssize_t x,
9694 %        const ssize_t y)
9695 %
9696 %  A description of each parameter follows:
9697 %
9698 %    o wand: the magick wand.
9699 %
9700 %    o width: the page width.
9701 %
9702 %    o height: the page height.
9703 %
9704 %    o x: the page x-offset.
9705 %
9706 %    o y: the page y-offset.
9707 %
9708 */
9709 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
9710   const size_t width,const size_t height,const ssize_t x,
9711   const ssize_t y)
9712 {
9713   assert(wand != (MagickWand *) NULL);
9714   assert(wand->signature == WandSignature);
9715   if (wand->debug != MagickFalse)
9716     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9717   if (wand->images == (Image *) NULL)
9718     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9719   wand->images->page.width=width;
9720   wand->images->page.height=height;
9721   wand->images->page.x=x;
9722   wand->images->page.y=y;
9723   return(MagickTrue);
9724 }
9725 \f
9726 /*
9727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9728 %                                                                             %
9729 %                                                                             %
9730 %                                                                             %
9731 %   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                 %
9732 %                                                                             %
9733 %                                                                             %
9734 %                                                                             %
9735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9736 %
9737 %  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
9738 %  specified method and returns the previous progress monitor if any.  The
9739 %  progress monitor method looks like this:
9740 %
9741 %    MagickBooleanType MagickProgressMonitor(const char *text,
9742 %      const MagickOffsetType offset,const MagickSizeType span,
9743 %      void *client_data)
9744 %
9745 %  If the progress monitor returns MagickFalse, the current operation is
9746 %  interrupted.
9747 %
9748 %  The format of the MagickSetImageProgressMonitor method is:
9749 %
9750 %      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
9751 %        const MagickProgressMonitor progress_monitor,void *client_data)
9752 %
9753 %  A description of each parameter follows:
9754 %
9755 %    o wand: the magick wand.
9756 %
9757 %    o progress_monitor: Specifies a pointer to a method to monitor progress
9758 %      of an image operation.
9759 %
9760 %    o client_data: Specifies a pointer to any client data.
9761 %
9762 */
9763 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
9764   const MagickProgressMonitor progress_monitor,void *client_data)
9765 {
9766   MagickProgressMonitor
9767     previous_monitor;
9768
9769   assert(wand != (MagickWand *) NULL);
9770   assert(wand->signature == WandSignature);
9771   if (wand->debug != MagickFalse)
9772     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9773   if (wand->images == (Image *) NULL)
9774     {
9775       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
9776         "ContainsNoImages","`%s'",wand->name);
9777       return((MagickProgressMonitor) NULL);
9778     }
9779   previous_monitor=SetImageProgressMonitor(wand->images,
9780     progress_monitor,client_data);
9781   return(previous_monitor);
9782 }
9783 \f
9784 /*
9785 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9786 %                                                                             %
9787 %                                                                             %
9788 %                                                                             %
9789 %   M a g i c k S e t I m a g e R e d P r i m a r y                           %
9790 %                                                                             %
9791 %                                                                             %
9792 %                                                                             %
9793 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9794 %
9795 %  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
9796 %
9797 %  The format of the MagickSetImageRedPrimary method is:
9798 %
9799 %      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9800 %        const double x,const double y)
9801 %
9802 %  A description of each parameter follows:
9803 %
9804 %    o wand: the magick wand.
9805 %
9806 %    o x: the red primary x-point.
9807 %
9808 %    o y: the red primary y-point.
9809 %
9810 */
9811 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9812   const double x,const double y)
9813 {
9814   assert(wand != (MagickWand *) NULL);
9815   assert(wand->signature == WandSignature);
9816   if (wand->debug != MagickFalse)
9817     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9818   if (wand->images == (Image *) NULL)
9819     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9820   wand->images->chromaticity.red_primary.x=x;
9821   wand->images->chromaticity.red_primary.y=y;
9822   return(MagickTrue);
9823 }
9824 \f
9825 /*
9826 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9827 %                                                                             %
9828 %                                                                             %
9829 %                                                                             %
9830 %   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                 %
9831 %                                                                             %
9832 %                                                                             %
9833 %                                                                             %
9834 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9835 %
9836 %  MagickSetImageRenderingIntent() sets the image rendering intent.
9837 %
9838 %  The format of the MagickSetImageRenderingIntent method is:
9839 %
9840 %      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9841 %        const RenderingIntent rendering_intent)
9842 %
9843 %  A description of each parameter follows:
9844 %
9845 %    o wand: the magick wand.
9846 %
9847 %    o rendering_intent: the image rendering intent: UndefinedIntent,
9848 %      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
9849 %
9850 */
9851 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9852   const RenderingIntent rendering_intent)
9853 {
9854   assert(wand != (MagickWand *) NULL);
9855   assert(wand->signature == WandSignature);
9856   if (wand->debug != MagickFalse)
9857     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9858   if (wand->images == (Image *) NULL)
9859     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9860   wand->images->rendering_intent=rendering_intent;
9861   return(MagickTrue);
9862 }
9863 \f
9864 /*
9865 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9866 %                                                                             %
9867 %                                                                             %
9868 %                                                                             %
9869 %   M a g i c k S e t I m a g e R e s o l u t i o n                           %
9870 %                                                                             %
9871 %                                                                             %
9872 %                                                                             %
9873 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9874 %
9875 %  MagickSetImageResolution() sets the image resolution.
9876 %
9877 %  The format of the MagickSetImageResolution method is:
9878 %
9879 %      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9880 %        const double x_resolution,const doubtl y_resolution)
9881 %
9882 %  A description of each parameter follows:
9883 %
9884 %    o wand: the magick wand.
9885 %
9886 %    o x_resolution: the image x resolution.
9887 %
9888 %    o y_resolution: the image y resolution.
9889 %
9890 */
9891 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9892   const double x_resolution,const double y_resolution)
9893 {
9894   assert(wand != (MagickWand *) NULL);
9895   assert(wand->signature == WandSignature);
9896   if (wand->debug != MagickFalse)
9897     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9898   if (wand->images == (Image *) NULL)
9899     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9900   wand->images->resolution.x=x_resolution;
9901   wand->images->resolution.y=y_resolution;
9902   return(MagickTrue);
9903 }
9904 \f
9905 /*
9906 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9907 %                                                                             %
9908 %                                                                             %
9909 %                                                                             %
9910 %   M a g i c k S e t I m a g e S c e n e                                     %
9911 %                                                                             %
9912 %                                                                             %
9913 %                                                                             %
9914 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9915 %
9916 %  MagickSetImageScene() sets the image scene.
9917 %
9918 %  The format of the MagickSetImageScene method is:
9919 %
9920 %      MagickBooleanType MagickSetImageScene(MagickWand *wand,
9921 %        const size_t scene)
9922 %
9923 %  A description of each parameter follows:
9924 %
9925 %    o wand: the magick wand.
9926 %
9927 %    o delay: the image scene number.
9928 %
9929 */
9930 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
9931   const size_t scene)
9932 {
9933   assert(wand != (MagickWand *) NULL);
9934   assert(wand->signature == WandSignature);
9935   if (wand->debug != MagickFalse)
9936     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9937   if (wand->images == (Image *) NULL)
9938     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9939   wand->images->scene=scene;
9940   return(MagickTrue);
9941 }
9942 \f
9943 /*
9944 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9945 %                                                                             %
9946 %                                                                             %
9947 %                                                                             %
9948 %   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                   %
9949 %                                                                             %
9950 %                                                                             %
9951 %                                                                             %
9952 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9953 %
9954 %  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
9955 %
9956 %  The format of the MagickSetImageTicksPerSecond method is:
9957 %
9958 %      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9959 %        const ssize_t ticks_per-second)
9960 %
9961 %  A description of each parameter follows:
9962 %
9963 %    o wand: the magick wand.
9964 %
9965 %    o ticks_per_second: the units to use for the image delay.
9966 %
9967 */
9968 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9969   const ssize_t ticks_per_second)
9970 {
9971   assert(wand != (MagickWand *) NULL);
9972   assert(wand->signature == WandSignature);
9973   if (wand->debug != MagickFalse)
9974     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9975   if (wand->images == (Image *) NULL)
9976     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9977   wand->images->ticks_per_second=ticks_per_second;
9978   return(MagickTrue);
9979 }
9980 \f
9981 /*
9982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9983 %                                                                             %
9984 %                                                                             %
9985 %                                                                             %
9986 %   M a g i c k S e t I m a g e T y p e                                       %
9987 %                                                                             %
9988 %                                                                             %
9989 %                                                                             %
9990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9991 %
9992 %  MagickSetImageType() sets the image type.
9993 %
9994 %  The format of the MagickSetImageType method is:
9995 %
9996 %      MagickBooleanType MagickSetImageType(MagickWand *wand,
9997 %        const ImageType image_type)
9998 %
9999 %  A description of each parameter follows:
10000 %
10001 %    o wand: the magick wand.
10002 %
10003 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10004 %      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10005 %      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10006 %      or OptimizeType.
10007 %
10008 */
10009 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10010   const ImageType image_type)
10011 {
10012   assert(wand != (MagickWand *) NULL);
10013   assert(wand->signature == WandSignature);
10014   if (wand->debug != MagickFalse)
10015     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10016   if (wand->images == (Image *) NULL)
10017     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10018   return(SetImageType(wand->images,image_type,wand->exception));
10019 }
10020 \f
10021 /*
10022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10023 %                                                                             %
10024 %                                                                             %
10025 %                                                                             %
10026 %   M a g i c k S e t I m a g e U n i t s                                     %
10027 %                                                                             %
10028 %                                                                             %
10029 %                                                                             %
10030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10031 %
10032 %  MagickSetImageUnits() sets the image units of resolution.
10033 %
10034 %  The format of the MagickSetImageUnits method is:
10035 %
10036 %      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10037 %        const ResolutionType units)
10038 %
10039 %  A description of each parameter follows:
10040 %
10041 %    o wand: the magick wand.
10042 %
10043 %    o units: the image units of resolution : UndefinedResolution,
10044 %      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10045 %
10046 */
10047 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10048   const ResolutionType units)
10049 {
10050   assert(wand != (MagickWand *) NULL);
10051   assert(wand->signature == WandSignature);
10052   if (wand->debug != MagickFalse)
10053     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10054   if (wand->images == (Image *) NULL)
10055     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10056   wand->images->units=units;
10057   return(MagickTrue);
10058 }
10059 \f
10060 /*
10061 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10062 %                                                                             %
10063 %                                                                             %
10064 %                                                                             %
10065 %   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           %
10066 %                                                                             %
10067 %                                                                             %
10068 %                                                                             %
10069 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10070 %
10071 %  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10072 %
10073 %  The format of the MagickSetImageVirtualPixelMethod method is:
10074 %
10075 %      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10076 %        const VirtualPixelMethod method)
10077 %
10078 %  A description of each parameter follows:
10079 %
10080 %    o wand: the magick wand.
10081 %
10082 %    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10083 %      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10084 %      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10085 %
10086 */
10087 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10088   const VirtualPixelMethod method)
10089 {
10090   assert(wand != (MagickWand *) NULL);
10091   assert(wand->signature == WandSignature);
10092   if (wand->debug != MagickFalse)
10093     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10094   if (wand->images == (Image *) NULL)
10095     return(UndefinedVirtualPixelMethod);
10096   return(SetImageVirtualPixelMethod(wand->images,method));
10097 }
10098 \f
10099 /*
10100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10101 %                                                                             %
10102 %                                                                             %
10103 %                                                                             %
10104 %   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10105 %                                                                             %
10106 %                                                                             %
10107 %                                                                             %
10108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10109 %
10110 %  MagickSetImageWhitePoint() sets the image chromaticity white point.
10111 %
10112 %  The format of the MagickSetImageWhitePoint method is:
10113 %
10114 %      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10115 %        const double x,const double y)
10116 %
10117 %  A description of each parameter follows:
10118 %
10119 %    o wand: the magick wand.
10120 %
10121 %    o x: the white x-point.
10122 %
10123 %    o y: the white y-point.
10124 %
10125 */
10126 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10127   const double x,const double y)
10128 {
10129   assert(wand != (MagickWand *) NULL);
10130   assert(wand->signature == WandSignature);
10131   if (wand->debug != MagickFalse)
10132     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10133   if (wand->images == (Image *) NULL)
10134     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10135   wand->images->chromaticity.white_point.x=x;
10136   wand->images->chromaticity.white_point.y=y;
10137   return(MagickTrue);
10138 }
10139 \f
10140 /*
10141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10142 %                                                                             %
10143 %                                                                             %
10144 %                                                                             %
10145 %   M a g i c k S h a d e I m a g e C h a n n e l                             %
10146 %                                                                             %
10147 %                                                                             %
10148 %                                                                             %
10149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10150 %
10151 %  MagickShadeImage() shines a distant light on an image to create a
10152 %  three-dimensional effect. You control the positioning of the light with
10153 %  azimuth and elevation; azimuth is measured in degrees off the x axis
10154 %  and elevation is measured in pixels above the Z axis.
10155 %
10156 %  The format of the MagickShadeImage method is:
10157 %
10158 %      MagickBooleanType MagickShadeImage(MagickWand *wand,
10159 %        const MagickBooleanType gray,const double azimuth,
10160 %        const double elevation)
10161 %
10162 %  A description of each parameter follows:
10163 %
10164 %    o wand: the magick wand.
10165 %
10166 %    o gray: A value other than zero shades the intensity of each pixel.
10167 %
10168 %    o azimuth, elevation:  Define the light source direction.
10169 %
10170 */
10171 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10172   const MagickBooleanType gray,const double asimuth,const double elevation)
10173 {
10174   Image
10175     *shade_image;
10176
10177   assert(wand != (MagickWand *) NULL);
10178   assert(wand->signature == WandSignature);
10179   if (wand->debug != MagickFalse)
10180     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10181   if (wand->images == (Image *) NULL)
10182     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10183   shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10184   if (shade_image == (Image *) NULL)
10185     return(MagickFalse);
10186   ReplaceImageInList(&wand->images,shade_image);
10187   return(MagickTrue);
10188 }
10189 \f
10190 /*
10191 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10192 %                                                                             %
10193 %                                                                             %
10194 %                                                                             %
10195 %   M a g i c k S h a d o w I m a g e                                         %
10196 %                                                                             %
10197 %                                                                             %
10198 %                                                                             %
10199 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10200 %
10201 %  MagickShadowImage() simulates an image shadow.
10202 %
10203 %  The format of the MagickShadowImage method is:
10204 %
10205 %      MagickBooleanType MagickShadowImage(MagickWand *wand,
10206 %        const double alpha,const double sigma,const double bias,
10207 %        const ssize_t x,const ssize_t y)
10208 %
10209 %  A description of each parameter follows:
10210 %
10211 %    o wand: the magick wand.
10212 %
10213 %    o alpha: percentage transparency.
10214 %
10215 %    o sigma: the standard deviation of the Gaussian, in pixels.
10216 %
10217 %    o bias: the bias.
10218 %
10219 %    o x: the shadow x-offset.
10220 %
10221 %    o y: the shadow y-offset.
10222 %
10223 */
10224 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10225   const double alpha,const double sigma,const double bias,const ssize_t x,
10226   const ssize_t y)
10227 {
10228   Image
10229     *shadow_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   shadow_image=ShadowImage(wand->images,alpha,sigma,bias,x,y,wand->exception);
10238   if (shadow_image == (Image *) NULL)
10239     return(MagickFalse);
10240   ReplaceImageInList(&wand->images,shadow_image);
10241   return(MagickTrue);
10242 }
10243 \f
10244 /*
10245 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10246 %                                                                             %
10247 %                                                                             %
10248 %                                                                             %
10249 %   M a g i c k S h a r p e n I m a g e                                       %
10250 %                                                                             %
10251 %                                                                             %
10252 %                                                                             %
10253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10254 %
10255 %  MagickSharpenImage() sharpens an image.  We convolve the image with a
10256 %  Gaussian operator of the given radius and standard deviation (sigma).
10257 %  For reasonable results, the radius should be larger than sigma.  Use a
10258 %  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10259 %
10260 %  The format of the MagickSharpenImage method is:
10261 %
10262 %      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10263 %        const double radius,const double sigma,const double bias)
10264 %
10265 %  A description of each parameter follows:
10266 %
10267 %    o wand: the magick wand.
10268 %
10269 %    o radius: the radius of the Gaussian, in pixels, not counting the center
10270 %      pixel.
10271 %
10272 %    o sigma: the standard deviation of the Gaussian, in pixels.
10273 %
10274 %    o bias: the bias.
10275 %
10276 */
10277 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10278   const double radius,const double sigma,const double bias)
10279 {
10280   Image
10281     *sharp_image;
10282
10283   assert(wand != (MagickWand *) NULL);
10284   assert(wand->signature == WandSignature);
10285   if (wand->debug != MagickFalse)
10286     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10287   if (wand->images == (Image *) NULL)
10288     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10289   sharp_image=SharpenImage(wand->images,radius,sigma,bias,wand->exception);
10290   if (sharp_image == (Image *) NULL)
10291     return(MagickFalse);
10292   ReplaceImageInList(&wand->images,sharp_image);
10293   return(MagickTrue);
10294 }
10295 \f
10296 /*
10297 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10298 %                                                                             %
10299 %                                                                             %
10300 %                                                                             %
10301 %   M a g i c k S h a v e I m a g e                                           %
10302 %                                                                             %
10303 %                                                                             %
10304 %                                                                             %
10305 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10306 %
10307 %  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10308 %  memory necessary for the new Image structure and returns a pointer to the
10309 %  new image.
10310 %
10311 %  The format of the MagickShaveImage method is:
10312 %
10313 %      MagickBooleanType MagickShaveImage(MagickWand *wand,
10314 %        const size_t columns,const size_t rows)
10315 %
10316 %  A description of each parameter follows:
10317 %
10318 %    o wand: the magick wand.
10319 %
10320 %    o columns: the number of columns in the scaled image.
10321 %
10322 %    o rows: the number of rows in the scaled image.
10323 %
10324 %
10325 */
10326 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10327   const size_t columns,const size_t rows)
10328 {
10329   Image
10330     *shave_image;
10331
10332   RectangleInfo
10333     shave_info;
10334
10335   assert(wand != (MagickWand *) NULL);
10336   assert(wand->signature == WandSignature);
10337   if (wand->debug != MagickFalse)
10338     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10339   if (wand->images == (Image *) NULL)
10340     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10341   shave_info.width=columns;
10342   shave_info.height=rows;
10343   shave_info.x=0;
10344   shave_info.y=0;
10345   shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10346   if (shave_image == (Image *) NULL)
10347     return(MagickFalse);
10348   ReplaceImageInList(&wand->images,shave_image);
10349   return(MagickTrue);
10350 }
10351 \f
10352 /*
10353 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10354 %                                                                             %
10355 %                                                                             %
10356 %                                                                             %
10357 %   M a g i c k S h e a r I m a g e                                           %
10358 %                                                                             %
10359 %                                                                             %
10360 %                                                                             %
10361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10362 %
10363 %  MagickShearImage() slides one edge of an image along the X or Y axis,
10364 %  creating a parallelogram.  An X direction shear slides an edge along the X
10365 %  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10366 %  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10367 %  is measured relative to the Y axis, and similarly, for Y direction shears
10368 %  y_shear is measured relative to the X axis.  Empty triangles left over from
10369 %  shearing the image are filled with the background color.
10370 %
10371 %  The format of the MagickShearImage method is:
10372 %
10373 %      MagickBooleanType MagickShearImage(MagickWand *wand,
10374 %        const PixelWand *background,const double x_shear,onst double y_shear)
10375 %
10376 %  A description of each parameter follows:
10377 %
10378 %    o wand: the magick wand.
10379 %
10380 %    o background: the background pixel wand.
10381 %
10382 %    o x_shear: the number of degrees to shear the image.
10383 %
10384 %    o y_shear: the number of degrees to shear the image.
10385 %
10386 */
10387 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10388   const PixelWand *background,const double x_shear,const double y_shear)
10389 {
10390   Image
10391     *shear_image;
10392
10393   assert(wand != (MagickWand *) NULL);
10394   assert(wand->signature == WandSignature);
10395   if (wand->debug != MagickFalse)
10396     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10397   if (wand->images == (Image *) NULL)
10398     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10399   PixelGetQuantumPacket(background,&wand->images->background_color);
10400   shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10401   if (shear_image == (Image *) NULL)
10402     return(MagickFalse);
10403   ReplaceImageInList(&wand->images,shear_image);
10404   return(MagickTrue);
10405 }
10406 \f
10407 /*
10408 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10409 %                                                                             %
10410 %                                                                             %
10411 %                                                                             %
10412 %   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                   %
10413 %                                                                             %
10414 %                                                                             %
10415 %                                                                             %
10416 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10417 %
10418 %  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10419 %  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10420 %  image using a sigmoidal transfer function without saturating highlights or
10421 %  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10422 %  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10423 %  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10424 %  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10425 %  is reduced.
10426 %
10427 %  The format of the MagickSigmoidalContrastImage method is:
10428 %
10429 %      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10430 %        const MagickBooleanType sharpen,const double alpha,const double beta)
10431 %
10432 %  A description of each parameter follows:
10433 %
10434 %    o wand: the magick wand.
10435 %
10436 %    o sharpen: Increase or decrease image contrast.
10437 %
10438 %    o alpha: strength of the contrast, the larger the number the more
10439 %      'threshold-like' it becomes.
10440 %
10441 %    o beta: midpoint of the function as a color value 0 to QuantumRange.
10442 %
10443 */
10444 WandExport MagickBooleanType MagickSigmoidalContrastImage(
10445   MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10446   const double beta)
10447 {
10448   MagickBooleanType
10449     status;
10450
10451   assert(wand != (MagickWand *) NULL);
10452   assert(wand->signature == WandSignature);
10453   if (wand->debug != MagickFalse)
10454     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10455   if (wand->images == (Image *) NULL)
10456     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10457   status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10458     wand->exception);
10459   return(status);
10460 }
10461 \f
10462 /*
10463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10464 %                                                                             %
10465 %                                                                             %
10466 %                                                                             %
10467 %   M a g i c k S i m i l a r i t y I m a g e                                 %
10468 %                                                                             %
10469 %                                                                             %
10470 %                                                                             %
10471 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10472 %
10473 %  MagickSimilarityImage() compares the reference image of the image and
10474 %  returns the best match offset.  In addition, it returns a similarity image
10475 %  such that an exact match location is completely white and if none of the
10476 %  pixels match, black, otherwise some gray level in-between.
10477 %
10478 %  The format of the MagickSimilarityImage method is:
10479 %
10480 %      MagickWand *MagickSimilarityImage(MagickWand *wand,
10481 %        const MagickWand *reference,const MetricType metric,
10482 %        RectangeInfo *offset,double *similarity)
10483 %
10484 %  A description of each parameter follows:
10485 %
10486 %    o wand: the magick wand.
10487 %
10488 %    o reference: the reference wand.
10489 %
10490 %    o metric: the metric.
10491 %
10492 %    o offset: the best match offset of the reference image within the image.
10493 %
10494 %    o similarity: the computed similarity between the images.
10495 %
10496 */
10497 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10498   const MagickWand *reference,const MetricType metric,RectangleInfo *offset,
10499   double *similarity)
10500 {
10501   Image
10502     *similarity_image;
10503
10504   assert(wand != (MagickWand *) NULL);
10505   assert(wand->signature == WandSignature);
10506   if (wand->debug != MagickFalse)
10507     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10508   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10509     {
10510       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10511         "ContainsNoImages","`%s'",wand->name);
10512       return((MagickWand *) NULL);
10513     }
10514   similarity_image=SimilarityImage(wand->images,reference->images,metric,offset,
10515     similarity,wand->exception);
10516   if (similarity_image == (Image *) NULL)
10517     return((MagickWand *) NULL);
10518   return(CloneMagickWandFromImages(wand,similarity_image));
10519 }
10520 \f
10521 /*
10522 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10523 %                                                                             %
10524 %                                                                             %
10525 %                                                                             %
10526 %   M a g i c k S k e t c h I m a g e                                         %
10527 %                                                                             %
10528 %                                                                             %
10529 %                                                                             %
10530 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10531 %
10532 %  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10533 %  a Gaussian operator of the given radius and standard deviation (sigma).
10534 %  For reasonable results, radius should be larger than sigma.  Use a
10535 %  radius of 0 and SketchImage() selects a suitable radius for you.
10536 %  Angle gives the angle of the blurring motion.
10537 %
10538 %  The format of the MagickSketchImage method is:
10539 %
10540 %      MagickBooleanType MagickSketchImage(MagickWand *wand,
10541 %        const double radius,const double sigma,const double angle,
10542 %        const double bias)
10543 %
10544 %  A description of each parameter follows:
10545 %
10546 %    o wand: the magick wand.
10547 %
10548 %    o radius: the radius of the Gaussian, in pixels, not counting
10549 %      the center pixel.
10550 %
10551 %    o sigma: the standard deviation of the Gaussian, in pixels.
10552 %
10553 %    o angle: apply the effect along this angle.
10554 %
10555 %    o bias: the bias.
10556 %
10557 */
10558 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10559   const double radius,const double sigma,const double angle,const double bias)
10560 {
10561   Image
10562     *sketch_image;
10563
10564   assert(wand != (MagickWand *) NULL);
10565   assert(wand->signature == WandSignature);
10566   if (wand->debug != MagickFalse)
10567     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10568   if (wand->images == (Image *) NULL)
10569     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10570   sketch_image=SketchImage(wand->images,radius,sigma,angle,bias,
10571     wand->exception);
10572   if (sketch_image == (Image *) NULL)
10573     return(MagickFalse);
10574   ReplaceImageInList(&wand->images,sketch_image);
10575   return(MagickTrue);
10576 }
10577 \f
10578 /*
10579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10580 %                                                                             %
10581 %                                                                             %
10582 %                                                                             %
10583 %   M a g i c k S m u s h I m a g e s                                         %
10584 %                                                                             %
10585 %                                                                             %
10586 %                                                                             %
10587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10588 %
10589 %  MagickSmushImages() takes all images from the current image pointer to the
10590 %  end of the image list and smushs them to each other top-to-bottom if the
10591 %  stack parameter is true, otherwise left-to-right.
10592 %
10593 %  The format of the MagickSmushImages method is:
10594 %
10595 %      MagickWand *MagickSmushImages(MagickWand *wand,
10596 %        const MagickBooleanType stack,const ssize_t offset)
10597 %
10598 %  A description of each parameter follows:
10599 %
10600 %    o wand: the magick wand.
10601 %
10602 %    o stack: By default, images are stacked left-to-right. Set stack to
10603 %      MagickTrue to stack them top-to-bottom.
10604 %
10605 %    o offset: minimum distance in pixels between images.
10606 %
10607 */
10608 WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10609   const MagickBooleanType stack,const ssize_t offset)
10610 {
10611   Image
10612     *smush_image;
10613
10614   assert(wand != (MagickWand *) NULL);
10615   assert(wand->signature == WandSignature);
10616   if (wand->debug != MagickFalse)
10617     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10618   if (wand->images == (Image *) NULL)
10619     return((MagickWand *) NULL);
10620   smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10621   if (smush_image == (Image *) NULL)
10622     return((MagickWand *) NULL);
10623   return(CloneMagickWandFromImages(wand,smush_image));
10624 }
10625 \f
10626 /*
10627 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10628 %                                                                             %
10629 %                                                                             %
10630 %                                                                             %
10631 %     M a g i c k S o l a r i z e I m a g e                                   %
10632 %                                                                             %
10633 %                                                                             %
10634 %                                                                             %
10635 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10636 %
10637 %  MagickSolarizeImage() applies a special effect to the image, similar to the
10638 %  effect achieved in a photo darkroom by selectively exposing areas of photo
10639 %  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
10640 %  measure of the extent of the solarization.
10641 %
10642 %  The format of the MagickSolarizeImage method is:
10643 %
10644 %      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10645 %        const double threshold)
10646 %
10647 %  A description of each parameter follows:
10648 %
10649 %    o wand: the magick wand.
10650 %
10651 %    o threshold:  Define the extent of the solarization.
10652 %
10653 */
10654 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10655   const double threshold)
10656 {
10657   MagickBooleanType
10658     status;
10659
10660   assert(wand != (MagickWand *) NULL);
10661   assert(wand->signature == WandSignature);
10662   if (wand->debug != MagickFalse)
10663     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10664   if (wand->images == (Image *) NULL)
10665     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10666   status=SolarizeImage(wand->images,threshold,wand->exception);
10667   return(status);
10668 }
10669 \f
10670 /*
10671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10672 %                                                                             %
10673 %                                                                             %
10674 %                                                                             %
10675 %   M a g i c k S p a r s e C o l o r I m a g e                               %
10676 %                                                                             %
10677 %                                                                             %
10678 %                                                                             %
10679 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10680 %
10681 %  MagickSparseColorImage(), given a set of coordinates, interpolates the
10682 %  colors found at those coordinates, across the whole image, using various
10683 %  methods.
10684 %
10685 %  The format of the MagickSparseColorImage method is:
10686 %
10687 %      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10688 %        const SparseColorMethod method,const size_t number_arguments,
10689 %        const double *arguments)
10690 %
10691 %  A description of each parameter follows:
10692 %
10693 %    o image: the image to be sparseed.
10694 %
10695 %    o method: the method of image sparseion.
10696 %
10697 %        ArcSparseColorion will always ignore source image offset, and always
10698 %        'bestfit' the destination image with the top left corner offset
10699 %        relative to the polar mapping center.
10700 %
10701 %        Bilinear has no simple inverse mapping so will not allow 'bestfit'
10702 %        style of image sparseion.
10703 %
10704 %        Affine, Perspective, and Bilinear, will do least squares fitting of
10705 %        the distrotion when more than the minimum number of control point
10706 %        pairs are provided.
10707 %
10708 %        Perspective, and Bilinear, will fall back to a Affine sparseion when
10709 %        less than 4 control point pairs are provided. While Affine sparseions
10710 %        will let you use any number of control point pairs, that is Zero pairs
10711 %        is a No-Op (viewport only) distrotion, one pair is a translation and
10712 %        two pairs of control points will do a scale-rotate-translate, without
10713 %        any shearing.
10714 %
10715 %    o number_arguments: the number of arguments given for this sparseion
10716 %      method.
10717 %
10718 %    o arguments: the arguments for this sparseion method.
10719 %
10720 */
10721 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10722   const SparseColorMethod method,const size_t number_arguments,
10723   const double *arguments)
10724 {
10725   Image
10726     *sparse_image;
10727
10728   assert(wand != (MagickWand *) NULL);
10729   assert(wand->signature == WandSignature);
10730   if (wand->debug != MagickFalse)
10731     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10732   if (wand->images == (Image *) NULL)
10733     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10734   sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
10735     wand->exception);
10736   if (sparse_image == (Image *) NULL)
10737     return(MagickFalse);
10738   ReplaceImageInList(&wand->images,sparse_image);
10739   return(MagickTrue);
10740 }
10741 \f
10742 /*
10743 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10744 %                                                                             %
10745 %                                                                             %
10746 %                                                                             %
10747 %   M a g i c k S p l i c e I m a g e                                         %
10748 %                                                                             %
10749 %                                                                             %
10750 %                                                                             %
10751 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10752 %
10753 %  MagickSpliceImage() splices a solid color into the image.
10754 %
10755 %  The format of the MagickSpliceImage method is:
10756 %
10757 %      MagickBooleanType MagickSpliceImage(MagickWand *wand,
10758 %        const size_t width,const size_t height,const ssize_t x,
10759 %        const ssize_t y)
10760 %
10761 %  A description of each parameter follows:
10762 %
10763 %    o wand: the magick wand.
10764 %
10765 %    o width: the region width.
10766 %
10767 %    o height: the region height.
10768 %
10769 %    o x: the region x offset.
10770 %
10771 %    o y: the region y offset.
10772 %
10773 */
10774 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
10775   const size_t width,const size_t height,const ssize_t x,
10776   const ssize_t y)
10777 {
10778   Image
10779     *splice_image;
10780
10781   RectangleInfo
10782     splice;
10783
10784   assert(wand != (MagickWand *) NULL);
10785   assert(wand->signature == WandSignature);
10786   if (wand->debug != MagickFalse)
10787     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10788   if (wand->images == (Image *) NULL)
10789     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10790   splice.width=width;
10791   splice.height=height;
10792   splice.x=x;
10793   splice.y=y;
10794   splice_image=SpliceImage(wand->images,&splice,wand->exception);
10795   if (splice_image == (Image *) NULL)
10796     return(MagickFalse);
10797   ReplaceImageInList(&wand->images,splice_image);
10798   return(MagickTrue);
10799 }
10800 \f
10801 /*
10802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10803 %                                                                             %
10804 %                                                                             %
10805 %                                                                             %
10806 %   M a g i c k S p r e a d I m a g e                                         %
10807 %                                                                             %
10808 %                                                                             %
10809 %                                                                             %
10810 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10811 %
10812 %  MagickSpreadImage() is a special effects method that randomly displaces each
10813 %  pixel in a block defined by the radius parameter.
10814 %
10815 %  The format of the MagickSpreadImage method is:
10816 %
10817 %      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius,
10818 %        const PixelInterpolateMethod method)
10819 %
10820 %  A description of each parameter follows:
10821 %
10822 %    o wand: the magick wand.
10823 %
10824 %    o radius:  Choose a random pixel in a neighborhood of this extent.
10825 %
10826 %    o method: the pixel interpolation method.
10827 %
10828 */
10829 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
10830   const double radius,const PixelInterpolateMethod method)
10831 {
10832   Image
10833     *spread_image;
10834
10835   assert(wand != (MagickWand *) NULL);
10836   assert(wand->signature == WandSignature);
10837   if (wand->debug != MagickFalse)
10838     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10839   if (wand->images == (Image *) NULL)
10840     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10841   spread_image=SpreadImage(wand->images,radius,method,wand->exception);
10842   if (spread_image == (Image *) NULL)
10843     return(MagickFalse);
10844   ReplaceImageInList(&wand->images,spread_image);
10845   return(MagickTrue);
10846 }
10847 \f
10848 /*
10849 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10850 %                                                                             %
10851 %                                                                             %
10852 %                                                                             %
10853 %   M a g i c k S t a t i s t i c I m a g e                                   %
10854 %                                                                             %
10855 %                                                                             %
10856 %                                                                             %
10857 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10858 %
10859 %  MagickStatisticImage() replace each pixel with corresponding statistic from
10860 %  the neighborhood of the specified width and height.
10861 %
10862 %  The format of the MagickStatisticImage method is:
10863 %
10864 %      MagickBooleanType MagickStatisticImage(MagickWand *wand,
10865 %        const StatisticType type,const double width,const size_t height)
10866 %
10867 %  A description of each parameter follows:
10868 %
10869 %    o wand: the magick wand.
10870 %
10871 %    o type: the statistic type (e.g. median, mode, etc.).
10872 %
10873 %    o width: the width of the pixel neighborhood.
10874 %
10875 %    o height: the height of the pixel neighborhood.
10876 %
10877 */
10878 WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
10879   const StatisticType type,const size_t width,const size_t height)
10880 {
10881   Image
10882     *statistic_image;
10883
10884   assert(wand != (MagickWand *) NULL);
10885   assert(wand->signature == WandSignature);
10886   if (wand->debug != MagickFalse)
10887     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10888   if (wand->images == (Image *) NULL)
10889     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10890   statistic_image=StatisticImage(wand->images,type,width,height,
10891     wand->exception);
10892   if (statistic_image == (Image *) NULL)
10893     return(MagickFalse);
10894   ReplaceImageInList(&wand->images,statistic_image);
10895   return(MagickTrue);
10896 }
10897 \f
10898 /*
10899 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10900 %                                                                             %
10901 %                                                                             %
10902 %                                                                             %
10903 %   M a g i c k S t e g a n o I m a g e                                       %
10904 %                                                                             %
10905 %                                                                             %
10906 %                                                                             %
10907 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10908 %
10909 %  MagickSteganoImage() hides a digital watermark within the image.
10910 %  Recover the hidden watermark later to prove that the authenticity of
10911 %  an image.  Offset defines the start position within the image to hide
10912 %  the watermark.
10913 %
10914 %  The format of the MagickSteganoImage method is:
10915 %
10916 %      MagickWand *MagickSteganoImage(MagickWand *wand,
10917 %        const MagickWand *watermark_wand,const ssize_t offset)
10918 %
10919 %  A description of each parameter follows:
10920 %
10921 %    o wand: the magick wand.
10922 %
10923 %    o watermark_wand: the watermark wand.
10924 %
10925 %    o offset: Start hiding at this offset into the image.
10926 %
10927 */
10928 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
10929   const MagickWand *watermark_wand,const ssize_t offset)
10930 {
10931   Image
10932     *stegano_image;
10933
10934   assert(wand != (MagickWand *) NULL);
10935   assert(wand->signature == WandSignature);
10936   if (wand->debug != MagickFalse)
10937     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10938   if ((wand->images == (Image *) NULL) ||
10939       (watermark_wand->images == (Image *) NULL))
10940     {
10941       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10942         "ContainsNoImages","`%s'",wand->name);
10943       return((MagickWand *) NULL);
10944     }
10945   wand->images->offset=offset;
10946   stegano_image=SteganoImage(wand->images,watermark_wand->images,
10947     wand->exception);
10948   if (stegano_image == (Image *) NULL)
10949     return((MagickWand *) NULL);
10950   return(CloneMagickWandFromImages(wand,stegano_image));
10951 }
10952 \f
10953 /*
10954 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10955 %                                                                             %
10956 %                                                                             %
10957 %                                                                             %
10958 %   M a g i c k S t e r e o I m a g e                                         %
10959 %                                                                             %
10960 %                                                                             %
10961 %                                                                             %
10962 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10963 %
10964 %  MagickStereoImage() composites two images and produces a single image that
10965 %  is the composite of a left and right image of a stereo pair
10966 %
10967 %  The format of the MagickStereoImage method is:
10968 %
10969 %      MagickWand *MagickStereoImage(MagickWand *wand,
10970 %        const MagickWand *offset_wand)
10971 %
10972 %  A description of each parameter follows:
10973 %
10974 %    o wand: the magick wand.
10975 %
10976 %    o offset_wand: Another image wand.
10977 %
10978 */
10979 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
10980   const MagickWand *offset_wand)
10981 {
10982   Image
10983     *stereo_image;
10984
10985   assert(wand != (MagickWand *) NULL);
10986   assert(wand->signature == WandSignature);
10987   if (wand->debug != MagickFalse)
10988     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10989   if ((wand->images == (Image *) NULL) ||
10990       (offset_wand->images == (Image *) NULL))
10991     {
10992       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10993         "ContainsNoImages","`%s'",wand->name);
10994       return((MagickWand *) NULL);
10995     }
10996   stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
10997   if (stereo_image == (Image *) NULL)
10998     return((MagickWand *) NULL);
10999   return(CloneMagickWandFromImages(wand,stereo_image));
11000 }
11001 \f
11002 /*
11003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11004 %                                                                             %
11005 %                                                                             %
11006 %                                                                             %
11007 %   M a g i c k S t r i p I m a g e                                           %
11008 %                                                                             %
11009 %                                                                             %
11010 %                                                                             %
11011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11012 %
11013 %  MagickStripImage() strips an image of all profiles and comments.
11014 %
11015 %  The format of the MagickStripImage method is:
11016 %
11017 %      MagickBooleanType MagickStripImage(MagickWand *wand)
11018 %
11019 %  A description of each parameter follows:
11020 %
11021 %    o wand: the magick wand.
11022 %
11023 */
11024 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11025 {
11026   assert(wand != (MagickWand *) NULL);
11027   assert(wand->signature == WandSignature);
11028   if (wand->debug != MagickFalse)
11029     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11030   if (wand->images == (Image *) NULL)
11031     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11032   return(StripImage(wand->images,wand->exception));
11033 }
11034 \f
11035 /*
11036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11037 %                                                                             %
11038 %                                                                             %
11039 %                                                                             %
11040 %   M a g i c k S w i r l I m a g e                                           %
11041 %                                                                             %
11042 %                                                                             %
11043 %                                                                             %
11044 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11045 %
11046 %  MagickSwirlImage() swirls the pixels about the center of the image, where
11047 %  degrees indicates the sweep of the arc through which each pixel is moved.
11048 %  You get a more dramatic effect as the degrees move from 1 to 360.
11049 %
11050 %  The format of the MagickSwirlImage method is:
11051 %
11052 %      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11053 %        const PixelInterpolateMethod method)
11054 %
11055 %  A description of each parameter follows:
11056 %
11057 %    o wand: the magick wand.
11058 %
11059 %    o degrees: Define the tightness of the swirling effect.
11060 %
11061 %    o method: the pixel interpolation method.
11062 %
11063 */
11064 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11065   const double degrees,const PixelInterpolateMethod method)
11066 {
11067   Image
11068     *swirl_image;
11069
11070   assert(wand != (MagickWand *) NULL);
11071   assert(wand->signature == WandSignature);
11072   if (wand->debug != MagickFalse)
11073     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11074   if (wand->images == (Image *) NULL)
11075     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11076   swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
11077   if (swirl_image == (Image *) NULL)
11078     return(MagickFalse);
11079   ReplaceImageInList(&wand->images,swirl_image);
11080   return(MagickTrue);
11081 }
11082 \f
11083 /*
11084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11085 %                                                                             %
11086 %                                                                             %
11087 %                                                                             %
11088 %   M a g i c k T e x t u r e I m a g e                                       %
11089 %                                                                             %
11090 %                                                                             %
11091 %                                                                             %
11092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11093 %
11094 %  MagickTextureImage() repeatedly tiles the texture image across and down the
11095 %  image canvas.
11096 %
11097 %  The format of the MagickTextureImage method is:
11098 %
11099 %      MagickWand *MagickTextureImage(MagickWand *wand,
11100 %        const MagickWand *texture_wand)
11101 %
11102 %  A description of each parameter follows:
11103 %
11104 %    o wand: the magick wand.
11105 %
11106 %    o texture_wand: the texture wand
11107 %
11108 */
11109 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11110   const MagickWand *texture_wand)
11111 {
11112   Image
11113     *texture_image;
11114
11115   MagickBooleanType
11116     status;
11117
11118   assert(wand != (MagickWand *) NULL);
11119   assert(wand->signature == WandSignature);
11120   if (wand->debug != MagickFalse)
11121     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11122   if ((wand->images == (Image *) NULL) ||
11123       (texture_wand->images == (Image *) NULL))
11124     {
11125       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11126         "ContainsNoImages","`%s'",wand->name);
11127       return((MagickWand *) NULL);
11128     }
11129   texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11130   if (texture_image == (Image *) NULL)
11131     return((MagickWand *) NULL);
11132   status=TextureImage(texture_image,texture_wand->images,wand->exception);
11133   if (status == MagickFalse)
11134     {
11135       texture_image=DestroyImage(texture_image);
11136       return((MagickWand *) NULL);
11137     }
11138   return(CloneMagickWandFromImages(wand,texture_image));
11139 }
11140 \f
11141 /*
11142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11143 %                                                                             %
11144 %                                                                             %
11145 %                                                                             %
11146 %   M a g i c k T h r e s h o l d I m a g e                                   %
11147 %                                                                             %
11148 %                                                                             %
11149 %                                                                             %
11150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11151 %
11152 %  MagickThresholdImage() changes the value of individual pixels based on
11153 %  the intensity of each pixel compared to threshold.  The result is a
11154 %  high-contrast, two color image.
11155 %
11156 %  The format of the MagickThresholdImage method is:
11157 %
11158 %      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11159 %        const double threshold)
11160 %      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11161 %        const ChannelType channel,const double threshold)
11162 %
11163 %  A description of each parameter follows:
11164 %
11165 %    o wand: the magick wand.
11166 %
11167 %    o channel: the image channel(s).
11168 %
11169 %    o threshold: Define the threshold value.
11170 %
11171 */
11172 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11173   const double threshold)
11174 {
11175   MagickBooleanType
11176     status;
11177
11178   status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11179   return(status);
11180 }
11181
11182 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11183   const ChannelType channel,const double threshold)
11184 {
11185   MagickBooleanType
11186     status;
11187
11188   assert(wand != (MagickWand *) NULL);
11189   assert(wand->signature == WandSignature);
11190   if (wand->debug != MagickFalse)
11191     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11192   if (wand->images == (Image *) NULL)
11193     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11194   status=BilevelImage(wand->images,threshold,wand->exception);
11195   return(status);
11196 }
11197 \f
11198 /*
11199 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11200 %                                                                             %
11201 %                                                                             %
11202 %                                                                             %
11203 %   M a g i c k T h u m b n a i l I m a g e                                   %
11204 %                                                                             %
11205 %                                                                             %
11206 %                                                                             %
11207 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11208 %
11209 %  MagickThumbnailImage()  changes the size of an image to the given dimensions
11210 %  and removes any associated profiles.  The goal is to produce small low cost
11211 %  thumbnail images suited for display on the Web.
11212 %
11213 %  The format of the MagickThumbnailImage method is:
11214 %
11215 %      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11216 %        const size_t columns,const size_t rows)
11217 %
11218 %  A description of each parameter follows:
11219 %
11220 %    o wand: the magick wand.
11221 %
11222 %    o columns: the number of columns in the scaled image.
11223 %
11224 %    o rows: the number of rows in the scaled image.
11225 %
11226 */
11227 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11228   const size_t columns,const size_t rows)
11229 {
11230   Image
11231     *thumbnail_image;
11232
11233   assert(wand != (MagickWand *) NULL);
11234   assert(wand->signature == WandSignature);
11235   if (wand->debug != MagickFalse)
11236     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11237   if (wand->images == (Image *) NULL)
11238     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11239   thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11240   if (thumbnail_image == (Image *) NULL)
11241     return(MagickFalse);
11242   ReplaceImageInList(&wand->images,thumbnail_image);
11243   return(MagickTrue);
11244 }
11245 \f
11246 /*
11247 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11248 %                                                                             %
11249 %                                                                             %
11250 %                                                                             %
11251 %   M a g i c k T i n t I m a g e                                             %
11252 %                                                                             %
11253 %                                                                             %
11254 %                                                                             %
11255 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11256 %
11257 %  MagickTintImage() applies a color vector to each pixel in the image.  The
11258 %  length of the vector is 0 for black and white and at its maximum for the
11259 %  midtones.  The vector weighting function is
11260 %  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11261 %
11262 %  The format of the MagickTintImage method is:
11263 %
11264 %      MagickBooleanType MagickTintImage(MagickWand *wand,
11265 %        const PixelWand *tint,const PixelWand *blend)
11266 %
11267 %  A description of each parameter follows:
11268 %
11269 %    o wand: the magick wand.
11270 %
11271 %    o tint: the tint pixel wand.
11272 %
11273 %    o alpha: the alpha pixel wand.
11274 %
11275 */
11276 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11277   const PixelWand *tint,const PixelWand *blend)
11278 {
11279   char
11280     percent_blend[MaxTextExtent];
11281
11282   Image
11283     *tint_image;
11284
11285   PixelInfo
11286     target;
11287
11288   assert(wand != (MagickWand *) NULL);
11289   assert(wand->signature == WandSignature);
11290   if (wand->debug != MagickFalse)
11291     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11292   if (wand->images == (Image *) NULL)
11293     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11294   if (wand->images->colorspace != CMYKColorspace)
11295     (void) FormatLocaleString(percent_blend,MaxTextExtent,
11296       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11297       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11298       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11299       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11300       PixelGetAlphaQuantum(blend)));
11301   else
11302     (void) FormatLocaleString(percent_blend,MaxTextExtent,
11303       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
11304       PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11305       PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11306       PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11307       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11308       PixelGetAlphaQuantum(blend)));
11309   target=PixelGetPixel(tint);
11310   tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
11311   if (tint_image == (Image *) NULL)
11312     return(MagickFalse);
11313   ReplaceImageInList(&wand->images,tint_image);
11314   return(MagickTrue);
11315 }
11316 \f
11317 /*
11318 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11319 %                                                                             %
11320 %                                                                             %
11321 %                                                                             %
11322 %   M a g i c k T r a n s f o r m I m a g e                                   %
11323 %                                                                             %
11324 %                                                                             %
11325 %                                                                             %
11326 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11327 %
11328 %  MagickTransformImage() is a convenience method that behaves like
11329 %  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11330 %  information as a region geometry specification.  If the operation fails,
11331 %  a NULL image handle is returned.
11332 %
11333 %  The format of the MagickTransformImage method is:
11334 %
11335 %      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11336 %        const char *geometry)
11337 %
11338 %  A description of each parameter follows:
11339 %
11340 %    o wand: the magick wand.
11341 %
11342 %    o crop: A crop geometry string.  This geometry defines a subregion of the
11343 %      image to crop.
11344 %
11345 %    o geometry: An image geometry string.  This geometry defines the final
11346 %      size of the image.
11347 %
11348 */
11349 WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11350   const char *crop,const char *geometry)
11351 {
11352   Image
11353     *transform_image;
11354
11355   MagickBooleanType
11356     status;
11357
11358   assert(wand != (MagickWand *) NULL);
11359   assert(wand->signature == WandSignature);
11360   if (wand->debug != MagickFalse)
11361     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11362   if (wand->images == (Image *) NULL)
11363     return((MagickWand *) NULL);
11364   transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11365   if (transform_image == (Image *) NULL)
11366     return((MagickWand *) NULL);
11367   status=TransformImage(&transform_image,crop,geometry,wand->exception);
11368   if (status == MagickFalse)
11369     {
11370       transform_image=DestroyImage(transform_image);
11371       return((MagickWand *) NULL);
11372     }
11373   return(CloneMagickWandFromImages(wand,transform_image));
11374 }
11375 \f
11376 /*
11377 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11378 %                                                                             %
11379 %                                                                             %
11380 %                                                                             %
11381 %   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               %
11382 %                                                                             %
11383 %                                                                             %
11384 %                                                                             %
11385 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11386 %
11387 %  MagickTransformImageColorspace() transform the image colorspace.
11388 %
11389 %  The format of the MagickTransformImageColorspace method is:
11390 %
11391 %      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11392 %        const ColorspaceType colorspace)
11393 %
11394 %  A description of each parameter follows:
11395 %
11396 %    o wand: the magick wand.
11397 %
11398 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
11399 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
11400 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
11401 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
11402 %      HSLColorspace, or HWBColorspace.
11403 %
11404 */
11405 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11406   const ColorspaceType colorspace)
11407 {
11408   assert(wand != (MagickWand *) NULL);
11409   assert(wand->signature == WandSignature);
11410   if (wand->debug != MagickFalse)
11411     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11412   if (wand->images == (Image *) NULL)
11413     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11414   return(TransformImageColorspace(wand->images,colorspace,wand->exception));
11415 }
11416 \f
11417 /*
11418 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11419 %                                                                             %
11420 %                                                                             %
11421 %                                                                             %
11422 %   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                     %
11423 %                                                                             %
11424 %                                                                             %
11425 %                                                                             %
11426 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11427 %
11428 %  MagickTransparentPaintImage() changes any pixel that matches color with the
11429 %  color defined by fill.
11430 %
11431 %  The format of the MagickTransparentPaintImage method is:
11432 %
11433 %      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11434 %        const PixelWand *target,const double alpha,const double fuzz,
11435 %        const MagickBooleanType invert)
11436 %
11437 %  A description of each parameter follows:
11438 %
11439 %    o wand: the magick wand.
11440 %
11441 %    o target: Change this target color to specified alpha value within
11442 %      the image.
11443 %
11444 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11445 %      transparent.
11446 %
11447 %    o fuzz: By default target must match a particular pixel color
11448 %      exactly.  However, in many cases two colors may differ by a small amount.
11449 %      The fuzz member of image defines how much tolerance is acceptable to
11450 %      consider two colors as the same.  For example, set fuzz to 10 and the
11451 %      color red at intensities of 100 and 102 respectively are now interpreted
11452 %      as the same color for the purposes of the floodfill.
11453 %
11454 %    o invert: paint any pixel that does not match the target color.
11455 %
11456 */
11457 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11458   const PixelWand *target,const double alpha,const double fuzz,
11459   const MagickBooleanType invert)
11460 {
11461   MagickBooleanType
11462     status;
11463
11464   PixelInfo
11465     target_pixel;
11466
11467   assert(wand != (MagickWand *) NULL);
11468   assert(wand->signature == WandSignature);
11469   if (wand->debug != MagickFalse)
11470     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11471   if (wand->images == (Image *) NULL)
11472     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11473   PixelGetMagickColor(target,&target_pixel);
11474   wand->images->fuzz=fuzz;
11475   status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11476     QuantumRange*alpha),invert,wand->exception);
11477   return(status);
11478 }
11479 \f
11480 /*
11481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11482 %                                                                             %
11483 %                                                                             %
11484 %                                                                             %
11485 %   M a g i c k T r a n s p o s e I m a g e                                   %
11486 %                                                                             %
11487 %                                                                             %
11488 %                                                                             %
11489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11490 %
11491 %  MagickTransposeImage() creates a vertical mirror image by reflecting the
11492 %  pixels around the central x-axis while rotating them 90-degrees.
11493 %
11494 %  The format of the MagickTransposeImage method is:
11495 %
11496 %      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11497 %
11498 %  A description of each parameter follows:
11499 %
11500 %    o wand: the magick wand.
11501 %
11502 */
11503 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11504 {
11505   Image
11506     *transpose_image;
11507
11508   assert(wand != (MagickWand *) NULL);
11509   assert(wand->signature == WandSignature);
11510   if (wand->debug != MagickFalse)
11511     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11512   if (wand->images == (Image *) NULL)
11513     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11514   transpose_image=TransposeImage(wand->images,wand->exception);
11515   if (transpose_image == (Image *) NULL)
11516     return(MagickFalse);
11517   ReplaceImageInList(&wand->images,transpose_image);
11518   return(MagickTrue);
11519 }
11520 \f
11521 /*
11522 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11523 %                                                                             %
11524 %                                                                             %
11525 %                                                                             %
11526 %   M a g i c k T r a n s v e r s e I m a g e                                 %
11527 %                                                                             %
11528 %                                                                             %
11529 %                                                                             %
11530 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11531 %
11532 %  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11533 %  pixels around the central y-axis while rotating them 270-degrees.
11534 %
11535 %  The format of the MagickTransverseImage method is:
11536 %
11537 %      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11538 %
11539 %  A description of each parameter follows:
11540 %
11541 %    o wand: the magick wand.
11542 %
11543 */
11544 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11545 {
11546   Image
11547     *transverse_image;
11548
11549   assert(wand != (MagickWand *) NULL);
11550   assert(wand->signature == WandSignature);
11551   if (wand->debug != MagickFalse)
11552     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11553   if (wand->images == (Image *) NULL)
11554     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11555   transverse_image=TransverseImage(wand->images,wand->exception);
11556   if (transverse_image == (Image *) NULL)
11557     return(MagickFalse);
11558   ReplaceImageInList(&wand->images,transverse_image);
11559   return(MagickTrue);
11560 }
11561 \f
11562 /*
11563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11564 %                                                                             %
11565 %                                                                             %
11566 %                                                                             %
11567 %   M a g i c k T r i m I m a g e                                             %
11568 %                                                                             %
11569 %                                                                             %
11570 %                                                                             %
11571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11572 %
11573 %  MagickTrimImage() remove edges that are the background color from the image.
11574 %
11575 %  The format of the MagickTrimImage method is:
11576 %
11577 %      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11578 %
11579 %  A description of each parameter follows:
11580 %
11581 %    o wand: the magick wand.
11582 %
11583 %    o fuzz: By default target must match a particular pixel color
11584 %      exactly.  However, in many cases two colors may differ by a small amount.
11585 %      The fuzz member of image defines how much tolerance is acceptable to
11586 %      consider two colors as the same.  For example, set fuzz to 10 and the
11587 %      color red at intensities of 100 and 102 respectively are now interpreted
11588 %      as the same color for the purposes of the floodfill.
11589 %
11590 */
11591 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11592 {
11593   Image
11594     *trim_image;
11595
11596   assert(wand != (MagickWand *) NULL);
11597   assert(wand->signature == WandSignature);
11598   if (wand->debug != MagickFalse)
11599     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11600   if (wand->images == (Image *) NULL)
11601     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11602   wand->images->fuzz=fuzz;
11603   trim_image=TrimImage(wand->images,wand->exception);
11604   if (trim_image == (Image *) NULL)
11605     return(MagickFalse);
11606   ReplaceImageInList(&wand->images,trim_image);
11607   return(MagickTrue);
11608 }
11609 \f
11610 /*
11611 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11612 %                                                                             %
11613 %                                                                             %
11614 %                                                                             %
11615 %   M a g i c k U n i q u e I m a g e C o l o r s                             %
11616 %                                                                             %
11617 %                                                                             %
11618 %                                                                             %
11619 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11620 %
11621 %  MagickUniqueImageColors() discards all but one of any pixel color.
11622 %
11623 %  The format of the MagickUniqueImageColors method is:
11624 %
11625 %      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11626 %
11627 %  A description of each parameter follows:
11628 %
11629 %    o wand: the magick wand.
11630 %
11631 */
11632 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11633 {
11634   Image
11635     *unique_image;
11636
11637   assert(wand != (MagickWand *) NULL);
11638   assert(wand->signature == WandSignature);
11639   if (wand->debug != MagickFalse)
11640     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11641   if (wand->images == (Image *) NULL)
11642     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11643   unique_image=UniqueImageColors(wand->images,wand->exception);
11644   if (unique_image == (Image *) NULL)
11645     return(MagickFalse);
11646   ReplaceImageInList(&wand->images,unique_image);
11647   return(MagickTrue);
11648 }
11649 \f
11650 /*
11651 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11652 %                                                                             %
11653 %                                                                             %
11654 %                                                                             %
11655 %   M a g i c k U n s h a r p M a s k I m a g e                               %
11656 %                                                                             %
11657 %                                                                             %
11658 %                                                                             %
11659 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11660 %
11661 %  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
11662 %  Gaussian operator of the given radius and standard deviation (sigma).
11663 %  For reasonable results, radius should be larger than sigma.  Use a radius
11664 %  of 0 and UnsharpMaskImage() selects a suitable radius for you.
11665 %
11666 %  The format of the MagickUnsharpMaskImage method is:
11667 %
11668 %      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11669 %        const double radius,const double sigma,const double amount,
11670 %        const double threshold)
11671 %
11672 %  A description of each parameter follows:
11673 %
11674 %    o wand: the magick wand.
11675 %
11676 %    o radius: the radius of the Gaussian, in pixels, not counting the center
11677 %      pixel.
11678 %
11679 %    o sigma: the standard deviation of the Gaussian, in pixels.
11680 %
11681 %    o amount: the percentage of the difference between the original and the
11682 %      blur image that is added back into the original.
11683 %
11684 %    o threshold: the threshold in pixels needed to apply the diffence amount.
11685 %
11686 */
11687 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11688   const double radius,const double sigma,const double amount,
11689   const double threshold)
11690 {
11691   Image
11692     *unsharp_image;
11693
11694   assert(wand != (MagickWand *) NULL);
11695   assert(wand->signature == WandSignature);
11696   if (wand->debug != MagickFalse)
11697     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11698   if (wand->images == (Image *) NULL)
11699     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11700   unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
11701     wand->exception);
11702   if (unsharp_image == (Image *) NULL)
11703     return(MagickFalse);
11704   ReplaceImageInList(&wand->images,unsharp_image);
11705   return(MagickTrue);
11706 }
11707 \f
11708 /*
11709 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11710 %                                                                             %
11711 %                                                                             %
11712 %                                                                             %
11713 %   M a g i c k V i g n e t t e I m a g e                                     %
11714 %                                                                             %
11715 %                                                                             %
11716 %                                                                             %
11717 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11718 %
11719 %  MagickVignetteImage() softens the edges of the image in vignette style.
11720 %
11721 %  The format of the MagickVignetteImage method is:
11722 %
11723 %      MagickBooleanType MagickVignetteImage(MagickWand *wand,
11724 %        const double radius,const double sigma,const double bias,
11725 %        const ssize_t x,const ssize_t y)
11726 %
11727 %  A description of each parameter follows:
11728 %
11729 %    o wand: the magick wand.
11730 %
11731 %    o radius: the radius.
11732 %
11733 %    o sigma: the sigma.
11734 %
11735 %    o bias: the bias.
11736 %
11737 %    o x, y:  Define the x and y ellipse offset.
11738 %
11739 */
11740 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
11741   const double radius,const double sigma,const double bias,const ssize_t x,
11742   const ssize_t y)
11743 {
11744   Image
11745     *vignette_image;
11746
11747   assert(wand != (MagickWand *) NULL);
11748   assert(wand->signature == WandSignature);
11749   if (wand->debug != MagickFalse)
11750     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11751   if (wand->images == (Image *) NULL)
11752     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11753   vignette_image=VignetteImage(wand->images,radius,sigma,bias,x,y,
11754     wand->exception);
11755   if (vignette_image == (Image *) NULL)
11756     return(MagickFalse);
11757   ReplaceImageInList(&wand->images,vignette_image);
11758   return(MagickTrue);
11759 }
11760 \f
11761 /*
11762 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11763 %                                                                             %
11764 %                                                                             %
11765 %                                                                             %
11766 %   M a g i c k W a v e I m a g e                                             %
11767 %                                                                             %
11768 %                                                                             %
11769 %                                                                             %
11770 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11771 %
11772 %  MagickWaveImage()  creates a "ripple" effect in the image by shifting
11773 %  the pixels vertically along a sine wave whose amplitude and wavelength
11774 %  is specified by the given parameters.
11775 %
11776 %  The format of the MagickWaveImage method is:
11777 %
11778 %      MagickBooleanType MagickWaveImage(MagickWand *wand,
11779 %        const double amplitude,const double wave_length,
11780 %        const PixelInterpolateMethod method)
11781 %
11782 %  A description of each parameter follows:
11783 %
11784 %    o wand: the magick wand.
11785 %
11786 %    o amplitude, wave_length:  Define the amplitude and wave length of the
11787 %      sine wave.
11788 %
11789 %    o method: the pixel interpolation method.
11790 %
11791 */
11792 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
11793   const double amplitude,const double wave_length,
11794   const PixelInterpolateMethod method)
11795 {
11796   Image
11797     *wave_image;
11798
11799   assert(wand != (MagickWand *) NULL);
11800   assert(wand->signature == WandSignature);
11801   if (wand->debug != MagickFalse)
11802     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11803   if (wand->images == (Image *) NULL)
11804     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11805   wave_image=WaveImage(wand->images,amplitude,wave_length,method,
11806     wand->exception);
11807   if (wave_image == (Image *) NULL)
11808     return(MagickFalse);
11809   ReplaceImageInList(&wand->images,wave_image);
11810   return(MagickTrue);
11811 }
11812 \f
11813 /*
11814 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11815 %                                                                             %
11816 %                                                                             %
11817 %                                                                             %
11818 %   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                         %
11819 %                                                                             %
11820 %                                                                             %
11821 %                                                                             %
11822 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11823 %
11824 %  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
11825 %  above the threshold into white while leaving all pixels below the threshold
11826 %  unchanged.
11827 %
11828 %  The format of the MagickWhiteThresholdImage method is:
11829 %
11830 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11831 %        const PixelWand *threshold)
11832 %
11833 %  A description of each parameter follows:
11834 %
11835 %    o wand: the magick wand.
11836 %
11837 %    o threshold: the pixel wand.
11838 %
11839 */
11840 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11841   const PixelWand *threshold)
11842 {
11843   char
11844     thresholds[MaxTextExtent];
11845
11846   assert(wand != (MagickWand *) NULL);
11847   assert(wand->signature == WandSignature);
11848   if (wand->debug != MagickFalse)
11849     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11850   if (wand->images == (Image *) NULL)
11851     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11852   (void) FormatLocaleString(thresholds,MaxTextExtent,
11853     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
11854     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
11855     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
11856   return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
11857 }
11858 \f
11859 /*
11860 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11861 %                                                                             %
11862 %                                                                             %
11863 %                                                                             %
11864 %   M a g i c k W r i t e I m a g e                                           %
11865 %                                                                             %
11866 %                                                                             %
11867 %                                                                             %
11868 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11869 %
11870 %  MagickWriteImage() writes an image to the specified filename.  If the
11871 %  filename parameter is NULL, the image is written to the filename set
11872 %  by MagickReadImage() or MagickSetImageFilename().
11873 %
11874 %  The format of the MagickWriteImage method is:
11875 %
11876 %      MagickBooleanType MagickWriteImage(MagickWand *wand,
11877 %        const char *filename)
11878 %
11879 %  A description of each parameter follows:
11880 %
11881 %    o wand: the magick wand.
11882 %
11883 %    o filename: the image filename.
11884 %
11885 %
11886 */
11887 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
11888   const char *filename)
11889 {
11890   Image
11891     *image;
11892
11893   ImageInfo
11894     *write_info;
11895
11896   MagickBooleanType
11897     status;
11898
11899   assert(wand != (MagickWand *) NULL);
11900   assert(wand->signature == WandSignature);
11901   if (wand->debug != MagickFalse)
11902     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11903   if (wand->images == (Image *) NULL)
11904     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11905   if (filename != (const char *) NULL)
11906     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
11907   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11908   if (image == (Image *) NULL)
11909     return(MagickFalse);
11910   write_info=CloneImageInfo(wand->image_info);
11911   write_info->adjoin=MagickTrue;
11912   status=WriteImage(write_info,image,wand->exception);
11913   image=DestroyImage(image);
11914   write_info=DestroyImageInfo(write_info);
11915   return(status);
11916 }
11917 \f
11918 /*
11919 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11920 %                                                                             %
11921 %                                                                             %
11922 %                                                                             %
11923 %   M a g i c k W r i t e I m a g e F i l e                                   %
11924 %                                                                             %
11925 %                                                                             %
11926 %                                                                             %
11927 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11928 %
11929 %  MagickWriteImageFile() writes an image to an open file descriptor.
11930 %
11931 %  The format of the MagickWriteImageFile method is:
11932 %
11933 %      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11934 %
11935 %  A description of each parameter follows:
11936 %
11937 %    o wand: the magick wand.
11938 %
11939 %    o file: the file descriptor.
11940 %
11941 */
11942 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
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   assert(file != (FILE *) NULL);
11956   if (wand->debug != MagickFalse)
11957     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11958   if (wand->images == (Image *) NULL)
11959     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11960   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11961   if (image == (Image *) NULL)
11962     return(MagickFalse);
11963   write_info=CloneImageInfo(wand->image_info);
11964   SetImageInfoFile(write_info,file);
11965   write_info->adjoin=MagickTrue;
11966   status=WriteImage(write_info,image,wand->exception);
11967   write_info=DestroyImageInfo(write_info);
11968   image=DestroyImage(image);
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 s                                         %
11978 %                                                                             %
11979 %                                                                             %
11980 %                                                                             %
11981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11982 %
11983 %  MagickWriteImages() writes an image or image sequence.
11984 %
11985 %  The format of the MagickWriteImages method is:
11986 %
11987 %      MagickBooleanType MagickWriteImages(MagickWand *wand,
11988 %        const char *filename,const MagickBooleanType adjoin)
11989 %
11990 %  A description of each parameter follows:
11991 %
11992 %    o wand: the magick wand.
11993 %
11994 %    o filename: the image filename.
11995 %
11996 %    o adjoin: join images into a single multi-image file.
11997 %
11998 */
11999 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12000   const char *filename,const MagickBooleanType adjoin)
12001 {
12002   ImageInfo
12003     *write_info;
12004
12005   MagickBooleanType
12006     status;
12007
12008   assert(wand != (MagickWand *) NULL);
12009   assert(wand->signature == WandSignature);
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   write_info=CloneImageInfo(wand->image_info);
12015   write_info->adjoin=adjoin;
12016   status=WriteImages(write_info,wand->images,filename,wand->exception);
12017   write_info=DestroyImageInfo(write_info);
12018   return(status);
12019 }
12020 \f
12021 /*
12022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12023 %                                                                             %
12024 %                                                                             %
12025 %                                                                             %
12026 %   M a g i c k W r i t e I m a g e s F i l e                                 %
12027 %                                                                             %
12028 %                                                                             %
12029 %                                                                             %
12030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12031 %
12032 %  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12033 %
12034 %  The format of the MagickWriteImagesFile method is:
12035 %
12036 %      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12037 %
12038 %  A description of each parameter follows:
12039 %
12040 %    o wand: the magick wand.
12041 %
12042 %    o file: the file descriptor.
12043 %
12044 */
12045 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12046 {
12047   ImageInfo
12048     *write_info;
12049
12050   MagickBooleanType
12051     status;
12052
12053   assert(wand != (MagickWand *) NULL);
12054   assert(wand->signature == WandSignature);
12055   if (wand->debug != MagickFalse)
12056     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12057   if (wand->images == (Image *) NULL)
12058     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12059   write_info=CloneImageInfo(wand->image_info);
12060   SetImageInfoFile(write_info,file);
12061   write_info->adjoin=MagickTrue;
12062   status=WriteImages(write_info,wand->images,(const char *) NULL,
12063     wand->exception);
12064   write_info=DestroyImageInfo(write_info);
12065   return(status);
12066 }