]> 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 %                                    Cristy                                   %
23 %                                 August 2003                                 %
24 %                                                                             %
25 %                                                                             %
26 %  Copyright 1999-2014 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 #include "MagickCore/image-private.h"
55 \f
56 /*
57   Define declarations.
58 */
59 #define MagickWandId  "MagickWand"
60 \f
61 /*
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 %                                                                             %
64 %                                                                             %
65 %                                                                             %
66 +   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                         %
67 %                                                                             %
68 %                                                                             %
69 %                                                                             %
70 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71 %
72 %  CloneMagickWandFromImages() clones the magick wand and inserts a new image
73 %  list.
74 %
75 %  The format of the CloneMagickWandFromImages method is:
76 %
77 %      MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
78 %        Image *images)
79 %
80 %  A description of each parameter follows:
81 %
82 %    o wand: the magick wand.
83 %
84 %    o images: replace the image list with these image(s).
85 %
86 */
87 static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
88   Image *images)
89 {
90   MagickWand
91     *clone_wand;
92
93   assert(wand != (MagickWand *) NULL);
94   assert(wand->signature == WandSignature);
95   if (IfMagickTrue(wand->debug))
96     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
97   clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
98   if (clone_wand == (MagickWand *) NULL)
99     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
100       images->filename);
101   (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
102   clone_wand->id=AcquireWandId();
103   (void) FormatLocaleString(clone_wand->name,MaxTextExtent,"%s-%.20g",
104     MagickWandId,(double) clone_wand->id);
105   clone_wand->exception=AcquireExceptionInfo();
106   InheritException(clone_wand->exception,wand->exception);
107   clone_wand->image_info=CloneImageInfo(wand->image_info);
108   clone_wand->images=images;
109   clone_wand->debug=IsEventLogging();
110   clone_wand->signature=WandSignature;
111   if (IfMagickTrue(clone_wand->debug))
112     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
113   return(clone_wand);
114 }
115 \f
116 /*
117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
118 %                                                                             %
119 %                                                                             %
120 %                                                                             %
121 %   G e t I m a g e F r o m M a g i c k W a n d                               %
122 %                                                                             %
123 %                                                                             %
124 %                                                                             %
125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
126 %
127 %  GetImageFromMagickWand() returns the current image from the magick wand.
128 %
129 %  The format of the GetImageFromMagickWand method is:
130 %
131 %      Image *GetImageFromMagickWand(const MagickWand *wand)
132 %
133 %  A description of each parameter follows:
134 %
135 %    o wand: the magick wand.
136 %
137 */
138 WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
139 {
140   assert(wand != (MagickWand *) NULL);
141   assert(wand->signature == WandSignature);
142   if (IfMagickTrue(wand->debug))
143     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
144   if (wand->images == (Image *) NULL)
145     {
146       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
147         "ContainsNoImages","`%s'",wand->name);
148       return((Image *) NULL);
149     }
150   return(wand->images);
151 }
152 \f
153 /*
154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
155 %                                                                             %
156 %                                                                             %
157 %                                                                             %
158 %   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                       %
159 %                                                                             %
160 %                                                                             %
161 %                                                                             %
162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
163 %
164 %  MagickAdaptiveBlurImage() adaptively blurs the image by blurring
165 %  less intensely near image edges and more intensely far from edges. We
166 %  blur the image with a Gaussian operator of the given radius and standard
167 %  deviation (sigma).  For reasonable results, radius should be larger than
168 %  sigma.  Use a radius of 0 and MagickAdaptiveBlurImage() selects a
169 %  suitable radius for you.
170 %
171 %  The format of the MagickAdaptiveBlurImage method is:
172 %
173 %      MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
174 %        const double radius,const double sigma)
175 %
176 %  A description of each parameter follows:
177 %
178 %    o wand: the magick wand.
179 %
180 %    o radius: the radius of the Gaussian, in pixels, not counting the center
181 %      pixel.
182 %
183 %    o sigma: the standard deviation of the Gaussian, in pixels.
184 %
185 */
186 WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
187   const double radius,const double sigma)
188 {
189   Image
190     *sharp_image;
191
192   assert(wand != (MagickWand *) NULL);
193   assert(wand->signature == WandSignature);
194   if (IfMagickTrue(wand->debug))
195     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
196   if (wand->images == (Image *) NULL)
197     ThrowWandException(WandError,"ContainsNoImages",wand->name);
198   sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,wand->exception);
199   if (sharp_image == (Image *) NULL)
200     return(MagickFalse);
201   ReplaceImageInList(&wand->images,sharp_image);
202   return(MagickTrue);
203 }
204 \f
205 /*
206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
207 %                                                                             %
208 %                                                                             %
209 %                                                                             %
210 %   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                         %
211 %                                                                             %
212 %                                                                             %
213 %                                                                             %
214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
215 %
216 %  MagickAdaptiveResizeImage() adaptively resize image with data dependent
217 %  triangulation.
218 %
219 %      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
220 %        const size_t columns,const size_t rows)
221 %
222 %  A description of each parameter follows:
223 %
224 %    o wand: the magick wand.
225 %
226 %    o columns: the number of columns in the scaled image.
227 %
228 %    o rows: the number of rows in the scaled image.
229 %
230 */
231 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
232   const size_t columns,const size_t rows)
233 {
234   Image
235     *resize_image;
236
237   assert(wand != (MagickWand *) NULL);
238   assert(wand->signature == WandSignature);
239   if (IfMagickTrue(wand->debug))
240     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
241   if (wand->images == (Image *) NULL)
242     ThrowWandException(WandError,"ContainsNoImages",wand->name);
243   resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
244   if (resize_image == (Image *) NULL)
245     return(MagickFalse);
246   ReplaceImageInList(&wand->images,resize_image);
247   return(MagickTrue);
248 }
249 \f
250 /*
251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
252 %                                                                             %
253 %                                                                             %
254 %                                                                             %
255 %   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                       %
256 %                                                                             %
257 %                                                                             %
258 %                                                                             %
259 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
260 %
261 %  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
262 %  more intensely near image edges and less intensely far from edges. We
263 %  sharpen the image with a Gaussian operator of the given radius and standard
264 %  deviation (sigma).  For reasonable results, radius should be larger than
265 %  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
266 %  suitable radius for you.
267 %
268 %  The format of the MagickAdaptiveSharpenImage method is:
269 %
270 %      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
271 %        const double radius,const double sigma)
272 %
273 %  A description of each parameter follows:
274 %
275 %    o wand: the magick wand.
276 %
277 %    o radius: the radius of the Gaussian, in pixels, not counting the center
278 %      pixel.
279 %
280 %    o sigma: the standard deviation of the Gaussian, in pixels.
281 %
282 */
283 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
284   const double radius,const double sigma)
285 {
286   Image
287     *sharp_image;
288
289   assert(wand != (MagickWand *) NULL);
290   assert(wand->signature == WandSignature);
291   if (IfMagickTrue(wand->debug))
292     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
293   if (wand->images == (Image *) NULL)
294     ThrowWandException(WandError,"ContainsNoImages",wand->name);
295   sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,wand->exception);
296   if (sharp_image == (Image *) NULL)
297     return(MagickFalse);
298   ReplaceImageInList(&wand->images,sharp_image);
299   return(MagickTrue);
300 }
301 \f
302 /*
303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
304 %                                                                             %
305 %                                                                             %
306 %                                                                             %
307 %   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                   %
308 %                                                                             %
309 %                                                                             %
310 %                                                                             %
311 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
312 %
313 %  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
314 %  based on the range of intensity values in its local neighborhood.  This
315 %  allows for thresholding of an image whose global intensity histogram
316 %  doesn't contain distinctive peaks.
317 %
318 %  The format of the AdaptiveThresholdImage method is:
319 %
320 %      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
321 %        const size_t width,const size_t height,const double bias)
322 %
323 %  A description of each parameter follows:
324 %
325 %    o wand: the magick wand.
326 %
327 %    o width: the width of the local neighborhood.
328 %
329 %    o height: the height of the local neighborhood.
330 %
331 %    o offset: the mean bias.
332 %
333 */
334 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
335   const size_t width,const size_t height,const double bias)
336 {
337   Image
338     *threshold_image;
339
340   assert(wand != (MagickWand *) NULL);
341   assert(wand->signature == WandSignature);
342   if (IfMagickTrue(wand->debug))
343     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
344   if (wand->images == (Image *) NULL)
345     ThrowWandException(WandError,"ContainsNoImages",wand->name);
346   threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
347     wand->exception);
348   if (threshold_image == (Image *) NULL)
349     return(MagickFalse);
350   ReplaceImageInList(&wand->images,threshold_image);
351   return(MagickTrue);
352 }
353 \f
354 /*
355 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
356 %                                                                             %
357 %                                                                             %
358 %                                                                             %
359 %   M a g i c k A d d I m a g e                                               %
360 %                                                                             %
361 %                                                                             %
362 %                                                                             %
363 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
364 %
365 %  MagickAddImage() adds a clone of the images from the second wand and
366 %  inserts them into the first wand.
367 %
368 %  Use MagickSetLastIterator(), to append new images into an existing wand,
369 %  current image will be set to last image so later adds with also be
370 %  appened to end of wand.
371 %
372 %  Use MagickSetFirstIterator() to prepend new images into wand, any more
373 %  images added will also be prepended before other images in the wand.
374 %  However the order of a list of new images will not change.
375 %
376 %  Otherwise the new images will be inserted just after the current image,
377 %  and any later image will also be added after this current image but
378 %  before the previously added images.  Caution is advised when multiple
379 %  image adds are inserted into the middle of the wand image list.
380 %
381 %  The format of the MagickAddImage method is:
382 %
383 %      MagickBooleanType MagickAddImage(MagickWand *wand,
384 %        const MagickWand *add_wand)
385 %
386 %  A description of each parameter follows:
387 %
388 %    o wand: the magick wand.
389 %
390 %    o add_wand: A wand that contains the image list to be added
391 %
392 */
393 static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
394   Image *images)
395 {
396   if (wand->images == (Image *) NULL)
397     {
398       /*
399         No images in wand, just add them, set current as appropriate.
400       */
401       if (IfMagickTrue(wand->insert_before))
402         wand->images=GetFirstImageInList(images);
403       else
404         wand->images=GetLastImageInList(images);
405       return(MagickTrue);
406     }
407   /* user jumped to first image, so prepend new images - remain active */
408   if (IfMagickTrue((wand->insert_before)) &&
409        (wand->images->previous == (Image *) NULL))
410     {
411       PrependImageToList(&wand->images,images);
412       wand->images=GetFirstImageInList(images);
413       return(MagickTrue);
414     }
415   /*
416     Note you should never have 'insert_before' true when current image is not
417     the first image in the wand!  That is no insert before current image, only
418     after current image
419   */
420   if (wand->images->next == (Image *) NULL)
421     {
422       /*
423         At last image, append new images.
424       */
425       InsertImageInList(&wand->images,images);
426       wand->images=GetLastImageInList(images);
427       return(MagickTrue);
428     }
429   /*
430     Insert new images, just after the current image.
431   */
432   InsertImageInList(&wand->images,images);
433   return(MagickTrue);
434 }
435
436 WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
437   const MagickWand *add_wand)
438 {
439   Image
440     *images;
441
442   assert(wand != (MagickWand *) NULL);
443   assert(wand->signature == WandSignature);
444   if (IfMagickTrue(wand->debug))
445     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
446   assert(add_wand != (MagickWand *) NULL);
447   assert(add_wand->signature == WandSignature);
448   if (add_wand->images == (Image *) NULL)
449     ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
450   /*
451     Clone images in second wand, and insert into first.
452   */
453   images=CloneImageList(add_wand->images,wand->exception);
454   if (images == (Image *) NULL)
455     return(MagickFalse);
456   return(InsertImageInWand(wand,images));
457 }
458 \f
459 /*
460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
461 %                                                                             %
462 %                                                                             %
463 %                                                                             %
464 %     M a g i c k A d d N o i s e I m a g e                                   %
465 %                                                                             %
466 %                                                                             %
467 %                                                                             %
468 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
469 %
470 %  MagickAddNoiseImage() adds random noise to the image.
471 %
472 %  The format of the MagickAddNoiseImage method is:
473 %
474 %      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
475 %        const NoiseType noise_type,const double attenuate)
476 %
477 %  A description of each parameter follows:
478 %
479 %    o wand: the magick wand.
480 %
481 %    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
482 %      Impulse, Laplacian, or Poisson.
483 %
484 %    o attenuate:  attenuate the random distribution.
485 %
486 */
487 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
488   const NoiseType noise_type,const double attenuate)
489 {
490   Image
491     *noise_image;
492
493   assert(wand != (MagickWand *) NULL);
494   assert(wand->signature == WandSignature);
495   if (IfMagickTrue(wand->debug))
496     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
497   if (wand->images == (Image *) NULL)
498     ThrowWandException(WandError,"ContainsNoImages",wand->name);
499   noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
500   if (noise_image == (Image *) NULL)
501     return(MagickFalse);
502   ReplaceImageInList(&wand->images,noise_image);
503   return(MagickTrue);
504 }
505 \f
506 /*
507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
508 %                                                                             %
509 %                                                                             %
510 %                                                                             %
511 %   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                       %
512 %                                                                             %
513 %                                                                             %
514 %                                                                             %
515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
516 %
517 %  MagickAffineTransformImage() transforms an image as dictated by the affine
518 %  matrix of the drawing wand.
519 %
520 %  The format of the MagickAffineTransformImage method is:
521 %
522 %      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
523 %        const DrawingWand *drawing_wand)
524 %
525 %  A description of each parameter follows:
526 %
527 %    o wand: the magick wand.
528 %
529 %    o drawing_wand: the draw wand.
530 %
531 */
532 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
533   const DrawingWand *drawing_wand)
534 {
535   DrawInfo
536     *draw_info;
537
538   Image
539     *affine_image;
540
541   assert(wand != (MagickWand *) NULL);
542   assert(wand->signature == WandSignature);
543   if (IfMagickTrue(wand->debug))
544     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
545   if (wand->images == (Image *) NULL)
546     ThrowWandException(WandError,"ContainsNoImages",wand->name);
547   draw_info=PeekDrawingWand(drawing_wand);
548   if (draw_info == (DrawInfo *) NULL)
549     return(MagickFalse);
550   affine_image=AffineTransformImage(wand->images,&draw_info->affine,
551     wand->exception);
552   draw_info=DestroyDrawInfo(draw_info);
553   if (affine_image == (Image *) NULL)
554     return(MagickFalse);
555   ReplaceImageInList(&wand->images,affine_image);
556   return(MagickTrue);
557 }
558 \f
559 /*
560 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
561 %                                                                             %
562 %                                                                             %
563 %                                                                             %
564 %   M a g i c k A n n o t a t e I m a g e                                     %
565 %                                                                             %
566 %                                                                             %
567 %                                                                             %
568 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
569 %
570 %  MagickAnnotateImage() annotates an image with text.
571 %
572 %  The format of the MagickAnnotateImage method is:
573 %
574 %      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
575 %        const DrawingWand *drawing_wand,const double x,const double y,
576 %        const double angle,const char *text)
577 %
578 %  A description of each parameter follows:
579 %
580 %    o wand: the magick wand.
581 %
582 %    o drawing_wand: the draw wand.
583 %
584 %    o x: x ordinate to left of text
585 %
586 %    o y: y ordinate to text baseline
587 %
588 %    o angle: rotate text relative to this angle.
589 %
590 %    o text: text to draw
591 %
592 */
593 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
594   const DrawingWand *drawing_wand,const double x,const double y,
595   const double angle,const char *text)
596 {
597   char
598     geometry[MaxTextExtent];
599
600   DrawInfo
601     *draw_info;
602
603   MagickBooleanType
604     status;
605
606   assert(wand != (MagickWand *) NULL);
607   assert(wand->signature == WandSignature);
608   if (IfMagickTrue(wand->debug))
609     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
610   if (wand->images == (Image *) NULL)
611     ThrowWandException(WandError,"ContainsNoImages",wand->name);
612   draw_info=PeekDrawingWand(drawing_wand);
613   if (draw_info == (DrawInfo *) NULL)
614     return(MagickFalse);
615   (void) CloneString(&draw_info->text,text);
616   (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",x,y);
617   draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0)));
618   draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0)));
619   draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0))));
620   draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0)));
621   (void) CloneString(&draw_info->geometry,geometry);
622   status=AnnotateImage(wand->images,draw_info,wand->exception);
623   draw_info=DestroyDrawInfo(draw_info);
624   return(status);
625 }
626 \f
627 /*
628 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
629 %                                                                             %
630 %                                                                             %
631 %                                                                             %
632 %   M a g i c k A n i m a t e I m a g e s                                     %
633 %                                                                             %
634 %                                                                             %
635 %                                                                             %
636 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
637 %
638 %  MagickAnimateImages() animates an image or image sequence.
639 %
640 %  The format of the MagickAnimateImages method is:
641 %
642 %      MagickBooleanType MagickAnimateImages(MagickWand *wand,
643 %        const char *server_name)
644 %
645 %  A description of each parameter follows:
646 %
647 %    o wand: the magick wand.
648 %
649 %    o server_name: the X server name.
650 %
651 */
652 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
653   const char *server_name)
654 {
655   MagickBooleanType
656     status;
657
658   assert(wand != (MagickWand *) NULL);
659   assert(wand->signature == WandSignature);
660   if (IfMagickTrue(wand->debug))
661     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
662   (void) CloneString(&wand->image_info->server_name,server_name);
663   status=AnimateImages(wand->image_info,wand->images,wand->exception);
664   return(status);
665 }
666 \f
667 /*
668 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
669 %                                                                             %
670 %                                                                             %
671 %                                                                             %
672 %   M a g i c k A p p e n d I m a g e s                                       %
673 %                                                                             %
674 %                                                                             %
675 %                                                                             %
676 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
677 %
678 %  MagickAppendImages() append the images in a wand from the current image
679 %  onwards, creating a new wand with the single image result.  This is
680 %  affected by the gravity and background settings of the first image.
681 %
682 %  Typically you would call either MagickResetIterator() or
683 %  MagickSetFirstImage() before calling this function to ensure that all
684 %  the images in the wand's image list will be appended together.
685 %
686 %  The format of the MagickAppendImages method is:
687 %
688 %      MagickWand *MagickAppendImages(MagickWand *wand,
689 %        const MagickBooleanType stack)
690 %
691 %  A description of each parameter follows:
692 %
693 %    o wand: the magick wand.
694 %
695 %    o stack: By default, images are stacked left-to-right. Set stack to
696 %      MagickTrue to stack them top-to-bottom.
697 %
698 */
699 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
700   const MagickBooleanType stack)
701 {
702   Image
703     *append_image;
704
705   assert(wand != (MagickWand *) NULL);
706   assert(wand->signature == WandSignature);
707   if (IfMagickTrue(wand->debug))
708     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
709   if (wand->images == (Image *) NULL)
710     return((MagickWand *) NULL);
711   append_image=AppendImages(wand->images,stack,wand->exception);
712   if (append_image == (Image *) NULL)
713     return((MagickWand *) NULL);
714   return(CloneMagickWandFromImages(wand,append_image));
715 }
716 \f
717 /*
718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
719 %                                                                             %
720 %                                                                             %
721 %                                                                             %
722 %   M a g i c k A u t o G a m m a I m a g e                                   %
723 %                                                                             %
724 %                                                                             %
725 %                                                                             %
726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
727 %
728 %  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
729 %  image to try make set its gamma appropriatally.
730 %
731 %  The format of the MagickAutoGammaImage method is:
732 %
733 %      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
734 %
735 %  A description of each parameter follows:
736 %
737 %    o wand: the magick wand.
738 %
739 */
740 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
741 {
742   MagickBooleanType
743     status;
744
745   assert(wand != (MagickWand *) NULL);
746   assert(wand->signature == WandSignature);
747   if (IfMagickTrue(wand->debug))
748     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
749   if (wand->images == (Image *) NULL)
750     ThrowWandException(WandError,"ContainsNoImages",wand->name);
751   status=AutoGammaImage(wand->images,wand->exception);
752   return(status);
753 }
754 \f
755 /*
756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
757 %                                                                             %
758 %                                                                             %
759 %                                                                             %
760 %   M a g i c k A u t o L e v e l I m a g e                                   %
761 %                                                                             %
762 %                                                                             %
763 %                                                                             %
764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
765 %
766 %  MagickAutoLevelImage() adjusts the levels of a particular image channel by
767 %  scaling the minimum and maximum values to the full quantum range.
768 %
769 %  The format of the MagickAutoLevelImage method is:
770 %
771 %      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
772 %
773 %  A description of each parameter follows:
774 %
775 %    o wand: the magick wand.
776 %
777 */
778 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
779 {
780   MagickBooleanType
781     status;
782
783   assert(wand != (MagickWand *) NULL);
784   assert(wand->signature == WandSignature);
785   if (IfMagickTrue(wand->debug))
786     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
787   if (wand->images == (Image *) NULL)
788     ThrowWandException(WandError,"ContainsNoImages",wand->name);
789   status=AutoLevelImage(wand->images,wand->exception);
790   return(status);
791 }
792 \f
793 /*
794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
795 %                                                                             %
796 %                                                                             %
797 %                                                                             %
798 %   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                         %
799 %                                                                             %
800 %                                                                             %
801 %                                                                             %
802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
803 %
804 %  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
805 %  pixels below the threshold into black while leaving all pixels above the
806 %  threshold unchanged.
807 %
808 %  The format of the MagickBlackThresholdImage method is:
809 %
810 %      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
811 %        const PixelWand *threshold)
812 %
813 %  A description of each parameter follows:
814 %
815 %    o wand: the magick wand.
816 %
817 %    o threshold: the pixel wand.
818 %
819 */
820 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
821   const PixelWand *threshold)
822 {
823   char
824     thresholds[MaxTextExtent];
825
826   MagickBooleanType
827     status;
828
829   assert(wand != (MagickWand *) NULL);
830   assert(wand->signature == WandSignature);
831   if (IfMagickTrue(wand->debug))
832     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
833   if (wand->images == (Image *) NULL)
834     ThrowWandException(WandError,"ContainsNoImages",wand->name);
835   (void) FormatLocaleString(thresholds,MaxTextExtent,
836     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
837     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
838     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
839   status=BlackThresholdImage(wand->images,thresholds,wand->exception);
840   return(status);
841 }
842 \f
843 /*
844 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
845 %                                                                             %
846 %                                                                             %
847 %                                                                             %
848 %   M a g i c k B l u e S h i f t I m a g e                                   %
849 %                                                                             %
850 %                                                                             %
851 %                                                                             %
852 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
853 %
854 %  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
855 %  nighttime in the moonlight.
856 %
857 %  The format of the MagickBlueShiftImage method is:
858 %
859 %      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
860 %        const double factor)
861 %
862 %  A description of each parameter follows:
863 %
864 %    o wand: the magick wand.
865 %
866 %    o factor: the blue shift factor (default 1.5)
867 %
868 */
869 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
870   const double factor)
871 {
872   Image
873     *shift_image;
874
875   assert(wand != (MagickWand *) NULL);
876   assert(wand->signature == WandSignature);
877   if (IfMagickTrue(wand->debug))
878     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
879   if (wand->images == (Image *) NULL)
880     ThrowWandException(WandError,"ContainsNoImages",wand->name);
881   shift_image=BlueShiftImage(wand->images,factor,wand->exception);
882   if (shift_image == (Image *) NULL)
883     return(MagickFalse);
884   ReplaceImageInList(&wand->images,shift_image);
885   return(MagickTrue);
886 }
887 \f
888 /*
889 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
890 %                                                                             %
891 %                                                                             %
892 %                                                                             %
893 %   M a g i c k B l u r I m a g e                                             %
894 %                                                                             %
895 %                                                                             %
896 %                                                                             %
897 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
898 %
899 %  MagickBlurImage() blurs an image.  We convolve the image with a
900 %  gaussian operator of the given radius and standard deviation (sigma).
901 %  For reasonable results, the radius should be larger than sigma.  Use a
902 %  radius of 0 and BlurImage() selects a suitable radius for you.
903 %
904 %  The format of the MagickBlurImage method is:
905 %
906 %      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
907 %        const double sigma)
908 %
909 %  A description of each parameter follows:
910 %
911 %    o wand: the magick wand.
912 %
913 %    o radius: the radius of the , in pixels, not counting the center
914 %      pixel.
915 %
916 %    o sigma: the standard deviation of the , in pixels.
917 %
918 */
919 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
920   const double radius,const double sigma)
921 {
922   Image
923     *blur_image;
924
925   assert(wand != (MagickWand *) NULL);
926   assert(wand->signature == WandSignature);
927   if (IfMagickTrue(wand->debug))
928     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
929   if (wand->images == (Image *) NULL)
930     ThrowWandException(WandError,"ContainsNoImages",wand->name);
931   blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
932   if (blur_image == (Image *) NULL)
933     return(MagickFalse);
934   ReplaceImageInList(&wand->images,blur_image);
935   return(MagickTrue);
936 }
937 \f
938 /*
939 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
940 %                                                                             %
941 %                                                                             %
942 %                                                                             %
943 %   M a g i c k B o r d e r I m a g e                                         %
944 %                                                                             %
945 %                                                                             %
946 %                                                                             %
947 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
948 %
949 %  MagickBorderImage() surrounds the image with a border of the color defined
950 %  by the bordercolor pixel wand.
951 %
952 %  The format of the MagickBorderImage method is:
953 %
954 %      MagickBooleanType MagickBorderImage(MagickWand *wand,
955 %        const PixelWand *bordercolor,const size_t width,
956 %        const size_t height,const CompositeOperator compose)
957 %
958 %  A description of each parameter follows:
959 %
960 %    o wand: the magick wand.
961 %
962 %    o bordercolor: the border color pixel wand.
963 %
964 %    o width: the border width.
965 %
966 %    o height: the border height.
967 %
968 %    o compose: the composite operator.
969 %
970 */
971 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
972   const PixelWand *bordercolor,const size_t width,const size_t height,
973   const CompositeOperator compose)
974 {
975   Image
976     *border_image;
977
978   RectangleInfo
979     border_info;
980
981   assert(wand != (MagickWand *) NULL);
982   assert(wand->signature == WandSignature);
983   if (IfMagickTrue(wand->debug))
984     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
985   if (wand->images == (Image *) NULL)
986     ThrowWandException(WandError,"ContainsNoImages",wand->name);
987   border_info.width=width;
988   border_info.height=height;
989   border_info.x=0;
990   border_info.y=0;
991   PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
992   border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
993   if (border_image == (Image *) NULL)
994     return(MagickFalse);
995   ReplaceImageInList(&wand->images,border_image);
996   return(MagickTrue);
997 }
998 \f
999 /*
1000 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1001 %                                                                             %
1002 %                                                                             %
1003 %                                                                             %
1004 %   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   %
1005 %                                                                             %
1006 %                                                                             %
1007 %                                                                             %
1008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1009 %
1010 %  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1011 %  of an image.  It converts the brightness and contrast parameters into slope
1012 %  and intercept and calls a polynomical function to apply to the image.
1013
1014 %
1015 %  The format of the MagickBrightnessContrastImage method is:
1016 %
1017 %      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1018 %        const double brightness,const double contrast)
1019 %
1020 %  A description of each parameter follows:
1021 %
1022 %    o wand: the magick wand.
1023 %
1024 %    o brightness: the brightness percent (-100 .. 100).
1025 %
1026 %    o contrast: the contrast percent (-100 .. 100).
1027 %
1028 */
1029 WandExport MagickBooleanType MagickBrightnessContrastImage(
1030   MagickWand *wand,const double brightness,const double contrast)
1031 {
1032   MagickBooleanType
1033     status;
1034
1035   assert(wand != (MagickWand *) NULL);
1036   assert(wand->signature == WandSignature);
1037   if (IfMagickTrue(wand->debug))
1038     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1039   if (wand->images == (Image *) NULL)
1040     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1041   status=BrightnessContrastImage(wand->images,brightness,contrast,
1042     wand->exception);
1043   return(status);
1044 }
1045 \f
1046 /*
1047 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1048 %                                                                             %
1049 %                                                                             %
1050 %                                                                             %
1051 %   M a g i c k C h a n n e l F x I m a g e                                   %
1052 %                                                                             %
1053 %                                                                             %
1054 %                                                                             %
1055 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1056 %
1057 %  MagickChannelFxImage() applies a channel expression to the specified image.
1058 %  The expression consists of one or more channels, either mnemonic or numeric
1059 %  (e.g. red, 1), separated by actions as follows:
1060 %
1061 %    <=>     exchange two channels (e.g. red<=>blue)
1062 %    =>      transfer a channel to another (e.g. red=>green)
1063 %    ,       separate channel operations (e.g. red, green)
1064 %    |       read channels from next input image (e.g. red | green)
1065 %    ;       write channels to next output image (e.g. red; green; blue)
1066 %
1067 %  A channel without a operation symbol implies extract. For example, to create
1068 %  3 grayscale images from the red, green, and blue channels of an image, use:
1069 %
1070 %    -channel-fx "red; green; blue"
1071 %
1072 %  The format of the MagickChannelFxImage method is:
1073 %
1074 %      MagickWand *MagickChannelFxImage(MagickWand *wand,const char *expression)
1075 %
1076 %  A description of each parameter follows:
1077 %
1078 %    o wand: the magick wand.
1079 %
1080 %    o expression: the expression.
1081 %
1082 */
1083 WandExport MagickWand *MagickChannelFxImage(MagickWand *wand,
1084   const char *expression)
1085 {
1086   Image
1087     *fx_image;
1088
1089   assert(wand != (MagickWand *) NULL);
1090   assert(wand->signature == WandSignature);
1091   if (IfMagickTrue(wand->debug))
1092     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1093   if (wand->images == (Image *) NULL)
1094     return((MagickWand *) NULL);
1095   fx_image=ChannelFxImage(wand->images,expression,wand->exception);
1096   if (fx_image == (Image *) NULL)
1097     return((MagickWand *) NULL);
1098   return(CloneMagickWandFromImages(wand,fx_image));
1099 }
1100 \f
1101 /*
1102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1103 %                                                                             %
1104 %                                                                             %
1105 %                                                                             %
1106 %   M a g i c k C h a r c o a l I m a g e                                     %
1107 %                                                                             %
1108 %                                                                             %
1109 %                                                                             %
1110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1111 %
1112 %  MagickCharcoalImage() simulates a charcoal drawing.
1113 %
1114 %  The format of the MagickCharcoalImage method is:
1115 %
1116 %      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1117 %        const double radius,const double sigma)
1118 %
1119 %  A description of each parameter follows:
1120 %
1121 %    o wand: the magick wand.
1122 %
1123 %    o radius: the radius of the Gaussian, in pixels, not counting the center
1124 %      pixel.
1125 %
1126 %    o sigma: the standard deviation of the Gaussian, in pixels.
1127 %
1128 */
1129 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1130   const double radius,const double sigma)
1131 {
1132   Image
1133     *charcoal_image;
1134
1135   assert(wand != (MagickWand *) NULL);
1136   assert(wand->signature == WandSignature);
1137   if (IfMagickTrue(wand->debug))
1138     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1139   if (wand->images == (Image *) NULL)
1140     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1141   charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1142   if (charcoal_image == (Image *) NULL)
1143     return(MagickFalse);
1144   ReplaceImageInList(&wand->images,charcoal_image);
1145   return(MagickTrue);
1146 }
1147 \f
1148 /*
1149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1150 %                                                                             %
1151 %                                                                             %
1152 %                                                                             %
1153 %   M a g i c k C h o p I m a g e                                             %
1154 %                                                                             %
1155 %                                                                             %
1156 %                                                                             %
1157 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1158 %
1159 %  MagickChopImage() removes a region of an image and collapses the image to
1160 %  occupy the removed portion
1161 %
1162 %  The format of the MagickChopImage method is:
1163 %
1164 %      MagickBooleanType MagickChopImage(MagickWand *wand,
1165 %        const size_t width,const size_t height,const ssize_t x,
1166 %        const ssize_t y)
1167 %
1168 %  A description of each parameter follows:
1169 %
1170 %    o wand: the magick wand.
1171 %
1172 %    o width: the region width.
1173 %
1174 %    o height: the region height.
1175 %
1176 %    o x: the region x offset.
1177 %
1178 %    o y: the region y offset.
1179 %
1180 %
1181 */
1182 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1183   const size_t width,const size_t height,const ssize_t x,
1184   const ssize_t y)
1185 {
1186   Image
1187     *chop_image;
1188
1189   RectangleInfo
1190     chop;
1191
1192   assert(wand != (MagickWand *) NULL);
1193   assert(wand->signature == WandSignature);
1194   if (IfMagickTrue(wand->debug))
1195     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1196   if (wand->images == (Image *) NULL)
1197     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1198   chop.width=width;
1199   chop.height=height;
1200   chop.x=x;
1201   chop.y=y;
1202   chop_image=ChopImage(wand->images,&chop,wand->exception);
1203   if (chop_image == (Image *) NULL)
1204     return(MagickFalse);
1205   ReplaceImageInList(&wand->images,chop_image);
1206   return(MagickTrue);
1207 }
1208 \f
1209 /*
1210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1211 %                                                                             %
1212 %                                                                             %
1213 %                                                                             %
1214 %   M a g i c k C l a m p I m a g e                                           %
1215 %                                                                             %
1216 %                                                                             %
1217 %                                                                             %
1218 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1219 %
1220 %  MagickClampImage() restricts the color range from 0 to the quantum depth.
1221 %
1222 %  The format of the MagickClampImage method is:
1223 %
1224 %      MagickBooleanType MagickClampImage(MagickWand *wand)
1225 %
1226 %  A description of each parameter follows:
1227 %
1228 %    o wand: the magick wand.
1229 %
1230 %    o channel: the channel.
1231 %
1232 */
1233 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1234 {
1235   assert(wand != (MagickWand *) NULL);
1236   assert(wand->signature == WandSignature);
1237   if (IfMagickTrue(wand->debug))
1238     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1239   if (wand->images == (Image *) NULL)
1240     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1241   return(ClampImage(wand->images,wand->exception));
1242 }
1243 \f
1244 /*
1245 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1246 %                                                                             %
1247 %                                                                             %
1248 %                                                                             %
1249 %   M a g i c k C l i p I m a g e                                             %
1250 %                                                                             %
1251 %                                                                             %
1252 %                                                                             %
1253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1254 %
1255 %  MagickClipImage() clips along the first path from the 8BIM profile, if
1256 %  present.
1257 %
1258 %  The format of the MagickClipImage method is:
1259 %
1260 %      MagickBooleanType MagickClipImage(MagickWand *wand)
1261 %
1262 %  A description of each parameter follows:
1263 %
1264 %    o wand: the magick wand.
1265 %
1266 */
1267 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1268 {
1269   MagickBooleanType
1270     status;
1271
1272   assert(wand != (MagickWand *) NULL);
1273   assert(wand->signature == WandSignature);
1274   if (IfMagickTrue(wand->debug))
1275     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1276   if (wand->images == (Image *) NULL)
1277     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1278   status=ClipImage(wand->images,wand->exception);
1279   return(status);
1280 }
1281 \f
1282 /*
1283 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1284 %                                                                             %
1285 %                                                                             %
1286 %                                                                             %
1287 %   M a g i c k C l i p I m a g e P a t h                                     %
1288 %                                                                             %
1289 %                                                                             %
1290 %                                                                             %
1291 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1292 %
1293 %  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1294 %  present. Later operations take effect inside the path.  Id may be a number
1295 %  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1296 %  path.
1297 %
1298 %  The format of the MagickClipImagePath method is:
1299 %
1300 %      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1301 %        const char *pathname,const MagickBooleanType inside)
1302 %
1303 %  A description of each parameter follows:
1304 %
1305 %    o wand: the magick wand.
1306 %
1307 %    o pathname: name of clipping path resource. If name is preceded by #, use
1308 %      clipping path numbered by name.
1309 %
1310 %    o inside: if non-zero, later operations take effect inside clipping path.
1311 %      Otherwise later operations take effect outside clipping path.
1312 %
1313 */
1314 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1315   const char *pathname,const MagickBooleanType inside)
1316 {
1317   MagickBooleanType
1318     status;
1319
1320   assert(wand != (MagickWand *) NULL);
1321   assert(wand->signature == WandSignature);
1322   if (IfMagickTrue(wand->debug))
1323     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1324   if (wand->images == (Image *) NULL)
1325     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1326   status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1327   return(status);
1328 }
1329 \f
1330 /*
1331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1332 %                                                                             %
1333 %                                                                             %
1334 %                                                                             %
1335 %   M a g i c k C l u t I m a g e                                             %
1336 %                                                                             %
1337 %                                                                             %
1338 %                                                                             %
1339 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1340 %
1341 %  MagickClutImage() replaces colors in the image from a color lookup table.
1342 %
1343 %  The format of the MagickClutImage method is:
1344 %
1345 %      MagickBooleanType MagickClutImage(MagickWand *wand,
1346 %        const MagickWand *clut_wand,const PixelInterpolateMethod method)
1347 %
1348 %  A description of each parameter follows:
1349 %
1350 %    o wand: the magick wand.
1351 %
1352 %    o clut_image: the clut image.
1353 %
1354 %    o method: the pixel interpolation method.
1355 %
1356 */
1357 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1358   const MagickWand *clut_wand,const PixelInterpolateMethod method)
1359 {
1360   MagickBooleanType
1361     status;
1362
1363   assert(wand != (MagickWand *) NULL);
1364   assert(wand->signature == WandSignature);
1365   if (IfMagickTrue(wand->debug))
1366     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1367   if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1368     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1369   status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1370   return(status);
1371 }
1372 \f
1373 /*
1374 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1375 %                                                                             %
1376 %                                                                             %
1377 %                                                                             %
1378 %   M a g i c k C o a l e s c e I m a g e s                                   %
1379 %                                                                             %
1380 %                                                                             %
1381 %                                                                             %
1382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1383 %
1384 %  MagickCoalesceImages() composites a set of images while respecting any page
1385 %  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1386 %  typically start with an image background and each subsequent image
1387 %  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1388 %  where each image in the sequence is the same size as the first and
1389 %  composited with the next image in the sequence.
1390 %
1391 %  The format of the MagickCoalesceImages method is:
1392 %
1393 %      MagickWand *MagickCoalesceImages(MagickWand *wand)
1394 %
1395 %  A description of each parameter follows:
1396 %
1397 %    o wand: the magick wand.
1398 %
1399 */
1400 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1401 {
1402   Image
1403     *coalesce_image;
1404
1405   assert(wand != (MagickWand *) NULL);
1406   assert(wand->signature == WandSignature);
1407   if (IfMagickTrue(wand->debug))
1408     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1409   if (wand->images == (Image *) NULL)
1410     return((MagickWand *) NULL);
1411   coalesce_image=CoalesceImages(wand->images,wand->exception);
1412   if (coalesce_image == (Image *) NULL)
1413     return((MagickWand *) NULL);
1414   return(CloneMagickWandFromImages(wand,coalesce_image));
1415 }
1416 \f
1417 /*
1418 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1419 %                                                                             %
1420 %                                                                             %
1421 %                                                                             %
1422 %   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1423 %                                                                             %
1424 %                                                                             %
1425 %                                                                             %
1426 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1427 %
1428 %  MagickColorDecisionListImage() accepts a lightweight Color Correction
1429 %  Collection (CCC) file which solely contains one or more color corrections
1430 %  and applies the color correction to the image.  Here is a sample CCC file:
1431 %
1432 %    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1433 %          <ColorCorrection id="cc03345">
1434 %                <SOPNode>
1435 %                     <Slope> 0.9 1.2 0.5 </Slope>
1436 %                     <Offset> 0.4 -0.5 0.6 </Offset>
1437 %                     <Power> 1.0 0.8 1.5 </Power>
1438 %                </SOPNode>
1439 %                <SATNode>
1440 %                     <Saturation> 0.85 </Saturation>
1441 %                </SATNode>
1442 %          </ColorCorrection>
1443 %    </ColorCorrectionCollection>
1444 %
1445 %  which includes the offset, slope, and power for each of the RGB channels
1446 %  as well as the saturation.
1447 %
1448 %  The format of the MagickColorDecisionListImage method is:
1449 %
1450 %      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1451 %        const char *color_correction_collection)
1452 %
1453 %  A description of each parameter follows:
1454 %
1455 %    o wand: the magick wand.
1456 %
1457 %    o color_correction_collection: the color correction collection in XML.
1458 %
1459 */
1460 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1461   const char *color_correction_collection)
1462 {
1463   MagickBooleanType
1464     status;
1465
1466   assert(wand != (MagickWand *) NULL);
1467   assert(wand->signature == WandSignature);
1468   if (IfMagickTrue(wand->debug))
1469     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1470   if (wand->images == (Image *) NULL)
1471     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1472   status=ColorDecisionListImage(wand->images,color_correction_collection,
1473     wand->exception);
1474   return(status);
1475 }
1476 \f
1477 /*
1478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1479 %                                                                             %
1480 %                                                                             %
1481 %                                                                             %
1482 %   M a g i c k C o l o r i z e I m a g e                                     %
1483 %                                                                             %
1484 %                                                                             %
1485 %                                                                             %
1486 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1487 %
1488 %  MagickColorizeImage() blends the fill color with each pixel in the image.
1489 %
1490 %  The format of the MagickColorizeImage method is:
1491 %
1492 %      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1493 %        const PixelWand *colorize,const PixelWand *blend)
1494 %
1495 %  A description of each parameter follows:
1496 %
1497 %    o wand: the magick wand.
1498 %
1499 %    o colorize: the colorize pixel wand.
1500 %
1501 %    o alpha: the alpha pixel wand.
1502 %
1503 */
1504 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1505   const PixelWand *colorize,const PixelWand *blend)
1506 {
1507   char
1508     percent_blend[MaxTextExtent];
1509
1510   Image
1511     *colorize_image;
1512
1513   PixelInfo
1514     target;
1515
1516   assert(wand != (MagickWand *) NULL);
1517   assert(wand->signature == WandSignature);
1518   if (IfMagickTrue(wand->debug))
1519     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1520   if (wand->images == (Image *) NULL)
1521     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1522   GetPixelInfo(wand->images,&target);
1523   if (target.colorspace != CMYKColorspace)
1524     (void) FormatLocaleString(percent_blend,MaxTextExtent,
1525       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1526       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1527       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1528       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1529       PixelGetAlphaQuantum(blend)));
1530   else
1531     (void) FormatLocaleString(percent_blend,MaxTextExtent,
1532       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1533       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1534       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1535       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1536       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1537       PixelGetAlphaQuantum(blend)));
1538   target=PixelGetPixel(colorize);
1539   colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1540     wand->exception);
1541   if (colorize_image == (Image *) NULL)
1542     return(MagickFalse);
1543   ReplaceImageInList(&wand->images,colorize_image);
1544   return(MagickTrue);
1545 }
1546 \f
1547 /*
1548 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1549 %                                                                             %
1550 %                                                                             %
1551 %                                                                             %
1552 %   M a g i c k C o l o r M a t r i x I m a g e                               %
1553 %                                                                             %
1554 %                                                                             %
1555 %                                                                             %
1556 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1557 %
1558 %  MagickColorMatrixImage() apply color transformation to an image. The method
1559 %  permits saturation changes, hue rotation, luminance to alpha, and various
1560 %  other effects.  Although variable-sized transformation matrices can be used,
1561 %  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1562 %  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1563 %  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1564 %  and offsets are normalized (divide Flash offset by 255).
1565 %
1566 %  The format of the MagickColorMatrixImage method is:
1567 %
1568 %      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1569 %        const KernelInfo *color_matrix)
1570 %
1571 %  A description of each parameter follows:
1572 %
1573 %    o wand: the magick wand.
1574 %
1575 %    o color_matrix:  the color matrix.
1576 %
1577 */
1578 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1579   const KernelInfo *color_matrix)
1580 {
1581   Image
1582     *color_image;
1583
1584   assert(wand != (MagickWand *) NULL);
1585   assert(wand->signature == WandSignature);
1586   if (IfMagickTrue(wand->debug))
1587     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1588   if (color_matrix == (const KernelInfo *) NULL)
1589     return(MagickFalse);
1590   if (wand->images == (Image *) NULL)
1591     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1592   color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1593   if (color_image == (Image *) NULL)
1594     return(MagickFalse);
1595   ReplaceImageInList(&wand->images,color_image);
1596   return(MagickTrue);
1597 }
1598 \f
1599 /*
1600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1601 %                                                                             %
1602 %                                                                             %
1603 %                                                                             %
1604 %   M a g i c k C o m b i n e I m a g e s                                     %
1605 %                                                                             %
1606 %                                                                             %
1607 %                                                                             %
1608 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1609 %
1610 %  MagickCombineImages() combines one or more images into a single image.  The
1611 %  grayscale value of the pixels of each image in the sequence is assigned in
1612 %  order to the specified  hannels of the combined image.   The typical
1613 %  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1614 %
1615 %  The format of the MagickCombineImages method is:
1616 %
1617 %      MagickWand *MagickCombineImages(MagickWand *wand,
1618 %        const ColorspaceType colorspace)
1619 %
1620 %  A description of each parameter follows:
1621 %
1622 %    o wand: the magick wand.
1623 %
1624 %    o colorspace: the colorspace.
1625 %
1626 */
1627 WandExport MagickWand *MagickCombineImages(MagickWand *wand,
1628   const ColorspaceType colorspace)
1629 {
1630   Image
1631     *combine_image;
1632
1633   assert(wand != (MagickWand *) NULL);
1634   assert(wand->signature == WandSignature);
1635   if (IfMagickTrue(wand->debug))
1636     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1637   if (wand->images == (Image *) NULL)
1638     return((MagickWand *) NULL);
1639   combine_image=CombineImages(wand->images,colorspace,wand->exception);
1640   if (combine_image == (Image *) NULL)
1641     return((MagickWand *) NULL);
1642   return(CloneMagickWandFromImages(wand,combine_image));
1643 }
1644 \f
1645 /*
1646 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1647 %                                                                             %
1648 %                                                                             %
1649 %                                                                             %
1650 %   M a g i c k C o m m e n t I m a g e                                       %
1651 %                                                                             %
1652 %                                                                             %
1653 %                                                                             %
1654 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1655 %
1656 %  MagickCommentImage() adds a comment to your image.
1657 %
1658 %  The format of the MagickCommentImage method is:
1659 %
1660 %      MagickBooleanType MagickCommentImage(MagickWand *wand,
1661 %        const char *comment)
1662 %
1663 %  A description of each parameter follows:
1664 %
1665 %    o wand: the magick wand.
1666 %
1667 %    o comment: the image comment.
1668 %
1669 */
1670 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1671   const char *comment)
1672 {
1673   MagickBooleanType
1674     status;
1675
1676   assert(wand != (MagickWand *) NULL);
1677   assert(wand->signature == WandSignature);
1678   if (IfMagickTrue(wand->debug))
1679     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1680   if (wand->images == (Image *) NULL)
1681     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1682   status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1683   return(status);
1684 }
1685 \f
1686 /*
1687 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1688 %                                                                             %
1689 %                                                                             %
1690 %                                                                             %
1691 %   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1692 %                                                                             %
1693 %                                                                             %
1694 %                                                                             %
1695 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1696 %
1697 %  MagickCompareImagesLayers() compares each image with the next in a sequence
1698 %  and returns the maximum bounding region of any pixel differences it
1699 %  discovers.
1700 %
1701 %  The format of the MagickCompareImagesLayers method is:
1702 %
1703 %      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1704 %        const LayerMethod method)
1705 %
1706 %  A description of each parameter follows:
1707 %
1708 %    o wand: the magick wand.
1709 %
1710 %    o method: the compare method.
1711 %
1712 */
1713 WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1714   const LayerMethod method)
1715 {
1716   Image
1717     *layers_image;
1718
1719   assert(wand != (MagickWand *) NULL);
1720   assert(wand->signature == WandSignature);
1721   if (IfMagickTrue(wand->debug))
1722     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1723   if (wand->images == (Image *) NULL)
1724     return((MagickWand *) NULL);
1725   layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1726   if (layers_image == (Image *) NULL)
1727     return((MagickWand *) NULL);
1728   return(CloneMagickWandFromImages(wand,layers_image));
1729 }
1730 \f
1731 /*
1732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1733 %                                                                             %
1734 %                                                                             %
1735 %                                                                             %
1736 %   M a g i c k C o m p a r e I m a g e s                                     %
1737 %                                                                             %
1738 %                                                                             %
1739 %                                                                             %
1740 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1741 %
1742 %  MagickCompareImages() compares an image to a reconstructed image and returns
1743 %  the specified difference image.
1744 %
1745 %  The format of the MagickCompareImages method is:
1746 %
1747 %      MagickWand *MagickCompareImages(MagickWand *wand,
1748 %        const MagickWand *reference,const MetricType metric,
1749 %        double *distortion)
1750 %
1751 %  A description of each parameter follows:
1752 %
1753 %    o wand: the magick wand.
1754 %
1755 %    o reference: the reference wand.
1756 %
1757 %    o metric: the metric.
1758 %
1759 %    o distortion: the computed distortion between the images.
1760 %
1761 */
1762 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1763   const MagickWand *reference,const MetricType metric,double *distortion)
1764 {
1765   Image
1766     *compare_image;
1767
1768
1769   assert(wand != (MagickWand *) NULL);
1770   assert(wand->signature == WandSignature);
1771   if (IfMagickTrue(wand->debug))
1772     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1773   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1774     {
1775       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1776         "ContainsNoImages","`%s'",wand->name);
1777       return((MagickWand *) NULL);
1778     }
1779   compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1780     wand->exception);
1781   if (compare_image == (Image *) NULL)
1782     return((MagickWand *) NULL);
1783   return(CloneMagickWandFromImages(wand,compare_image));
1784 }
1785 \f
1786 /*
1787 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1788 %                                                                             %
1789 %                                                                             %
1790 %                                                                             %
1791 %   M a g i c k C o m p o s i t e I m a g e                                   %
1792 %                                                                             %
1793 %                                                                             %
1794 %                                                                             %
1795 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1796 %
1797 %  MagickCompositeImage() composite one image onto another at the specified
1798 %  offset.
1799 %
1800 %  The format of the MagickCompositeImage method is:
1801 %
1802 %      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1803 %        const MagickWand *source_wand,const CompositeOperator compose,
1804 %        const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1805 %
1806 %  A description of each parameter follows:
1807 %
1808 %    o wand: the magick wand holding the destination images
1809 %
1810 %    o source_image: the magick wand holding source image.
1811 %
1812 %    o compose: This operator affects how the composite is applied to the
1813 %      image.  The default is Over.  These are some of the compose methods
1814 %      availble.
1815 %
1816 %        OverCompositeOp       InCompositeOp         OutCompositeOp
1817 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1818 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1819 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1820 %        DisplaceCompositeOp
1821 %
1822 %    o clip_to_self: set to MagickTrue to limit composition to area composed.
1823 %
1824 %    o x: the column offset of the composited image.
1825 %
1826 %    o y: the row offset of the composited image.
1827 %
1828 */
1829 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1830   const MagickWand *source_wand,const CompositeOperator compose,
1831   const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1832 {
1833   MagickBooleanType
1834     status;
1835
1836   assert(wand != (MagickWand *) NULL);
1837   assert(wand->signature == WandSignature);
1838   if (IfMagickTrue(wand->debug))
1839     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1840   if ((wand->images == (Image *) NULL) ||
1841       (source_wand->images == (Image *) NULL))
1842     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1843   status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self,
1844     x,y,wand->exception);
1845   return(status);
1846 }
1847 \f
1848 /*
1849 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1850 %                                                                             %
1851 %                                                                             %
1852 %                                                                             %
1853 %   M a g i c k C o m p o s i t e L a y e r s                                 %
1854 %                                                                             %
1855 %                                                                             %
1856 %                                                                             %
1857 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1858 %
1859 %  MagickCompositeLayers() composite the images in the source wand over the
1860 %  images in the destination wand in sequence, starting with the current
1861 %  image in both lists.
1862 %
1863 %  Each layer from the two image lists are composted together until the end of
1864 %  one of the image lists is reached.  The offset of each composition is also
1865 %  adjusted to match the virtual canvas offsets of each layer. As such the
1866 %  given offset is relative to the virtual canvas, and not the actual image.
1867 %
1868 %  Composition uses given x and y offsets, as the 'origin' location of the
1869 %  source images virtual canvas (not the real image) allowing you to compose a
1870 %  list of 'layer images' into the destiantioni images.  This makes it well
1871 %  sutiable for directly composing 'Clears Frame Animations' or 'Coaleased
1872 %  Animations' onto a static or other 'Coaleased Animation' destination image
1873 %  list.  GIF disposal handling is not looked at.
1874 %
1875 %  Special case:- If one of the image sequences is the last image (just a
1876 %  single image remaining), that image is repeatally composed with all the
1877 %  images in the other image list.  Either the source or destination lists may
1878 %  be the single image, for this situation.
1879 %
1880 %  In the case of a single destination image (or last image given), that image
1881 %  will ve cloned to match the number of images remaining in the source image
1882 %  list.
1883 %
1884 %  This is equivelent to the "-layer Composite" Shell API operator.
1885 %
1886 %  The format of the MagickCompositeLayers method is:
1887 %
1888 %      MagickBooleanType MagickCompositeLayers(MagickWand *wand,
1889 %        const MagickWand *source_wand, const CompositeOperator compose,
1890 %        const ssize_t x,const ssize_t y)
1891 %
1892 %  A description of each parameter follows:
1893 %
1894 %    o wand: the magick wand holding destaintion images
1895 %
1896 %    o source_wand: the wand holding the source images
1897 %
1898 %    o compose, x, y:  composition arguments
1899 %
1900 */
1901 WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand,
1902   const MagickWand *source_wand,const CompositeOperator compose,
1903   const ssize_t x,const ssize_t y)
1904 {
1905   MagickBooleanType
1906     status;
1907
1908   assert(wand != (MagickWand *) NULL);
1909   assert(wand->signature == WandSignature);
1910   if (IfMagickTrue(wand->debug))
1911     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1912   if ((wand->images == (Image *) NULL) ||
1913       (source_wand->images == (Image *) NULL))
1914     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1915   CompositeLayers(wand->images,compose,source_wand->images,x,y,wand->exception);
1916   status=MagickTrue;  /* FUTURE: determine status from exceptions */
1917   return(status);
1918 }
1919 \f
1920 /*
1921 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1922 %                                                                             %
1923 %                                                                             %
1924 %                                                                             %
1925 %   M a g i c k C o n t r a s t I m a g e                                     %
1926 %                                                                             %
1927 %                                                                             %
1928 %                                                                             %
1929 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1930 %
1931 %  MagickContrastImage() enhances the intensity differences between the lighter
1932 %  and darker elements of the image.  Set sharpen to a value other than 0 to
1933 %  increase the image contrast otherwise the contrast is reduced.
1934 %
1935 %  The format of the MagickContrastImage method is:
1936 %
1937 %      MagickBooleanType MagickContrastImage(MagickWand *wand,
1938 %        const MagickBooleanType sharpen)
1939 %
1940 %  A description of each parameter follows:
1941 %
1942 %    o wand: the magick wand.
1943 %
1944 %    o sharpen: Increase or decrease image contrast.
1945 %
1946 %
1947 */
1948 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1949   const MagickBooleanType sharpen)
1950 {
1951   MagickBooleanType
1952     status;
1953
1954   assert(wand != (MagickWand *) NULL);
1955   assert(wand->signature == WandSignature);
1956   if (IfMagickTrue(wand->debug))
1957     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1958   if (wand->images == (Image *) NULL)
1959     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1960   status=ContrastImage(wand->images,sharpen,wand->exception);
1961   return(status);
1962 }
1963 \f
1964 /*
1965 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1966 %                                                                             %
1967 %                                                                             %
1968 %                                                                             %
1969 %   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                       %
1970 %                                                                             %
1971 %                                                                             %
1972 %                                                                             %
1973 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1974 %
1975 %  MagickContrastStretchImage() enhances the contrast of a color image by
1976 %  adjusting the pixels color to span the entire range of colors available.
1977 %  You can also reduce the influence of a particular channel with a gamma
1978 %  value of 0.
1979 %
1980 %  The format of the MagickContrastStretchImage method is:
1981 %
1982 %      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1983 %        const double black_point,const double white_point)
1984 %
1985 %  A description of each parameter follows:
1986 %
1987 %    o wand: the magick wand.
1988 %
1989 %    o black_point: the black point.
1990 %
1991 %    o white_point: the white point.
1992 %
1993 */
1994 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1995   const double black_point,const double white_point)
1996 {
1997   MagickBooleanType
1998     status;
1999
2000   assert(wand != (MagickWand *) NULL);
2001   assert(wand->signature == WandSignature);
2002   if (IfMagickTrue(wand->debug))
2003     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2004   if (wand->images == (Image *) NULL)
2005     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2006   status=ContrastStretchImage(wand->images,black_point,white_point,
2007     wand->exception);
2008   return(status);
2009 }
2010 \f
2011 /*
2012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2013 %                                                                             %
2014 %                                                                             %
2015 %                                                                             %
2016 %   M a g i c k C o n v o l v e I m a g e                                     %
2017 %                                                                             %
2018 %                                                                             %
2019 %                                                                             %
2020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2021 %
2022 %  MagickConvolveImage() applies a custom convolution kernel to the image.
2023 %
2024 %  The format of the MagickConvolveImage method is:
2025 %
2026 %      MagickBooleanType MagickConvolveImage(MagickWand *wand,
2027 %        const KernelInfo *kernel)
2028 %
2029 %  A description of each parameter follows:
2030 %
2031 %    o wand: the magick wand.
2032 %
2033 %    o kernel: An array of doubles representing the convolution kernel.
2034 %
2035 */
2036 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2037   const KernelInfo *kernel)
2038 {
2039   Image
2040     *filter_image;
2041
2042   assert(wand != (MagickWand *) NULL);
2043   assert(wand->signature == WandSignature);
2044   if (IfMagickTrue(wand->debug))
2045     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2046   if (kernel == (const KernelInfo *) NULL)
2047     return(MagickFalse);
2048   if (wand->images == (Image *) NULL)
2049     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2050   filter_image=ConvolveImage(wand->images,kernel,wand->exception);
2051   if (filter_image == (Image *) NULL)
2052     return(MagickFalse);
2053   ReplaceImageInList(&wand->images,filter_image);
2054   return(MagickTrue);
2055 }
2056 \f
2057 /*
2058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2059 %                                                                             %
2060 %                                                                             %
2061 %                                                                             %
2062 %   M a g i c k C r o p I m a g e                                             %
2063 %                                                                             %
2064 %                                                                             %
2065 %                                                                             %
2066 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2067 %
2068 %  MagickCropImage() extracts a region of the image.
2069 %
2070 %  The format of the MagickCropImage method is:
2071 %
2072 %      MagickBooleanType MagickCropImage(MagickWand *wand,
2073 %        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2074 %
2075 %  A description of each parameter follows:
2076 %
2077 %    o wand: the magick wand.
2078 %
2079 %    o width: the region width.
2080 %
2081 %    o height: the region height.
2082 %
2083 %    o x: the region x-offset.
2084 %
2085 %    o y: the region y-offset.
2086 %
2087 */
2088 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2089   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2090 {
2091   Image
2092     *crop_image;
2093
2094   RectangleInfo
2095     crop;
2096
2097   assert(wand != (MagickWand *) NULL);
2098   assert(wand->signature == WandSignature);
2099   if (IfMagickTrue(wand->debug))
2100     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2101   if (wand->images == (Image *) NULL)
2102     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2103   crop.width=width;
2104   crop.height=height;
2105   crop.x=x;
2106   crop.y=y;
2107   crop_image=CropImage(wand->images,&crop,wand->exception);
2108   if (crop_image == (Image *) NULL)
2109     return(MagickFalse);
2110   ReplaceImageInList(&wand->images,crop_image);
2111   return(MagickTrue);
2112 }
2113 \f
2114 /*
2115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2116 %                                                                             %
2117 %                                                                             %
2118 %                                                                             %
2119 %   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2120 %                                                                             %
2121 %                                                                             %
2122 %                                                                             %
2123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2124 %
2125 %  MagickCycleColormapImage() displaces an image's colormap by a given number
2126 %  of positions.  If you cycle the colormap a number of times you can produce
2127 %  a psychodelic effect.
2128 %
2129 %  The format of the MagickCycleColormapImage method is:
2130 %
2131 %      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2132 %        const ssize_t displace)
2133 %
2134 %  A description of each parameter follows:
2135 %
2136 %    o wand: the magick wand.
2137 %
2138 %    o pixel_wand: the pixel wand.
2139 %
2140 */
2141 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2142   const ssize_t displace)
2143 {
2144   MagickBooleanType
2145     status;
2146
2147   assert(wand != (MagickWand *) NULL);
2148   assert(wand->signature == WandSignature);
2149   if (IfMagickTrue(wand->debug))
2150     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2151   if (wand->images == (Image *) NULL)
2152     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2153   status=CycleColormapImage(wand->images,displace,wand->exception);
2154   return(status);
2155 }
2156 \f
2157 /*
2158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2159 %                                                                             %
2160 %                                                                             %
2161 %                                                                             %
2162 %   M a g i c k C o n s t i t u t e I m a g e                                 %
2163 %                                                                             %
2164 %                                                                             %
2165 %                                                                             %
2166 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2167 %
2168 %  MagickConstituteImage() adds an image to the wand comprised of the pixel
2169 %  data you supply.  The pixel data must be in scanline order top-to-bottom.
2170 %  The data can be char, short int, int, float, or double.  Float and double
2171 %  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2172 %  is the maximum value the type can accomodate (e.g. 255 for char).  For
2173 %  example, to create a 640x480 image from unsigned red-green-blue character
2174 %  data, use
2175 %
2176 %      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2177 %
2178 %  The format of the MagickConstituteImage method is:
2179 %
2180 %      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2181 %        const size_t columns,const size_t rows,const char *map,
2182 %        const StorageType storage,void *pixels)
2183 %
2184 %  A description of each parameter follows:
2185 %
2186 %    o wand: the magick wand.
2187 %
2188 %    o columns: width in pixels of the image.
2189 %
2190 %    o rows: height in pixels of the image.
2191 %
2192 %    o map:  This string reflects the expected ordering of the pixel array.
2193 %      It can be any combination or order of R = red, G = green, B = blue,
2194 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2195 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2196 %      P = pad.
2197 %
2198 %    o storage: Define the data type of the pixels.  Float and double types are
2199 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2200 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2201 %      LongPixel, QuantumPixel, or ShortPixel.
2202 %
2203 %    o pixels: This array of values contain the pixel components as defined by
2204 %      map and type.  You must preallocate this array where the expected
2205 %      length varies depending on the values of width, height, map, and type.
2206 %
2207 %
2208 */
2209 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2210   const size_t columns,const size_t rows,const char *map,
2211   const StorageType storage,const void *pixels)
2212 {
2213   Image
2214     *images;
2215
2216   assert(wand != (MagickWand *) NULL);
2217   assert(wand->signature == WandSignature);
2218   if (IfMagickTrue(wand->debug))
2219     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2220   images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2221   if (images == (Image *) NULL)
2222     return(MagickFalse);
2223   return(InsertImageInWand(wand,images));
2224 }
2225 \f
2226 /*
2227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2228 %                                                                             %
2229 %                                                                             %
2230 %                                                                             %
2231 %   M a g i c k D e c i p h e r I m a g e                                     %
2232 %                                                                             %
2233 %                                                                             %
2234 %                                                                             %
2235 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2236 %
2237 %  MagickDecipherImage() converts cipher pixels to plain pixels.
2238 %
2239 %  The format of the MagickDecipherImage method is:
2240 %
2241 %      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2242 %        const char *passphrase)
2243 %
2244 %  A description of each parameter follows:
2245 %
2246 %    o wand: the magick wand.
2247 %
2248 %    o passphrase: the passphrase.
2249 %
2250 */
2251 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2252   const char *passphrase)
2253 {
2254   assert(wand != (MagickWand *) NULL);
2255   assert(wand->signature == WandSignature);
2256   if (IfMagickTrue(wand->debug))
2257     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2258   if (wand->images == (Image *) NULL)
2259     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2260   return(DecipherImage(wand->images,passphrase,wand->exception));
2261 }
2262 \f
2263 /*
2264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2265 %                                                                             %
2266 %                                                                             %
2267 %                                                                             %
2268 %   M a g i c k D e c o n s t r u c t I m a g e s                             %
2269 %                                                                             %
2270 %                                                                             %
2271 %                                                                             %
2272 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2273 %
2274 %  MagickDeconstructImages() compares each image with the next in a sequence
2275 %  and returns the maximum bounding region of any pixel differences it
2276 %  discovers.
2277 %
2278 %  The format of the MagickDeconstructImages method is:
2279 %
2280 %      MagickWand *MagickDeconstructImages(MagickWand *wand)
2281 %
2282 %  A description of each parameter follows:
2283 %
2284 %    o wand: the magick wand.
2285 %
2286 */
2287 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2288 {
2289   Image
2290     *deconstruct_image;
2291
2292   assert(wand != (MagickWand *) NULL);
2293   assert(wand->signature == WandSignature);
2294   if (IfMagickTrue(wand->debug))
2295     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2296   if (wand->images == (Image *) NULL)
2297     return((MagickWand *) NULL);
2298   deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2299     wand->exception);
2300   if (deconstruct_image == (Image *) NULL)
2301     return((MagickWand *) NULL);
2302   return(CloneMagickWandFromImages(wand,deconstruct_image));
2303 }
2304 \f
2305 /*
2306 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2307 %                                                                             %
2308 %                                                                             %
2309 %                                                                             %
2310 %     M a g i c k D e s k e w I m a g e                                       %
2311 %                                                                             %
2312 %                                                                             %
2313 %                                                                             %
2314 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2315 %
2316 %  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2317 %  occurs in scanned images because of the camera being misaligned,
2318 %  imperfections in the scanning or surface, or simply because the paper was
2319 %  not placed completely flat when scanned.
2320 %
2321 %  The format of the MagickDeskewImage method is:
2322 %
2323 %      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2324 %        const double threshold)
2325 %
2326 %  A description of each parameter follows:
2327 %
2328 %    o wand: the magick wand.
2329 %
2330 %    o threshold: separate background from foreground.
2331 %
2332 */
2333 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2334   const double threshold)
2335 {
2336   Image
2337     *sepia_image;
2338
2339   assert(wand != (MagickWand *) NULL);
2340   assert(wand->signature == WandSignature);
2341   if (IfMagickTrue(wand->debug))
2342     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2343   if (wand->images == (Image *) NULL)
2344     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2345   sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2346   if (sepia_image == (Image *) NULL)
2347     return(MagickFalse);
2348   ReplaceImageInList(&wand->images,sepia_image);
2349   return(MagickTrue);
2350 }
2351 \f
2352 /*
2353 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2354 %                                                                             %
2355 %                                                                             %
2356 %                                                                             %
2357 %     M a g i c k D e s p e c k l e I m a g e                                 %
2358 %                                                                             %
2359 %                                                                             %
2360 %                                                                             %
2361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2362 %
2363 %  MagickDespeckleImage() reduces the speckle noise in an image while
2364 %  perserving the edges of the original image.
2365 %
2366 %  The format of the MagickDespeckleImage method is:
2367 %
2368 %      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2369 %
2370 %  A description of each parameter follows:
2371 %
2372 %    o wand: the magick wand.
2373 %
2374 */
2375 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2376 {
2377   Image
2378     *despeckle_image;
2379
2380   assert(wand != (MagickWand *) NULL);
2381   assert(wand->signature == WandSignature);
2382   if (IfMagickTrue(wand->debug))
2383     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2384   if (wand->images == (Image *) NULL)
2385     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2386   despeckle_image=DespeckleImage(wand->images,wand->exception);
2387   if (despeckle_image == (Image *) NULL)
2388     return(MagickFalse);
2389   ReplaceImageInList(&wand->images,despeckle_image);
2390   return(MagickTrue);
2391 }
2392 \f
2393 /*
2394 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2395 %                                                                             %
2396 %                                                                             %
2397 %                                                                             %
2398 %   M a g i c k D e s t r o y I m a g e                                       %
2399 %                                                                             %
2400 %                                                                             %
2401 %                                                                             %
2402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2403 %
2404 %  MagickDestroyImage() dereferences an image, deallocating memory associated
2405 %  with the image if the reference count becomes zero.
2406 %
2407 %  The format of the MagickDestroyImage method is:
2408 %
2409 %      Image *MagickDestroyImage(Image *image)
2410 %
2411 %  A description of each parameter follows:
2412 %
2413 %    o image: the image.
2414 %
2415 */
2416 WandExport Image *MagickDestroyImage(Image *image)
2417 {
2418   return(DestroyImage(image));
2419 }
2420 \f
2421 /*
2422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2423 %                                                                             %
2424 %                                                                             %
2425 %                                                                             %
2426 %   M a g i c k D i s p l a y I m a g e                                       %
2427 %                                                                             %
2428 %                                                                             %
2429 %                                                                             %
2430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2431 %
2432 %  MagickDisplayImage() displays an image.
2433 %
2434 %  The format of the MagickDisplayImage method is:
2435 %
2436 %      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2437 %        const char *server_name)
2438 %
2439 %  A description of each parameter follows:
2440 %
2441 %    o wand: the magick wand.
2442 %
2443 %    o server_name: the X server name.
2444 %
2445 */
2446 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2447   const char *server_name)
2448 {
2449   Image
2450     *image;
2451
2452   MagickBooleanType
2453     status;
2454
2455   assert(wand != (MagickWand *) NULL);
2456   assert(wand->signature == WandSignature);
2457   if (IfMagickTrue(wand->debug))
2458     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2459   if (wand->images == (Image *) NULL)
2460     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2461   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2462   if (image == (Image *) NULL)
2463     return(MagickFalse);
2464   (void) CloneString(&wand->image_info->server_name,server_name);
2465   status=DisplayImages(wand->image_info,image,wand->exception);
2466   image=DestroyImage(image);
2467   return(status);
2468 }
2469 \f
2470 /*
2471 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2472 %                                                                             %
2473 %                                                                             %
2474 %                                                                             %
2475 %   M a g i c k D i s p l a y I m a g e s                                     %
2476 %                                                                             %
2477 %                                                                             %
2478 %                                                                             %
2479 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2480 %
2481 %  MagickDisplayImages() displays an image or image sequence.
2482 %
2483 %  The format of the MagickDisplayImages method is:
2484 %
2485 %      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2486 %        const char *server_name)
2487 %
2488 %  A description of each parameter follows:
2489 %
2490 %    o wand: the magick wand.
2491 %
2492 %    o server_name: the X server name.
2493 %
2494 */
2495 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2496   const char *server_name)
2497 {
2498   MagickBooleanType
2499     status;
2500
2501   assert(wand != (MagickWand *) NULL);
2502   assert(wand->signature == WandSignature);
2503   if (IfMagickTrue(wand->debug))
2504     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2505   (void) CloneString(&wand->image_info->server_name,server_name);
2506   status=DisplayImages(wand->image_info,wand->images,wand->exception);
2507   return(status);
2508 }
2509 \f
2510 /*
2511 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2512 %                                                                             %
2513 %                                                                             %
2514 %                                                                             %
2515 %   M a g i c k D i s t o r t I m a g e                                       %
2516 %                                                                             %
2517 %                                                                             %
2518 %                                                                             %
2519 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2520 %
2521 %  MagickDistortImage() distorts an image using various distortion methods, by
2522 %  mapping color lookups of the source image to a new destination image
2523 %  usally of the same size as the source image, unless 'bestfit' is set to
2524 %  true.
2525 %
2526 %  If 'bestfit' is enabled, and distortion allows it, the destination image is
2527 %  adjusted to ensure the whole source 'image' will just fit within the final
2528 %  destination image, which will be sized and offset accordingly.  Also in
2529 %  many cases the virtual offset of the source image will be taken into
2530 %  account in the mapping.
2531 %
2532 %  The format of the MagickDistortImage method is:
2533 %
2534 %      MagickBooleanType MagickDistortImage(MagickWand *wand,
2535 %        const DistortImageMethod method,const size_t number_arguments,
2536 %        const double *arguments,const MagickBooleanType bestfit)
2537 %
2538 %  A description of each parameter follows:
2539 %
2540 %    o image: the image to be distorted.
2541 %
2542 %    o method: the method of image distortion.
2543 %
2544 %        ArcDistortion always ignores the source image offset, and always
2545 %        'bestfit' the destination image with the top left corner offset
2546 %        relative to the polar mapping center.
2547 %
2548 %        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2549 %        style of image distortion.
2550 %
2551 %        Affine, Perspective, and Bilinear, do least squares fitting of the
2552 %        distortion when more than the minimum number of control point pairs
2553 %        are provided.
2554 %
2555 %        Perspective, and Bilinear, falls back to a Affine distortion when less
2556 %        that 4 control point pairs are provided. While Affine distortions let
2557 %        you use any number of control point pairs, that is Zero pairs is a
2558 %        no-Op (viewport only) distrotion, one pair is a translation and two
2559 %        pairs of control points do a scale-rotate-translate, without any
2560 %        shearing.
2561 %
2562 %    o number_arguments: the number of arguments given for this distortion
2563 %      method.
2564 %
2565 %    o arguments: the arguments for this distortion method.
2566 %
2567 %    o bestfit: Attempt to resize destination to fit distorted source.
2568 %
2569 */
2570 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2571   const DistortImageMethod method,const size_t number_arguments,
2572   const double *arguments,const MagickBooleanType bestfit)
2573 {
2574   Image
2575     *distort_image;
2576
2577   assert(wand != (MagickWand *) NULL);
2578   assert(wand->signature == WandSignature);
2579   if (IfMagickTrue(wand->debug))
2580     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2581   if (wand->images == (Image *) NULL)
2582     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2583   distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2584     bestfit,wand->exception);
2585   if (distort_image == (Image *) NULL)
2586     return(MagickFalse);
2587   ReplaceImageInList(&wand->images,distort_image);
2588   return(MagickTrue);
2589 }
2590 \f
2591 /*
2592 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2593 %                                                                             %
2594 %                                                                             %
2595 %                                                                             %
2596 %   M a g i c k D r a w I m a g e                                             %
2597 %                                                                             %
2598 %                                                                             %
2599 %                                                                             %
2600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2601 %
2602 %  MagickDrawImage() renders the drawing wand on the current image.
2603 %
2604 %  The format of the MagickDrawImage method is:
2605 %
2606 %      MagickBooleanType MagickDrawImage(MagickWand *wand,
2607 %        const DrawingWand *drawing_wand)
2608 %
2609 %  A description of each parameter follows:
2610 %
2611 %    o wand: the magick wand.
2612 %
2613 %    o drawing_wand: the draw wand.
2614 %
2615 */
2616 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2617   const DrawingWand *drawing_wand)
2618 {
2619   char
2620     *primitive;
2621
2622   DrawInfo
2623     *draw_info;
2624
2625   MagickBooleanType
2626     status;
2627
2628   assert(wand != (MagickWand *) NULL);
2629   assert(wand->signature == WandSignature);
2630   if (IfMagickTrue(wand->debug))
2631     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2632   if (wand->images == (Image *) NULL)
2633     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2634   draw_info=PeekDrawingWand(drawing_wand);
2635   if ((draw_info == (DrawInfo *) NULL) ||
2636       (draw_info->primitive == (char *) NULL))
2637     return(MagickFalse);
2638   primitive=AcquireString(draw_info->primitive);
2639   draw_info=DestroyDrawInfo(draw_info);
2640   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2641   draw_info->primitive=primitive;
2642   status=DrawImage(wand->images,draw_info,wand->exception);
2643   draw_info=DestroyDrawInfo(draw_info);
2644   return(status);
2645 }
2646 \f
2647 /*
2648 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2649 %                                                                             %
2650 %                                                                             %
2651 %                                                                             %
2652 %   M a g i c k E d g e I m a g e                                             %
2653 %                                                                             %
2654 %                                                                             %
2655 %                                                                             %
2656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2657 %
2658 %  MagickEdgeImage() enhance edges within the image with a convolution filter
2659 %  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2660 %  radius for you.
2661 %
2662 %  The format of the MagickEdgeImage method is:
2663 %
2664 %      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2665 %
2666 %  A description of each parameter follows:
2667 %
2668 %    o wand: the magick wand.
2669 %
2670 %    o radius: the radius of the pixel neighborhood.
2671 %
2672 */
2673 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2674   const double radius)
2675 {
2676   Image
2677     *edge_image;
2678
2679   assert(wand != (MagickWand *) NULL);
2680   assert(wand->signature == WandSignature);
2681   if (IfMagickTrue(wand->debug))
2682     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2683   if (wand->images == (Image *) NULL)
2684     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2685   edge_image=EdgeImage(wand->images,radius,wand->exception);
2686   if (edge_image == (Image *) NULL)
2687     return(MagickFalse);
2688   ReplaceImageInList(&wand->images,edge_image);
2689   return(MagickTrue);
2690 }
2691 \f
2692 /*
2693 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2694 %                                                                             %
2695 %                                                                             %
2696 %                                                                             %
2697 %   M a g i c k E m b o s s I m a g e                                         %
2698 %                                                                             %
2699 %                                                                             %
2700 %                                                                             %
2701 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2702 %
2703 %  MagickEmbossImage() returns a grayscale image with a three-dimensional
2704 %  effect.  We convolve the image with a Gaussian operator of the given radius
2705 %  and standard deviation (sigma).  For reasonable results, radius should be
2706 %  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2707 %  radius for you.
2708 %
2709 %  The format of the MagickEmbossImage method is:
2710 %
2711 %      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2712 %        const double sigma)
2713 %
2714 %  A description of each parameter follows:
2715 %
2716 %    o wand: the magick wand.
2717 %
2718 %    o radius: the radius of the Gaussian, in pixels, not counting the center
2719 %      pixel.
2720 %
2721 %    o sigma: the standard deviation of the Gaussian, in pixels.
2722 %
2723 */
2724 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2725   const double radius,const double sigma)
2726 {
2727   Image
2728     *emboss_image;
2729
2730   assert(wand != (MagickWand *) NULL);
2731   assert(wand->signature == WandSignature);
2732   if (IfMagickTrue(wand->debug))
2733     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2734   if (wand->images == (Image *) NULL)
2735     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2736   emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2737   if (emboss_image == (Image *) NULL)
2738     return(MagickFalse);
2739   ReplaceImageInList(&wand->images,emboss_image);
2740   return(MagickTrue);
2741 }
2742 \f
2743 /*
2744 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2745 %                                                                             %
2746 %                                                                             %
2747 %                                                                             %
2748 %   M a g i c k E n c i p h e r I m a g e                                     %
2749 %                                                                             %
2750 %                                                                             %
2751 %                                                                             %
2752 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2753 %
2754 %  MagickEncipherImage() converts plaint pixels to cipher pixels.
2755 %
2756 %  The format of the MagickEncipherImage method is:
2757 %
2758 %      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2759 %        const char *passphrase)
2760 %
2761 %  A description of each parameter follows:
2762 %
2763 %    o wand: the magick wand.
2764 %
2765 %    o passphrase: the passphrase.
2766 %
2767 */
2768 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2769   const char *passphrase)
2770 {
2771   assert(wand != (MagickWand *) NULL);
2772   assert(wand->signature == WandSignature);
2773   if (IfMagickTrue(wand->debug))
2774     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2775   if (wand->images == (Image *) NULL)
2776     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2777   return(EncipherImage(wand->images,passphrase,wand->exception));
2778 }
2779 \f
2780 /*
2781 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2782 %                                                                             %
2783 %                                                                             %
2784 %                                                                             %
2785 %   M a g i c k E n h a n c e I m a g e                                       %
2786 %                                                                             %
2787 %                                                                             %
2788 %                                                                             %
2789 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2790 %
2791 %  MagickEnhanceImage() applies a digital filter that improves the quality of a
2792 %  noisy image.
2793 %
2794 %  The format of the MagickEnhanceImage method is:
2795 %
2796 %      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2797 %
2798 %  A description of each parameter follows:
2799 %
2800 %    o wand: the magick wand.
2801 %
2802 */
2803 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2804 {
2805   Image
2806     *enhance_image;
2807
2808   assert(wand != (MagickWand *) NULL);
2809   assert(wand->signature == WandSignature);
2810   if (IfMagickTrue(wand->debug))
2811     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2812   if (wand->images == (Image *) NULL)
2813     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2814   enhance_image=EnhanceImage(wand->images,wand->exception);
2815   if (enhance_image == (Image *) NULL)
2816     return(MagickFalse);
2817   ReplaceImageInList(&wand->images,enhance_image);
2818   return(MagickTrue);
2819 }
2820 \f
2821 /*
2822 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2823 %                                                                             %
2824 %                                                                             %
2825 %                                                                             %
2826 %   M a g i c k E q u a l i z e I m a g e                                     %
2827 %                                                                             %
2828 %                                                                             %
2829 %                                                                             %
2830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2831 %
2832 %  MagickEqualizeImage() equalizes the image histogram.
2833 %
2834 %  The format of the MagickEqualizeImage method is:
2835 %
2836 %      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2837 %
2838 %  A description of each parameter follows:
2839 %
2840 %    o wand: the magick wand.
2841 %
2842 %    o channel: the image channel(s).
2843 %
2844 */
2845 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2846 {
2847   MagickBooleanType
2848     status;
2849
2850   assert(wand != (MagickWand *) NULL);
2851   assert(wand->signature == WandSignature);
2852   if (IfMagickTrue(wand->debug))
2853     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2854   if (wand->images == (Image *) NULL)
2855     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2856   status=EqualizeImage(wand->images,wand->exception);
2857   return(status);
2858 }
2859 \f
2860 /*
2861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2862 %                                                                             %
2863 %                                                                             %
2864 %                                                                             %
2865 %   M a g i c k E v a l u a t e I m a g e                                     %
2866 %                                                                             %
2867 %                                                                             %
2868 %                                                                             %
2869 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2870 %
2871 %  MagickEvaluateImage() applys an arithmetic, relational, or logical
2872 %  expression to an image.  Use these operators to lighten or darken an image,
2873 %  to increase or decrease contrast in an image, or to produce the "negative"
2874 %  of an image.
2875 %
2876 %  The format of the MagickEvaluateImage method is:
2877 %
2878 %      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2879 %        const MagickEvaluateOperator operator,const double value)
2880 %      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2881 %        const MagickEvaluateOperator operator)
2882 %
2883 %  A description of each parameter follows:
2884 %
2885 %    o wand: the magick wand.
2886 %
2887 %    o op: A channel operator.
2888 %
2889 %    o value: A value value.
2890 %
2891 */
2892
2893 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2894   const MagickEvaluateOperator op)
2895 {
2896   Image
2897     *evaluate_image;
2898
2899   assert(wand != (MagickWand *) NULL);
2900   assert(wand->signature == WandSignature);
2901   if (IfMagickTrue(wand->debug))
2902     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2903   if (wand->images == (Image *) NULL)
2904     return((MagickWand *) NULL);
2905   evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2906   if (evaluate_image == (Image *) NULL)
2907     return((MagickWand *) NULL);
2908   return(CloneMagickWandFromImages(wand,evaluate_image));
2909 }
2910
2911 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2912   const MagickEvaluateOperator op,const double value)
2913 {
2914   MagickBooleanType
2915     status;
2916
2917   assert(wand != (MagickWand *) NULL);
2918   assert(wand->signature == WandSignature);
2919   if (IfMagickTrue(wand->debug))
2920     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2921   if (wand->images == (Image *) NULL)
2922     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2923   status=EvaluateImage(wand->images,op,value,wand->exception);
2924   return(status);
2925 }
2926 \f
2927 /*
2928 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2929 %                                                                             %
2930 %                                                                             %
2931 %                                                                             %
2932 %   M a g i c k E x p o r t I m a g e P i x e l s                             %
2933 %                                                                             %
2934 %                                                                             %
2935 %                                                                             %
2936 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2937 %
2938 %  MagickExportImagePixels() extracts pixel data from an image and returns it
2939 %  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2940 %  an error is encountered.  The data is returned as char, short int, int,
2941 %  ssize_t, float, or double in the order specified by map.
2942 %
2943 %  Suppose you want to extract the first scanline of a 640x480 image as
2944 %  character data in red-green-blue order:
2945 %
2946 %      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
2947 %
2948 %  The format of the MagickExportImagePixels method is:
2949 %
2950 %      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2951 %        const ssize_t x,const ssize_t y,const size_t columns,
2952 %        const size_t rows,const char *map,const StorageType storage,
2953 %        void *pixels)
2954 %
2955 %  A description of each parameter follows:
2956 %
2957 %    o wand: the magick wand.
2958 %
2959 %    o x, y, columns, rows:  These values define the perimeter
2960 %      of a region of pixels you want to extract.
2961 %
2962 %    o map:  This string reflects the expected ordering of the pixel array.
2963 %      It can be any combination or order of R = red, G = green, B = blue,
2964 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2965 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2966 %      P = pad.
2967 %
2968 %    o storage: Define the data type of the pixels.  Float and double types are
2969 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2970 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2971 %      LongPixel, QuantumPixel, or ShortPixel.
2972 %
2973 %    o pixels: This array of values contain the pixel components as defined by
2974 %      map and type.  You must preallocate this array where the expected
2975 %      length varies depending on the values of width, height, map, and type.
2976 %
2977 */
2978 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2979   const ssize_t x,const ssize_t y,const size_t columns,
2980   const size_t rows,const char *map,const StorageType storage,
2981   void *pixels)
2982 {
2983   MagickBooleanType
2984     status;
2985
2986   assert(wand != (MagickWand *) NULL);
2987   assert(wand->signature == WandSignature);
2988   if (IfMagickTrue(wand->debug))
2989     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2990   if (wand->images == (Image *) NULL)
2991     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2992   status=ExportImagePixels(wand->images,x,y,columns,rows,map,
2993     storage,pixels,wand->exception);
2994   return(status);
2995 }
2996 \f
2997 /*
2998 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2999 %                                                                             %
3000 %                                                                             %
3001 %                                                                             %
3002 %   M a g i c k E x t e n t I m a g e                                         %
3003 %                                                                             %
3004 %                                                                             %
3005 %                                                                             %
3006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3007 %
3008 %  MagickExtentImage() extends the image as defined by the geometry, gravity,
3009 %  and wand background color.  Set the (x,y) offset of the geometry to move
3010 %  the original wand relative to the extended wand.
3011 %
3012 %  The format of the MagickExtentImage method is:
3013 %
3014 %      MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
3015 %        const size_t height,const ssize_t x,const ssize_t y)
3016 %
3017 %  A description of each parameter follows:
3018 %
3019 %    o wand: the magick wand.
3020 %
3021 %    o width: the region width.
3022 %
3023 %    o height: the region height.
3024 %
3025 %    o x: the region x offset.
3026 %
3027 %    o y: the region y offset.
3028 %
3029 */
3030 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3031   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
3032 {
3033   Image
3034     *extent_image;
3035
3036   RectangleInfo
3037     extent;
3038
3039   assert(wand != (MagickWand *) NULL);
3040   assert(wand->signature == WandSignature);
3041   if (IfMagickTrue(wand->debug))
3042     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3043   if (wand->images == (Image *) NULL)
3044     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3045   extent.width=width;
3046   extent.height=height;
3047   extent.x=x;
3048   extent.y=y;
3049   extent_image=ExtentImage(wand->images,&extent,wand->exception);
3050   if (extent_image == (Image *) NULL)
3051     return(MagickFalse);
3052   ReplaceImageInList(&wand->images,extent_image);
3053   return(MagickTrue);
3054 }
3055 \f
3056 /*
3057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3058 %                                                                             %
3059 %                                                                             %
3060 %                                                                             %
3061 %   M a g i c k F l i p I m a g e                                             %
3062 %                                                                             %
3063 %                                                                             %
3064 %                                                                             %
3065 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3066 %
3067 %  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3068 %  around the central x-axis.
3069 %
3070 %  The format of the MagickFlipImage method is:
3071 %
3072 %      MagickBooleanType MagickFlipImage(MagickWand *wand)
3073 %
3074 %  A description of each parameter follows:
3075 %
3076 %    o wand: the magick wand.
3077 %
3078 */
3079 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3080 {
3081   Image
3082     *flip_image;
3083
3084   assert(wand != (MagickWand *) NULL);
3085   assert(wand->signature == WandSignature);
3086   if (IfMagickTrue(wand->debug))
3087     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3088   if (wand->images == (Image *) NULL)
3089     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3090   flip_image=FlipImage(wand->images,wand->exception);
3091   if (flip_image == (Image *) NULL)
3092     return(MagickFalse);
3093   ReplaceImageInList(&wand->images,flip_image);
3094   return(MagickTrue);
3095 }
3096 \f
3097 /*
3098 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3099 %                                                                             %
3100 %                                                                             %
3101 %                                                                             %
3102 %   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                         %
3103 %                                                                             %
3104 %                                                                             %
3105 %                                                                             %
3106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3107 %
3108 %  MagickFloodfillPaintImage() changes the color value of any pixel that matches
3109 %  target and is an immediate neighbor.  If the method FillToBorderMethod is
3110 %  specified, the color value is changed for any neighbor pixel that does not
3111 %  match the bordercolor member of image.
3112 %
3113 %  The format of the MagickFloodfillPaintImage method is:
3114 %
3115 %      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3116 %        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3117 %        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3118 %
3119 %  A description of each parameter follows:
3120 %
3121 %    o wand: the magick wand.
3122 %
3123 %    o fill: the floodfill color pixel wand.
3124 %
3125 %    o fuzz: By default target must match a particular pixel color
3126 %      exactly.  However, in many cases two colors may differ by a small amount.
3127 %      The fuzz member of image defines how much tolerance is acceptable to
3128 %      consider two colors as the same.  For example, set fuzz to 10 and the
3129 %      color red at intensities of 100 and 102 respectively are now interpreted
3130 %      as the same color for the purposes of the floodfill.
3131 %
3132 %    o bordercolor: the border color pixel wand.
3133 %
3134 %    o x,y: the starting location of the operation.
3135 %
3136 %    o invert: paint any pixel that does not match the target color.
3137 %
3138 */
3139 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3140   const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3141   const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3142 {
3143   DrawInfo
3144     *draw_info;
3145
3146   MagickBooleanType
3147     status;
3148
3149   PixelInfo
3150     target;
3151
3152   assert(wand != (MagickWand *) NULL);
3153   assert(wand->signature == WandSignature);
3154   if (IfMagickTrue(wand->debug))
3155     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3156   if (wand->images == (Image *) NULL)
3157     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3158   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3159   PixelGetQuantumPacket(fill,&draw_info->fill);
3160   (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
3161     wand->images->columns,y % wand->images->rows,&target,wand->exception);
3162   if (bordercolor != (PixelWand *) NULL)
3163     PixelGetMagickColor(bordercolor,&target);
3164   wand->images->fuzz=fuzz;
3165   status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3166     wand->exception);
3167   draw_info=DestroyDrawInfo(draw_info);
3168   return(status);
3169 }
3170 \f
3171 /*
3172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3173 %                                                                             %
3174 %                                                                             %
3175 %                                                                             %
3176 %   M a g i c k F l o p I m a g e                                             %
3177 %                                                                             %
3178 %                                                                             %
3179 %                                                                             %
3180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3181 %
3182 %  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3183 %  around the central y-axis.
3184 %
3185 %  The format of the MagickFlopImage method is:
3186 %
3187 %      MagickBooleanType MagickFlopImage(MagickWand *wand)
3188 %
3189 %  A description of each parameter follows:
3190 %
3191 %    o wand: the magick wand.
3192 %
3193 */
3194 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3195 {
3196   Image
3197     *flop_image;
3198
3199   assert(wand != (MagickWand *) NULL);
3200   assert(wand->signature == WandSignature);
3201   if (IfMagickTrue(wand->debug))
3202     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3203   if (wand->images == (Image *) NULL)
3204     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3205   flop_image=FlopImage(wand->images,wand->exception);
3206   if (flop_image == (Image *) NULL)
3207     return(MagickFalse);
3208   ReplaceImageInList(&wand->images,flop_image);
3209   return(MagickTrue);
3210 }
3211 \f
3212 /*
3213 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3214 %                                                                             %
3215 %                                                                             %
3216 %                                                                             %
3217 %   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                     %
3218 %                                                                             %
3219 %                                                                             %
3220 %                                                                             %
3221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3222 %
3223 %  MagickForwardFourierTransformImage() implements the discrete Fourier
3224 %  transform (DFT) of the image either as a magnitude / phase or real /
3225 %  imaginary image pair.
3226 %
3227 %  The format of the MagickForwardFourierTransformImage method is:
3228 %
3229 %      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3230 %        const MagickBooleanType magnitude)
3231 %
3232 %  A description of each parameter follows:
3233 %
3234 %    o wand: the magick wand.
3235 %
3236 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3237 %      imaginary image pair.
3238 %
3239 */
3240 WandExport MagickBooleanType MagickForwardFourierTransformImage(
3241   MagickWand *wand,const MagickBooleanType magnitude)
3242 {
3243   Image
3244     *forward_image;
3245
3246   assert(wand != (MagickWand *) NULL);
3247   assert(wand->signature == WandSignature);
3248   if (IfMagickTrue(wand->debug))
3249     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3250   if (wand->images == (Image *) NULL)
3251     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3252   forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3253     wand->exception);
3254   if (forward_image == (Image *) NULL)
3255     return(MagickFalse);
3256   ReplaceImageInList(&wand->images,forward_image);
3257   return(MagickTrue);
3258 }
3259 \f
3260 /*
3261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3262 %                                                                             %
3263 %                                                                             %
3264 %                                                                             %
3265 %   M a g i c k F r a m e I m a g e                                           %
3266 %                                                                             %
3267 %                                                                             %
3268 %                                                                             %
3269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3270 %
3271 %  MagickFrameImage() adds a simulated three-dimensional border around the
3272 %  image.  The width and height specify the border width of the vertical and
3273 %  horizontal sides of the frame.  The inner and outer bevels indicate the
3274 %  width of the inner and outer shadows of the frame.
3275 %
3276 %  The format of the MagickFrameImage method is:
3277 %
3278 %      MagickBooleanType MagickFrameImage(MagickWand *wand,
3279 %        const PixelWand *matte_color,const size_t width,
3280 %        const size_t height,const ssize_t inner_bevel,
3281 %        const ssize_t outer_bevel,const CompositeOperator compose)
3282 %
3283 %  A description of each parameter follows:
3284 %
3285 %    o wand: the magick wand.
3286 %
3287 %    o matte_color: the frame color pixel wand.
3288 %
3289 %    o width: the border width.
3290 %
3291 %    o height: the border height.
3292 %
3293 %    o inner_bevel: the inner bevel width.
3294 %
3295 %    o outer_bevel: the outer bevel width.
3296 %
3297 %    o compose: the composite operator.
3298 %
3299 */
3300 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3301   const PixelWand *matte_color,const size_t width,const size_t height,
3302   const ssize_t inner_bevel,const ssize_t outer_bevel,
3303   const CompositeOperator compose)
3304 {
3305   Image
3306     *frame_image;
3307
3308   FrameInfo
3309     frame_info;
3310
3311   assert(wand != (MagickWand *) NULL);
3312   assert(wand->signature == WandSignature);
3313   if (IfMagickTrue(wand->debug))
3314     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3315   if (wand->images == (Image *) NULL)
3316     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3317   (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3318   frame_info.width=wand->images->columns+2*width;
3319   frame_info.height=wand->images->rows+2*height;
3320   frame_info.x=(ssize_t) width;
3321   frame_info.y=(ssize_t) height;
3322   frame_info.inner_bevel=inner_bevel;
3323   frame_info.outer_bevel=outer_bevel;
3324   PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3325   frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3326   if (frame_image == (Image *) NULL)
3327     return(MagickFalse);
3328   ReplaceImageInList(&wand->images,frame_image);
3329   return(MagickTrue);
3330 }
3331 \f
3332 /*
3333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3334 %                                                                             %
3335 %                                                                             %
3336 %                                                                             %
3337 %   M a g i c k F u n c t i o n I m a g e                                     %
3338 %                                                                             %
3339 %                                                                             %
3340 %                                                                             %
3341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3342 %
3343 %  MagickFunctionImage() applys an arithmetic, relational, or logical
3344 %  expression to an image.  Use these operators to lighten or darken an image,
3345 %  to increase or decrease contrast in an image, or to produce the "negative"
3346 %  of an image.
3347 %
3348 %  The format of the MagickFunctionImage method is:
3349 %
3350 %      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3351 %        const MagickFunction function,const size_t number_arguments,
3352 %        const double *arguments)
3353 %
3354 %  A description of each parameter follows:
3355 %
3356 %    o wand: the magick wand.
3357 %
3358 %    o function: the image function.
3359 %
3360 %    o number_arguments: the number of function arguments.
3361 %
3362 %    o arguments: the function arguments.
3363 %
3364 */
3365 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3366   const MagickFunction function,const size_t number_arguments,
3367   const double *arguments)
3368 {
3369   MagickBooleanType
3370     status;
3371
3372   assert(wand != (MagickWand *) NULL);
3373   assert(wand->signature == WandSignature);
3374   if (IfMagickTrue(wand->debug))
3375     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3376   if (wand->images == (Image *) NULL)
3377     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3378   status=FunctionImage(wand->images,function,number_arguments,arguments,
3379     wand->exception);
3380   return(status);
3381 }
3382 \f
3383 /*
3384 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3385 %                                                                             %
3386 %                                                                             %
3387 %                                                                             %
3388 %   M a g i c k F x I m a g e                                                 %
3389 %                                                                             %
3390 %                                                                             %
3391 %                                                                             %
3392 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3393 %
3394 %  MagickFxImage() evaluate expression for each pixel in the image.
3395 %
3396 %  The format of the MagickFxImage method is:
3397 %
3398 %      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3399 %
3400 %  A description of each parameter follows:
3401 %
3402 %    o wand: the magick wand.
3403 %
3404 %    o expression: the expression.
3405 %
3406 */
3407 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3408 {
3409   Image
3410     *fx_image;
3411
3412   assert(wand != (MagickWand *) NULL);
3413   assert(wand->signature == WandSignature);
3414   if (IfMagickTrue(wand->debug))
3415     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3416   if (wand->images == (Image *) NULL)
3417     return((MagickWand *) NULL);
3418   fx_image=FxImage(wand->images,expression,wand->exception);
3419   if (fx_image == (Image *) NULL)
3420     return((MagickWand *) NULL);
3421   return(CloneMagickWandFromImages(wand,fx_image));
3422 }
3423 \f
3424 /*
3425 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3426 %                                                                             %
3427 %                                                                             %
3428 %                                                                             %
3429 %   M a g i c k G a m m a I m a g e                                           %
3430 %                                                                             %
3431 %                                                                             %
3432 %                                                                             %
3433 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3434 %
3435 %  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3436 %  different devices will have perceptual differences in the way the image's
3437 %  intensities are represented on the screen.  Specify individual gamma levels
3438 %  for the red, green, and blue channels, or adjust all three with the gamma
3439 %  parameter.  Values typically range from 0.8 to 2.3.
3440 %
3441 %  You can also reduce the influence of a particular channel with a gamma
3442 %  value of 0.
3443 %
3444 %  The format of the MagickGammaImage method is:
3445 %
3446 %      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3447 %
3448 %  A description of each parameter follows:
3449 %
3450 %    o wand: the magick wand.
3451 %
3452 %    o level: Define the level of gamma correction.
3453 %
3454 */
3455 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3456   const double gamma)
3457 {
3458   MagickBooleanType
3459     status;
3460
3461   assert(wand != (MagickWand *) NULL);
3462   assert(wand->signature == WandSignature);
3463   if (IfMagickTrue(wand->debug))
3464     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3465   if (wand->images == (Image *) NULL)
3466     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3467   status=GammaImage(wand->images,gamma,wand->exception);
3468   return(status);
3469 }
3470 \f
3471 /*
3472 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3473 %                                                                             %
3474 %                                                                             %
3475 %                                                                             %
3476 %   M a g i c k G a u s s i a n B l u r I m a g e                             %
3477 %                                                                             %
3478 %                                                                             %
3479 %                                                                             %
3480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3481 %
3482 %  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3483 %  Gaussian operator of the given radius and standard deviation (sigma).
3484 %  For reasonable results, the radius should be larger than sigma.  Use a
3485 %  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3486 %
3487 %  The format of the MagickGaussianBlurImage method is:
3488 %
3489 %      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3490 %        const double radius,const double sigma)
3491 %
3492 %  A description of each parameter follows:
3493 %
3494 %    o wand: the magick wand.
3495 %
3496 %    o radius: the radius of the Gaussian, in pixels, not counting the center
3497 %      pixel.
3498 %
3499 %    o sigma: the standard deviation of the Gaussian, in pixels.
3500 %
3501 */
3502 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3503   const double radius,const double sigma)
3504 {
3505   Image
3506     *blur_image;
3507
3508   assert(wand != (MagickWand *) NULL);
3509   assert(wand->signature == WandSignature);
3510   if (IfMagickTrue(wand->debug))
3511     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3512   if (wand->images == (Image *) NULL)
3513     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3514   blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3515   if (blur_image == (Image *) NULL)
3516     return(MagickFalse);
3517   ReplaceImageInList(&wand->images,blur_image);
3518   return(MagickTrue);
3519 }
3520 \f
3521 /*
3522 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3523 %                                                                             %
3524 %                                                                             %
3525 %                                                                             %
3526 %   M a g i c k G e t I m a g e                                               %
3527 %                                                                             %
3528 %                                                                             %
3529 %                                                                             %
3530 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3531 %
3532 %  MagickGetImage() gets the image at the current image index.
3533 %
3534 %  The format of the MagickGetImage method is:
3535 %
3536 %      MagickWand *MagickGetImage(MagickWand *wand)
3537 %
3538 %  A description of each parameter follows:
3539 %
3540 %    o wand: the magick wand.
3541 %
3542 */
3543 WandExport MagickWand *MagickGetImage(MagickWand *wand)
3544 {
3545   Image
3546     *image;
3547
3548   assert(wand != (MagickWand *) NULL);
3549   assert(wand->signature == WandSignature);
3550   if (IfMagickTrue(wand->debug))
3551     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3552   if (wand->images == (Image *) NULL)
3553     {
3554       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3555         "ContainsNoImages","`%s'",wand->name);
3556       return((MagickWand *) NULL);
3557     }
3558   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3559   if (image == (Image *) NULL)
3560     return((MagickWand *) NULL);
3561   return(CloneMagickWandFromImages(wand,image));
3562 }
3563 \f
3564 /*
3565 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3566 %                                                                             %
3567 %                                                                             %
3568 %                                                                             %
3569 %   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                       %
3570 %                                                                             %
3571 %                                                                             %
3572 %                                                                             %
3573 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3574 %
3575 %  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3576 %  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3577 %  than CMYKA.
3578 %
3579 %  The format of the MagickGetImageAlphaChannel method is:
3580 %
3581 %      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3582 %
3583 %  A description of each parameter follows:
3584 %
3585 %    o wand: the magick wand.
3586 %
3587 */
3588 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3589 {
3590   assert(wand != (MagickWand *) NULL);
3591   assert(wand->signature == WandSignature);
3592   if (IfMagickTrue(wand->debug))
3593     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3594   if (wand->images == (Image *) NULL)
3595     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3596   return(GetImageAlphaChannel(wand->images));
3597 }
3598 \f
3599 /*
3600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3601 %                                                                             %
3602 %                                                                             %
3603 %                                                                             %
3604 %   M a g i c k G e t I m a g e C l i p M a s k                               %
3605 %                                                                             %
3606 %                                                                             %
3607 %                                                                             %
3608 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3609 %
3610 %  MagickGetImageMask() gets the image clip mask at the current image index.
3611 %
3612 %  The format of the MagickGetImageMask method is:
3613 %
3614 %      MagickWand *MagickGetImageMask(MagickWand *wand)
3615 %
3616 %  A description of each parameter follows:
3617 %
3618 %    o wand: the magick wand.
3619 %
3620 */
3621 WandExport MagickWand *MagickGetImageMask(MagickWand *wand)
3622 {
3623   Image
3624     *image;
3625
3626   assert(wand != (MagickWand *) NULL);
3627   assert(wand->signature == WandSignature);
3628   if (IfMagickTrue(wand->debug))
3629     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3630   if (wand->images == (Image *) NULL)
3631     {
3632       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3633         "ContainsNoImages","`%s'",wand->name);
3634       return((MagickWand *) NULL);
3635     }
3636   image=GetImageMask(wand->images,wand->exception);
3637   if (image == (Image *) NULL)
3638     return((MagickWand *) NULL);
3639   return(CloneMagickWandFromImages(wand,image));
3640 }
3641 \f
3642 /*
3643 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3644 %                                                                             %
3645 %                                                                             %
3646 %                                                                             %
3647 %   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                 %
3648 %                                                                             %
3649 %                                                                             %
3650 %                                                                             %
3651 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3652 %
3653 %  MagickGetImageBackgroundColor() returns the image background color.
3654 %
3655 %  The format of the MagickGetImageBackgroundColor method is:
3656 %
3657 %      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3658 %        PixelWand *background_color)
3659 %
3660 %  A description of each parameter follows:
3661 %
3662 %    o wand: the magick wand.
3663 %
3664 %    o background_color: Return the background color.
3665 %
3666 */
3667 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3668   PixelWand *background_color)
3669 {
3670   assert(wand != (MagickWand *) NULL);
3671   assert(wand->signature == WandSignature);
3672   if (IfMagickTrue(wand->debug))
3673     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3674   if (wand->images == (Image *) NULL)
3675     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3676   PixelSetPixelColor(background_color,&wand->images->background_color);
3677   return(MagickTrue);
3678 }
3679 \f
3680 /*
3681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3682 %                                                                             %
3683 %                                                                             %
3684 %                                                                             %
3685 %   M a g i c k G e t I m a g e B l o b                                       %
3686 %                                                                             %
3687 %                                                                             %
3688 %                                                                             %
3689 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3690 %
3691 %  MagickGetImageBlob() implements direct to memory image formats.  It returns
3692 %  the image as a blob (a formatted "file" in memory) and its length, starting
3693 %  from the current position in the image sequence.  Use MagickSetImageFormat()
3694 %  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3695 %
3696 %  Utilize MagickResetIterator() to ensure the write is from the beginning of
3697 %  the image sequence.
3698 %
3699 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
3700 %
3701 %  The format of the MagickGetImageBlob method is:
3702 %
3703 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3704 %
3705 %  A description of each parameter follows:
3706 %
3707 %    o wand: the magick wand.
3708 %
3709 %    o length: the length of the blob.
3710 %
3711 */
3712 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3713 {
3714   assert(wand != (MagickWand *) NULL);
3715   assert(wand->signature == WandSignature);
3716   if (IfMagickTrue(wand->debug))
3717     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3718   if (wand->images == (Image *) NULL)
3719     {
3720       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3721         "ContainsNoImages","`%s'",wand->name);
3722       return((unsigned char *) NULL);
3723     }
3724   return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3725 }
3726 \f
3727 /*
3728 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3729 %                                                                             %
3730 %                                                                             %
3731 %                                                                             %
3732 %   M a g i c k G e t I m a g e s B l o b                                     %
3733 %                                                                             %
3734 %                                                                             %
3735 %                                                                             %
3736 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3737 %
3738 %  MagickGetImageBlob() implements direct to memory image formats.  It
3739 %  returns the image sequence as a blob and its length.  The format of the image
3740 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3741 %  return a different image format, use MagickSetImageFormat().
3742 %
3743 %  Note, some image formats do not permit multiple images to the same image
3744 %  stream (e.g. JPEG).  in this instance, just the first image of the
3745 %  sequence is returned as a blob.
3746 %
3747 %  The format of the MagickGetImagesBlob method is:
3748 %
3749 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3750 %
3751 %  A description of each parameter follows:
3752 %
3753 %    o wand: the magick wand.
3754 %
3755 %    o length: the length of the blob.
3756 %
3757 */
3758 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3759 {
3760   unsigned char
3761     *blob;
3762
3763   assert(wand != (MagickWand *) NULL);
3764   assert(wand->signature == WandSignature);
3765   if (IfMagickTrue(wand->debug))
3766     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3767   if (wand->images == (Image *) NULL)
3768     {
3769       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3770         "ContainsNoImages","`%s'",wand->name);
3771       return((unsigned char *) NULL);
3772     }
3773   blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3774     wand->exception);
3775   return(blob);
3776 }
3777 \f
3778 /*
3779 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3780 %                                                                             %
3781 %                                                                             %
3782 %                                                                             %
3783 %   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                         %
3784 %                                                                             %
3785 %                                                                             %
3786 %                                                                             %
3787 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3788 %
3789 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3790 %  image.
3791 %
3792 %  The format of the MagickGetImageBluePrimary method is:
3793 %
3794 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3795 %        double *y)
3796 %
3797 %  A description of each parameter follows:
3798 %
3799 %    o wand: the magick wand.
3800 %
3801 %    o x: the chromaticity blue primary x-point.
3802 %
3803 %    o y: the chromaticity blue primary y-point.
3804 %
3805 */
3806 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3807   double *x,double *y)
3808 {
3809   assert(wand != (MagickWand *) NULL);
3810   assert(wand->signature == WandSignature);
3811   if (IfMagickTrue(wand->debug))
3812     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3813   if (wand->images == (Image *) NULL)
3814     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3815   *x=wand->images->chromaticity.blue_primary.x;
3816   *y=wand->images->chromaticity.blue_primary.y;
3817   return(MagickTrue);
3818 }
3819 \f
3820 /*
3821 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3822 %                                                                             %
3823 %                                                                             %
3824 %                                                                             %
3825 %   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                         %
3826 %                                                                             %
3827 %                                                                             %
3828 %                                                                             %
3829 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3830 %
3831 %  MagickGetImageBorderColor() returns the image border color.
3832 %
3833 %  The format of the MagickGetImageBorderColor method is:
3834 %
3835 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3836 %        PixelWand *border_color)
3837 %
3838 %  A description of each parameter follows:
3839 %
3840 %    o wand: the magick wand.
3841 %
3842 %    o border_color: Return the border color.
3843 %
3844 */
3845 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3846   PixelWand *border_color)
3847 {
3848   assert(wand != (MagickWand *) NULL);
3849   assert(wand->signature == WandSignature);
3850   if (IfMagickTrue(wand->debug))
3851     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3852   if (wand->images == (Image *) NULL)
3853     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3854   PixelSetPixelColor(border_color,&wand->images->border_color);
3855   return(MagickTrue);
3856 }
3857 \f
3858 /*
3859 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3860 %                                                                             %
3861 %                                                                             %
3862 %                                                                             %
3863 %   M a g i c k G e t I m a g e F e a t u r e s                               %
3864 %                                                                             %
3865 %                                                                             %
3866 %                                                                             %
3867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3868 %
3869 %  MagickGetImageFeatures() returns features for each channel in the
3870 %  image in each of four directions (horizontal, vertical, left and right
3871 %  diagonals) for the specified distance.  The features include the angular
3872 %  second moment, contrast, correlation, sum of squares: variance, inverse
3873 %  difference moment, sum average, sum varience, sum entropy, entropy,
3874 %  difference variance, difference entropy, information measures of
3875 %  correlation 1, information measures of correlation 2, and maximum
3876 %  correlation coefficient.  You can access the red channel contrast, for
3877 %  example, like this:
3878 %
3879 %      channel_features=MagickGetImageFeatures(wand,1);
3880 %      contrast=channel_features[RedPixelChannel].contrast[0];
3881 %
3882 %  Use MagickRelinquishMemory() to free the statistics buffer.
3883 %
3884 %  The format of the MagickGetImageFeatures method is:
3885 %
3886 %      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3887 %        const size_t distance)
3888 %
3889 %  A description of each parameter follows:
3890 %
3891 %    o wand: the magick wand.
3892 %
3893 %    o distance: the distance.
3894 %
3895 */
3896 WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3897   const size_t distance)
3898 {
3899   assert(wand != (MagickWand *) NULL);
3900   assert(wand->signature == WandSignature);
3901   if (IfMagickTrue(wand->debug))
3902     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3903   if (wand->images == (Image *) NULL)
3904     {
3905       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3906         "ContainsNoImages","`%s'",wand->name);
3907       return((ChannelFeatures *) NULL);
3908     }
3909   return(GetImageFeatures(wand->images,distance,wand->exception));
3910 }
3911 \f
3912 /*
3913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3914 %                                                                             %
3915 %                                                                             %
3916 %                                                                             %
3917 %   M a g i c k G e t I m a g e K u r t o s i s                               %
3918 %                                                                             %
3919 %                                                                             %
3920 %                                                                             %
3921 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3922 %
3923 %  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
3924 %  more image channels.
3925 %
3926 %  The format of the MagickGetImageKurtosis method is:
3927 %
3928 %      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3929 %        double *kurtosis,double *skewness)
3930 %
3931 %  A description of each parameter follows:
3932 %
3933 %    o wand: the magick wand.
3934 %
3935 %    o kurtosis:  The kurtosis for the specified channel(s).
3936 %
3937 %    o skewness:  The skewness for the specified channel(s).
3938 %
3939 */
3940 WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3941   double *kurtosis,double *skewness)
3942 {
3943   MagickBooleanType
3944     status;
3945
3946   assert(wand != (MagickWand *) NULL);
3947   assert(wand->signature == WandSignature);
3948   if (IfMagickTrue(wand->debug))
3949     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3950   if (wand->images == (Image *) NULL)
3951     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3952   status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
3953   return(status);
3954 }
3955 \f
3956 /*
3957 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3958 %                                                                             %
3959 %                                                                             %
3960 %                                                                             %
3961 %   M a g i c k G e t I m a g e M e a n                                       %
3962 %                                                                             %
3963 %                                                                             %
3964 %                                                                             %
3965 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3966 %
3967 %  MagickGetImageMean() gets the mean and standard deviation of one or more
3968 %  image channels.
3969 %
3970 %  The format of the MagickGetImageMean method is:
3971 %
3972 %      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3973 %        double *standard_deviation)
3974 %
3975 %  A description of each parameter follows:
3976 %
3977 %    o wand: the magick wand.
3978 %
3979 %    o channel: the image channel(s).
3980 %
3981 %    o mean:  The mean pixel value for the specified channel(s).
3982 %
3983 %    o standard_deviation:  The standard deviation for the specified channel(s).
3984 %
3985 */
3986 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3987   double *standard_deviation)
3988 {
3989   MagickBooleanType
3990     status;
3991
3992   assert(wand != (MagickWand *) NULL);
3993   assert(wand->signature == WandSignature);
3994   if (IfMagickTrue(wand->debug))
3995     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3996   if (wand->images == (Image *) NULL)
3997     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3998   status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
3999   return(status);
4000 }
4001 \f
4002 /*
4003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4004 %                                                                             %
4005 %                                                                             %
4006 %                                                                             %
4007 %   M a g i c k G e t I m a g e R a n g e                                     %
4008 %                                                                             %
4009 %                                                                             %
4010 %                                                                             %
4011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4012 %
4013 %  MagickGetImageRange() gets the range for one or more image channels.
4014 %
4015 %  The format of the MagickGetImageRange method is:
4016 %
4017 %      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
4018 %        double *maxima)
4019 %
4020 %  A description of each parameter follows:
4021 %
4022 %    o wand: the magick wand.
4023 %
4024 %    o minima:  The minimum pixel value for the specified channel(s).
4025 %
4026 %    o maxima:  The maximum pixel value for the specified channel(s).
4027 %
4028 */
4029 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
4030   double *minima,double *maxima)
4031 {
4032   MagickBooleanType
4033     status;
4034
4035   assert(wand != (MagickWand *) NULL);
4036   assert(wand->signature == WandSignature);
4037   if (IfMagickTrue(wand->debug))
4038     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4039   if (wand->images == (Image *) NULL)
4040     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4041   status=GetImageRange(wand->images,minima,maxima,wand->exception);
4042   return(status);
4043 }
4044 \f
4045 /*
4046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4047 %                                                                             %
4048 %                                                                             %
4049 %                                                                             %
4050 %   M a g i c k G e t I m a g e S t a t i s t i c s                           %
4051 %                                                                             %
4052 %                                                                             %
4053 %                                                                             %
4054 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4055 %
4056 %  MagickGetImageStatistics() returns statistics for each channel in the
4057 %  image.  The statistics include the channel depth, its minima and
4058 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
4059 %  You can access the red channel mean, for example, like this:
4060 %
4061 %      channel_statistics=MagickGetImageStatistics(wand);
4062 %      red_mean=channel_statistics[RedPixelChannel].mean;
4063 %
4064 %  Use MagickRelinquishMemory() to free the statistics buffer.
4065 %
4066 %  The format of the MagickGetImageStatistics method is:
4067 %
4068 %      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4069 %
4070 %  A description of each parameter follows:
4071 %
4072 %    o wand: the magick wand.
4073 %
4074 */
4075 WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4076 {
4077   assert(wand != (MagickWand *) NULL);
4078   assert(wand->signature == WandSignature);
4079   if (IfMagickTrue(wand->debug))
4080     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4081   if (wand->images == (Image *) NULL)
4082     {
4083       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4084         "ContainsNoImages","`%s'",wand->name);
4085       return((ChannelStatistics *) NULL);
4086     }
4087   return(GetImageStatistics(wand->images,wand->exception));
4088 }
4089 \f
4090 /*
4091 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4092 %                                                                             %
4093 %                                                                             %
4094 %                                                                             %
4095 %   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                     %
4096 %                                                                             %
4097 %                                                                             %
4098 %                                                                             %
4099 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4100 %
4101 %  MagickGetImageColormapColor() returns the color of the specified colormap
4102 %  index.
4103 %
4104 %  The format of the MagickGetImageColormapColor method is:
4105 %
4106 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4107 %        const size_t index,PixelWand *color)
4108 %
4109 %  A description of each parameter follows:
4110 %
4111 %    o wand: the magick wand.
4112 %
4113 %    o index: the offset into the image colormap.
4114 %
4115 %    o color: Return the colormap color in this wand.
4116 %
4117 */
4118 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4119   const size_t index,PixelWand *color)
4120 {
4121   assert(wand != (MagickWand *) NULL);
4122   assert(wand->signature == WandSignature);
4123   if (IfMagickTrue(wand->debug))
4124     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4125   if (wand->images == (Image *) NULL)
4126     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4127   if ((wand->images->colormap == (PixelInfo *) NULL) ||
4128       (index >= wand->images->colors))
4129     {
4130       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4131         "InvalidColormapIndex","`%s'",wand->name);
4132       return(MagickFalse);
4133     }
4134   PixelSetPixelColor(color,wand->images->colormap+index);
4135   return(MagickTrue);
4136 }
4137 \f
4138 /*
4139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4140 %                                                                             %
4141 %                                                                             %
4142 %                                                                             %
4143 %   M a g i c k G e t I m a g e C o l o r s                                   %
4144 %                                                                             %
4145 %                                                                             %
4146 %                                                                             %
4147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4148 %
4149 %  MagickGetImageColors() gets the number of unique colors in the image.
4150 %
4151 %  The format of the MagickGetImageColors method is:
4152 %
4153 %      size_t MagickGetImageColors(MagickWand *wand)
4154 %
4155 %  A description of each parameter follows:
4156 %
4157 %    o wand: the magick wand.
4158 %
4159 */
4160 WandExport size_t MagickGetImageColors(MagickWand *wand)
4161 {
4162   assert(wand != (MagickWand *) NULL);
4163   assert(wand->signature == WandSignature);
4164   if (IfMagickTrue(wand->debug))
4165     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4166   if (wand->images == (Image *) NULL)
4167     {
4168       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4169         "ContainsNoImages","`%s'",wand->name);
4170       return(0);
4171     }
4172   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4173 }
4174 \f
4175 /*
4176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4177 %                                                                             %
4178 %                                                                             %
4179 %                                                                             %
4180 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4181 %                                                                             %
4182 %                                                                             %
4183 %                                                                             %
4184 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4185 %
4186 %  MagickGetImageColorspace() gets the image colorspace.
4187 %
4188 %  The format of the MagickGetImageColorspace method is:
4189 %
4190 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4191 %
4192 %  A description of each parameter follows:
4193 %
4194 %    o wand: the magick wand.
4195 %
4196 */
4197 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4198 {
4199   assert(wand != (MagickWand *) NULL);
4200   assert(wand->signature == WandSignature);
4201   if (IfMagickTrue(wand->debug))
4202     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4203   if (wand->images == (Image *) NULL)
4204     {
4205       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4206         "ContainsNoImages","`%s'",wand->name);
4207       return(UndefinedColorspace);
4208     }
4209   return(wand->images->colorspace);
4210 }
4211 \f
4212 /*
4213 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4214 %                                                                             %
4215 %                                                                             %
4216 %                                                                             %
4217 %   M a g i c k G e t I m a g e C o m p o s e                                 %
4218 %                                                                             %
4219 %                                                                             %
4220 %                                                                             %
4221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4222 %
4223 %  MagickGetImageCompose() returns the composite operator associated with the
4224 %  image.
4225 %
4226 %  The format of the MagickGetImageCompose method is:
4227 %
4228 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4229 %
4230 %  A description of each parameter follows:
4231 %
4232 %    o wand: the magick wand.
4233 %
4234 */
4235 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4236 {
4237   assert(wand != (MagickWand *) NULL);
4238   assert(wand->signature == WandSignature);
4239   if (IfMagickTrue(wand->debug))
4240     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4241   if (wand->images == (Image *) NULL)
4242     {
4243       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4244         "ContainsNoImages","`%s'",wand->name);
4245       return(UndefinedCompositeOp);
4246     }
4247   return(wand->images->compose);
4248 }
4249 \f
4250 /*
4251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4252 %                                                                             %
4253 %                                                                             %
4254 %                                                                             %
4255 %   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                         %
4256 %                                                                             %
4257 %                                                                             %
4258 %                                                                             %
4259 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4260 %
4261 %  MagickGetImageCompression() gets the image compression.
4262 %
4263 %  The format of the MagickGetImageCompression method is:
4264 %
4265 %      CompressionType MagickGetImageCompression(MagickWand *wand)
4266 %
4267 %  A description of each parameter follows:
4268 %
4269 %    o wand: the magick wand.
4270 %
4271 */
4272 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4273 {
4274   assert(wand != (MagickWand *) NULL);
4275   assert(wand->signature == WandSignature);
4276   if (IfMagickTrue(wand->debug))
4277     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4278   if (wand->images == (Image *) NULL)
4279     {
4280       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4281         "ContainsNoImages","`%s'",wand->name);
4282       return(UndefinedCompression);
4283     }
4284   return(wand->images->compression);
4285 }
4286 \f
4287 /*
4288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4289 %                                                                             %
4290 %                                                                             %
4291 %                                                                             %
4292 %   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           %
4293 %                                                                             %
4294 %                                                                             %
4295 %                                                                             %
4296 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4297 %
4298 %  MagickGetImageCompressionQuality() gets the image compression quality.
4299 %
4300 %  The format of the MagickGetImageCompressionQuality method is:
4301 %
4302 %      size_t MagickGetImageCompressionQuality(MagickWand *wand)
4303 %
4304 %  A description of each parameter follows:
4305 %
4306 %    o wand: the magick wand.
4307 %
4308 */
4309 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4310 {
4311   assert(wand != (MagickWand *) NULL);
4312   assert(wand->signature == WandSignature);
4313   if (IfMagickTrue(wand->debug))
4314     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4315   if (wand->images == (Image *) NULL)
4316     {
4317       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4318         "ContainsNoImages","`%s'",wand->name);
4319       return(0UL);
4320     }
4321   return(wand->images->quality);
4322 }
4323 \f
4324 /*
4325 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4326 %                                                                             %
4327 %                                                                             %
4328 %                                                                             %
4329 %   M a g i c k G e t I m a g e D e l a y                                     %
4330 %                                                                             %
4331 %                                                                             %
4332 %                                                                             %
4333 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4334 %
4335 %  MagickGetImageDelay() gets the image delay.
4336 %
4337 %  The format of the MagickGetImageDelay method is:
4338 %
4339 %      size_t MagickGetImageDelay(MagickWand *wand)
4340 %
4341 %  A description of each parameter follows:
4342 %
4343 %    o wand: the magick wand.
4344 %
4345 */
4346 WandExport size_t MagickGetImageDelay(MagickWand *wand)
4347 {
4348   assert(wand != (MagickWand *) NULL);
4349   assert(wand->signature == WandSignature);
4350   if (IfMagickTrue(wand->debug))
4351     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4352   if (wand->images == (Image *) NULL)
4353     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4354   return(wand->images->delay);
4355 }
4356 \f
4357 /*
4358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4359 %                                                                             %
4360 %                                                                             %
4361 %                                                                             %
4362 %   M a g i c k G e t I m a g e D e p t h                                     %
4363 %                                                                             %
4364 %                                                                             %
4365 %                                                                             %
4366 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4367 %
4368 %  MagickGetImageDepth() gets the image depth.
4369 %
4370 %  The format of the MagickGetImageDepth method is:
4371 %
4372 %      size_t MagickGetImageDepth(MagickWand *wand)
4373 %
4374 %  A description of each parameter follows:
4375 %
4376 %    o wand: the magick wand.
4377 %
4378 */
4379 WandExport size_t MagickGetImageDepth(MagickWand *wand)
4380 {
4381   assert(wand != (MagickWand *) NULL);
4382   assert(wand->signature == WandSignature);
4383   if (IfMagickTrue(wand->debug))
4384     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4385   if (wand->images == (Image *) NULL)
4386     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4387   return(wand->images->depth);
4388 }
4389 \f
4390 /*
4391 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4392 %                                                                             %
4393 %                                                                             %
4394 %                                                                             %
4395 %   M a g i c k G e t I m a g e D i s p o s e                                 %
4396 %                                                                             %
4397 %                                                                             %
4398 %                                                                             %
4399 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4400 %
4401 %  MagickGetImageDispose() gets the image disposal method.
4402 %
4403 %  The format of the MagickGetImageDispose method is:
4404 %
4405 %      DisposeType MagickGetImageDispose(MagickWand *wand)
4406 %
4407 %  A description of each parameter follows:
4408 %
4409 %    o wand: the magick wand.
4410 %
4411 */
4412 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4413 {
4414   assert(wand != (MagickWand *) NULL);
4415   assert(wand->signature == WandSignature);
4416   if (IfMagickTrue(wand->debug))
4417     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4418   if (wand->images == (Image *) NULL)
4419     {
4420       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4421         "ContainsNoImages","`%s'",wand->name);
4422       return(UndefinedDispose);
4423     }
4424   return((DisposeType) wand->images->dispose);
4425 }
4426 \f
4427 /*
4428 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4429 %                                                                             %
4430 %                                                                             %
4431 %                                                                             %
4432 %   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4433 %                                                                             %
4434 %                                                                             %
4435 %                                                                             %
4436 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4437 %
4438 %  MagickGetImageDistortion() compares an image to a reconstructed image and
4439 %  returns the specified distortion metric.
4440 %
4441 %  The format of the MagickGetImageDistortion method is:
4442 %
4443 %      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4444 %        const MagickWand *reference,const MetricType metric,
4445 %        double *distortion)
4446 %
4447 %  A description of each parameter follows:
4448 %
4449 %    o wand: the magick wand.
4450 %
4451 %    o reference: the reference wand.
4452 %
4453 %    o metric: the metric.
4454 %
4455 %    o distortion: the computed distortion between the images.
4456 %
4457 */
4458 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4459   const MagickWand *reference,const MetricType metric,double *distortion)
4460 {
4461   MagickBooleanType
4462     status;
4463
4464   assert(wand != (MagickWand *) NULL);
4465   assert(wand->signature == WandSignature);
4466   if (IfMagickTrue(wand->debug))
4467     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4468   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4469     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4470   status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4471     wand->exception);
4472   return(status);
4473 }
4474 \f
4475 /*
4476 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4477 %                                                                             %
4478 %                                                                             %
4479 %                                                                             %
4480 %   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                         %
4481 %                                                                             %
4482 %                                                                             %
4483 %                                                                             %
4484 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4485 %
4486 %  MagickGetImageDistortions() compares one or more pixel channels of an
4487 %  image to a reconstructed image and returns the specified distortion metrics.
4488 %
4489 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4490 %
4491 %  The format of the MagickGetImageDistortion method is:
4492 %
4493 %      double *MagickGetImageDistortion(MagickWand *wand,
4494 %        const MagickWand *reference,const MetricType metric)
4495 %
4496 %  A description of each parameter follows:
4497 %
4498 %    o wand: the magick wand.
4499 %
4500 %    o reference: the reference wand.
4501 %
4502 %    o metric: the metric.
4503 %
4504 */
4505 WandExport double *MagickGetImageDistortions(MagickWand *wand,
4506   const MagickWand *reference,const MetricType metric)
4507 {
4508   double
4509     *channel_distortion;
4510
4511   assert(wand != (MagickWand *) NULL);
4512   assert(wand->signature == WandSignature);
4513   if (IfMagickTrue(wand->debug))
4514     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4515   assert(reference != (MagickWand *) NULL);
4516   assert(reference->signature == WandSignature);
4517   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4518     {
4519       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4520         "ContainsNoImages","`%s'",wand->name);
4521       return((double *) NULL);
4522     }
4523   channel_distortion=GetImageDistortions(wand->images,reference->images,
4524     metric,wand->exception);
4525   return(channel_distortion);
4526 }
4527 \f
4528 /*
4529 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4530 %                                                                             %
4531 %                                                                             %
4532 %                                                                             %
4533 %   M a g i c k G e t I m a g e E n d i a n                                   %
4534 %                                                                             %
4535 %                                                                             %
4536 %                                                                             %
4537 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4538 %
4539 %  MagickGetImageEndian() gets the image endian.
4540 %
4541 %  The format of the MagickGetImageEndian method is:
4542 %
4543 %      EndianType MagickGetImageEndian(MagickWand *wand)
4544 %
4545 %  A description of each parameter follows:
4546 %
4547 %    o wand: the magick wand.
4548 %
4549 */
4550 WandExport EndianType MagickGetImageEndian(MagickWand *wand)
4551 {
4552   assert(wand != (MagickWand *) NULL);
4553   assert(wand->signature == WandSignature);
4554   if (IfMagickTrue(wand->debug))
4555     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4556   if (wand->images == (Image *) NULL)
4557     {
4558       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4559         "ContainsNoImages","`%s'",wand->name);
4560       return(UndefinedEndian);
4561     }
4562   return(wand->images->endian);
4563 }
4564 \f
4565 /*
4566 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4567 %                                                                             %
4568 %                                                                             %
4569 %                                                                             %
4570 %   M a g i c k G e t I m a g e F i l e n a m e                               %
4571 %                                                                             %
4572 %                                                                             %
4573 %                                                                             %
4574 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4575 %
4576 %  MagickGetImageFilename() returns the filename of a particular image in a
4577 %  sequence.
4578 %
4579 %  The format of the MagickGetImageFilename method is:
4580 %
4581 %      char *MagickGetImageFilename(MagickWand *wand)
4582 %
4583 %  A description of each parameter follows:
4584 %
4585 %    o wand: the magick wand.
4586 %
4587 */
4588 WandExport char *MagickGetImageFilename(MagickWand *wand)
4589 {
4590   assert(wand != (MagickWand *) NULL);
4591   assert(wand->signature == WandSignature);
4592   if (IfMagickTrue(wand->debug))
4593     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4594   if (wand->images == (Image *) NULL)
4595     {
4596       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4597         "ContainsNoImages","`%s'",wand->name);
4598       return((char *) NULL);
4599     }
4600   return(AcquireString(wand->images->filename));
4601 }
4602 \f
4603 /*
4604 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4605 %                                                                             %
4606 %                                                                             %
4607 %                                                                             %
4608 %   M a g i c k G e t I m a g e F o r m a t                                   %
4609 %                                                                             %
4610 %                                                                             %
4611 %                                                                             %
4612 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4613 %
4614 %  MagickGetImageFormat() returns the format of a particular image in a
4615 %  sequence.
4616 %
4617 %  The format of the MagickGetImageFormat method is:
4618 %
4619 %      char *MagickGetImageFormat(MagickWand *wand)
4620 %
4621 %  A description of each parameter follows:
4622 %
4623 %    o wand: the magick wand.
4624 %
4625 */
4626 WandExport char *MagickGetImageFormat(MagickWand *wand)
4627 {
4628   assert(wand != (MagickWand *) NULL);
4629   assert(wand->signature == WandSignature);
4630   if (IfMagickTrue(wand->debug))
4631     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4632   if (wand->images == (Image *) NULL)
4633     {
4634       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4635         "ContainsNoImages","`%s'",wand->name);
4636       return((char *) NULL);
4637     }
4638   return(AcquireString(wand->images->magick));
4639 }
4640 \f
4641 /*
4642 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4643 %                                                                             %
4644 %                                                                             %
4645 %                                                                             %
4646 %   M a g i c k G e t I m a g e F u z z                                       %
4647 %                                                                             %
4648 %                                                                             %
4649 %                                                                             %
4650 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4651 %
4652 %  MagickGetImageFuzz() gets the image fuzz.
4653 %
4654 %  The format of the MagickGetImageFuzz method is:
4655 %
4656 %      double MagickGetImageFuzz(MagickWand *wand)
4657 %
4658 %  A description of each parameter follows:
4659 %
4660 %    o wand: the magick wand.
4661 %
4662 */
4663 WandExport double MagickGetImageFuzz(MagickWand *wand)
4664 {
4665   assert(wand != (MagickWand *) NULL);
4666   assert(wand->signature == WandSignature);
4667   if (IfMagickTrue(wand->debug))
4668     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4669   if (wand->images == (Image *) NULL)
4670     {
4671       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4672         "ContainsNoImages","`%s'",wand->name);
4673       return(0.0);
4674     }
4675   return(wand->images->fuzz);
4676 }
4677 \f
4678 /*
4679 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4680 %                                                                             %
4681 %                                                                             %
4682 %                                                                             %
4683 %   M a g i c k G e t I m a g e G a m m a                                     %
4684 %                                                                             %
4685 %                                                                             %
4686 %                                                                             %
4687 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4688 %
4689 %  MagickGetImageGamma() gets the image gamma.
4690 %
4691 %  The format of the MagickGetImageGamma method is:
4692 %
4693 %      double MagickGetImageGamma(MagickWand *wand)
4694 %
4695 %  A description of each parameter follows:
4696 %
4697 %    o wand: the magick wand.
4698 %
4699 */
4700 WandExport double MagickGetImageGamma(MagickWand *wand)
4701 {
4702   assert(wand != (MagickWand *) NULL);
4703   assert(wand->signature == WandSignature);
4704   if (IfMagickTrue(wand->debug))
4705     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4706   if (wand->images == (Image *) NULL)
4707     {
4708       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4709         "ContainsNoImages","`%s'",wand->name);
4710       return(0.0);
4711     }
4712   return(wand->images->gamma);
4713 }
4714 \f
4715 /*
4716 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4717 %                                                                             %
4718 %                                                                             %
4719 %                                                                             %
4720 %   M a g i c k G e t I m a g e G r a v i t y                                 %
4721 %                                                                             %
4722 %                                                                             %
4723 %                                                                             %
4724 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4725 %
4726 %  MagickGetImageGravity() gets the image gravity.
4727 %
4728 %  The format of the MagickGetImageGravity method is:
4729 %
4730 %      GravityType MagickGetImageGravity(MagickWand *wand)
4731 %
4732 %  A description of each parameter follows:
4733 %
4734 %    o wand: the magick wand.
4735 %
4736 */
4737 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4738 {
4739   assert(wand != (MagickWand *) NULL);
4740   assert(wand->signature == WandSignature);
4741   if (IfMagickTrue(wand->debug))
4742     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4743   if (wand->images == (Image *) NULL)
4744     {
4745       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4746         "ContainsNoImages","`%s'",wand->name);
4747       return(UndefinedGravity);
4748     }
4749   return(wand->images->gravity);
4750 }
4751 \f
4752 /*
4753 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4754 %                                                                             %
4755 %                                                                             %
4756 %                                                                             %
4757 %   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                       %
4758 %                                                                             %
4759 %                                                                             %
4760 %                                                                             %
4761 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4762 %
4763 %  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4764 %
4765 %  The format of the MagickGetImageGreenPrimary method is:
4766 %
4767 %      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4768 %        double *y)
4769 %
4770 %  A description of each parameter follows:
4771 %
4772 %    o wand: the magick wand.
4773 %
4774 %    o x: the chromaticity green primary x-point.
4775 %
4776 %    o y: the chromaticity green primary y-point.
4777 %
4778 */
4779 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4780   double *x,double *y)
4781 {
4782   assert(wand != (MagickWand *) NULL);
4783   assert(wand->signature == WandSignature);
4784   if (IfMagickTrue(wand->debug))
4785     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4786   if (wand->images == (Image *) NULL)
4787     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4788   *x=wand->images->chromaticity.green_primary.x;
4789   *y=wand->images->chromaticity.green_primary.y;
4790   return(MagickTrue);
4791 }
4792 \f
4793 /*
4794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4795 %                                                                             %
4796 %                                                                             %
4797 %                                                                             %
4798 %   M a g i c k G e t I m a g e H e i g h t                                   %
4799 %                                                                             %
4800 %                                                                             %
4801 %                                                                             %
4802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4803 %
4804 %  MagickGetImageHeight() returns the image height.
4805 %
4806 %  The format of the MagickGetImageHeight method is:
4807 %
4808 %      size_t MagickGetImageHeight(MagickWand *wand)
4809 %
4810 %  A description of each parameter follows:
4811 %
4812 %    o wand: the magick wand.
4813 %
4814 */
4815 WandExport size_t MagickGetImageHeight(MagickWand *wand)
4816 {
4817   assert(wand != (MagickWand *) NULL);
4818   assert(wand->signature == WandSignature);
4819   if (IfMagickTrue(wand->debug))
4820     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4821   if (wand->images == (Image *) NULL)
4822     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4823   return(wand->images->rows);
4824 }
4825 \f
4826 /*
4827 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4828 %                                                                             %
4829 %                                                                             %
4830 %                                                                             %
4831 %   M a g i c k G e t I m a g e H i s t o g r a m                             %
4832 %                                                                             %
4833 %                                                                             %
4834 %                                                                             %
4835 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4836 %
4837 %  MagickGetImageHistogram() returns the image histogram as an array of
4838 %  PixelWand wands.
4839 %
4840 %  The format of the MagickGetImageHistogram method is:
4841 %
4842 %      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4843 %        size_t *number_colors)
4844 %
4845 %  A description of each parameter follows:
4846 %
4847 %    o wand: the magick wand.
4848 %
4849 %    o number_colors: the number of unique colors in the image and the number
4850 %      of pixel wands returned.
4851 %
4852 */
4853 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4854   size_t *number_colors)
4855 {
4856   PixelInfo
4857     *histogram;
4858
4859   PixelWand
4860     **pixel_wands;
4861
4862   register ssize_t
4863     i;
4864
4865   assert(wand != (MagickWand *) NULL);
4866   assert(wand->signature == WandSignature);
4867   if (IfMagickTrue(wand->debug))
4868     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4869   if (wand->images == (Image *) NULL)
4870     {
4871       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4872         "ContainsNoImages","`%s'",wand->name);
4873       return((PixelWand **) NULL);
4874     }
4875   histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4876   if (histogram == (PixelInfo *) NULL)
4877     return((PixelWand **) NULL);
4878   pixel_wands=NewPixelWands(*number_colors);
4879   for (i=0; i < (ssize_t) *number_colors; i++)
4880   {
4881     PixelSetPixelColor(pixel_wands[i],&histogram[i]);
4882     PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4883   }
4884   histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
4885   return(pixel_wands);
4886 }
4887 \f
4888 /*
4889 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4890 %                                                                             %
4891 %                                                                             %
4892 %                                                                             %
4893 %   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                 %
4894 %                                                                             %
4895 %                                                                             %
4896 %                                                                             %
4897 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4898 %
4899 %  MagickGetImageInterlaceScheme() gets the image interlace scheme.
4900 %
4901 %  The format of the MagickGetImageInterlaceScheme method is:
4902 %
4903 %      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4904 %
4905 %  A description of each parameter follows:
4906 %
4907 %    o wand: the magick wand.
4908 %
4909 */
4910 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4911 {
4912   assert(wand != (MagickWand *) NULL);
4913   assert(wand->signature == WandSignature);
4914   if (IfMagickTrue(wand->debug))
4915     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4916   if (wand->images == (Image *) NULL)
4917     {
4918       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4919         "ContainsNoImages","`%s'",wand->name);
4920       return(UndefinedInterlace);
4921     }
4922   return(wand->images->interlace);
4923 }
4924 \f
4925 /*
4926 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4927 %                                                                             %
4928 %                                                                             %
4929 %                                                                             %
4930 %   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             %
4931 %                                                                             %
4932 %                                                                             %
4933 %                                                                             %
4934 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4935 %
4936 %  MagickGetImageInterpolateMethod() returns the interpolation method for the
4937 %  sepcified image.
4938 %
4939 %  The format of the MagickGetImageInterpolateMethod method is:
4940 %
4941 %      PixelInterpolateMethod MagickGetImagePixelInterpolateMethod(
4942 %        MagickWand *wand)
4943 %
4944 %  A description of each parameter follows:
4945 %
4946 %    o wand: the magick wand.
4947 %
4948 */
4949 WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
4950   MagickWand *wand)
4951 {
4952   assert(wand != (MagickWand *) NULL);
4953   assert(wand->signature == WandSignature);
4954   if (IfMagickTrue(wand->debug))
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(UndefinedInterpolatePixel);
4961     }
4962   return(wand->images->interpolate);
4963 }
4964 \f
4965 /*
4966 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4967 %                                                                             %
4968 %                                                                             %
4969 %                                                                             %
4970 %   M a g i c k G e t I m a g e I t e r a t i o n s                           %
4971 %                                                                             %
4972 %                                                                             %
4973 %                                                                             %
4974 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4975 %
4976 %  MagickGetImageIterations() gets the image iterations.
4977 %
4978 %  The format of the MagickGetImageIterations method is:
4979 %
4980 %      size_t MagickGetImageIterations(MagickWand *wand)
4981 %
4982 %  A description of each parameter follows:
4983 %
4984 %    o wand: the magick wand.
4985 %
4986 */
4987 WandExport size_t MagickGetImageIterations(MagickWand *wand)
4988 {
4989   assert(wand != (MagickWand *) NULL);
4990   assert(wand->signature == WandSignature);
4991   if (IfMagickTrue(wand->debug))
4992     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4993   if (wand->images == (Image *) NULL)
4994     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4995   return(wand->images->iterations);
4996 }
4997 \f
4998 /*
4999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5000 %                                                                             %
5001 %                                                                             %
5002 %                                                                             %
5003 %   M a g i c k G e t I m a g e L e n g t h                                   %
5004 %                                                                             %
5005 %                                                                             %
5006 %                                                                             %
5007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5008 %
5009 %  MagickGetImageLength() returns the image length in bytes.
5010 %
5011 %  The format of the MagickGetImageLength method is:
5012 %
5013 %      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5014 %        MagickSizeType *length)
5015 %
5016 %  A description of each parameter follows:
5017 %
5018 %    o wand: the magick wand.
5019 %
5020 %    o length: the image length in bytes.
5021 %
5022 */
5023 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5024   MagickSizeType *length)
5025 {
5026   assert(wand != (MagickWand *) NULL);
5027   assert(wand->signature == WandSignature);
5028   if (IfMagickTrue(wand->debug))
5029     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5030   if (wand->images == (Image *) NULL)
5031     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5032   *length=GetBlobSize(wand->images);
5033   return(MagickTrue);
5034 }
5035 \f
5036 /*
5037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5038 %                                                                             %
5039 %                                                                             %
5040 %                                                                             %
5041 %   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5042 %                                                                             %
5043 %                                                                             %
5044 %                                                                             %
5045 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5046 %
5047 %  MagickGetImageMatteColor() returns the image matte color.
5048 %
5049 %  The format of the MagickGetImageMatteColor method is:
5050 %
5051 %      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5052 %        PixelWand *matte_color)
5053 %
5054 %  A description of each parameter follows:
5055 %
5056 %    o wand: the magick wand.
5057 %
5058 %    o matte_color: Return the matte color.
5059 %
5060 */
5061 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5062   PixelWand *matte_color)
5063 {
5064   assert(wand != (MagickWand *) NULL);
5065   assert(wand->signature == WandSignature);
5066   if (IfMagickTrue(wand->debug))
5067     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5068   if (wand->images == (Image *) NULL)
5069     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5070   PixelSetPixelColor(matte_color,&wand->images->matte_color);
5071   return(MagickTrue);
5072 }
5073 \f
5074 /*
5075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5076 %                                                                             %
5077 %                                                                             %
5078 %                                                                             %
5079 %   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                         %
5080 %                                                                             %
5081 %                                                                             %
5082 %                                                                             %
5083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5084 %
5085 %  MagickGetImageOrientation() returns the image orientation.
5086 %
5087 %  The format of the MagickGetImageOrientation method is:
5088 %
5089 %      OrientationType MagickGetImageOrientation(MagickWand *wand)
5090 %
5091 %  A description of each parameter follows:
5092 %
5093 %    o wand: the magick wand.
5094 %
5095 */
5096 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5097 {
5098   assert(wand != (MagickWand *) NULL);
5099   assert(wand->signature == WandSignature);
5100   if (IfMagickTrue(wand->debug))
5101     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5102   if (wand->images == (Image *) NULL)
5103     {
5104       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5105         "ContainsNoImages","`%s'",wand->name);
5106       return(UndefinedOrientation);
5107     }
5108   return(wand->images->orientation);
5109 }
5110 \f
5111 /*
5112 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5113 %                                                                             %
5114 %                                                                             %
5115 %                                                                             %
5116 %   M a g i c k G e t I m a g e P a g e                                       %
5117 %                                                                             %
5118 %                                                                             %
5119 %                                                                             %
5120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5121 %
5122 %  MagickGetImagePage() returns the page geometry associated with the image.
5123 %
5124 %  The format of the MagickGetImagePage method is:
5125 %
5126 %      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5127 %        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5128 %
5129 %  A description of each parameter follows:
5130 %
5131 %    o wand: the magick wand.
5132 %
5133 %    o width: the page width.
5134 %
5135 %    o height: the page height.
5136 %
5137 %    o x: the page x-offset.
5138 %
5139 %    o y: the page y-offset.
5140 %
5141 */
5142 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5143   size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5144 {
5145   assert(wand != (const MagickWand *) NULL);
5146   assert(wand->signature == WandSignature);
5147   if (IfMagickTrue(wand->debug))
5148     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5149   if (wand->images == (Image *) NULL)
5150     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5151   *width=wand->images->page.width;
5152   *height=wand->images->page.height;
5153   *x=wand->images->page.x;
5154   *y=wand->images->page.y;
5155   return(MagickTrue);
5156 }
5157 \f
5158 /*
5159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5160 %                                                                             %
5161 %                                                                             %
5162 %                                                                             %
5163 %   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5164 %                                                                             %
5165 %                                                                             %
5166 %                                                                             %
5167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5168 %
5169 %  MagickGetImagePixelColor() returns the color of the specified pixel.
5170 %
5171 %  The format of the MagickGetImagePixelColor method is:
5172 %
5173 %      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5174 %        const ssize_t x,const ssize_t y,PixelWand *color)
5175 %
5176 %  A description of each parameter follows:
5177 %
5178 %    o wand: the magick wand.
5179 %
5180 %    o x,y: the pixel offset into the image.
5181 %
5182 %    o color: Return the colormap color in this wand.
5183 %
5184 */
5185 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5186   const ssize_t x,const ssize_t y,PixelWand *color)
5187 {
5188   register const Quantum
5189     *p;
5190
5191   CacheView
5192     *image_view;
5193
5194   assert(wand != (MagickWand *) NULL);
5195   assert(wand->signature == WandSignature);
5196   if (IfMagickTrue(wand->debug))
5197     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5198   if (wand->images == (Image *) NULL)
5199     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5200   image_view=AcquireVirtualCacheView(wand->images,wand->exception);
5201   p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5202   if (p == (const Quantum *) NULL)
5203     {
5204       image_view=DestroyCacheView(image_view);
5205       return(MagickFalse);
5206     }
5207   PixelSetQuantumPixel(wand->images,p,color);
5208   image_view=DestroyCacheView(image_view);
5209   return(MagickTrue);
5210 }
5211 \f
5212 /*
5213 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5214 %                                                                             %
5215 %                                                                             %
5216 %                                                                             %
5217 %   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5218 %                                                                             %
5219 %                                                                             %
5220 %                                                                             %
5221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5222 %
5223 %  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5224 %
5225 %  The format of the MagickGetImageRedPrimary method is:
5226 %
5227 %      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5228 %        double *y)
5229 %
5230 %  A description of each parameter follows:
5231 %
5232 %    o wand: the magick wand.
5233 %
5234 %    o x: the chromaticity red primary x-point.
5235 %
5236 %    o y: the chromaticity red primary y-point.
5237 %
5238 */
5239 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5240   double *x,double *y)
5241 {
5242   assert(wand != (MagickWand *) NULL);
5243   assert(wand->signature == WandSignature);
5244   if (IfMagickTrue(wand->debug))
5245     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5246   if (wand->images == (Image *) NULL)
5247     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5248   *x=wand->images->chromaticity.red_primary.x;
5249   *y=wand->images->chromaticity.red_primary.y;
5250   return(MagickTrue);
5251 }
5252 \f
5253 /*
5254 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5255 %                                                                             %
5256 %                                                                             %
5257 %                                                                             %
5258 %   M a g i c k G e t I m a g e R e g i o n                                   %
5259 %                                                                             %
5260 %                                                                             %
5261 %                                                                             %
5262 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5263 %
5264 %  MagickGetImageRegion() extracts a region of the image and returns it as a
5265 %  a new wand.
5266 %
5267 %  The format of the MagickGetImageRegion method is:
5268 %
5269 %      MagickWand *MagickGetImageRegion(MagickWand *wand,
5270 %        const size_t width,const size_t height,const ssize_t x,
5271 %        const ssize_t y)
5272 %
5273 %  A description of each parameter follows:
5274 %
5275 %    o wand: the magick wand.
5276 %
5277 %    o width: the region width.
5278 %
5279 %    o height: the region height.
5280 %
5281 %    o x: the region x offset.
5282 %
5283 %    o y: the region y offset.
5284 %
5285 */
5286 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5287   const size_t width,const size_t height,const ssize_t x,
5288   const ssize_t y)
5289 {
5290   Image
5291     *region_image;
5292
5293   RectangleInfo
5294     region;
5295
5296   assert(wand != (MagickWand *) NULL);
5297   assert(wand->signature == WandSignature);
5298   if (IfMagickTrue(wand->debug))
5299     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5300   if (wand->images == (Image *) NULL)
5301     return((MagickWand *) NULL);
5302   region.width=width;
5303   region.height=height;
5304   region.x=x;
5305   region.y=y;
5306   region_image=CropImage(wand->images,&region,wand->exception);
5307   if (region_image == (Image *) NULL)
5308     return((MagickWand *) NULL);
5309   return(CloneMagickWandFromImages(wand,region_image));
5310 }
5311 \f
5312 /*
5313 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5314 %                                                                             %
5315 %                                                                             %
5316 %                                                                             %
5317 %   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                 %
5318 %                                                                             %
5319 %                                                                             %
5320 %                                                                             %
5321 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5322 %
5323 %  MagickGetImageRenderingIntent() gets the image rendering intent.
5324 %
5325 %  The format of the MagickGetImageRenderingIntent method is:
5326 %
5327 %      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5328 %
5329 %  A description of each parameter follows:
5330 %
5331 %    o wand: the magick wand.
5332 %
5333 */
5334 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5335 {
5336   assert(wand != (MagickWand *) NULL);
5337   assert(wand->signature == WandSignature);
5338   if (IfMagickTrue(wand->debug))
5339     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5340   if (wand->images == (Image *) NULL)
5341     {
5342       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5343         "ContainsNoImages","`%s'",wand->name);
5344       return(UndefinedIntent);
5345     }
5346   return((RenderingIntent) wand->images->rendering_intent);
5347 }
5348 \f
5349 /*
5350 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5351 %                                                                             %
5352 %                                                                             %
5353 %                                                                             %
5354 %   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5355 %                                                                             %
5356 %                                                                             %
5357 %                                                                             %
5358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5359 %
5360 %  MagickGetImageResolution() gets the image X and Y resolution.
5361 %
5362 %  The format of the MagickGetImageResolution method is:
5363 %
5364 %      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5365 %        double *y)
5366 %
5367 %  A description of each parameter follows:
5368 %
5369 %    o wand: the magick wand.
5370 %
5371 %    o x: the image x-resolution.
5372 %
5373 %    o y: the image y-resolution.
5374 %
5375 */
5376 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5377   double *x,double *y)
5378 {
5379   assert(wand != (MagickWand *) NULL);
5380   assert(wand->signature == WandSignature);
5381   if (IfMagickTrue(wand->debug))
5382     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5383   if (wand->images == (Image *) NULL)
5384     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5385   *x=wand->images->resolution.x;
5386   *y=wand->images->resolution.y;
5387   return(MagickTrue);
5388 }
5389 \f
5390 /*
5391 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5392 %                                                                             %
5393 %                                                                             %
5394 %                                                                             %
5395 %   M a g i c k G e t I m a g e S c e n e                                     %
5396 %                                                                             %
5397 %                                                                             %
5398 %                                                                             %
5399 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5400 %
5401 %  MagickGetImageScene() gets the image scene.
5402 %
5403 %  The format of the MagickGetImageScene method is:
5404 %
5405 %      size_t MagickGetImageScene(MagickWand *wand)
5406 %
5407 %  A description of each parameter follows:
5408 %
5409 %    o wand: the magick wand.
5410 %
5411 */
5412 WandExport size_t MagickGetImageScene(MagickWand *wand)
5413 {
5414   assert(wand != (MagickWand *) NULL);
5415   assert(wand->signature == WandSignature);
5416   if (IfMagickTrue(wand->debug))
5417     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5418   if (wand->images == (Image *) NULL)
5419     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5420   return(wand->images->scene);
5421 }
5422 \f
5423 /*
5424 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5425 %                                                                             %
5426 %                                                                             %
5427 %                                                                             %
5428 %   M a g i c k G e t I m a g e S i g n a t u r e                             %
5429 %                                                                             %
5430 %                                                                             %
5431 %                                                                             %
5432 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5433 %
5434 %  MagickGetImageSignature() generates an SHA-256 message digest for the image
5435 %  pixel stream.
5436 %
5437 %  The format of the MagickGetImageSignature method is:
5438 %
5439 %      char *MagickGetImageSignature(MagickWand *wand)
5440 %
5441 %  A description of each parameter follows:
5442 %
5443 %    o wand: the magick wand.
5444 %
5445 */
5446 WandExport char *MagickGetImageSignature(MagickWand *wand)
5447 {
5448   const char
5449     *value;
5450
5451   MagickBooleanType
5452     status;
5453
5454   assert(wand != (MagickWand *) NULL);
5455   assert(wand->signature == WandSignature);
5456   if (IfMagickTrue(wand->debug))
5457     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5458   if (wand->images == (Image *) NULL)
5459     {
5460       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5461         "ContainsNoImages","`%s'",wand->name);
5462       return((char *) NULL);
5463     }
5464   status=SignatureImage(wand->images,wand->exception);
5465   if (IfMagickFalse(status))
5466     return((char *) NULL);
5467   value=GetImageProperty(wand->images,"signature",wand->exception);
5468   if (value == (const char *) NULL)
5469     return((char *) NULL);
5470   return(AcquireString(value));
5471 }
5472 \f
5473 /*
5474 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5475 %                                                                             %
5476 %                                                                             %
5477 %                                                                             %
5478 %   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                   %
5479 %                                                                             %
5480 %                                                                             %
5481 %                                                                             %
5482 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5483 %
5484 %  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5485 %
5486 %  The format of the MagickGetImageTicksPerSecond method is:
5487 %
5488 %      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5489 %
5490 %  A description of each parameter follows:
5491 %
5492 %    o wand: the magick wand.
5493 %
5494 */
5495 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5496 {
5497   assert(wand != (MagickWand *) NULL);
5498   assert(wand->signature == WandSignature);
5499   if (IfMagickTrue(wand->debug))
5500     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5501   if (wand->images == (Image *) NULL)
5502     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5503   return((size_t) wand->images->ticks_per_second);
5504 }
5505 \f
5506 /*
5507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5508 %                                                                             %
5509 %                                                                             %
5510 %                                                                             %
5511 %   M a g i c k G e t I m a g e T y p e                                       %
5512 %                                                                             %
5513 %                                                                             %
5514 %                                                                             %
5515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5516 %
5517 %  MagickGetImageType() gets the potential image type:
5518 %
5519 %        Bilevel        Grayscale       GrayscaleMatte
5520 %        Palette        PaletteMatte    TrueColor
5521 %        TrueColorMatte ColorSeparation ColorSeparationMatte
5522 %
5523 %  To ensure the image type matches its potential, use MagickSetImageType():
5524 %
5525 %    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5526 %
5527 %  The format of the MagickGetImageType method is:
5528 %
5529 %      ImageType MagickGetImageType(MagickWand *wand)
5530 %
5531 %  A description of each parameter follows:
5532 %
5533 %    o wand: the magick wand.
5534 %
5535 */
5536 WandExport ImageType MagickGetImageType(MagickWand *wand)
5537 {
5538   assert(wand != (MagickWand *) NULL);
5539   assert(wand->signature == WandSignature);
5540   if (IfMagickTrue(wand->debug))
5541     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5542   if (wand->images == (Image *) NULL)
5543     {
5544       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5545         "ContainsNoImages","`%s'",wand->name);
5546       return(UndefinedType);
5547     }
5548   return(GetImageType(wand->images,wand->exception));
5549 }
5550 \f
5551 /*
5552 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5553 %                                                                             %
5554 %                                                                             %
5555 %                                                                             %
5556 %   M a g i c k G e t I m a g e U n i t s                                     %
5557 %                                                                             %
5558 %                                                                             %
5559 %                                                                             %
5560 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5561 %
5562 %  MagickGetImageUnits() gets the image units of resolution.
5563 %
5564 %  The format of the MagickGetImageUnits method is:
5565 %
5566 %      ResolutionType MagickGetImageUnits(MagickWand *wand)
5567 %
5568 %  A description of each parameter follows:
5569 %
5570 %    o wand: the magick wand.
5571 %
5572 */
5573 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5574 {
5575   assert(wand != (MagickWand *) NULL);
5576   assert(wand->signature == WandSignature);
5577   if (IfMagickTrue(wand->debug))
5578     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5579   if (wand->images == (Image *) NULL)
5580     {
5581       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5582         "ContainsNoImages","`%s'",wand->name);
5583       return(UndefinedResolution);
5584     }
5585   return(wand->images->units);
5586 }
5587 \f
5588 /*
5589 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5590 %                                                                             %
5591 %                                                                             %
5592 %                                                                             %
5593 %   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           %
5594 %                                                                             %
5595 %                                                                             %
5596 %                                                                             %
5597 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5598 %
5599 %  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5600 %  sepcified image.
5601 %
5602 %  The format of the MagickGetImageVirtualPixelMethod method is:
5603 %
5604 %      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5605 %
5606 %  A description of each parameter follows:
5607 %
5608 %    o wand: the magick wand.
5609 %
5610 */
5611 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5612 {
5613   assert(wand != (MagickWand *) NULL);
5614   assert(wand->signature == WandSignature);
5615   if (IfMagickTrue(wand->debug))
5616     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5617   if (wand->images == (Image *) NULL)
5618     {
5619       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5620         "ContainsNoImages","`%s'",wand->name);
5621       return(UndefinedVirtualPixelMethod);
5622     }
5623   return(GetImageVirtualPixelMethod(wand->images));
5624 }
5625 \f
5626 /*
5627 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5628 %                                                                             %
5629 %                                                                             %
5630 %                                                                             %
5631 %   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5632 %                                                                             %
5633 %                                                                             %
5634 %                                                                             %
5635 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5636 %
5637 %  MagickGetImageWhitePoint() returns the chromaticy white point.
5638 %
5639 %  The format of the MagickGetImageWhitePoint method is:
5640 %
5641 %      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5642 %        double *y)
5643 %
5644 %  A description of each parameter follows:
5645 %
5646 %    o wand: the magick wand.
5647 %
5648 %    o x: the chromaticity white x-point.
5649 %
5650 %    o y: the chromaticity white y-point.
5651 %
5652 */
5653 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5654   double *x,double *y)
5655 {
5656   assert(wand != (MagickWand *) NULL);
5657   assert(wand->signature == WandSignature);
5658   if (IfMagickTrue(wand->debug))
5659     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5660   if (wand->images == (Image *) NULL)
5661     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5662   *x=wand->images->chromaticity.white_point.x;
5663   *y=wand->images->chromaticity.white_point.y;
5664   return(MagickTrue);
5665 }
5666 \f
5667 /*
5668 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5669 %                                                                             %
5670 %                                                                             %
5671 %                                                                             %
5672 %   M a g i c k G e t I m a g e W i d t h                                     %
5673 %                                                                             %
5674 %                                                                             %
5675 %                                                                             %
5676 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5677 %
5678 %  MagickGetImageWidth() returns the image width.
5679 %
5680 %  The format of the MagickGetImageWidth method is:
5681 %
5682 %      size_t MagickGetImageWidth(MagickWand *wand)
5683 %
5684 %  A description of each parameter follows:
5685 %
5686 %    o wand: the magick wand.
5687 %
5688 */
5689 WandExport size_t MagickGetImageWidth(MagickWand *wand)
5690 {
5691   assert(wand != (MagickWand *) NULL);
5692   assert(wand->signature == WandSignature);
5693   if (IfMagickTrue(wand->debug))
5694     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5695   if (wand->images == (Image *) NULL)
5696     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5697   return(wand->images->columns);
5698 }
5699 \f
5700 /*
5701 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5702 %                                                                             %
5703 %                                                                             %
5704 %                                                                             %
5705 %   M a g i c k G e t N u m b e r I m a g e s                                 %
5706 %                                                                             %
5707 %                                                                             %
5708 %                                                                             %
5709 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5710 %
5711 %  MagickGetNumberImages() returns the number of images associated with a
5712 %  magick wand.
5713 %
5714 %  The format of the MagickGetNumberImages method is:
5715 %
5716 %      size_t MagickGetNumberImages(MagickWand *wand)
5717 %
5718 %  A description of each parameter follows:
5719 %
5720 %    o wand: the magick wand.
5721 %
5722 */
5723 WandExport size_t MagickGetNumberImages(MagickWand *wand)
5724 {
5725   assert(wand != (MagickWand *) NULL);
5726   assert(wand->signature == WandSignature);
5727   if (IfMagickTrue(wand->debug))
5728     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5729   return(GetImageListLength(wand->images));
5730 }
5731 \f
5732 /*
5733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5734 %                                                                             %
5735 %                                                                             %
5736 %                                                                             %
5737 %   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                 %
5738 %                                                                             %
5739 %                                                                             %
5740 %                                                                             %
5741 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5742 %
5743 %  MagickGetImageTotalInkDensity() gets the image total ink density.
5744 %
5745 %  The format of the MagickGetImageTotalInkDensity method is:
5746 %
5747 %      double MagickGetImageTotalInkDensity(MagickWand *wand)
5748 %
5749 %  A description of each parameter follows:
5750 %
5751 %    o wand: the magick wand.
5752 %
5753 */
5754 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5755 {
5756   assert(wand != (MagickWand *) NULL);
5757   assert(wand->signature == WandSignature);
5758   if (IfMagickTrue(wand->debug))
5759     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5760   if (wand->images == (Image *) NULL)
5761     {
5762       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5763         "ContainsNoImages","`%s'",wand->name);
5764       return(0.0);
5765     }
5766   return(GetImageTotalInkDensity(wand->images,wand->exception));
5767 }
5768 \f
5769 /*
5770 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5771 %                                                                             %
5772 %                                                                             %
5773 %                                                                             %
5774 %   M a g i c k H a l d C l u t I m a g e                                     %
5775 %                                                                             %
5776 %                                                                             %
5777 %                                                                             %
5778 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5779 %
5780 %  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5781 %  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5782 %  dimensions.  Create it with the HALD coder.  You can apply any color
5783 %  transformation to the Hald image and then use this method to apply the
5784 %  transform to the image.
5785 %
5786 %  The format of the MagickHaldClutImage method is:
5787 %
5788 %      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5789 %        const MagickWand *hald_wand)
5790 %
5791 %  A description of each parameter follows:
5792 %
5793 %    o wand: the magick wand.
5794 %
5795 %    o hald_image: the hald CLUT image.
5796 %
5797 */
5798 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5799   const MagickWand *hald_wand)
5800 {
5801   MagickBooleanType
5802     status;
5803
5804   assert(wand != (MagickWand *) NULL);
5805   assert(wand->signature == WandSignature);
5806   if (IfMagickTrue(wand->debug))
5807     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5808   if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5809     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5810   status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
5811   return(status);
5812 }
5813 \f
5814 /*
5815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5816 %                                                                             %
5817 %                                                                             %
5818 %                                                                             %
5819 %   M a g i c k H a s N e x t I m a g e                                       %
5820 %                                                                             %
5821 %                                                                             %
5822 %                                                                             %
5823 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5824 %
5825 %  MagickHasNextImage() returns MagickTrue if the wand has more images when
5826 %  traversing the list in the forward direction
5827 %
5828 %  The format of the MagickHasNextImage method is:
5829 %
5830 %      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5831 %
5832 %  A description of each parameter follows:
5833 %
5834 %    o wand: the magick wand.
5835 %
5836 */
5837 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5838 {
5839   assert(wand != (MagickWand *) NULL);
5840   assert(wand->signature == WandSignature);
5841   if (IfMagickTrue(wand->debug))
5842     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5843   if (wand->images == (Image *) NULL)
5844     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5845   if (GetNextImageInList(wand->images) == (Image *) NULL)
5846     return(MagickFalse);
5847   return(MagickTrue);
5848 }
5849 \f
5850 /*
5851 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5852 %                                                                             %
5853 %                                                                             %
5854 %                                                                             %
5855 %   M a g i c k H a s P r e v i o u s I m a g e                               %
5856 %                                                                             %
5857 %                                                                             %
5858 %                                                                             %
5859 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5860 %
5861 %  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5862 %  traversing the list in the reverse direction
5863 %
5864 %  The format of the MagickHasPreviousImage method is:
5865 %
5866 %      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5867 %
5868 %  A description of each parameter follows:
5869 %
5870 %    o wand: the magick wand.
5871 %
5872 */
5873 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5874 {
5875   assert(wand != (MagickWand *) NULL);
5876   assert(wand->signature == WandSignature);
5877   if (IfMagickTrue(wand->debug))
5878     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5879   if (wand->images == (Image *) NULL)
5880     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5881   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5882     return(MagickFalse);
5883   return(MagickTrue);
5884 }
5885 \f
5886 /*
5887 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5888 %                                                                             %
5889 %                                                                             %
5890 %                                                                             %
5891 %   M a g i c k I d e n t i f y I m a g e                                     %
5892 %                                                                             %
5893 %                                                                             %
5894 %                                                                             %
5895 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5896 %
5897 %  MagickIdentifyImage() identifies an image by printing its attributes to the
5898 %  file.  Attributes include the image width, height, size, and others.
5899 %
5900 %  The format of the MagickIdentifyImage method is:
5901 %
5902 %      const char *MagickIdentifyImage(MagickWand *wand)
5903 %
5904 %  A description of each parameter follows:
5905 %
5906 %    o wand: the magick wand.
5907 %
5908 */
5909 WandExport char *MagickIdentifyImage(MagickWand *wand)
5910 {
5911   char
5912     *description,
5913     filename[MaxTextExtent];
5914
5915   FILE
5916     *file;
5917
5918   int
5919     unique_file;
5920
5921   assert(wand != (MagickWand *) NULL);
5922   assert(wand->signature == WandSignature);
5923   if (IfMagickTrue(wand->debug))
5924     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5925   if (wand->images == (Image *) NULL)
5926     {
5927       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5928         "ContainsNoImages","`%s'",wand->name);
5929       return((char *) NULL);
5930     }
5931   description=(char *) NULL;
5932   unique_file=AcquireUniqueFileResource(filename);
5933   file=(FILE *) NULL;
5934   if (unique_file != -1)
5935     file=fdopen(unique_file,"wb");
5936   if ((unique_file == -1) || (file == (FILE *) NULL))
5937     {
5938       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5939         "UnableToCreateTemporaryFile","`%s'",wand->name);
5940       return((char *) NULL);
5941     }
5942   (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
5943   (void) fclose(file);
5944   description=FileToString(filename,~0UL,wand->exception);
5945   (void) RelinquishUniqueFileResource(filename);
5946   return(description);
5947 }
5948 \f
5949 /*
5950 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5951 %                                                                             %
5952 %                                                                             %
5953 %                                                                             %
5954 %   M a g i c k I m p l o d e I m a g e                                       %
5955 %                                                                             %
5956 %                                                                             %
5957 %                                                                             %
5958 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5959 %
5960 %  MagickImplodeImage() creates a new image that is a copy of an existing
5961 %  one with the image pixels "implode" by the specified percentage.  It
5962 %  allocates the memory necessary for the new Image structure and returns a
5963 %  pointer to the new image.
5964 %
5965 %  The format of the MagickImplodeImage method is:
5966 %
5967 %      MagickBooleanType MagickImplodeImage(MagickWand *wand,
5968 %        const double radius,const PixelInterpolateMethod method)
5969 %
5970 %  A description of each parameter follows:
5971 %
5972 %    o wand: the magick wand.
5973 %
5974 %    o amount: Define the extent of the implosion.
5975 %
5976 %    o method: the pixel interpolation method.
5977 %
5978 */
5979 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
5980   const double amount,const PixelInterpolateMethod method)
5981 {
5982   Image
5983     *implode_image;
5984
5985   assert(wand != (MagickWand *) NULL);
5986   assert(wand->signature == WandSignature);
5987   if (IfMagickTrue(wand->debug))
5988     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5989   if (wand->images == (Image *) NULL)
5990     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5991   implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
5992   if (implode_image == (Image *) NULL)
5993     return(MagickFalse);
5994   ReplaceImageInList(&wand->images,implode_image);
5995   return(MagickTrue);
5996 }
5997 \f
5998 /*
5999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6000 %                                                                             %
6001 %                                                                             %
6002 %                                                                             %
6003 %   M a g i c k I m p o r t I m a g e P i x e l s                             %
6004 %                                                                             %
6005 %                                                                             %
6006 %                                                                             %
6007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6008 %
6009 %  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6010 %  location you specify.  The method returns MagickFalse on success otherwise
6011 %  MagickTrue if an error is encountered.  The pixel data can be either char,
6012 %  short int, int, ssize_t, float, or double in the order specified by map.
6013 %
6014 %  Suppose your want to upload the first scanline of a 640x480 image from
6015 %  character data in red-green-blue order:
6016 %
6017 %      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6018 %
6019 %  The format of the MagickImportImagePixels method is:
6020 %
6021 %      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6022 %        const ssize_t x,const ssize_t y,const size_t columns,
6023 %        const size_t rows,const char *map,const StorageType storage,
6024 %        const void *pixels)
6025 %
6026 %  A description of each parameter follows:
6027 %
6028 %    o wand: the magick wand.
6029 %
6030 %    o x, y, columns, rows:  These values define the perimeter of a region
6031 %      of pixels you want to define.
6032 %
6033 %    o map:  This string reflects the expected ordering of the pixel array.
6034 %      It can be any combination or order of R = red, G = green, B = blue,
6035 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
6036 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6037 %      P = pad.
6038 %
6039 %    o storage: Define the data type of the pixels.  Float and double types are
6040 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6041 %      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6042 %      or DoublePixel.
6043 %
6044 %    o pixels: This array of values contain the pixel components as defined by
6045 %      map and type.  You must preallocate this array where the expected
6046 %      length varies depending on the values of width, height, map, and type.
6047 %
6048 */
6049 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6050   const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
6051   const char *map,const StorageType storage,const void *pixels)
6052 {
6053   MagickBooleanType
6054     status;
6055
6056   assert(wand != (MagickWand *) NULL);
6057   assert(wand->signature == WandSignature);
6058   if (IfMagickTrue(wand->debug))
6059     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6060   if (wand->images == (Image *) NULL)
6061     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6062   status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
6063     wand->exception);
6064   return(status);
6065 }
6066 \f
6067 /*
6068 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6069 %                                                                             %
6070 %                                                                             %
6071 %                                                                             %
6072 %   M a g i c k I n t e r p o l a t i v e R e s i z e I m a g e               %
6073 %                                                                             %
6074 %                                                                             %
6075 %                                                                             %
6076 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6077 %
6078 %  MagickInterpolativeResizeImage() resize image using a interpolative
6079 %  method.
6080 %
6081 %      MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6082 %        const size_t columns,const size_t rows,
6083 %        const PixelInterpolateMethod method)
6084 %
6085 %  A description of each parameter follows:
6086 %
6087 %    o wand: the magick wand.
6088 %
6089 %    o columns: the number of columns in the scaled image.
6090 %
6091 %    o rows: the number of rows in the scaled image.
6092 %
6093 %    o interpolate: the pixel interpolation method.
6094 %
6095 */
6096 WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6097   const size_t columns,const size_t rows,const PixelInterpolateMethod method)
6098 {
6099   Image
6100     *resize_image;
6101
6102   assert(wand != (MagickWand *) NULL);
6103   assert(wand->signature == WandSignature);
6104   if (IfMagickTrue(wand->debug))
6105     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6106   if (wand->images == (Image *) NULL)
6107     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6108   resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
6109     wand->exception);
6110   if (resize_image == (Image *) NULL)
6111     return(MagickFalse);
6112   ReplaceImageInList(&wand->images,resize_image);
6113   return(MagickTrue);
6114 }
6115 \f
6116 /*
6117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6118 %                                                                             %
6119 %                                                                             %
6120 %                                                                             %
6121 %   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       %
6122 %                                                                             %
6123 %                                                                             %
6124 %                                                                             %
6125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6126 %
6127 %  MagickInverseFourierTransformImage() implements the inverse discrete
6128 %  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6129 %  imaginary image pair.
6130 %
6131 %  The format of the MagickInverseFourierTransformImage method is:
6132 %
6133 %      MagickBooleanType MagickInverseFourierTransformImage(
6134 %        MagickWand *magnitude_wand,MagickWand *phase_wand,
6135 %        const MagickBooleanType magnitude)
6136 %
6137 %  A description of each parameter follows:
6138 %
6139 %    o magnitude_wand: the magnitude or real wand.
6140 %
6141 %    o phase_wand: the phase or imaginary wand.
6142 %
6143 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6144 %      imaginary image pair.
6145 %
6146 */
6147 WandExport MagickBooleanType MagickInverseFourierTransformImage(
6148   MagickWand *magnitude_wand,MagickWand *phase_wand,
6149   const MagickBooleanType magnitude)
6150 {
6151   Image
6152     *inverse_image;
6153
6154   MagickWand
6155     *wand;
6156
6157   assert(magnitude_wand != (MagickWand *) NULL);
6158   assert(magnitude_wand->signature == WandSignature);
6159   if (IfMagickTrue(magnitude_wand->debug))
6160     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6161       magnitude_wand->name);
6162   wand=magnitude_wand;
6163   if (magnitude_wand->images == (Image *) NULL)
6164     ThrowWandException(WandError,"ContainsNoImages",
6165       magnitude_wand->name);
6166   assert(phase_wand != (MagickWand *) NULL);
6167   assert(phase_wand->signature == WandSignature);
6168   inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6169     phase_wand->images,magnitude,wand->exception);
6170   if (inverse_image == (Image *) NULL)
6171     return(MagickFalse);
6172   ReplaceImageInList(&wand->images,inverse_image);
6173   return(MagickTrue);
6174 }
6175 \f
6176 /*
6177 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6178 %                                                                             %
6179 %                                                                             %
6180 %                                                                             %
6181 %   M a g i c k L a b e l I m a g e                                           %
6182 %                                                                             %
6183 %                                                                             %
6184 %                                                                             %
6185 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6186 %
6187 %  MagickLabelImage() adds a label to your image.
6188 %
6189 %  The format of the MagickLabelImage method is:
6190 %
6191 %      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6192 %
6193 %  A description of each parameter follows:
6194 %
6195 %    o wand: the magick wand.
6196 %
6197 %    o label: the image label.
6198 %
6199 */
6200 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6201   const char *label)
6202 {
6203   MagickBooleanType
6204     status;
6205
6206   assert(wand != (MagickWand *) NULL);
6207   assert(wand->signature == WandSignature);
6208   if (IfMagickTrue(wand->debug))
6209     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6210   if (wand->images == (Image *) NULL)
6211     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6212   status=SetImageProperty(wand->images,"label",label,wand->exception);
6213   return(status);
6214 }
6215 \f
6216 /*
6217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6218 %                                                                             %
6219 %                                                                             %
6220 %                                                                             %
6221 %   M a g i c k L e v e l I m a g e                                           %
6222 %                                                                             %
6223 %                                                                             %
6224 %                                                                             %
6225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6226 %
6227 %  MagickLevelImage() adjusts the levels of an image by scaling the colors
6228 %  falling between specified white and black points to the full available
6229 %  quantum range. The parameters provided represent the black, mid, and white
6230 %  points. The black point specifies the darkest color in the image. Colors
6231 %  darker than the black point are set to zero. Mid point specifies a gamma
6232 %  correction to apply to the image.  White point specifies the lightest color
6233 %  in the image. Colors brighter than the white point are set to the maximum
6234 %  quantum value.
6235 %
6236 %  The format of the MagickLevelImage method is:
6237 %
6238 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6239 %        const double black_point,const double gamma,const double white_point)
6240 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6241 %        const ChannelType channel,const double black_point,const double gamma,
6242 %        const double white_point)
6243 %
6244 %  A description of each parameter follows:
6245 %
6246 %    o wand: the magick wand.
6247 %
6248 %    o channel: Identify which channel to level: RedPixelChannel,
6249 %      GreenPixelChannel, etc.
6250 %
6251 %    o black_point: the black point.
6252 %
6253 %    o gamma: the gamma.
6254 %
6255 %    o white_point: the white point.
6256 %
6257 */
6258 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6259   const double black_point,const double gamma,const double white_point)
6260 {
6261   MagickBooleanType
6262     status;
6263
6264   assert(wand != (MagickWand *) NULL);
6265   assert(wand->signature == WandSignature);
6266   if (IfMagickTrue(wand->debug))
6267     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6268   if (wand->images == (Image *) NULL)
6269     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6270   status=LevelImage(wand->images,black_point,white_point,gamma,
6271     wand->exception);
6272   return(status);
6273 }
6274 \f
6275 /*
6276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6277 %                                                                             %
6278 %                                                                             %
6279 %                                                                             %
6280 %   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6281 %                                                                             %
6282 %                                                                             %
6283 %                                                                             %
6284 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6285 %
6286 %  MagickLinearStretchImage() stretches with saturation the image intensity.
6287 %
6288 %  You can also reduce the influence of a particular channel with a gamma
6289 %  value of 0.
6290 %
6291 %  The format of the MagickLinearStretchImage method is:
6292 %
6293 %      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6294 %        const double black_point,const double white_point)
6295 %
6296 %  A description of each parameter follows:
6297 %
6298 %    o wand: the magick wand.
6299 %
6300 %    o black_point: the black point.
6301 %
6302 %    o white_point: the white point.
6303 %
6304 */
6305 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6306   const double black_point,const double white_point)
6307 {
6308   MagickBooleanType
6309     status;
6310
6311   assert(wand != (MagickWand *) NULL);
6312   assert(wand->signature == WandSignature);
6313   if (IfMagickTrue(wand->debug))
6314     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6315   if (wand->images == (Image *) NULL)
6316     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6317   status=LinearStretchImage(wand->images,black_point,white_point,
6318     wand->exception);
6319   return(status);
6320 }
6321 \f
6322 /*
6323 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6324 %                                                                             %
6325 %                                                                             %
6326 %                                                                             %
6327 %   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6328 %                                                                             %
6329 %                                                                             %
6330 %                                                                             %
6331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6332 %
6333 %  MagickLiquidRescaleImage() rescales image with seam carving.
6334 %
6335 %      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6336 %        const size_t columns,const size_t rows,
6337 %        const double delta_x,const double rigidity)
6338 %
6339 %  A description of each parameter follows:
6340 %
6341 %    o wand: the magick wand.
6342 %
6343 %    o columns: the number of columns in the scaled image.
6344 %
6345 %    o rows: the number of rows in the scaled image.
6346 %
6347 %    o delta_x: maximum seam transversal step (0 means straight seams).
6348 %
6349 %    o rigidity: introduce a bias for non-straight seams (typically 0).
6350 %
6351 */
6352 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6353   const size_t columns,const size_t rows,const double delta_x,
6354   const double rigidity)
6355 {
6356   Image
6357     *rescale_image;
6358
6359   assert(wand != (MagickWand *) NULL);
6360   assert(wand->signature == WandSignature);
6361   if (IfMagickTrue(wand->debug))
6362     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6363   if (wand->images == (Image *) NULL)
6364     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6365   rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6366     rigidity,wand->exception);
6367   if (rescale_image == (Image *) NULL)
6368     return(MagickFalse);
6369   ReplaceImageInList(&wand->images,rescale_image);
6370   return(MagickTrue);
6371 }
6372 \f
6373 /*
6374 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6375 %                                                                             %
6376 %                                                                             %
6377 %                                                                             %
6378 %   M a g i c k M a g n i f y I m a g e                                       %
6379 %                                                                             %
6380 %                                                                             %
6381 %                                                                             %
6382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6383 %
6384 %  MagickMagnifyImage() is a convenience method that scales an image
6385 %  proportionally to twice its original size.
6386 %
6387 %  The format of the MagickMagnifyImage method is:
6388 %
6389 %      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6390 %
6391 %  A description of each parameter follows:
6392 %
6393 %    o wand: the magick wand.
6394 %
6395 */
6396 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6397 {
6398   Image
6399     *magnify_image;
6400
6401   assert(wand != (MagickWand *) NULL);
6402   assert(wand->signature == WandSignature);
6403   if (IfMagickTrue(wand->debug))
6404     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6405   if (wand->images == (Image *) NULL)
6406     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6407   magnify_image=MagnifyImage(wand->images,wand->exception);
6408   if (magnify_image == (Image *) NULL)
6409     return(MagickFalse);
6410   ReplaceImageInList(&wand->images,magnify_image);
6411   return(MagickTrue);
6412 }
6413 \f
6414 /*
6415 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6416 %                                                                             %
6417 %                                                                             %
6418 %                                                                             %
6419 %   M a g i c k M e r g e I m a g e L a y e r s                               %
6420 %                                                                             %
6421 %                                                                             %
6422 %                                                                             %
6423 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6424 %
6425 %  MagickMergeImageLayers() composes all the image layers from the current
6426 %  given image onward to produce a single image of the merged layers.
6427 %
6428 %  The inital canvas's size depends on the given LayerMethod, and is
6429 %  initialized using the first images background color.  The images
6430 %  are then compositied onto that image in sequence using the given
6431 %  composition that has been assigned to each individual image.
6432 %
6433 %  The format of the MagickMergeImageLayers method is:
6434 %
6435 %      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6436 %        const LayerMethod method)
6437 %
6438 %  A description of each parameter follows:
6439 %
6440 %    o wand: the magick wand.
6441 %
6442 %    o method: the method of selecting the size of the initial canvas.
6443 %
6444 %        MergeLayer: Merge all layers onto a canvas just large enough
6445 %           to hold all the actual images. The virtual canvas of the
6446 %           first image is preserved but otherwise ignored.
6447 %
6448 %        FlattenLayer: Use the virtual canvas size of first image.
6449 %           Images which fall outside this canvas is clipped.
6450 %           This can be used to 'fill out' a given virtual canvas.
6451 %
6452 %        MosaicLayer: Start with the virtual canvas of the first image,
6453 %           enlarging left and right edges to contain all images.
6454 %           Images with negative offsets will be clipped.
6455 %
6456 */
6457 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6458   const LayerMethod method)
6459 {
6460   Image
6461     *mosaic_image;
6462
6463   assert(wand != (MagickWand *) NULL);
6464   assert(wand->signature == WandSignature);
6465   if (IfMagickTrue(wand->debug))
6466     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6467   if (wand->images == (Image *) NULL)
6468     return((MagickWand *) NULL);
6469   mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6470   if (mosaic_image == (Image *) NULL)
6471     return((MagickWand *) NULL);
6472   return(CloneMagickWandFromImages(wand,mosaic_image));
6473 }
6474 \f
6475 /*
6476 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6477 %                                                                             %
6478 %                                                                             %
6479 %                                                                             %
6480 %   M a g i c k M i n i f y I m a g e                                         %
6481 %                                                                             %
6482 %                                                                             %
6483 %                                                                             %
6484 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6485 %
6486 %  MagickMinifyImage() is a convenience method that scales an image
6487 %  proportionally to one-half its original size
6488 %
6489 %  The format of the MagickMinifyImage method is:
6490 %
6491 %      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6492 %
6493 %  A description of each parameter follows:
6494 %
6495 %    o wand: the magick wand.
6496 %
6497 */
6498 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6499 {
6500   Image
6501     *minify_image;
6502
6503   assert(wand != (MagickWand *) NULL);
6504   assert(wand->signature == WandSignature);
6505   if (IfMagickTrue(wand->debug))
6506     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6507   if (wand->images == (Image *) NULL)
6508     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6509   minify_image=MinifyImage(wand->images,wand->exception);
6510   if (minify_image == (Image *) NULL)
6511     return(MagickFalse);
6512   ReplaceImageInList(&wand->images,minify_image);
6513   return(MagickTrue);
6514 }
6515 \f
6516 /*
6517 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6518 %                                                                             %
6519 %                                                                             %
6520 %                                                                             %
6521 %   M a g i c k M o d u l a t e I m a g e                                     %
6522 %                                                                             %
6523 %                                                                             %
6524 %                                                                             %
6525 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6526 %
6527 %  MagickModulateImage() lets you control the brightness, saturation, and hue
6528 %  of an image.  Hue is the percentage of absolute rotation from the current
6529 %  position.  For example 50 results in a counter-clockwise rotation of 90
6530 %  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6531 %  both resulting in a rotation of 180 degrees.
6532 %
6533 %  To increase the color brightness by 20% and decrease the color saturation by
6534 %  10% and leave the hue unchanged, use: 120,90,100.
6535 %
6536 %  The format of the MagickModulateImage method is:
6537 %
6538 %      MagickBooleanType MagickModulateImage(MagickWand *wand,
6539 %        const double brightness,const double saturation,const double hue)
6540 %
6541 %  A description of each parameter follows:
6542 %
6543 %    o wand: the magick wand.
6544 %
6545 %    o brightness: the percent change in brighness.
6546 %
6547 %    o saturation: the percent change in saturation.
6548 %
6549 %    o hue: the percent change in hue.
6550 %
6551 */
6552 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6553   const double brightness,const double saturation,const double hue)
6554 {
6555   char
6556     modulate[MaxTextExtent];
6557
6558   MagickBooleanType
6559     status;
6560
6561   assert(wand != (MagickWand *) NULL);
6562   assert(wand->signature == WandSignature);
6563   if (IfMagickTrue(wand->debug))
6564     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6565   if (wand->images == (Image *) NULL)
6566     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6567   (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6568     brightness,saturation,hue);
6569   status=ModulateImage(wand->images,modulate,wand->exception);
6570   return(status);
6571 }
6572 \f
6573 /*
6574 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6575 %                                                                             %
6576 %                                                                             %
6577 %                                                                             %
6578 %   M a g i c k M o n t a g e I m a g e                                       %
6579 %                                                                             %
6580 %                                                                             %
6581 %                                                                             %
6582 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6583 %
6584 %  MagickMontageImage() creates a composite image by combining several
6585 %  separate images. The images are tiled on the composite image with the name
6586 %  of the image optionally appearing just below the individual tile.
6587 %
6588 %  The format of the MagickMontageImage method is:
6589 %
6590 %      MagickWand *MagickMontageImage(MagickWand *wand,
6591 %        const DrawingWand drawing_wand,const char *tile_geometry,
6592 %        const char *thumbnail_geometry,const MontageMode mode,
6593 %        const char *frame)
6594 %
6595 %  A description of each parameter follows:
6596 %
6597 %    o wand: the magick wand.
6598 %
6599 %    o drawing_wand: the drawing wand.  The font name, size, and color are
6600 %      obtained from this wand.
6601 %
6602 %    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6603 %
6604 %    o thumbnail_geometry: Preferred image size and border size of each
6605 %      thumbnail (e.g. 120x120+4+3>).
6606 %
6607 %    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6608 %
6609 %    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6610 %      The frame color is that of the thumbnail's matte color.
6611 %
6612 */
6613 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6614   const DrawingWand *drawing_wand,const char *tile_geometry,
6615   const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6616 {
6617   char
6618     *font;
6619
6620   Image
6621     *montage_image;
6622
6623   MontageInfo
6624     *montage_info;
6625
6626   PixelWand
6627     *pixel_wand;
6628
6629   assert(wand != (MagickWand *) NULL);
6630   assert(wand->signature == WandSignature);
6631   if (IfMagickTrue(wand->debug))
6632     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6633   if (wand->images == (Image *) NULL)
6634     return((MagickWand *) NULL);
6635   montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6636   switch (mode)
6637   {
6638     case FrameMode:
6639     {
6640       (void) CloneString(&montage_info->frame,"15x15+3+3");
6641       montage_info->shadow=MagickTrue;
6642       break;
6643     }
6644     case UnframeMode:
6645     {
6646       montage_info->frame=(char *) NULL;
6647       montage_info->shadow=MagickFalse;
6648       montage_info->border_width=0;
6649       break;
6650     }
6651     case ConcatenateMode:
6652     {
6653       montage_info->frame=(char *) NULL;
6654       montage_info->shadow=MagickFalse;
6655       (void) CloneString(&montage_info->geometry,"+0+0");
6656       montage_info->border_width=0;
6657       break;
6658     }
6659     default:
6660       break;
6661   }
6662   font=DrawGetFont(drawing_wand);
6663   if (font != (char *) NULL)
6664     (void) CloneString(&montage_info->font,font);
6665   if (frame != (char *) NULL)
6666     (void) CloneString(&montage_info->frame,frame);
6667   montage_info->pointsize=DrawGetFontSize(drawing_wand);
6668   pixel_wand=NewPixelWand();
6669   DrawGetFillColor(drawing_wand,pixel_wand);
6670   PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6671   DrawGetStrokeColor(drawing_wand,pixel_wand);
6672   PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6673   pixel_wand=DestroyPixelWand(pixel_wand);
6674   if (thumbnail_geometry != (char *) NULL)
6675     (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6676   if (tile_geometry != (char *) NULL)
6677     (void) CloneString(&montage_info->tile,tile_geometry);
6678   montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6679     wand->exception);
6680   montage_info=DestroyMontageInfo(montage_info);
6681   if (montage_image == (Image *) NULL)
6682     return((MagickWand *) NULL);
6683   return(CloneMagickWandFromImages(wand,montage_image));
6684 }
6685 \f
6686 /*
6687 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6688 %                                                                             %
6689 %                                                                             %
6690 %                                                                             %
6691 %   M a g i c k M o r p h I m a g e s                                         %
6692 %                                                                             %
6693 %                                                                             %
6694 %                                                                             %
6695 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6696 %
6697 %  MagickMorphImages() method morphs a set of images.  Both the image pixels
6698 %  and size are linearly interpolated to give the appearance of a
6699 %  meta-morphosis from one image to the next.
6700 %
6701 %  The format of the MagickMorphImages method is:
6702 %
6703 %      MagickWand *MagickMorphImages(MagickWand *wand,
6704 %        const size_t number_frames)
6705 %
6706 %  A description of each parameter follows:
6707 %
6708 %    o wand: the magick wand.
6709 %
6710 %    o number_frames: the number of in-between images to generate.
6711 %
6712 */
6713 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6714   const size_t number_frames)
6715 {
6716   Image
6717     *morph_image;
6718
6719   assert(wand != (MagickWand *) NULL);
6720   assert(wand->signature == WandSignature);
6721   if (IfMagickTrue(wand->debug))
6722     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6723   if (wand->images == (Image *) NULL)
6724     return((MagickWand *) NULL);
6725   morph_image=MorphImages(wand->images,number_frames,wand->exception);
6726   if (morph_image == (Image *) NULL)
6727     return((MagickWand *) NULL);
6728   return(CloneMagickWandFromImages(wand,morph_image));
6729 }
6730 \f
6731 /*
6732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6733 %                                                                             %
6734 %                                                                             %
6735 %                                                                             %
6736 %   M a g i c k M o r p h o l o g y I m a g e                                 %
6737 %                                                                             %
6738 %                                                                             %
6739 %                                                                             %
6740 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6741 %
6742 %  MagickMorphologyImage() applies a user supplied kernel to the image
6743 %  according to the given mophology method.
6744 %
6745 %  The format of the MagickMorphologyImage method is:
6746 %
6747 %      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6748 %        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6749 %
6750 %  A description of each parameter follows:
6751 %
6752 %    o wand: the magick wand.
6753 %
6754 %    o method: the morphology method to be applied.
6755 %
6756 %    o iterations: apply the operation this many times (or no change).
6757 %      A value of -1 means loop until no change found.  How this is applied
6758 %      may depend on the morphology method.  Typically this is a value of 1.
6759 %
6760 %    o kernel: An array of doubles representing the morphology kernel.
6761 %
6762 */
6763 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6764   MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6765 {
6766   Image
6767     *morphology_image;
6768
6769   assert(wand != (MagickWand *) NULL);
6770   assert(wand->signature == WandSignature);
6771   if (IfMagickTrue(wand->debug))
6772     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6773   if (kernel == (const KernelInfo *) NULL)
6774     return(MagickFalse);
6775   if (wand->images == (Image *) NULL)
6776     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6777   morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6778     wand->exception);
6779   if (morphology_image == (Image *) NULL)
6780     return(MagickFalse);
6781   ReplaceImageInList(&wand->images,morphology_image);
6782   return(MagickTrue);
6783 }
6784 \f
6785 /*
6786 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6787 %                                                                             %
6788 %                                                                             %
6789 %                                                                             %
6790 %   M a g i c k M o t i o n B l u r I m a g e                                 %
6791 %                                                                             %
6792 %                                                                             %
6793 %                                                                             %
6794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6795 %
6796 %  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6797 %  Gaussian operator of the given radius and standard deviation (sigma).
6798 %  For reasonable results, radius should be larger than sigma.  Use a
6799 %  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6800 %  Angle gives the angle of the blurring motion.
6801 %
6802 %  The format of the MagickMotionBlurImage method is:
6803 %
6804 %      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6805 %        const double radius,const double sigma,const double angle)
6806 %
6807 %  A description of each parameter follows:
6808 %
6809 %    o wand: the magick wand.
6810 %
6811 %    o radius: the radius of the Gaussian, in pixels, not counting
6812 %      the center pixel.
6813 %
6814 %    o sigma: the standard deviation of the Gaussian, in pixels.
6815 %
6816 %    o angle: Apply the effect along this angle.
6817 %
6818 */
6819 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6820   const double radius,const double sigma,const double angle)
6821 {
6822   Image
6823     *blur_image;
6824
6825   assert(wand != (MagickWand *) NULL);
6826   assert(wand->signature == WandSignature);
6827   if (IfMagickTrue(wand->debug))
6828     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6829   if (wand->images == (Image *) NULL)
6830     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6831   blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
6832   if (blur_image == (Image *) NULL)
6833     return(MagickFalse);
6834   ReplaceImageInList(&wand->images,blur_image);
6835   return(MagickTrue);
6836 }
6837 \f
6838 /*
6839 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6840 %                                                                             %
6841 %                                                                             %
6842 %                                                                             %
6843 %   M a g i c k N e g a t e I m a g e                                         %
6844 %                                                                             %
6845 %                                                                             %
6846 %                                                                             %
6847 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6848 %
6849 %  MagickNegateImage() negates the colors in the reference image.  The
6850 %  Grayscale option means that only grayscale values within the image are
6851 %  negated.
6852 %
6853 %  You can also reduce the influence of a particular channel with a gamma
6854 %  value of 0.
6855 %
6856 %  The format of the MagickNegateImage method is:
6857 %
6858 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
6859 %        const MagickBooleanType gray)
6860 %
6861 %  A description of each parameter follows:
6862 %
6863 %    o wand: the magick wand.
6864 %
6865 %    o gray: If MagickTrue, only negate grayscale pixels within the image.
6866 %
6867 */
6868 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6869   const MagickBooleanType gray)
6870 {
6871   MagickBooleanType
6872     status;
6873
6874   assert(wand != (MagickWand *) NULL);
6875   assert(wand->signature == WandSignature);
6876   if (IfMagickTrue(wand->debug))
6877     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6878   if (wand->images == (Image *) NULL)
6879     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6880   status=NegateImage(wand->images,gray,wand->exception);
6881   return(status);
6882 }
6883 \f
6884 /*
6885 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6886 %                                                                             %
6887 %                                                                             %
6888 %                                                                             %
6889 %   M a g i c k N e w I m a g e                                               %
6890 %                                                                             %
6891 %                                                                             %
6892 %                                                                             %
6893 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6894 %
6895 %  MagickNewImage() adds a blank image canvas of the specified size and
6896 %  background color to the wand.
6897 %
6898 %  The format of the MagickNewImage method is:
6899 %
6900 %      MagickBooleanType MagickNewImage(MagickWand *wand,
6901 %        const size_t columns,const size_t rows,
6902 %        const PixelWand *background)
6903 %
6904 %  A description of each parameter follows:
6905 %
6906 %    o wand: the magick wand.
6907 %
6908 %    o width: the image width.
6909 %
6910 %    o height: the image height.
6911 %
6912 %    o background: the image color.
6913 %
6914 */
6915 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
6916   const size_t height,const PixelWand *background)
6917 {
6918   Image
6919     *images;
6920
6921   PixelInfo
6922     pixel;
6923
6924   assert(wand != (MagickWand *) NULL);
6925   assert(wand->signature == WandSignature);
6926   if (IfMagickTrue(wand->debug))
6927     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6928   PixelGetMagickColor(background,&pixel);
6929   images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
6930   if (images == (Image *) NULL)
6931     return(MagickFalse);
6932   return(InsertImageInWand(wand,images));
6933 }
6934 \f
6935 /*
6936 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6937 %                                                                             %
6938 %                                                                             %
6939 %                                                                             %
6940 %   M a g i c k N e x t I m a g e                                             %
6941 %                                                                             %
6942 %                                                                             %
6943 %                                                                             %
6944 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6945 %
6946 %  MagickNextImage() sets the next image in the wand as the current image.
6947 %
6948 %  It is typically used after MagickResetIterator(), after which its first use
6949 %  will set the first image as the current image (unless the wand is empty).
6950 %
6951 %  It will return MagickFalse when no more images are left to be returned
6952 %  which happens when the wand is empty, or the current image is the last
6953 %  image.
6954 %
6955 %  When the above condition (end of image list) is reached, the iterator is
6956 %  automaticall set so that you can start using MagickPreviousImage() to
6957 %  again iterate over the images in the reverse direction, starting with the
6958 %  last image (again).  You can jump to this condition immeditally using
6959 %  MagickSetLastIterator().
6960 %
6961 %  The format of the MagickNextImage method is:
6962 %
6963 %      MagickBooleanType MagickNextImage(MagickWand *wand)
6964 %
6965 %  A description of each parameter follows:
6966 %
6967 %    o wand: the magick wand.
6968 %
6969 */
6970 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
6971 {
6972   assert(wand != (MagickWand *) NULL);
6973   assert(wand->signature == WandSignature);
6974   if (IfMagickTrue(wand->debug))
6975     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6976   if (wand->images == (Image *) NULL)
6977     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6978   wand->insert_before=MagickFalse; /* Inserts is now appended */
6979   if (IfMagickTrue(wand->image_pending))
6980     {
6981       wand->image_pending=MagickFalse;
6982       return(MagickTrue);
6983     }
6984   if (GetNextImageInList(wand->images) == (Image *) NULL)
6985     {
6986       wand->image_pending=MagickTrue; /* No image, PreviousImage re-gets */
6987       return(MagickFalse);
6988     }
6989   wand->images=GetNextImageInList(wand->images);
6990   return(MagickTrue);
6991 }
6992 \f
6993 /*
6994 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6995 %                                                                             %
6996 %                                                                             %
6997 %                                                                             %
6998 %   M a g i c k N o r m a l i z e I m a g e                                   %
6999 %                                                                             %
7000 %                                                                             %
7001 %                                                                             %
7002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7003 %
7004 %  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7005 %  the pixels color to span the entire range of colors available
7006 %
7007 %  You can also reduce the influence of a particular channel with a gamma
7008 %  value of 0.
7009 %
7010 %  The format of the MagickNormalizeImage method is:
7011 %
7012 %      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7013 %
7014 %  A description of each parameter follows:
7015 %
7016 %    o wand: the magick wand.
7017 %
7018 */
7019 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7020 {
7021   MagickBooleanType
7022     status;
7023
7024   assert(wand != (MagickWand *) NULL);
7025   assert(wand->signature == WandSignature);
7026   if (IfMagickTrue(wand->debug))
7027     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7028   if (wand->images == (Image *) NULL)
7029     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7030   status=NormalizeImage(wand->images,wand->exception);
7031   return(status);
7032 }
7033 \f
7034 /*
7035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7036 %                                                                             %
7037 %                                                                             %
7038 %                                                                             %
7039 %   M a g i c k O i l P a i n t I m a g e                                     %
7040 %                                                                             %
7041 %                                                                             %
7042 %                                                                             %
7043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7044 %
7045 %  MagickOilPaintImage() applies a special effect filter that simulates an oil
7046 %  painting.  Each pixel is replaced by the most frequent color occurring
7047 %  in a circular region defined by radius.
7048 %
7049 %  The format of the MagickOilPaintImage method is:
7050 %
7051 %      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7052 %        const double radius,const double sigma)
7053 %
7054 %  A description of each parameter follows:
7055 %
7056 %    o wand: the magick wand.
7057 %
7058 %    o radius: the radius of the circular neighborhood.
7059 %
7060 %    o sigma: the standard deviation of the Gaussian, in pixels.
7061 %
7062 */
7063 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7064   const double radius,const double sigma)
7065 {
7066   Image
7067     *paint_image;
7068
7069   assert(wand != (MagickWand *) NULL);
7070   assert(wand->signature == WandSignature);
7071   if (IfMagickTrue(wand->debug))
7072     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7073   if (wand->images == (Image *) NULL)
7074     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7075   paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
7076   if (paint_image == (Image *) NULL)
7077     return(MagickFalse);
7078   ReplaceImageInList(&wand->images,paint_image);
7079   return(MagickTrue);
7080 }
7081 \f
7082 /*
7083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7084 %                                                                             %
7085 %                                                                             %
7086 %                                                                             %
7087 %   M a g i c k O p a q u e P a i n t I m a g e                               %
7088 %                                                                             %
7089 %                                                                             %
7090 %                                                                             %
7091 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7092 %
7093 %  MagickOpaquePaintImage() changes any pixel that matches color with the color
7094 %  defined by fill.
7095 %
7096 %  The format of the MagickOpaquePaintImage method is:
7097 %
7098 %      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7099 %        const PixelWand *target,const PixelWand *fill,const double fuzz,
7100 %        const MagickBooleanType invert)
7101 %
7102 %  A description of each parameter follows:
7103 %
7104 %    o wand: the magick wand.
7105 %
7106 %    o target: Change this target color to the fill color within the image.
7107 %
7108 %    o fill: the fill pixel wand.
7109 %
7110 %    o fuzz: By default target must match a particular pixel color
7111 %      exactly.  However, in many cases two colors may differ by a small amount.
7112 %      The fuzz member of image defines how much tolerance is acceptable to
7113 %      consider two colors as the same.  For example, set fuzz to 10 and the
7114 %      color red at intensities of 100 and 102 respectively are now interpreted
7115 %      as the same color for the purposes of the floodfill.
7116 %
7117 %    o invert: paint any pixel that does not match the target color.
7118 %
7119 */
7120 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7121   const PixelWand *target,const PixelWand *fill,const double fuzz,
7122   const MagickBooleanType invert)
7123 {
7124   MagickBooleanType
7125     status;
7126
7127   PixelInfo
7128     fill_pixel,
7129     target_pixel;
7130
7131   assert(wand != (MagickWand *) NULL);
7132   assert(wand->signature == WandSignature);
7133   if (IfMagickTrue(wand->debug))
7134     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7135   if (wand->images == (Image *) NULL)
7136     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7137   PixelGetMagickColor(target,&target_pixel);
7138   PixelGetMagickColor(fill,&fill_pixel);
7139   wand->images->fuzz=fuzz;
7140   status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
7141     wand->exception);
7142   return(status);
7143 }
7144 \f
7145 /*
7146 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7147 %                                                                             %
7148 %                                                                             %
7149 %                                                                             %
7150 %   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                         %
7151 %                                                                             %
7152 %                                                                             %
7153 %                                                                             %
7154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7155 %
7156 %  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7157 %  previous image in the sequence.  From this it attempts to select the
7158 %  smallest cropped image to replace each frame, while preserving the results
7159 %  of the animation.
7160 %
7161 %  The format of the MagickOptimizeImageLayers method is:
7162 %
7163 %      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7164 %
7165 %  A description of each parameter follows:
7166 %
7167 %    o wand: the magick wand.
7168 %
7169 */
7170 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7171 {
7172   Image
7173     *optimize_image;
7174
7175   assert(wand != (MagickWand *) NULL);
7176   assert(wand->signature == WandSignature);
7177   if (IfMagickTrue(wand->debug))
7178     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7179   if (wand->images == (Image *) NULL)
7180     return((MagickWand *) NULL);
7181   optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7182   if (optimize_image == (Image *) NULL)
7183     return((MagickWand *) NULL);
7184   return(CloneMagickWandFromImages(wand,optimize_image));
7185 }
7186 \f
7187 /*
7188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7189 %                                                                             %
7190 %                                                                             %
7191 %                                                                             %
7192 %   M a g i c k O p t i m i z e I m a g e T r a n s p a r e n c y             %
7193 %                                                                             %
7194 %                                                                             %
7195 %                                                                             %
7196 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7197 %
7198 %  MagickOptimizeImageTransparency() takes a frame optimized GIF animation, and
7199 %  compares the overlayed pixels against the disposal image resulting from all
7200 %  the previous frames in the animation.  Any pixel that does not change the
7201 %  disposal image (and thus does not effect the outcome of an overlay) is made
7202 %  transparent.
7203 %
7204 %  WARNING: This modifies the current images directly, rather than generate
7205 %  a new image sequence.
7206 %  The format of the MagickOptimizeImageTransparency method is:
7207 %
7208 %      MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7209 %
7210 %  A description of each parameter follows:
7211 %
7212 %    o wand: the magick wand.
7213 %
7214 */
7215 WandExport MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7216 {
7217   assert(wand != (MagickWand *) NULL);
7218   assert(wand->signature == WandSignature);
7219   if (IfMagickTrue(wand->debug))
7220     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7221   if (wand->images == (Image *) NULL)
7222     return(MagickFalse);
7223   OptimizeImageTransparency(wand->images,wand->exception);
7224   return(MagickTrue);
7225 }
7226 \f
7227 /*
7228 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7229 %                                                                             %
7230 %                                                                             %
7231 %                                                                             %
7232 %     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                   %
7233 %                                                                             %
7234 %                                                                             %
7235 %                                                                             %
7236 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7237 %
7238 %  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7239 %  of pre-defined dithering threshold maps, but over multiple intensity levels,
7240 %  which can be different for different channels, according to the input
7241 %  arguments.
7242 %
7243 %  The format of the MagickOrderedPosterizeImage method is:
7244 %
7245 %      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7246 %        const char *threshold_map)
7247 %
7248 %  A description of each parameter follows:
7249 %
7250 %    o image: the image.
7251 %
7252 %    o threshold_map: A string containing the name of the threshold dither
7253 %      map to use, followed by zero or more numbers representing the number of
7254 %      color levels tho dither between.
7255 %
7256 %      Any level number less than 2 is equivalent to 2, and means only binary
7257 %      dithering will be applied to each color channel.
7258 %
7259 %      No numbers also means a 2 level (bitmap) dither will be applied to all
7260 %      channels, while a single number is the number of levels applied to each
7261 %      channel in sequence.  More numbers will be applied in turn to each of
7262 %      the color channels.
7263 %
7264 %      For example: "o3x3,6" generates a 6 level posterization of the image
7265 %      with a ordered 3x3 diffused pixel dither being applied between each
7266 %      level. While checker,8,8,4 will produce a 332 colormaped image with
7267 %      only a single checkerboard hash pattern (50% grey) between each color
7268 %      level, to basically double the number of color levels with a bare
7269 %      minimim of dithering.
7270 %
7271 */
7272 WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7273   const char *threshold_map)
7274 {
7275   MagickBooleanType
7276     status;
7277
7278   assert(wand != (MagickWand *) NULL);
7279   assert(wand->signature == WandSignature);
7280   if (IfMagickTrue(wand->debug))
7281     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7282   if (wand->images == (Image *) NULL)
7283     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7284   status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7285   return(status);
7286 }
7287 \f
7288 /*
7289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7290 %                                                                             %
7291 %                                                                             %
7292 %                                                                             %
7293 %   M a g i c k P i n g I m a g e                                             %
7294 %                                                                             %
7295 %                                                                             %
7296 %                                                                             %
7297 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7298 %
7299 %  MagickPingImage() is the same as MagickReadImage() except the only valid
7300 %  information returned is the image width, height, size, and format.  It
7301 %  is designed to efficiently obtain this information from a file without
7302 %  reading the entire image sequence into memory.
7303 %
7304 %  The format of the MagickPingImage method is:
7305 %
7306 %      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7307 %
7308 %  A description of each parameter follows:
7309 %
7310 %    o wand: the magick wand.
7311 %
7312 %    o filename: the image filename.
7313 %
7314 */
7315 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7316   const char *filename)
7317 {
7318   Image
7319     *images;
7320
7321   ImageInfo
7322     *ping_info;
7323
7324   assert(wand != (MagickWand *) NULL);
7325   assert(wand->signature == WandSignature);
7326   if (IfMagickTrue(wand->debug))
7327     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7328   ping_info=CloneImageInfo(wand->image_info);
7329   if (filename != (const char *) NULL)
7330     (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7331   images=PingImage(ping_info,wand->exception);
7332   ping_info=DestroyImageInfo(ping_info);
7333   if (images == (Image *) NULL)
7334     return(MagickFalse);
7335   return(InsertImageInWand(wand,images));
7336 }
7337 \f
7338 /*
7339 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7340 %                                                                             %
7341 %                                                                             %
7342 %                                                                             %
7343 %   M a g i c k P i n g I m a g e B l o b                                     %
7344 %                                                                             %
7345 %                                                                             %
7346 %                                                                             %
7347 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7348 %
7349 %  MagickPingImageBlob() pings an image or image sequence from a blob.
7350 %
7351 %  The format of the MagickPingImageBlob method is:
7352 %
7353 %      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7354 %        const void *blob,const size_t length)
7355 %
7356 %  A description of each parameter follows:
7357 %
7358 %    o wand: the magick wand.
7359 %
7360 %    o blob: the blob.
7361 %
7362 %    o length: the blob length.
7363 %
7364 */
7365 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7366   const void *blob,const size_t length)
7367 {
7368   Image
7369     *images;
7370
7371   ImageInfo
7372     *read_info;
7373
7374   assert(wand != (MagickWand *) NULL);
7375   assert(wand->signature == WandSignature);
7376   if (IfMagickTrue(wand->debug))
7377     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7378   read_info=CloneImageInfo(wand->image_info);
7379   SetImageInfoBlob(read_info,blob,length);
7380   images=PingImage(read_info,wand->exception);
7381   read_info=DestroyImageInfo(read_info);
7382   if (images == (Image *) NULL)
7383     return(MagickFalse);
7384   return(InsertImageInWand(wand,images));
7385 }
7386 \f
7387 /*
7388 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7389 %                                                                             %
7390 %                                                                             %
7391 %                                                                             %
7392 %   M a g i c k P i n g I m a g e F i l e                                     %
7393 %                                                                             %
7394 %                                                                             %
7395 %                                                                             %
7396 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7397 %
7398 %  MagickPingImageFile() pings an image or image sequence from an open file
7399 %  descriptor.
7400 %
7401 %  The format of the MagickPingImageFile method is:
7402 %
7403 %      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7404 %
7405 %  A description of each parameter follows:
7406 %
7407 %    o wand: the magick wand.
7408 %
7409 %    o file: the file descriptor.
7410 %
7411 */
7412 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7413 {
7414   Image
7415     *images;
7416
7417   ImageInfo
7418     *read_info;
7419
7420   assert(wand != (MagickWand *) NULL);
7421   assert(wand->signature == WandSignature);
7422   assert(file != (FILE *) NULL);
7423   if (IfMagickTrue(wand->debug))
7424     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7425   read_info=CloneImageInfo(wand->image_info);
7426   SetImageInfoFile(read_info,file);
7427   images=PingImage(read_info,wand->exception);
7428   read_info=DestroyImageInfo(read_info);
7429   if (images == (Image *) NULL)
7430     return(MagickFalse);
7431   return(InsertImageInWand(wand,images));
7432 }
7433 \f
7434 /*
7435 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7436 %                                                                             %
7437 %                                                                             %
7438 %                                                                             %
7439 %   M a g i c k P o l a r o i d I m a g e                                     %
7440 %                                                                             %
7441 %                                                                             %
7442 %                                                                             %
7443 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7444 %
7445 %  MagickPolaroidImage() simulates a Polaroid picture.
7446 %
7447 %  The format of the MagickPolaroidImage method is:
7448 %
7449 %      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7450 %        const DrawingWand *drawing_wand,const char *caption,const double angle,
7451 %        const PixelInterpolateMethod method)
7452 %
7453 %  A description of each parameter follows:
7454 %
7455 %    o wand: the magick wand.
7456 %
7457 %    o drawing_wand: the draw wand.
7458 %
7459 %    o caption: the Polaroid caption.
7460 %
7461 %    o angle: Apply the effect along this angle.
7462 %
7463 %    o method: the pixel interpolation method.
7464 %
7465 */
7466 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7467   const DrawingWand *drawing_wand,const char *caption,const double angle,
7468   const PixelInterpolateMethod method)
7469 {
7470   DrawInfo
7471     *draw_info;
7472
7473   Image
7474     *polaroid_image;
7475
7476   assert(wand != (MagickWand *) NULL);
7477   assert(wand->signature == WandSignature);
7478   if (IfMagickTrue(wand->debug))
7479     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7480   if (wand->images == (Image *) NULL)
7481     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7482   draw_info=PeekDrawingWand(drawing_wand);
7483   if (draw_info == (DrawInfo *) NULL)
7484     return(MagickFalse);
7485   polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
7486     wand->exception);
7487   if (polaroid_image == (Image *) NULL)
7488     return(MagickFalse);
7489   ReplaceImageInList(&wand->images,polaroid_image);
7490   return(MagickTrue);
7491 }
7492 \f
7493 /*
7494 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7495 %                                                                             %
7496 %                                                                             %
7497 %                                                                             %
7498 %   M a g i c k P o s t e r i z e I m a g e                                   %
7499 %                                                                             %
7500 %                                                                             %
7501 %                                                                             %
7502 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7503 %
7504 %  MagickPosterizeImage() reduces the image to a limited number of color level.
7505 %
7506 %  The format of the MagickPosterizeImage method is:
7507 %
7508 %      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7509 %        const size_t levels,const DitherMethod method)
7510 %
7511 %  A description of each parameter follows:
7512 %
7513 %    o wand: the magick wand.
7514 %
7515 %    o levels: Number of color levels allowed in each channel.  Very low values
7516 %      (2, 3, or 4) have the most visible effect.
7517 %
7518 %    o method: choose the dither method: UndefinedDitherMethod,
7519 %      NoDitherMethod, RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7520 %
7521 */
7522 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7523   const size_t levels,const DitherMethod dither)
7524 {
7525   MagickBooleanType
7526     status;
7527
7528   assert(wand != (MagickWand *) NULL);
7529   assert(wand->signature == WandSignature);
7530   if (IfMagickTrue(wand->debug))
7531     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7532   if (wand->images == (Image *) NULL)
7533     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7534   status=PosterizeImage(wand->images,levels,dither,wand->exception);
7535   return(status);
7536 }
7537 \f
7538 /*
7539 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7540 %                                                                             %
7541 %                                                                             %
7542 %                                                                             %
7543 %   M a g i c k P r e v i e w I m a g e s                                     %
7544 %                                                                             %
7545 %                                                                             %
7546 %                                                                             %
7547 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7548 %
7549 %  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7550 %  image processing operation applied at varying strengths.  This helpful
7551 %  to quickly pin-point an appropriate parameter for an image processing
7552 %  operation.
7553 %
7554 %  The format of the MagickPreviewImages method is:
7555 %
7556 %      MagickWand *MagickPreviewImages(MagickWand *wand,
7557 %        const PreviewType preview)
7558 %
7559 %  A description of each parameter follows:
7560 %
7561 %    o wand: the magick wand.
7562 %
7563 %    o preview: the preview type.
7564 %
7565 */
7566 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7567   const PreviewType preview)
7568 {
7569   Image
7570     *preview_image;
7571
7572   assert(wand != (MagickWand *) NULL);
7573   assert(wand->signature == WandSignature);
7574   if (IfMagickTrue(wand->debug))
7575     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7576   if (wand->images == (Image *) NULL)
7577     return((MagickWand *) NULL);
7578   preview_image=PreviewImage(wand->images,preview,wand->exception);
7579   if (preview_image == (Image *) NULL)
7580     return((MagickWand *) NULL);
7581   return(CloneMagickWandFromImages(wand,preview_image));
7582 }
7583 \f
7584 /*
7585 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7586 %                                                                             %
7587 %                                                                             %
7588 %                                                                             %
7589 %   M a g i c k P r e v i o u s I m a g e                                     %
7590 %                                                                             %
7591 %                                                                             %
7592 %                                                                             %
7593 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7594 %
7595 %  MagickPreviousImage() sets the previous image in the wand as the current
7596 %  image.
7597 %
7598 %  It is typically used after MagickSetLastIterator(), after which its first
7599 %  use will set the last image as the current image (unless the wand is empty).
7600 %
7601 %  It will return MagickFalse when no more images are left to be returned
7602 %  which happens when the wand is empty, or the current image is the first
7603 %  image.  At that point the iterator is than reset to again process images in
7604 %  the forward direction, again starting with the first image in list. Images
7605 %  added at this point are prepended.
7606 %
7607 %  Also at that point any images added to the wand using MagickAddImages() or
7608 %  MagickReadImages() will be prepended before the first image. In this sense
7609 %  the condition is not quite exactly the same as MagickResetIterator().
7610 %
7611 %  The format of the MagickPreviousImage method is:
7612 %
7613 %      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7614 %
7615 %  A description of each parameter follows:
7616 %
7617 %    o wand: the magick wand.
7618 %
7619 */
7620 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7621 {
7622   assert(wand != (MagickWand *) NULL);
7623   assert(wand->signature == WandSignature);
7624   if (IfMagickTrue(wand->debug))
7625     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7626   if (wand->images == (Image *) NULL)
7627     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7628   if (IfMagickTrue(wand->image_pending))
7629     {
7630       wand->image_pending=MagickFalse;  /* image returned no longer pending */
7631       return(MagickTrue);
7632     }
7633   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7634     {
7635       wand->image_pending=MagickTrue;   /* Next now re-gets first image */
7636       wand->insert_before=MagickTrue;   /* insert/add prepends new images */
7637       return(MagickFalse);
7638     }
7639   wand->images=GetPreviousImageInList(wand->images);
7640   return(MagickTrue);
7641 }
7642 \f
7643 /*
7644 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7645 %                                                                             %
7646 %                                                                             %
7647 %                                                                             %
7648 %   M a g i c k Q u a n t i z e I m a g e                                     %
7649 %                                                                             %
7650 %                                                                             %
7651 %                                                                             %
7652 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7653 %
7654 %  MagickQuantizeImage() analyzes the colors within a reference image and
7655 %  chooses a fixed number of colors to represent the image.  The goal of the
7656 %  algorithm is to minimize the color difference between the input and output
7657 %  image while minimizing the processing time.
7658 %
7659 %  The format of the MagickQuantizeImage method is:
7660 %
7661 %      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7662 %        const size_t number_colors,const ColorspaceType colorspace,
7663 %        const size_t treedepth,const DitherMethod dither_method,
7664 %        const MagickBooleanType measure_error)
7665 %
7666 %  A description of each parameter follows:
7667 %
7668 %    o wand: the magick wand.
7669 %
7670 %    o number_colors: the number of colors.
7671 %
7672 %    o colorspace: Perform color reduction in this colorspace, typically
7673 %      RGBColorspace.
7674 %
7675 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7676 %      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
7677 %      reference image with the least amount of memory and the fastest
7678 %      computational speed.  In some cases, such as an image with low color
7679 %      dispersion (a few number of colors), a value other than
7680 %      Log4(number_colors) is required.  To expand the color tree completely,
7681 %      use a value of 8.
7682 %
7683 %    o dither_method: choose from UndefinedDitherMethod, NoDitherMethod,
7684 %      RiemersmaDitherMethod, FloydSteinbergDitherMethod.
7685 %
7686 %    o measure_error: A value other than zero measures the difference between
7687 %      the original and quantized images.  This difference is the total
7688 %      quantization error.  The error is computed by summing over all pixels
7689 %      in an image the distance squared in RGB space between each reference
7690 %      pixel value and its quantized value.
7691 %
7692 */
7693 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7694   const size_t number_colors,const ColorspaceType colorspace,
7695   const size_t treedepth,const DitherMethod dither_method,
7696   const MagickBooleanType measure_error)
7697 {
7698   MagickBooleanType
7699     status;
7700
7701   QuantizeInfo
7702     *quantize_info;
7703
7704   assert(wand != (MagickWand *) NULL);
7705   assert(wand->signature == WandSignature);
7706   if (IfMagickTrue(wand->debug))
7707     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7708   if (wand->images == (Image *) NULL)
7709     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7710   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7711   quantize_info->number_colors=number_colors;
7712   quantize_info->dither_method=dither_method;
7713   quantize_info->tree_depth=treedepth;
7714   quantize_info->colorspace=colorspace;
7715   quantize_info->measure_error=measure_error;
7716   status=QuantizeImage(quantize_info,wand->images,wand->exception);
7717   quantize_info=DestroyQuantizeInfo(quantize_info);
7718   return(status);
7719 }
7720 \f
7721 /*
7722 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7723 %                                                                             %
7724 %                                                                             %
7725 %                                                                             %
7726 %   M a g i c k Q u a n t i z e I m a g e s                                   %
7727 %                                                                             %
7728 %                                                                             %
7729 %                                                                             %
7730 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7731 %
7732 %  MagickQuantizeImages() analyzes the colors within a sequence of images and
7733 %  chooses a fixed number of colors to represent the image.  The goal of the
7734 %  algorithm is to minimize the color difference between the input and output
7735 %  image while minimizing the processing time.
7736 %
7737 %  The format of the MagickQuantizeImages method is:
7738 %
7739 %      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7740 %        const size_t number_colors,const ColorspaceType colorspace,
7741 %        const size_t treedepth,const DitherMethod dither_method,
7742 %        const MagickBooleanType measure_error)
7743 %
7744 %  A description of each parameter follows:
7745 %
7746 %    o wand: the magick wand.
7747 %
7748 %    o number_colors: the number of colors.
7749 %
7750 %    o colorspace: Perform color reduction in this colorspace, typically
7751 %      RGBColorspace.
7752 %
7753 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7754 %      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
7755 %      reference image with the least amount of memory and the fastest
7756 %      computational speed.  In some cases, such as an image with low color
7757 %      dispersion (a few number of colors), a value other than
7758 %      Log4(number_colors) is required.  To expand the color tree completely,
7759 %      use a value of 8.
7760 %
7761 %    o dither_method: choose from these dither methods: NoDitherMethod,
7762 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7763 %
7764 %    o measure_error: A value other than zero measures the difference between
7765 %      the original and quantized images.  This difference is the total
7766 %      quantization error.  The error is computed by summing over all pixels
7767 %      in an image the distance squared in RGB space between each reference
7768 %      pixel value and its quantized value.
7769 %
7770 */
7771 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7772   const size_t number_colors,const ColorspaceType colorspace,
7773   const size_t treedepth,const DitherMethod dither_method,
7774   const MagickBooleanType measure_error)
7775 {
7776   MagickBooleanType
7777     status;
7778
7779   QuantizeInfo
7780     *quantize_info;
7781
7782   assert(wand != (MagickWand *) NULL);
7783   assert(wand->signature == WandSignature);
7784   if (IfMagickTrue(wand->debug))
7785     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7786   if (wand->images == (Image *) NULL)
7787     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7788   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7789   quantize_info->number_colors=number_colors;
7790   quantize_info->dither_method=dither_method;
7791   quantize_info->tree_depth=treedepth;
7792   quantize_info->colorspace=colorspace;
7793   quantize_info->measure_error=measure_error;
7794   status=QuantizeImages(quantize_info,wand->images,wand->exception);
7795   quantize_info=DestroyQuantizeInfo(quantize_info);
7796   return(status);
7797 }
7798 \f
7799 /*
7800 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7801 %                                                                             %
7802 %                                                                             %
7803 %                                                                             %
7804 %   M a g i c k R o t a t i o n a l B l u r I m a g e                         %
7805 %                                                                             %
7806 %                                                                             %
7807 %                                                                             %
7808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7809 %
7810 %  MagickRotationalBlurImage() rotational blurs an image.
7811 %
7812 %  The format of the MagickRotationalBlurImage method is:
7813 %
7814 %      MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
7815 %        const double angle)
7816 %
7817 %  A description of each parameter follows:
7818 %
7819 %    o wand: the magick wand.
7820 %
7821 %    o angle: the angle of the blur in degrees.
7822 %
7823 */
7824 WandExport MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
7825   const double angle)
7826 {
7827   Image
7828     *blur_image;
7829
7830   assert(wand != (MagickWand *) NULL);
7831   assert(wand->signature == WandSignature);
7832   if (IfMagickTrue(wand->debug))
7833     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7834   if (wand->images == (Image *) NULL)
7835     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7836   blur_image=RotationalBlurImage(wand->images,angle,wand->exception);
7837   if (blur_image == (Image *) NULL)
7838     return(MagickFalse);
7839   ReplaceImageInList(&wand->images,blur_image);
7840   return(MagickTrue);
7841 }
7842 \f
7843 /*
7844 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7845 %                                                                             %
7846 %                                                                             %
7847 %                                                                             %
7848 %   M a g i c k R a i s e I m a g e                                           %
7849 %                                                                             %
7850 %                                                                             %
7851 %                                                                             %
7852 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7853 %
7854 %  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7855 %  by lightening and darkening the edges of the image.  Members width and
7856 %  height of raise_info define the width of the vertical and horizontal
7857 %  edge of the effect.
7858 %
7859 %  The format of the MagickRaiseImage method is:
7860 %
7861 %      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7862 %        const size_t width,const size_t height,const ssize_t x,
7863 %        const ssize_t y,const MagickBooleanType raise)
7864 %
7865 %  A description of each parameter follows:
7866 %
7867 %    o wand: the magick wand.
7868 %
7869 %    o width,height,x,y:  Define the dimensions of the area to raise.
7870 %
7871 %    o raise: A value other than zero creates a 3-D raise effect,
7872 %      otherwise it has a lowered effect.
7873 %
7874 */
7875 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7876   const size_t width,const size_t height,const ssize_t x,
7877   const ssize_t y,const MagickBooleanType raise)
7878 {
7879   MagickBooleanType
7880     status;
7881
7882   RectangleInfo
7883     raise_info;
7884
7885   assert(wand != (MagickWand *) NULL);
7886   assert(wand->signature == WandSignature);
7887   if (IfMagickTrue(wand->debug))
7888     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7889   if (wand->images == (Image *) NULL)
7890     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7891   raise_info.width=width;
7892   raise_info.height=height;
7893   raise_info.x=x;
7894   raise_info.y=y;
7895   status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
7896   return(status);
7897 }
7898 \f
7899 /*
7900 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7901 %                                                                             %
7902 %                                                                             %
7903 %                                                                             %
7904 %   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                       %
7905 %                                                                             %
7906 %                                                                             %
7907 %                                                                             %
7908 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7909 %
7910 %  MagickRandomThresholdImage() changes the value of individual pixels based on
7911 %  the intensity of each pixel compared to threshold.  The result is a
7912 %  high-contrast, two color image.
7913 %
7914 %  The format of the MagickRandomThresholdImage method is:
7915 %
7916 %      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7917 %        const double low,const double high)
7918 %
7919 %  A description of each parameter follows:
7920 %
7921 %    o wand: the magick wand.
7922 %
7923 %    o low,high: Specify the high and low thresholds.  These values range from
7924 %      0 to QuantumRange.
7925 %
7926 */
7927 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7928   const double low,const double high)
7929 {
7930   char
7931     threshold[MaxTextExtent];
7932
7933   assert(wand != (MagickWand *) NULL);
7934   assert(wand->signature == WandSignature);
7935   if (IfMagickTrue(wand->debug))
7936     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7937   if (wand->images == (Image *) NULL)
7938     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7939   (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
7940   return(RandomThresholdImage(wand->images,threshold,wand->exception));
7941 }
7942 \f
7943 /*
7944 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7945 %                                                                             %
7946 %                                                                             %
7947 %                                                                             %
7948 %   M a g i c k R e a d I m a g e                                             %
7949 %                                                                             %
7950 %                                                                             %
7951 %                                                                             %
7952 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7953 %
7954 %  MagickReadImage() reads an image or image sequence.  The images are inserted
7955 %  jjust before the current image pointer position.
7956 %
7957 %  Use MagickSetFirstIterator(), to insert new images before all the current
7958 %  images in the wand, MagickSetLastIterator() to append add to the end,
7959 %  MagickSetImageIndex() to place images just after the given index.
7960 %
7961 %  The format of the MagickReadImage method is:
7962 %
7963 %      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
7964 %
7965 %  A description of each parameter follows:
7966 %
7967 %    o wand: the magick wand.
7968 %
7969 %    o filename: the image filename.
7970 %
7971 */
7972 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
7973   const char *filename)
7974 {
7975   Image
7976     *images;
7977
7978   ImageInfo
7979     *read_info;
7980
7981   assert(wand != (MagickWand *) NULL);
7982   assert(wand->signature == WandSignature);
7983   if (IfMagickTrue(wand->debug))
7984     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7985   read_info=CloneImageInfo(wand->image_info);
7986   if (filename != (const char *) NULL)
7987     (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
7988   images=ReadImage(read_info,wand->exception);
7989   read_info=DestroyImageInfo(read_info);
7990   if (images == (Image *) NULL)
7991     return(MagickFalse);
7992   return(InsertImageInWand(wand,images));
7993 }
7994 \f
7995 /*
7996 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7997 %                                                                             %
7998 %                                                                             %
7999 %                                                                             %
8000 %   M a g i c k R e a d I m a g e B l o b                                     %
8001 %                                                                             %
8002 %                                                                             %
8003 %                                                                             %
8004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8005 %
8006 %  MagickReadImageBlob() reads an image or image sequence from a blob.
8007 %  In all other respects it is like MagickReadImage().
8008 %
8009 %  The format of the MagickReadImageBlob method is:
8010 %
8011 %      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8012 %        const void *blob,const size_t length)
8013 %
8014 %  A description of each parameter follows:
8015 %
8016 %    o wand: the magick wand.
8017 %
8018 %    o blob: the blob.
8019 %
8020 %    o length: the blob length.
8021 %
8022 */
8023 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8024   const void *blob,const size_t length)
8025 {
8026   Image
8027     *images;
8028
8029   assert(wand != (MagickWand *) NULL);
8030   assert(wand->signature == WandSignature);
8031   if (IfMagickTrue(wand->debug))
8032     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8033   images=BlobToImage(wand->image_info,blob,length,wand->exception);
8034   if (images == (Image *) NULL)
8035     return(MagickFalse);
8036   return(InsertImageInWand(wand,images));
8037 }
8038 \f
8039 /*
8040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8041 %                                                                             %
8042 %                                                                             %
8043 %                                                                             %
8044 %   M a g i c k R e a d I m a g e F i l e                                     %
8045 %                                                                             %
8046 %                                                                             %
8047 %                                                                             %
8048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8049 %
8050 %  MagickReadImageFile() reads an image or image sequence from an already
8051 %  opened file descriptor.  Otherwise it is like MagickReadImage().
8052 %
8053 %  The format of the MagickReadImageFile method is:
8054 %
8055 %      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8056 %
8057 %  A description of each parameter follows:
8058 %
8059 %    o wand: the magick wand.
8060 %
8061 %    o file: the file descriptor.
8062 %
8063 */
8064 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8065 {
8066   Image
8067     *images;
8068
8069   ImageInfo
8070     *read_info;
8071
8072   assert(wand != (MagickWand *) NULL);
8073   assert(wand->signature == WandSignature);
8074   assert(file != (FILE *) NULL);
8075   if (IfMagickTrue(wand->debug))
8076     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8077   read_info=CloneImageInfo(wand->image_info);
8078   SetImageInfoFile(read_info,file);
8079   images=ReadImage(read_info,wand->exception);
8080   read_info=DestroyImageInfo(read_info);
8081   if (images == (Image *) NULL)
8082     return(MagickFalse);
8083   return(InsertImageInWand(wand,images));
8084 }
8085 \f
8086 /*
8087 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8088 %                                                                             %
8089 %                                                                             %
8090 %                                                                             %
8091 %   M a g i c k R e m a p I m a g e                                           %
8092 %                                                                             %
8093 %                                                                             %
8094 %                                                                             %
8095 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8096 %
8097 %  MagickRemapImage() replaces the colors of an image with the closest color
8098 %  from a reference image.
8099 %
8100 %  The format of the MagickRemapImage method is:
8101 %
8102 %      MagickBooleanType MagickRemapImage(MagickWand *wand,
8103 %        const MagickWand *remap_wand,const DitherMethod method)
8104 %
8105 %  A description of each parameter follows:
8106 %
8107 %    o wand: the magick wand.
8108 %
8109 %    o affinity: the affinity wand.
8110 %
8111 %    o method: choose from these dither methods: NoDitherMethod,
8112 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8113 %
8114 */
8115 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8116   const MagickWand *remap_wand,const DitherMethod dither_method)
8117 {
8118   MagickBooleanType
8119     status;
8120
8121   QuantizeInfo
8122     *quantize_info;
8123
8124   assert(wand != (MagickWand *) NULL);
8125   assert(wand->signature == WandSignature);
8126   if (IfMagickTrue(wand->debug))
8127     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8128   if ((wand->images == (Image *) NULL) ||
8129       (remap_wand->images == (Image *) NULL))
8130     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8131   quantize_info=AcquireQuantizeInfo(wand->image_info);
8132   quantize_info->dither_method=dither_method;
8133   status=RemapImage(quantize_info,wand->images,remap_wand->images,
8134     wand->exception);
8135   quantize_info=DestroyQuantizeInfo(quantize_info);
8136   return(status);
8137 }
8138 \f
8139 /*
8140 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8141 %                                                                             %
8142 %                                                                             %
8143 %                                                                             %
8144 %   M a g i c k R e m o v e I m a g e                                         %
8145 %                                                                             %
8146 %                                                                             %
8147 %                                                                             %
8148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8149 %
8150 %  MagickRemoveImage() removes an image from the image list.
8151 %
8152 %  The format of the MagickRemoveImage method is:
8153 %
8154 %      MagickBooleanType MagickRemoveImage(MagickWand *wand)
8155 %
8156 %  A description of each parameter follows:
8157 %
8158 %    o wand: the magick wand.
8159 %
8160 %    o insert: the splice wand.
8161 %
8162 */
8163 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8164 {
8165   assert(wand != (MagickWand *) NULL);
8166   assert(wand->signature == WandSignature);
8167   if (IfMagickTrue(wand->debug))
8168     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8169   if (wand->images == (Image *) NULL)
8170     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8171   DeleteImageFromList(&wand->images);
8172   return(MagickTrue);
8173 }
8174 \f
8175 /*
8176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8177 %                                                                             %
8178 %                                                                             %
8179 %                                                                             %
8180 %   M a g i c k R e s a m p l e I m a g e                                     %
8181 %                                                                             %
8182 %                                                                             %
8183 %                                                                             %
8184 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8185 %
8186 %  MagickResampleImage() resample image to desired resolution.
8187 %
8188 %    Bessel   Blackman   Box
8189 %    Catrom   Cubic      Gaussian
8190 %    Hanning  Hermite    Lanczos
8191 %    Mitchell Point      Quandratic
8192 %    Sinc     Triangle
8193 %
8194 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8195 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8196 %  are windowed (brought down to zero) with the Blackman filter.
8197 %
8198 %  The format of the MagickResampleImage method is:
8199 %
8200 %      MagickBooleanType MagickResampleImage(MagickWand *wand,
8201 %        const double x_resolution,const double y_resolution,
8202 %        const FilterTypes filter)
8203 %
8204 %  A description of each parameter follows:
8205 %
8206 %    o wand: the magick wand.
8207 %
8208 %    o x_resolution: the new image x resolution.
8209 %
8210 %    o y_resolution: the new image y resolution.
8211 %
8212 %    o filter: Image filter to use.
8213 %
8214 */
8215 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8216   const double x_resolution,const double y_resolution,const FilterTypes filter)
8217 {
8218   Image
8219     *resample_image;
8220
8221   assert(wand != (MagickWand *) NULL);
8222   assert(wand->signature == WandSignature);
8223   if (IfMagickTrue(wand->debug))
8224     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8225   if (wand->images == (Image *) NULL)
8226     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8227   resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8228     wand->exception);
8229   if (resample_image == (Image *) NULL)
8230     return(MagickFalse);
8231   ReplaceImageInList(&wand->images,resample_image);
8232   return(MagickTrue);
8233 }
8234 \f
8235 /*
8236 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8237 %                                                                             %
8238 %                                                                             %
8239 %                                                                             %
8240 %   M a g i c k R e s e t I m a g e P a g e                                   %
8241 %                                                                             %
8242 %                                                                             %
8243 %                                                                             %
8244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8245 %
8246 %  MagickResetImagePage() resets the Wand page canvas and position.
8247 %
8248 %  The format of the MagickResetImagePage method is:
8249 %
8250 %      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8251 %        const char *page)
8252 %
8253 %  A description of each parameter follows:
8254 %
8255 %    o wand: the magick wand.
8256 %
8257 %    o page: the relative page specification.
8258 %
8259 */
8260 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8261   const char *page)
8262 {
8263   assert(wand != (MagickWand *) NULL);
8264   assert(wand->signature == WandSignature);
8265   if (IfMagickTrue(wand->debug))
8266     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8267   if (wand->images == (Image *) NULL)
8268     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8269   if ((page == (char *) NULL) || (*page == '\0'))
8270     {
8271       (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8272       return(MagickTrue);
8273     }
8274   return(ResetImagePage(wand->images,page));
8275 }
8276 \f
8277 /*
8278 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8279 %                                                                             %
8280 %                                                                             %
8281 %                                                                             %
8282 %   M a g i c k R e s i z e I m a g e                                         %
8283 %                                                                             %
8284 %                                                                             %
8285 %                                                                             %
8286 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8287 %
8288 %  MagickResizeImage() scales an image to the desired dimensions with one of
8289 %  these filters:
8290 %
8291 %    Bessel   Blackman   Box
8292 %    Catrom   Cubic      Gaussian
8293 %    Hanning  Hermite    Lanczos
8294 %    Mitchell Point      Quandratic
8295 %    Sinc     Triangle
8296 %
8297 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8298 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8299 %  are windowed (brought down to zero) with the Blackman filter.
8300 %
8301 %  The format of the MagickResizeImage method is:
8302 %
8303 %      MagickBooleanType MagickResizeImage(MagickWand *wand,
8304 %        const size_t columns,const size_t rows,const FilterTypes filter)
8305 %
8306 %  A description of each parameter follows:
8307 %
8308 %    o wand: the magick wand.
8309 %
8310 %    o columns: the number of columns in the scaled image.
8311 %
8312 %    o rows: the number of rows in the scaled image.
8313 %
8314 %    o filter: Image filter to use.
8315 %
8316 */
8317 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8318   const size_t columns,const size_t rows,const FilterTypes filter)
8319 {
8320   Image
8321     *resize_image;
8322
8323   assert(wand != (MagickWand *) NULL);
8324   assert(wand->signature == WandSignature);
8325   if (IfMagickTrue(wand->debug))
8326     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8327   if (wand->images == (Image *) NULL)
8328     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8329   resize_image=ResizeImage(wand->images,columns,rows,filter,wand->exception);
8330   if (resize_image == (Image *) NULL)
8331     return(MagickFalse);
8332   ReplaceImageInList(&wand->images,resize_image);
8333   return(MagickTrue);
8334 }
8335 \f
8336 /*
8337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8338 %                                                                             %
8339 %                                                                             %
8340 %                                                                             %
8341 %   M a g i c k R o l l I m a g e                                             %
8342 %                                                                             %
8343 %                                                                             %
8344 %                                                                             %
8345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8346 %
8347 %  MagickRollImage() offsets an image as defined by x and y.
8348 %
8349 %  The format of the MagickRollImage method is:
8350 %
8351 %      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8352 %        const size_t y)
8353 %
8354 %  A description of each parameter follows:
8355 %
8356 %    o wand: the magick wand.
8357 %
8358 %    o x: the x offset.
8359 %
8360 %    o y: the y offset.
8361 %
8362 %
8363 */
8364 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8365   const ssize_t x,const ssize_t y)
8366 {
8367   Image
8368     *roll_image;
8369
8370   assert(wand != (MagickWand *) NULL);
8371   assert(wand->signature == WandSignature);
8372   if (IfMagickTrue(wand->debug))
8373     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8374   if (wand->images == (Image *) NULL)
8375     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8376   roll_image=RollImage(wand->images,x,y,wand->exception);
8377   if (roll_image == (Image *) NULL)
8378     return(MagickFalse);
8379   ReplaceImageInList(&wand->images,roll_image);
8380   return(MagickTrue);
8381 }
8382 \f
8383 /*
8384 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8385 %                                                                             %
8386 %                                                                             %
8387 %                                                                             %
8388 %   M a g i c k R o t a t e I m a g e                                         %
8389 %                                                                             %
8390 %                                                                             %
8391 %                                                                             %
8392 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8393 %
8394 %  MagickRotateImage() rotates an image the specified number of degrees. Empty
8395 %  triangles left over from rotating the image are filled with the
8396 %  background color.
8397 %
8398 %  The format of the MagickRotateImage method is:
8399 %
8400 %      MagickBooleanType MagickRotateImage(MagickWand *wand,
8401 %        const PixelWand *background,const double degrees)
8402 %
8403 %  A description of each parameter follows:
8404 %
8405 %    o wand: the magick wand.
8406 %
8407 %    o background: the background pixel wand.
8408 %
8409 %    o degrees: the number of degrees to rotate the image.
8410 %
8411 %
8412 */
8413 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8414   const PixelWand *background,const double degrees)
8415 {
8416   Image
8417     *rotate_image;
8418
8419   assert(wand != (MagickWand *) NULL);
8420   assert(wand->signature == WandSignature);
8421   if (IfMagickTrue(wand->debug))
8422     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8423   if (wand->images == (Image *) NULL)
8424     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8425   PixelGetQuantumPacket(background,&wand->images->background_color);
8426   rotate_image=RotateImage(wand->images,degrees,wand->exception);
8427   if (rotate_image == (Image *) NULL)
8428     return(MagickFalse);
8429   ReplaceImageInList(&wand->images,rotate_image);
8430   return(MagickTrue);
8431 }
8432 \f
8433 /*
8434 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8435 %                                                                             %
8436 %                                                                             %
8437 %                                                                             %
8438 %   M a g i c k S a m p l e I m a g e                                         %
8439 %                                                                             %
8440 %                                                                             %
8441 %                                                                             %
8442 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8443 %
8444 %  MagickSampleImage() scales an image to the desired dimensions with pixel
8445 %  sampling.  Unlike other scaling methods, this method does not introduce
8446 %  any additional color into the scaled image.
8447 %
8448 %  The format of the MagickSampleImage method is:
8449 %
8450 %      MagickBooleanType MagickSampleImage(MagickWand *wand,
8451 %        const size_t columns,const size_t rows)
8452 %
8453 %  A description of each parameter follows:
8454 %
8455 %    o wand: the magick wand.
8456 %
8457 %    o columns: the number of columns in the scaled image.
8458 %
8459 %    o rows: the number of rows in the scaled image.
8460 %
8461 %
8462 */
8463 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8464   const size_t columns,const size_t rows)
8465 {
8466   Image
8467     *sample_image;
8468
8469   assert(wand != (MagickWand *) NULL);
8470   assert(wand->signature == WandSignature);
8471   if (IfMagickTrue(wand->debug))
8472     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8473   if (wand->images == (Image *) NULL)
8474     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8475   sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8476   if (sample_image == (Image *) NULL)
8477     return(MagickFalse);
8478   ReplaceImageInList(&wand->images,sample_image);
8479   return(MagickTrue);
8480 }
8481 \f
8482 /*
8483 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8484 %                                                                             %
8485 %                                                                             %
8486 %                                                                             %
8487 %   M a g i c k S c a l e I m a g e                                           %
8488 %                                                                             %
8489 %                                                                             %
8490 %                                                                             %
8491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8492 %
8493 %  MagickScaleImage() scales the size of an image to the given dimensions.
8494 %
8495 %  The format of the MagickScaleImage method is:
8496 %
8497 %      MagickBooleanType MagickScaleImage(MagickWand *wand,
8498 %        const size_t columns,const size_t rows)
8499 %
8500 %  A description of each parameter follows:
8501 %
8502 %    o wand: the magick wand.
8503 %
8504 %    o columns: the number of columns in the scaled image.
8505 %
8506 %    o rows: the number of rows in the scaled image.
8507 %
8508 %
8509 */
8510 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8511   const size_t columns,const size_t rows)
8512 {
8513   Image
8514     *scale_image;
8515
8516   assert(wand != (MagickWand *) NULL);
8517   assert(wand->signature == WandSignature);
8518   if (IfMagickTrue(wand->debug))
8519     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8520   if (wand->images == (Image *) NULL)
8521     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8522   scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8523   if (scale_image == (Image *) NULL)
8524     return(MagickFalse);
8525   ReplaceImageInList(&wand->images,scale_image);
8526   return(MagickTrue);
8527 }
8528 \f
8529 /*
8530 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8531 %                                                                             %
8532 %                                                                             %
8533 %                                                                             %
8534 %   M a g i c k S e g m e n t I m a g e                                       %
8535 %                                                                             %
8536 %                                                                             %
8537 %                                                                             %
8538 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8539 %
8540 %  MagickSegmentImage() segments an image by analyzing the histograms of the
8541 %  color components and identifying units that are homogeneous with the fuzzy
8542 %  C-means technique.
8543 %
8544 %  The format of the SegmentImage method is:
8545 %
8546 %      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8547 %        const ColorspaceType colorspace,const MagickBooleanType verbose,
8548 %        const double cluster_threshold,const double smooth_threshold)
8549 %
8550 %  A description of each parameter follows.
8551 %
8552 %    o wand: the wand.
8553 %
8554 %    o colorspace: the image colorspace.
8555 %
8556 %    o verbose:  Set to MagickTrue to print detailed information about the
8557 %      identified classes.
8558 %
8559 %    o cluster_threshold:  This represents the minimum number of pixels
8560 %      contained in a hexahedra before it can be considered valid (expressed as
8561 %      a percentage).
8562 %
8563 %    o smooth_threshold: the smoothing threshold eliminates noise in the second
8564 %      derivative of the histogram.  As the value is increased, you can expect a
8565 %      smoother second derivative.
8566 %
8567 */
8568 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8569   const ColorspaceType colorspace,const MagickBooleanType verbose,
8570   const double cluster_threshold,const double smooth_threshold)
8571 {
8572   MagickBooleanType
8573     status;
8574
8575   assert(wand != (MagickWand *) NULL);
8576   assert(wand->signature == WandSignature);
8577   if (IfMagickTrue(wand->debug))
8578     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8579   if (wand->images == (Image *) NULL)
8580     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8581   status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8582     smooth_threshold,wand->exception);
8583   return(status);
8584 }
8585 \f
8586 /*
8587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8588 %                                                                             %
8589 %                                                                             %
8590 %                                                                             %
8591 %   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8592 %                                                                             %
8593 %                                                                             %
8594 %                                                                             %
8595 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8596 %
8597 %  MagickSelectiveBlurImage() selectively blur an image within a contrast
8598 %  threshold. It is similar to the unsharpen mask that sharpens everything with
8599 %  contrast above a certain threshold.
8600 %
8601 %  The format of the MagickSelectiveBlurImage method is:
8602 %
8603 %      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8604 %        const double radius,const double sigma,const double threshold)
8605 %
8606 %  A description of each parameter follows:
8607 %
8608 %    o wand: the magick wand.
8609 %
8610 %    o radius: the radius of the gaussian, in pixels, not counting the center
8611 %      pixel.
8612 %
8613 %    o sigma: the standard deviation of the gaussian, in pixels.
8614 %
8615 %    o threshold: only pixels within this contrast threshold are included
8616 %      in the blur operation.
8617 %
8618 */
8619 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8620   const double radius,const double sigma,const double threshold)
8621 {
8622   Image
8623     *blur_image;
8624
8625   assert(wand != (MagickWand *) NULL);
8626   assert(wand->signature == WandSignature);
8627   if (IfMagickTrue(wand->debug))
8628     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8629   if (wand->images == (Image *) NULL)
8630     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8631   blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
8632     wand->exception);
8633   if (blur_image == (Image *) NULL)
8634     return(MagickFalse);
8635   ReplaceImageInList(&wand->images,blur_image);
8636   return(MagickTrue);
8637 }
8638 \f
8639 /*
8640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8641 %                                                                             %
8642 %                                                                             %
8643 %                                                                             %
8644 %   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                       %
8645 %                                                                             %
8646 %                                                                             %
8647 %                                                                             %
8648 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8649 %
8650 %  MagickSeparateImage() separates a channel from the image and returns a
8651 %  grayscale image.  A channel is a particular color component of each pixel
8652 %  in the image.
8653 %
8654 %  The format of the MagickSeparateImage method is:
8655 %
8656 %      MagickBooleanType MagickSeparateImage(MagickWand *wand,
8657 %        const ChannelType channel)
8658 %
8659 %  A description of each parameter follows:
8660 %
8661 %    o wand: the magick wand.
8662 %
8663 %    o channel: the channel.
8664 %
8665 */
8666 WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
8667   const ChannelType channel)
8668 {
8669   Image
8670     *separate_image;
8671
8672   assert(wand != (MagickWand *) NULL);
8673   assert(wand->signature == WandSignature);
8674   if (IfMagickTrue(wand->debug))
8675     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8676   if (wand->images == (Image *) NULL)
8677     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8678   separate_image=SeparateImage(wand->images,channel,wand->exception);
8679   if (separate_image == (Image *) NULL)
8680     return(MagickFalse);
8681   ReplaceImageInList(&wand->images,separate_image);
8682   return(MagickTrue);
8683 }
8684 \f
8685 /*
8686 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8687 %                                                                             %
8688 %                                                                             %
8689 %                                                                             %
8690 %     M a g i c k S e p i a T o n e I m a g e                                 %
8691 %                                                                             %
8692 %                                                                             %
8693 %                                                                             %
8694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8695 %
8696 %  MagickSepiaToneImage() applies a special effect to the image, similar to the
8697 %  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8698 %  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8699 %  threshold of 80% is a good starting point for a reasonable tone.
8700 %
8701 %  The format of the MagickSepiaToneImage method is:
8702 %
8703 %      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8704 %        const double threshold)
8705 %
8706 %  A description of each parameter follows:
8707 %
8708 %    o wand: the magick wand.
8709 %
8710 %    o threshold:  Define the extent of the sepia toning.
8711 %
8712 */
8713 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8714   const double threshold)
8715 {
8716   Image
8717     *sepia_image;
8718
8719   assert(wand != (MagickWand *) NULL);
8720   assert(wand->signature == WandSignature);
8721   if (IfMagickTrue(wand->debug))
8722     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8723   if (wand->images == (Image *) NULL)
8724     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8725   sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8726   if (sepia_image == (Image *) NULL)
8727     return(MagickFalse);
8728   ReplaceImageInList(&wand->images,sepia_image);
8729   return(MagickTrue);
8730 }
8731 \f
8732 /*
8733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8734 %                                                                             %
8735 %                                                                             %
8736 %                                                                             %
8737 %   M a g i c k S e t I m a g e                                               %
8738 %                                                                             %
8739 %                                                                             %
8740 %                                                                             %
8741 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8742 %
8743 %  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8744 %  MagickNextImage(), MagickPreviousImage() with the images from the specified
8745 %  wand.
8746 %
8747 %  The format of the MagickSetImage method is:
8748 %
8749 %      MagickBooleanType MagickSetImage(MagickWand *wand,
8750 %        const MagickWand *set_wand)
8751 %
8752 %  A description of each parameter follows:
8753 %
8754 %    o wand: the magick wand.
8755 %
8756 %    o set_wand: the set_wand wand.
8757 %
8758 */
8759 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8760   const MagickWand *set_wand)
8761 {
8762   Image
8763     *images;
8764
8765   assert(wand != (MagickWand *) NULL);
8766   assert(wand->signature == WandSignature);
8767   if (IfMagickTrue(wand->debug))
8768     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8769   assert(set_wand != (MagickWand *) NULL);
8770   assert(set_wand->signature == WandSignature);
8771   if (IfMagickTrue(wand->debug))
8772     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8773   if (set_wand->images == (Image *) NULL)
8774     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8775   images=CloneImageList(set_wand->images,wand->exception);
8776   if (images == (Image *) NULL)
8777     return(MagickFalse);
8778   ReplaceImageInList(&wand->images,images);
8779   return(MagickTrue);
8780 }
8781 \f
8782 /*
8783 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8784 %                                                                             %
8785 %                                                                             %
8786 %                                                                             %
8787 %   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                       %
8788 %                                                                             %
8789 %                                                                             %
8790 %                                                                             %
8791 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8792 %
8793 %  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8794 %  alpha channel.
8795 %
8796 %  The format of the MagickSetImageAlphaChannel method is:
8797 %
8798 %      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8799 %        const AlphaChannelOption alpha_type)
8800 %
8801 %  A description of each parameter follows:
8802 %
8803 %    o wand: the magick wand.
8804 %
8805 %    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8806 %      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8807 %
8808 */
8809 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8810   const AlphaChannelOption alpha_type)
8811 {
8812   assert(wand != (MagickWand *) NULL);
8813   assert(wand->signature == WandSignature);
8814   if (IfMagickTrue(wand->debug))
8815     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8816   if (wand->images == (Image *) NULL)
8817     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8818   return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
8819 }
8820 \f
8821 /*
8822 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8823 %                                                                             %
8824 %                                                                             %
8825 %                                                                             %
8826 %   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                 %
8827 %                                                                             %
8828 %                                                                             %
8829 %                                                                             %
8830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8831 %
8832 %  MagickSetImageBackgroundColor() sets the image background color.
8833 %
8834 %  The format of the MagickSetImageBackgroundColor method is:
8835 %
8836 %      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8837 %        const PixelWand *background)
8838 %
8839 %  A description of each parameter follows:
8840 %
8841 %    o wand: the magick wand.
8842 %
8843 %    o background: the background pixel wand.
8844 %
8845 */
8846 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8847   const PixelWand *background)
8848 {
8849   assert(wand != (MagickWand *) NULL);
8850   assert(wand->signature == WandSignature);
8851   if (IfMagickTrue(wand->debug))
8852     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8853   if (wand->images == (Image *) NULL)
8854     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8855   PixelGetQuantumPacket(background,&wand->images->background_color);
8856   return(MagickTrue);
8857 }
8858 \f
8859 /*
8860 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8861 %                                                                             %
8862 %                                                                             %
8863 %                                                                             %
8864 %   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                         %
8865 %                                                                             %
8866 %                                                                             %
8867 %                                                                             %
8868 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8869 %
8870 %  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8871 %
8872 %  The format of the MagickSetImageBluePrimary method is:
8873 %
8874 %      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8875 %        const double x,const double y)
8876 %
8877 %  A description of each parameter follows:
8878 %
8879 %    o wand: the magick wand.
8880 %
8881 %    o x: the blue primary x-point.
8882 %
8883 %    o y: the blue primary y-point.
8884 %
8885 */
8886 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8887   const double x,const double y)
8888 {
8889   assert(wand != (MagickWand *) NULL);
8890   assert(wand->signature == WandSignature);
8891   if (IfMagickTrue(wand->debug))
8892     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8893   if (wand->images == (Image *) NULL)
8894     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8895   wand->images->chromaticity.blue_primary.x=x;
8896   wand->images->chromaticity.blue_primary.y=y;
8897   return(MagickTrue);
8898 }
8899 \f
8900 /*
8901 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8902 %                                                                             %
8903 %                                                                             %
8904 %                                                                             %
8905 %   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                         %
8906 %                                                                             %
8907 %                                                                             %
8908 %                                                                             %
8909 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8910 %
8911 %  MagickSetImageBorderColor() sets the image border color.
8912 %
8913 %  The format of the MagickSetImageBorderColor method is:
8914 %
8915 %      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8916 %        const PixelWand *border)
8917 %
8918 %  A description of each parameter follows:
8919 %
8920 %    o wand: the magick wand.
8921 %
8922 %    o border: the border pixel wand.
8923 %
8924 */
8925 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8926   const PixelWand *border)
8927 {
8928   assert(wand != (MagickWand *) NULL);
8929   assert(wand->signature == WandSignature);
8930   if (IfMagickTrue(wand->debug))
8931     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8932   if (wand->images == (Image *) NULL)
8933     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8934   PixelGetQuantumPacket(border,&wand->images->border_color);
8935   return(MagickTrue);
8936 }
8937 \f
8938 /*
8939 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8940 %                                                                             %
8941 %                                                                             %
8942 %                                                                             %
8943 %   M a g i c k S e t I m a g e C l i p M a s k                               %
8944 %                                                                             %
8945 %                                                                             %
8946 %                                                                             %
8947 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8948 %
8949 %  MagickSetImageMask() sets image clip mask.
8950 %
8951 %  The format of the MagickSetImageMask method is:
8952 %
8953 %      MagickBooleanType MagickSetImageMask(MagickWand *wand,
8954 %        const MagickWand *clip_mask)
8955 %
8956 %  A description of each parameter follows:
8957 %
8958 %    o wand: the magick wand.
8959 %
8960 %    o clip_mask: the clip_mask wand.
8961 %
8962 */
8963 WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
8964   const MagickWand *clip_mask)
8965 {
8966   assert(wand != (MagickWand *) NULL);
8967   assert(wand->signature == WandSignature);
8968   if (IfMagickTrue(wand->debug))
8969     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8970   assert(clip_mask != (MagickWand *) NULL);
8971   assert(clip_mask->signature == WandSignature);
8972   if (IfMagickTrue(clip_mask->debug))
8973     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
8974   if (clip_mask->images == (Image *) NULL)
8975     ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
8976   return(SetImageMask(wand->images,clip_mask->images,wand->exception));
8977 }
8978 \f
8979 /*
8980 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8981 %                                                                             %
8982 %                                                                             %
8983 %                                                                             %
8984 %   M a g i c k S e t I m a g e C o l o r                                     %
8985 %                                                                             %
8986 %                                                                             %
8987 %                                                                             %
8988 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8989 %
8990 %  MagickSetImageColor() set the entire wand canvas to the specified color.
8991 %
8992 %  The format of the MagickSetImageColor method is:
8993 %
8994 %      MagickBooleanType MagickSetImageColor(MagickWand *wand,
8995 %        const PixelWand *color)
8996 %
8997 %  A description of each parameter follows:
8998 %
8999 %    o wand: the magick wand.
9000 %
9001 %    o background: the image color.
9002 %
9003 */
9004 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9005   const PixelWand *color)
9006 {
9007   PixelInfo
9008     pixel;
9009
9010   assert(wand != (MagickWand *) NULL);
9011   assert(wand->signature == WandSignature);
9012   if (IfMagickTrue(wand->debug))
9013     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9014   PixelGetMagickColor(color,&pixel);
9015   return(SetImageColor(wand->images,&pixel,wand->exception));
9016 }
9017 \f
9018 /*
9019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9020 %                                                                             %
9021 %                                                                             %
9022 %                                                                             %
9023 %   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                     %
9024 %                                                                             %
9025 %                                                                             %
9026 %                                                                             %
9027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9028 %
9029 %  MagickSetImageColormapColor() sets the color of the specified colormap
9030 %  index.
9031 %
9032 %  The format of the MagickSetImageColormapColor method is:
9033 %
9034 %      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9035 %        const size_t index,const PixelWand *color)
9036 %
9037 %  A description of each parameter follows:
9038 %
9039 %    o wand: the magick wand.
9040 %
9041 %    o index: the offset into the image colormap.
9042 %
9043 %    o color: Return the colormap color in this wand.
9044 %
9045 */
9046 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9047   const size_t index,const PixelWand *color)
9048 {
9049   assert(wand != (MagickWand *) NULL);
9050   assert(wand->signature == WandSignature);
9051   if (IfMagickTrue(wand->debug))
9052     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9053   if (wand->images == (Image *) NULL)
9054     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9055   if ((wand->images->colormap == (PixelInfo *) NULL) ||
9056       (index >= wand->images->colors))
9057     ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9058   PixelGetQuantumPacket(color,wand->images->colormap+index);
9059   return(SyncImage(wand->images,wand->exception));
9060 }
9061 \f
9062 /*
9063 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9064 %                                                                             %
9065 %                                                                             %
9066 %                                                                             %
9067 %   M a g i c k S e t I m a g e C o l o r s p a c e                           %
9068 %                                                                             %
9069 %                                                                             %
9070 %                                                                             %
9071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9072 %
9073 %  MagickSetImageColorspace() sets the image colorspace. But does not modify
9074 %  the image data.
9075 %
9076 %  The format of the MagickSetImageColorspace method is:
9077 %
9078 %      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9079 %        const ColorspaceType colorspace)
9080 %
9081 %  A description of each parameter follows:
9082 %
9083 %    o wand: the magick wand.
9084 %
9085 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
9086 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9087 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9088 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9089 %      HSLColorspace, or HWBColorspace.
9090 %
9091 */
9092 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9093   const ColorspaceType colorspace)
9094 {
9095   assert(wand != (MagickWand *) NULL);
9096   assert(wand->signature == WandSignature);
9097   if (IfMagickTrue(wand->debug))
9098     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9099   if (wand->images == (Image *) NULL)
9100     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9101   return(SetImageColorspace(wand->images,colorspace,wand->exception));
9102 }
9103 \f
9104 /*
9105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9106 %                                                                             %
9107 %                                                                             %
9108 %                                                                             %
9109 %   M a g i c k S e t I m a g e C o m p o s e                                 %
9110 %                                                                             %
9111 %                                                                             %
9112 %                                                                             %
9113 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9114 %
9115 %  MagickSetImageCompose() sets the image composite operator, useful for
9116 %  specifying how to composite the image thumbnail when using the
9117 %  MagickMontageImage() method.
9118 %
9119 %  The format of the MagickSetImageCompose method is:
9120 %
9121 %      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9122 %        const CompositeOperator compose)
9123 %
9124 %  A description of each parameter follows:
9125 %
9126 %    o wand: the magick wand.
9127 %
9128 %    o compose: the image composite operator.
9129 %
9130 */
9131 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9132   const CompositeOperator compose)
9133 {
9134   assert(wand != (MagickWand *) NULL);
9135   assert(wand->signature == WandSignature);
9136   if (IfMagickTrue(wand->debug))
9137     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9138   if (wand->images == (Image *) NULL)
9139     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9140   wand->images->compose=compose;
9141   return(MagickTrue);
9142 }
9143 \f
9144 /*
9145 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9146 %                                                                             %
9147 %                                                                             %
9148 %                                                                             %
9149 %   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                         %
9150 %                                                                             %
9151 %                                                                             %
9152 %                                                                             %
9153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9154 %
9155 %  MagickSetImageCompression() sets the image compression.
9156 %
9157 %  The format of the MagickSetImageCompression method is:
9158 %
9159 %      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9160 %        const CompressionType compression)
9161 %
9162 %  A description of each parameter follows:
9163 %
9164 %    o wand: the magick wand.
9165 %
9166 %    o compression: the image compression type.
9167 %
9168 */
9169 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9170   const CompressionType compression)
9171 {
9172   assert(wand != (MagickWand *) NULL);
9173   assert(wand->signature == WandSignature);
9174   if (IfMagickTrue(wand->debug))
9175     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9176   if (wand->images == (Image *) NULL)
9177     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9178   wand->images->compression=compression;
9179   return(MagickTrue);
9180 }
9181 \f
9182 /*
9183 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9184 %                                                                             %
9185 %                                                                             %
9186 %                                                                             %
9187 %   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           %
9188 %                                                                             %
9189 %                                                                             %
9190 %                                                                             %
9191 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9192 %
9193 %  MagickSetImageCompressionQuality() sets the image compression quality.
9194 %
9195 %  The format of the MagickSetImageCompressionQuality method is:
9196 %
9197 %      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9198 %        const size_t quality)
9199 %
9200 %  A description of each parameter follows:
9201 %
9202 %    o wand: the magick wand.
9203 %
9204 %    o quality: the image compression tlityype.
9205 %
9206 */
9207 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9208   const size_t quality)
9209 {
9210   assert(wand != (MagickWand *) NULL);
9211   assert(wand->signature == WandSignature);
9212   if (IfMagickTrue(wand->debug))
9213     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9214   if (wand->images == (Image *) NULL)
9215     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9216   wand->images->quality=quality;
9217   return(MagickTrue);
9218 }
9219 \f
9220 /*
9221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9222 %                                                                             %
9223 %                                                                             %
9224 %                                                                             %
9225 %   M a g i c k S e t I m a g e D e l a y                                     %
9226 %                                                                             %
9227 %                                                                             %
9228 %                                                                             %
9229 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9230 %
9231 %  MagickSetImageDelay() sets the image delay.
9232 %
9233 %  The format of the MagickSetImageDelay method is:
9234 %
9235 %      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9236 %        const size_t delay)
9237 %
9238 %  A description of each parameter follows:
9239 %
9240 %    o wand: the magick wand.
9241 %
9242 %    o delay: the image delay in ticks-per-second units.
9243 %
9244 */
9245 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9246   const size_t delay)
9247 {
9248   assert(wand != (MagickWand *) NULL);
9249   assert(wand->signature == WandSignature);
9250   if (IfMagickTrue(wand->debug))
9251     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9252   if (wand->images == (Image *) NULL)
9253     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9254   wand->images->delay=delay;
9255   return(MagickTrue);
9256 }
9257 \f
9258 /*
9259 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9260 %                                                                             %
9261 %                                                                             %
9262 %                                                                             %
9263 %   M a g i c k S e t I m a g e D e p t h                                     %
9264 %                                                                             %
9265 %                                                                             %
9266 %                                                                             %
9267 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9268 %
9269 %  MagickSetImageDepth() sets the image depth.
9270 %
9271 %  The format of the MagickSetImageDepth method is:
9272 %
9273 %      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9274 %        const size_t depth)
9275 %
9276 %  A description of each parameter follows:
9277 %
9278 %    o wand: the magick wand.
9279 %
9280 %    o depth: the image depth in bits: 8, 16, or 32.
9281 %
9282 */
9283 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9284   const size_t depth)
9285 {
9286   assert(wand != (MagickWand *) NULL);
9287   assert(wand->signature == WandSignature);
9288   if (IfMagickTrue(wand->debug))
9289     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9290   if (wand->images == (Image *) NULL)
9291     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9292   return(SetImageDepth(wand->images,depth,wand->exception));
9293 }
9294 \f
9295 /*
9296 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9297 %                                                                             %
9298 %                                                                             %
9299 %                                                                             %
9300 %   M a g i c k S e t I m a g e D i s p o s e                                 %
9301 %                                                                             %
9302 %                                                                             %
9303 %                                                                             %
9304 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9305 %
9306 %  MagickSetImageDispose() sets the image disposal method.
9307 %
9308 %  The format of the MagickSetImageDispose method is:
9309 %
9310 %      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9311 %        const DisposeType dispose)
9312 %
9313 %  A description of each parameter follows:
9314 %
9315 %    o wand: the magick wand.
9316 %
9317 %    o dispose: the image disposeal type.
9318 %
9319 */
9320 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9321   const DisposeType dispose)
9322 {
9323   assert(wand != (MagickWand *) NULL);
9324   assert(wand->signature == WandSignature);
9325   if (IfMagickTrue(wand->debug))
9326     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9327   if (wand->images == (Image *) NULL)
9328     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9329   wand->images->dispose=dispose;
9330   return(MagickTrue);
9331 }
9332 \f
9333 /*
9334 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9335 %                                                                             %
9336 %                                                                             %
9337 %                                                                             %
9338 %   M a g i c k S e t I m a g e E n d i a n                                   %
9339 %                                                                             %
9340 %                                                                             %
9341 %                                                                             %
9342 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9343 %
9344 %  MagickSetImageEndian() sets the image endian method.
9345 %
9346 %  The format of the MagickSetImageEndian method is:
9347 %
9348 %      MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9349 %        const EndianType endian)
9350 %
9351 %  A description of each parameter follows:
9352 %
9353 %    o wand: the magick wand.
9354 %
9355 %    o endian: the image endian type.
9356 %
9357 */
9358 WandExport MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9359   const EndianType endian)
9360 {
9361   assert(wand != (MagickWand *) NULL);
9362   assert(wand->signature == WandSignature);
9363   if (wand->debug != MagickFalse)
9364     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9365   if (wand->images == (Image *) NULL)
9366     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9367   wand->images->endian=endian;
9368   return(MagickTrue);
9369 }
9370 \f
9371 /*
9372 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9373 %                                                                             %
9374 %                                                                             %
9375 %                                                                             %
9376 %   M a g i c k S e t I m a g e E x t e n t                                   %
9377 %                                                                             %
9378 %                                                                             %
9379 %                                                                             %
9380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9381 %
9382 %  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9383 %
9384 %  The format of the MagickSetImageExtent method is:
9385 %
9386 %      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9387 %        const size_t columns,const unsigned rows)
9388 %
9389 %  A description of each parameter follows:
9390 %
9391 %    o wand: the magick wand.
9392 %
9393 %    o columns:  The image width in pixels.
9394 %
9395 %    o rows:  The image height in pixels.
9396 %
9397 */
9398 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9399   const size_t columns,const size_t rows)
9400 {
9401   assert(wand != (MagickWand *) NULL);
9402   assert(wand->signature == WandSignature);
9403   if (IfMagickTrue(wand->debug))
9404     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9405   if (wand->images == (Image *) NULL)
9406     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9407   return(SetImageExtent(wand->images,columns,rows,wand->exception));
9408 }
9409 \f
9410 /*
9411 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9412 %                                                                             %
9413 %                                                                             %
9414 %                                                                             %
9415 %   M a g i c k S e t I m a g e F i l e n a m e                               %
9416 %                                                                             %
9417 %                                                                             %
9418 %                                                                             %
9419 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9420 %
9421 %  MagickSetImageFilename() sets the filename of a particular image in a
9422 %  sequence.
9423 %
9424 %  The format of the MagickSetImageFilename method is:
9425 %
9426 %      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9427 %        const char *filename)
9428 %
9429 %  A description of each parameter follows:
9430 %
9431 %    o wand: the magick wand.
9432 %
9433 %    o filename: the image filename.
9434 %
9435 */
9436 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9437   const char *filename)
9438 {
9439   assert(wand != (MagickWand *) NULL);
9440   assert(wand->signature == WandSignature);
9441   if (IfMagickTrue(wand->debug))
9442     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9443   if (wand->images == (Image *) NULL)
9444     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9445   if (filename != (const char *) NULL)
9446     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9447   return(MagickTrue);
9448 }
9449 \f
9450 /*
9451 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9452 %                                                                             %
9453 %                                                                             %
9454 %                                                                             %
9455 %   M a g i c k S e t I m a g e F o r m a t                                   %
9456 %                                                                             %
9457 %                                                                             %
9458 %                                                                             %
9459 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9460 %
9461 %  MagickSetImageFormat() sets the format of a particular image in a
9462 %  sequence.
9463 %
9464 %  The format of the MagickSetImageFormat method is:
9465 %
9466 %      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9467 %        const char *format)
9468 %
9469 %  A description of each parameter follows:
9470 %
9471 %    o wand: the magick wand.
9472 %
9473 %    o format: the image format.
9474 %
9475 */
9476 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9477   const char *format)
9478 {
9479   const MagickInfo
9480     *magick_info;
9481
9482   assert(wand != (MagickWand *) NULL);
9483   assert(wand->signature == WandSignature);
9484   if (IfMagickTrue(wand->debug))
9485     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9486   if (wand->images == (Image *) NULL)
9487     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9488   if ((format == (char *) NULL) || (*format == '\0'))
9489     {
9490       *wand->images->magick='\0';
9491       return(MagickTrue);
9492     }
9493   magick_info=GetMagickInfo(format,wand->exception);
9494   if (magick_info == (const MagickInfo *) NULL)
9495     return(MagickFalse);
9496   ClearMagickException(wand->exception);
9497   (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9498   return(MagickTrue);
9499 }
9500 \f
9501 /*
9502 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9503 %                                                                             %
9504 %                                                                             %
9505 %                                                                             %
9506 %   M a g i c k S e t I m a g e F u z z                                       %
9507 %                                                                             %
9508 %                                                                             %
9509 %                                                                             %
9510 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9511 %
9512 %  MagickSetImageFuzz() sets the image fuzz.
9513 %
9514 %  The format of the MagickSetImageFuzz method is:
9515 %
9516 %      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9517 %        const double fuzz)
9518 %
9519 %  A description of each parameter follows:
9520 %
9521 %    o wand: the magick wand.
9522 %
9523 %    o fuzz: the image fuzz.
9524 %
9525 */
9526 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9527   const double fuzz)
9528 {
9529   assert(wand != (MagickWand *) NULL);
9530   assert(wand->signature == WandSignature);
9531   if (IfMagickTrue(wand->debug))
9532     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9533   if (wand->images == (Image *) NULL)
9534     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9535   wand->images->fuzz=fuzz;
9536   return(MagickTrue);
9537 }
9538 \f
9539 /*
9540 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9541 %                                                                             %
9542 %                                                                             %
9543 %                                                                             %
9544 %   M a g i c k S e t I m a g e G a m m a                                     %
9545 %                                                                             %
9546 %                                                                             %
9547 %                                                                             %
9548 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9549 %
9550 %  MagickSetImageGamma() sets the image gamma.
9551 %
9552 %  The format of the MagickSetImageGamma method is:
9553 %
9554 %      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9555 %        const double gamma)
9556 %
9557 %  A description of each parameter follows:
9558 %
9559 %    o wand: the magick wand.
9560 %
9561 %    o gamma: the image gamma.
9562 %
9563 */
9564 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9565   const double gamma)
9566 {
9567   assert(wand != (MagickWand *) NULL);
9568   assert(wand->signature == WandSignature);
9569   if (IfMagickTrue(wand->debug))
9570     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9571   if (wand->images == (Image *) NULL)
9572     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9573   wand->images->gamma=gamma;
9574   return(MagickTrue);
9575 }
9576 \f
9577 /*
9578 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9579 %                                                                             %
9580 %                                                                             %
9581 %                                                                             %
9582 %   M a g i c k S e t I m a g e G r a v i t y                                 %
9583 %                                                                             %
9584 %                                                                             %
9585 %                                                                             %
9586 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9587 %
9588 %  MagickSetImageGravity() sets the image gravity type.
9589 %
9590 %  The format of the MagickSetImageGravity method is:
9591 %
9592 %      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9593 %        const GravityType gravity)
9594 %
9595 %  A description of each parameter follows:
9596 %
9597 %    o wand: the magick wand.
9598 %
9599 %    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9600 %      PlaneInterlace, PartitionInterlace.
9601 %
9602 */
9603 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9604   const GravityType gravity)
9605 {
9606   assert(wand != (MagickWand *) NULL);
9607   assert(wand->signature == WandSignature);
9608   if (IfMagickTrue(wand->debug))
9609     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9610   if (wand->images == (Image *) NULL)
9611     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9612   wand->images->gravity=gravity;
9613   return(MagickTrue);
9614 }
9615 \f
9616 /*
9617 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9618 %                                                                             %
9619 %                                                                             %
9620 %                                                                             %
9621 %   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                       %
9622 %                                                                             %
9623 %                                                                             %
9624 %                                                                             %
9625 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9626 %
9627 %  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9628 %  point.
9629 %
9630 %  The format of the MagickSetImageGreenPrimary method is:
9631 %
9632 %      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9633 %        const double x,const double y)
9634 %
9635 %  A description of each parameter follows:
9636 %
9637 %    o wand: the magick wand.
9638 %
9639 %    o x: the green primary x-point.
9640 %
9641 %    o y: the green primary y-point.
9642 %
9643 %
9644 */
9645 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9646   const double x,const double y)
9647 {
9648   assert(wand != (MagickWand *) NULL);
9649   assert(wand->signature == WandSignature);
9650   if (IfMagickTrue(wand->debug))
9651     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9652   if (wand->images == (Image *) NULL)
9653     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9654   wand->images->chromaticity.green_primary.x=x;
9655   wand->images->chromaticity.green_primary.y=y;
9656   return(MagickTrue);
9657 }
9658 \f
9659 /*
9660 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9661 %                                                                             %
9662 %                                                                             %
9663 %                                                                             %
9664 %   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                 %
9665 %                                                                             %
9666 %                                                                             %
9667 %                                                                             %
9668 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9669 %
9670 %  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9671 %
9672 %  The format of the MagickSetImageInterlaceScheme method is:
9673 %
9674 %      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9675 %        const InterlaceType interlace)
9676 %
9677 %  A description of each parameter follows:
9678 %
9679 %    o wand: the magick wand.
9680 %
9681 %    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9682 %      PlaneInterlace, PartitionInterlace.
9683 %
9684 */
9685 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9686   const InterlaceType interlace)
9687 {
9688   assert(wand != (MagickWand *) NULL);
9689   assert(wand->signature == WandSignature);
9690   if (IfMagickTrue(wand->debug))
9691     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9692   if (wand->images == (Image *) NULL)
9693     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9694   wand->images->interlace=interlace;
9695   return(MagickTrue);
9696 }
9697 \f
9698 /*
9699 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9700 %                                                                             %
9701 %                                                                             %
9702 %                                                                             %
9703 %   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             %
9704 %                                                                             %
9705 %                                                                             %
9706 %                                                                             %
9707 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9708 %
9709 %  MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel
9710 %  method.
9711 %
9712 %  The format of the MagickSetImagePixelInterpolateMethod method is:
9713 %
9714 %      MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9715 %        const PixelInterpolateMethod method)
9716 %
9717 %  A description of each parameter follows:
9718 %
9719 %    o wand: the magick wand.
9720 %
9721 %    o method: the image interpole pixel methods: choose from Undefined,
9722 %      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9723 %
9724 */
9725 WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(
9726   MagickWand *wand,const PixelInterpolateMethod method)
9727 {
9728   assert(wand != (MagickWand *) NULL);
9729   assert(wand->signature == WandSignature);
9730   if (IfMagickTrue(wand->debug))
9731     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9732   if (wand->images == (Image *) NULL)
9733     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9734   wand->images->interpolate=method;
9735   return(MagickTrue);
9736 }
9737 \f
9738 /*
9739 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9740 %                                                                             %
9741 %                                                                             %
9742 %                                                                             %
9743 %   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9744 %                                                                             %
9745 %                                                                             %
9746 %                                                                             %
9747 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9748 %
9749 %  MagickSetImageIterations() sets the image iterations.
9750 %
9751 %  The format of the MagickSetImageIterations method is:
9752 %
9753 %      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9754 %        const size_t iterations)
9755 %
9756 %  A description of each parameter follows:
9757 %
9758 %    o wand: the magick wand.
9759 %
9760 %    o delay: the image delay in 1/100th of a second.
9761 %
9762 */
9763 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9764   const size_t iterations)
9765 {
9766   assert(wand != (MagickWand *) NULL);
9767   assert(wand->signature == WandSignature);
9768   if (IfMagickTrue(wand->debug))
9769     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9770   if (wand->images == (Image *) NULL)
9771     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9772   wand->images->iterations=iterations;
9773   return(MagickTrue);
9774 }
9775 \f
9776 /*
9777 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9778 %                                                                             %
9779 %                                                                             %
9780 %                                                                             %
9781 %   M a g i c k S e t I m a g e M a t t e                                     %
9782 %                                                                             %
9783 %                                                                             %
9784 %                                                                             %
9785 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9786 %
9787 %  MagickSetImageMatte() sets the image matte channel.
9788 %
9789 %  The format of the MagickSetImageMatteColor method is:
9790 %
9791 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9792 %        const MagickBooleanType *matte)
9793 %
9794 %  A description of each parameter follows:
9795 %
9796 %    o wand: the magick wand.
9797 %
9798 %    o matte: Set to MagickTrue to enable the image matte channel otherwise
9799 %      MagickFalse.
9800 %
9801 */
9802 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9803   const MagickBooleanType matte)
9804 {
9805   assert(wand != (MagickWand *) NULL);
9806   assert(wand->signature == WandSignature);
9807   if (IfMagickTrue(wand->debug))
9808     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9809   if (wand->images == (Image *) NULL)
9810     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9811   if ((wand->images->alpha_trait != BlendPixelTrait) && IsMagickTrue(matte))
9812     (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
9813   wand->images->alpha_trait=matte != MagickFalse ? BlendPixelTrait :
9814     UndefinedPixelTrait;
9815   return(MagickTrue);
9816 }
9817 \f
9818 /*
9819 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9820 %                                                                             %
9821 %                                                                             %
9822 %                                                                             %
9823 %   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9824 %                                                                             %
9825 %                                                                             %
9826 %                                                                             %
9827 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9828 %
9829 %  MagickSetImageMatteColor() sets the image matte color.
9830 %
9831 %  The format of the MagickSetImageMatteColor method is:
9832 %
9833 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9834 %        const PixelWand *matte)
9835 %
9836 %  A description of each parameter follows:
9837 %
9838 %    o wand: the magick wand.
9839 %
9840 %    o matte: the matte pixel wand.
9841 %
9842 */
9843 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9844   const PixelWand *matte)
9845 {
9846   assert(wand != (MagickWand *) NULL);
9847   assert(wand->signature == WandSignature);
9848   if (IfMagickTrue(wand->debug))
9849     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9850   if (wand->images == (Image *) NULL)
9851     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9852   PixelGetQuantumPacket(matte,&wand->images->matte_color);
9853   return(MagickTrue);
9854 }
9855 \f
9856 /*
9857 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9858 %                                                                             %
9859 %                                                                             %
9860 %                                                                             %
9861 %   M a g i c k S e t I m a g e O p a c i t y                                 %
9862 %                                                                             %
9863 %                                                                             %
9864 %                                                                             %
9865 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9866 %
9867 %  MagickSetImageAlpha() sets the image to the specified alpha level.
9868 %
9869 %  The format of the MagickSetImageAlpha method is:
9870 %
9871 %      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9872 %        const double alpha)
9873 %
9874 %  A description of each parameter follows:
9875 %
9876 %    o wand: the magick wand.
9877 %
9878 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9879 %      transparent.
9880 %
9881 */
9882 WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9883   const double alpha)
9884 {
9885   MagickBooleanType
9886     status;
9887
9888   assert(wand != (MagickWand *) NULL);
9889   assert(wand->signature == WandSignature);
9890   if (IfMagickTrue(wand->debug))
9891     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9892   if (wand->images == (Image *) NULL)
9893     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9894   status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
9895     wand->exception);
9896   return(status);
9897 }
9898 \f
9899 /*
9900 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9901 %                                                                             %
9902 %                                                                             %
9903 %                                                                             %
9904 %   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                         %
9905 %                                                                             %
9906 %                                                                             %
9907 %                                                                             %
9908 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9909 %
9910 %  MagickSetImageOrientation() sets the image orientation.
9911 %
9912 %  The format of the MagickSetImageOrientation method is:
9913 %
9914 %      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9915 %        const OrientationType orientation)
9916 %
9917 %  A description of each parameter follows:
9918 %
9919 %    o wand: the magick wand.
9920 %
9921 %    o orientation: the image orientation type.
9922 %
9923 */
9924 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9925   const OrientationType orientation)
9926 {
9927   assert(wand != (MagickWand *) NULL);
9928   assert(wand->signature == WandSignature);
9929   if (IfMagickTrue(wand->debug))
9930     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9931   if (wand->images == (Image *) NULL)
9932     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9933   wand->images->orientation=orientation;
9934   return(MagickTrue);
9935 }
9936 \f
9937 /*
9938 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9939 %                                                                             %
9940 %                                                                             %
9941 %                                                                             %
9942 %   M a g i c k S e t I m a g e P a g e                                       %
9943 %                                                                             %
9944 %                                                                             %
9945 %                                                                             %
9946 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9947 %
9948 %  MagickSetImagePage() sets the page geometry of the image.
9949 %
9950 %  The format of the MagickSetImagePage method is:
9951 %
9952 %      MagickBooleanType MagickSetImagePage(MagickWand *wand,const size_t width,%        const size_t height,const ssize_t x,const ssize_t y)
9953 %
9954 %  A description of each parameter follows:
9955 %
9956 %    o wand: the magick wand.
9957 %
9958 %    o width: the page width.
9959 %
9960 %    o height: the page height.
9961 %
9962 %    o x: the page x-offset.
9963 %
9964 %    o y: the page y-offset.
9965 %
9966 */
9967 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
9968   const size_t width,const size_t height,const ssize_t x,
9969   const ssize_t y)
9970 {
9971   assert(wand != (MagickWand *) NULL);
9972   assert(wand->signature == WandSignature);
9973   if (IfMagickTrue(wand->debug))
9974     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9975   if (wand->images == (Image *) NULL)
9976     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9977   wand->images->page.width=width;
9978   wand->images->page.height=height;
9979   wand->images->page.x=x;
9980   wand->images->page.y=y;
9981   return(MagickTrue);
9982 }
9983 \f
9984 /*
9985 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9986 %                                                                             %
9987 %                                                                             %
9988 %                                                                             %
9989 %   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                 %
9990 %                                                                             %
9991 %                                                                             %
9992 %                                                                             %
9993 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9994 %
9995 %  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
9996 %  specified method and returns the previous progress monitor if any.  The
9997 %  progress monitor method looks like this:
9998 %
9999 %    MagickBooleanType MagickProgressMonitor(const char *text,
10000 %      const MagickOffsetType offset,const MagickSizeType span,
10001 %      void *client_data)
10002 %
10003 %  If the progress monitor returns MagickFalse, the current operation is
10004 %  interrupted.
10005 %
10006 %  The format of the MagickSetImageProgressMonitor method is:
10007 %
10008 %      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10009 %        const MagickProgressMonitor progress_monitor,void *client_data)
10010 %
10011 %  A description of each parameter follows:
10012 %
10013 %    o wand: the magick wand.
10014 %
10015 %    o progress_monitor: Specifies a pointer to a method to monitor progress
10016 %      of an image operation.
10017 %
10018 %    o client_data: Specifies a pointer to any client data.
10019 %
10020 */
10021 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10022   const MagickProgressMonitor progress_monitor,void *client_data)
10023 {
10024   MagickProgressMonitor
10025     previous_monitor;
10026
10027   assert(wand != (MagickWand *) NULL);
10028   assert(wand->signature == WandSignature);
10029   if (IfMagickTrue(wand->debug))
10030     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10031   if (wand->images == (Image *) NULL)
10032     {
10033       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10034         "ContainsNoImages","`%s'",wand->name);
10035       return((MagickProgressMonitor) NULL);
10036     }
10037   previous_monitor=SetImageProgressMonitor(wand->images,
10038     progress_monitor,client_data);
10039   return(previous_monitor);
10040 }
10041 \f
10042 /*
10043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10044 %                                                                             %
10045 %                                                                             %
10046 %                                                                             %
10047 %   M a g i c k S e t I m a g e R e d P r i m a r y                           %
10048 %                                                                             %
10049 %                                                                             %
10050 %                                                                             %
10051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10052 %
10053 %  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10054 %
10055 %  The format of the MagickSetImageRedPrimary method is:
10056 %
10057 %      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10058 %        const double x,const double y)
10059 %
10060 %  A description of each parameter follows:
10061 %
10062 %    o wand: the magick wand.
10063 %
10064 %    o x: the red primary x-point.
10065 %
10066 %    o y: the red primary y-point.
10067 %
10068 */
10069 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10070   const double x,const double y)
10071 {
10072   assert(wand != (MagickWand *) NULL);
10073   assert(wand->signature == WandSignature);
10074   if (IfMagickTrue(wand->debug))
10075     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10076   if (wand->images == (Image *) NULL)
10077     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10078   wand->images->chromaticity.red_primary.x=x;
10079   wand->images->chromaticity.red_primary.y=y;
10080   return(MagickTrue);
10081 }
10082 \f
10083 /*
10084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10085 %                                                                             %
10086 %                                                                             %
10087 %                                                                             %
10088 %   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                 %
10089 %                                                                             %
10090 %                                                                             %
10091 %                                                                             %
10092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10093 %
10094 %  MagickSetImageRenderingIntent() sets the image rendering intent.
10095 %
10096 %  The format of the MagickSetImageRenderingIntent method is:
10097 %
10098 %      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10099 %        const RenderingIntent rendering_intent)
10100 %
10101 %  A description of each parameter follows:
10102 %
10103 %    o wand: the magick wand.
10104 %
10105 %    o rendering_intent: the image rendering intent: UndefinedIntent,
10106 %      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10107 %
10108 */
10109 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10110   const RenderingIntent rendering_intent)
10111 {
10112   assert(wand != (MagickWand *) NULL);
10113   assert(wand->signature == WandSignature);
10114   if (IfMagickTrue(wand->debug))
10115     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10116   if (wand->images == (Image *) NULL)
10117     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10118   wand->images->rendering_intent=rendering_intent;
10119   return(MagickTrue);
10120 }
10121 \f
10122 /*
10123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10124 %                                                                             %
10125 %                                                                             %
10126 %                                                                             %
10127 %   M a g i c k S e t I m a g e R e s o l u t i o n                           %
10128 %                                                                             %
10129 %                                                                             %
10130 %                                                                             %
10131 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10132 %
10133 %  MagickSetImageResolution() sets the image resolution.
10134 %
10135 %  The format of the MagickSetImageResolution method is:
10136 %
10137 %      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10138 %        const double x_resolution,const double y_resolution)
10139 %
10140 %  A description of each parameter follows:
10141 %
10142 %    o wand: the magick wand.
10143 %
10144 %    o x_resolution: the image x resolution.
10145 %
10146 %    o y_resolution: the image y resolution.
10147 %
10148 */
10149 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10150   const double x_resolution,const double y_resolution)
10151 {
10152   assert(wand != (MagickWand *) NULL);
10153   assert(wand->signature == WandSignature);
10154   if (IfMagickTrue(wand->debug))
10155     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10156   if (wand->images == (Image *) NULL)
10157     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10158   wand->images->resolution.x=x_resolution;
10159   wand->images->resolution.y=y_resolution;
10160   return(MagickTrue);
10161 }
10162 \f
10163 /*
10164 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10165 %                                                                             %
10166 %                                                                             %
10167 %                                                                             %
10168 %   M a g i c k S e t I m a g e S c e n e                                     %
10169 %                                                                             %
10170 %                                                                             %
10171 %                                                                             %
10172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10173 %
10174 %  MagickSetImageScene() sets the image scene.
10175 %
10176 %  The format of the MagickSetImageScene method is:
10177 %
10178 %      MagickBooleanType MagickSetImageScene(MagickWand *wand,
10179 %        const size_t scene)
10180 %
10181 %  A description of each parameter follows:
10182 %
10183 %    o wand: the magick wand.
10184 %
10185 %    o delay: the image scene number.
10186 %
10187 */
10188 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
10189   const size_t scene)
10190 {
10191   assert(wand != (MagickWand *) NULL);
10192   assert(wand->signature == WandSignature);
10193   if (IfMagickTrue(wand->debug))
10194     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10195   if (wand->images == (Image *) NULL)
10196     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10197   wand->images->scene=scene;
10198   return(MagickTrue);
10199 }
10200 \f
10201 /*
10202 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10203 %                                                                             %
10204 %                                                                             %
10205 %                                                                             %
10206 %   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                   %
10207 %                                                                             %
10208 %                                                                             %
10209 %                                                                             %
10210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10211 %
10212 %  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10213 %
10214 %  The format of the MagickSetImageTicksPerSecond method is:
10215 %
10216 %      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10217 %        const ssize_t ticks_per-second)
10218 %
10219 %  A description of each parameter follows:
10220 %
10221 %    o wand: the magick wand.
10222 %
10223 %    o ticks_per_second: the units to use for the image delay.
10224 %
10225 */
10226 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10227   const ssize_t ticks_per_second)
10228 {
10229   assert(wand != (MagickWand *) NULL);
10230   assert(wand->signature == WandSignature);
10231   if (IfMagickTrue(wand->debug))
10232     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10233   if (wand->images == (Image *) NULL)
10234     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10235   wand->images->ticks_per_second=ticks_per_second;
10236   return(MagickTrue);
10237 }
10238 \f
10239 /*
10240 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10241 %                                                                             %
10242 %                                                                             %
10243 %                                                                             %
10244 %   M a g i c k S e t I m a g e T y p e                                       %
10245 %                                                                             %
10246 %                                                                             %
10247 %                                                                             %
10248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10249 %
10250 %  MagickSetImageType() sets the image type.
10251 %
10252 %  The format of the MagickSetImageType method is:
10253 %
10254 %      MagickBooleanType MagickSetImageType(MagickWand *wand,
10255 %        const ImageType image_type)
10256 %
10257 %  A description of each parameter follows:
10258 %
10259 %    o wand: the magick wand.
10260 %
10261 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10262 %      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10263 %      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10264 %      or OptimizeType.
10265 %
10266 */
10267 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10268   const ImageType image_type)
10269 {
10270   assert(wand != (MagickWand *) NULL);
10271   assert(wand->signature == WandSignature);
10272   if (IfMagickTrue(wand->debug))
10273     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10274   if (wand->images == (Image *) NULL)
10275     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10276   return(SetImageType(wand->images,image_type,wand->exception));
10277 }
10278 \f
10279 /*
10280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10281 %                                                                             %
10282 %                                                                             %
10283 %                                                                             %
10284 %   M a g i c k S e t I m a g e U n i t s                                     %
10285 %                                                                             %
10286 %                                                                             %
10287 %                                                                             %
10288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10289 %
10290 %  MagickSetImageUnits() sets the image units of resolution.
10291 %
10292 %  The format of the MagickSetImageUnits method is:
10293 %
10294 %      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10295 %        const ResolutionType units)
10296 %
10297 %  A description of each parameter follows:
10298 %
10299 %    o wand: the magick wand.
10300 %
10301 %    o units: the image units of resolution : UndefinedResolution,
10302 %      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10303 %
10304 */
10305 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10306   const ResolutionType units)
10307 {
10308   assert(wand != (MagickWand *) NULL);
10309   assert(wand->signature == WandSignature);
10310   if (IfMagickTrue(wand->debug))
10311     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10312   if (wand->images == (Image *) NULL)
10313     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10314   wand->images->units=units;
10315   return(MagickTrue);
10316 }
10317 \f
10318 /*
10319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10320 %                                                                             %
10321 %                                                                             %
10322 %                                                                             %
10323 %   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           %
10324 %                                                                             %
10325 %                                                                             %
10326 %                                                                             %
10327 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10328 %
10329 %  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10330 %
10331 %  The format of the MagickSetImageVirtualPixelMethod method is:
10332 %
10333 %      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10334 %        const VirtualPixelMethod method)
10335 %
10336 %  A description of each parameter follows:
10337 %
10338 %    o wand: the magick wand.
10339 %
10340 %    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10341 %      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10342 %      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10343 %
10344 */
10345 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10346   const VirtualPixelMethod method)
10347 {
10348   assert(wand != (MagickWand *) NULL);
10349   assert(wand->signature == WandSignature);
10350   if (IfMagickTrue(wand->debug))
10351     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10352   if (wand->images == (Image *) NULL)
10353     return(UndefinedVirtualPixelMethod);
10354   return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
10355 }
10356 \f
10357 /*
10358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10359 %                                                                             %
10360 %                                                                             %
10361 %                                                                             %
10362 %   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10363 %                                                                             %
10364 %                                                                             %
10365 %                                                                             %
10366 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10367 %
10368 %  MagickSetImageWhitePoint() sets the image chromaticity white point.
10369 %
10370 %  The format of the MagickSetImageWhitePoint method is:
10371 %
10372 %      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10373 %        const double x,const double y)
10374 %
10375 %  A description of each parameter follows:
10376 %
10377 %    o wand: the magick wand.
10378 %
10379 %    o x: the white x-point.
10380 %
10381 %    o y: the white y-point.
10382 %
10383 */
10384 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10385   const double x,const double y)
10386 {
10387   assert(wand != (MagickWand *) NULL);
10388   assert(wand->signature == WandSignature);
10389   if (IfMagickTrue(wand->debug))
10390     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10391   if (wand->images == (Image *) NULL)
10392     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10393   wand->images->chromaticity.white_point.x=x;
10394   wand->images->chromaticity.white_point.y=y;
10395   return(MagickTrue);
10396 }
10397 \f
10398 /*
10399 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10400 %                                                                             %
10401 %                                                                             %
10402 %                                                                             %
10403 %   M a g i c k S h a d e I m a g e C h a n n e l                             %
10404 %                                                                             %
10405 %                                                                             %
10406 %                                                                             %
10407 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10408 %
10409 %  MagickShadeImage() shines a distant light on an image to create a
10410 %  three-dimensional effect. You control the positioning of the light with
10411 %  azimuth and elevation; azimuth is measured in degrees off the x axis
10412 %  and elevation is measured in pixels above the Z axis.
10413 %
10414 %  The format of the MagickShadeImage method is:
10415 %
10416 %      MagickBooleanType MagickShadeImage(MagickWand *wand,
10417 %        const MagickBooleanType gray,const double azimuth,
10418 %        const double elevation)
10419 %
10420 %  A description of each parameter follows:
10421 %
10422 %    o wand: the magick wand.
10423 %
10424 %    o gray: A value other than zero shades the intensity of each pixel.
10425 %
10426 %    o azimuth, elevation:  Define the light source direction.
10427 %
10428 */
10429 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10430   const MagickBooleanType gray,const double asimuth,const double elevation)
10431 {
10432   Image
10433     *shade_image;
10434
10435   assert(wand != (MagickWand *) NULL);
10436   assert(wand->signature == WandSignature);
10437   if (IfMagickTrue(wand->debug))
10438     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10439   if (wand->images == (Image *) NULL)
10440     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10441   shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10442   if (shade_image == (Image *) NULL)
10443     return(MagickFalse);
10444   ReplaceImageInList(&wand->images,shade_image);
10445   return(MagickTrue);
10446 }
10447 \f
10448 /*
10449 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10450 %                                                                             %
10451 %                                                                             %
10452 %                                                                             %
10453 %   M a g i c k S h a d o w I m a g e                                         %
10454 %                                                                             %
10455 %                                                                             %
10456 %                                                                             %
10457 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10458 %
10459 %  MagickShadowImage() simulates an image shadow.
10460 %
10461 %  The format of the MagickShadowImage method is:
10462 %
10463 %      MagickBooleanType MagickShadowImage(MagickWand *wand,const double alpha,
10464 %        const double sigma,const ssize_t x,const ssize_t y)
10465 %
10466 %  A description of each parameter follows:
10467 %
10468 %    o wand: the magick wand.
10469 %
10470 %    o alpha: percentage transparency.
10471 %
10472 %    o sigma: the standard deviation of the Gaussian, in pixels.
10473 %
10474 %    o x: the shadow x-offset.
10475 %
10476 %    o y: the shadow y-offset.
10477 %
10478 */
10479 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10480   const double alpha,const double sigma,const ssize_t x,const ssize_t y)
10481 {
10482   Image
10483     *shadow_image;
10484
10485   assert(wand != (MagickWand *) NULL);
10486   assert(wand->signature == WandSignature);
10487   if (IfMagickTrue(wand->debug))
10488     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10489   if (wand->images == (Image *) NULL)
10490     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10491   shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
10492   if (shadow_image == (Image *) NULL)
10493     return(MagickFalse);
10494   ReplaceImageInList(&wand->images,shadow_image);
10495   return(MagickTrue);
10496 }
10497 \f
10498 /*
10499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10500 %                                                                             %
10501 %                                                                             %
10502 %                                                                             %
10503 %   M a g i c k S h a r p e n I m a g e                                       %
10504 %                                                                             %
10505 %                                                                             %
10506 %                                                                             %
10507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10508 %
10509 %  MagickSharpenImage() sharpens an image.  We convolve the image with a
10510 %  Gaussian operator of the given radius and standard deviation (sigma).
10511 %  For reasonable results, the radius should be larger than sigma.  Use a
10512 %  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10513 %
10514 %  The format of the MagickSharpenImage method is:
10515 %
10516 %      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10517 %        const double radius,const double sigma)
10518 %
10519 %  A description of each parameter follows:
10520 %
10521 %    o wand: the magick wand.
10522 %
10523 %    o radius: the radius of the Gaussian, in pixels, not counting the center
10524 %      pixel.
10525 %
10526 %    o sigma: the standard deviation of the Gaussian, in pixels.
10527 %
10528 */
10529 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10530   const double radius,const double sigma)
10531 {
10532   Image
10533     *sharp_image;
10534
10535   assert(wand != (MagickWand *) NULL);
10536   assert(wand->signature == WandSignature);
10537   if (IfMagickTrue(wand->debug))
10538     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10539   if (wand->images == (Image *) NULL)
10540     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10541   sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
10542   if (sharp_image == (Image *) NULL)
10543     return(MagickFalse);
10544   ReplaceImageInList(&wand->images,sharp_image);
10545   return(MagickTrue);
10546 }
10547 \f
10548 /*
10549 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10550 %                                                                             %
10551 %                                                                             %
10552 %                                                                             %
10553 %   M a g i c k S h a v e I m a g e                                           %
10554 %                                                                             %
10555 %                                                                             %
10556 %                                                                             %
10557 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10558 %
10559 %  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10560 %  memory necessary for the new Image structure and returns a pointer to the
10561 %  new image.
10562 %
10563 %  The format of the MagickShaveImage method is:
10564 %
10565 %      MagickBooleanType MagickShaveImage(MagickWand *wand,
10566 %        const size_t columns,const size_t rows)
10567 %
10568 %  A description of each parameter follows:
10569 %
10570 %    o wand: the magick wand.
10571 %
10572 %    o columns: the number of columns in the scaled image.
10573 %
10574 %    o rows: the number of rows in the scaled image.
10575 %
10576 %
10577 */
10578 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10579   const size_t columns,const size_t rows)
10580 {
10581   Image
10582     *shave_image;
10583
10584   RectangleInfo
10585     shave_info;
10586
10587   assert(wand != (MagickWand *) NULL);
10588   assert(wand->signature == WandSignature);
10589   if (IfMagickTrue(wand->debug))
10590     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10591   if (wand->images == (Image *) NULL)
10592     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10593   shave_info.width=columns;
10594   shave_info.height=rows;
10595   shave_info.x=0;
10596   shave_info.y=0;
10597   shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10598   if (shave_image == (Image *) NULL)
10599     return(MagickFalse);
10600   ReplaceImageInList(&wand->images,shave_image);
10601   return(MagickTrue);
10602 }
10603 \f
10604 /*
10605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10606 %                                                                             %
10607 %                                                                             %
10608 %                                                                             %
10609 %   M a g i c k S h e a r I m a g e                                           %
10610 %                                                                             %
10611 %                                                                             %
10612 %                                                                             %
10613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10614 %
10615 %  MagickShearImage() slides one edge of an image along the X or Y axis,
10616 %  creating a parallelogram.  An X direction shear slides an edge along the X
10617 %  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10618 %  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10619 %  is measured relative to the Y axis, and similarly, for Y direction shears
10620 %  y_shear is measured relative to the X axis.  Empty triangles left over from
10621 %  shearing the image are filled with the background color.
10622 %
10623 %  The format of the MagickShearImage method is:
10624 %
10625 %      MagickBooleanType MagickShearImage(MagickWand *wand,
10626 %        const PixelWand *background,const double x_shear,const double y_shear)
10627 %
10628 %  A description of each parameter follows:
10629 %
10630 %    o wand: the magick wand.
10631 %
10632 %    o background: the background pixel wand.
10633 %
10634 %    o x_shear: the number of degrees to shear the image.
10635 %
10636 %    o y_shear: the number of degrees to shear the image.
10637 %
10638 */
10639 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10640   const PixelWand *background,const double x_shear,const double y_shear)
10641 {
10642   Image
10643     *shear_image;
10644
10645   assert(wand != (MagickWand *) NULL);
10646   assert(wand->signature == WandSignature);
10647   if (IfMagickTrue(wand->debug))
10648     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10649   if (wand->images == (Image *) NULL)
10650     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10651   PixelGetQuantumPacket(background,&wand->images->background_color);
10652   shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10653   if (shear_image == (Image *) NULL)
10654     return(MagickFalse);
10655   ReplaceImageInList(&wand->images,shear_image);
10656   return(MagickTrue);
10657 }
10658 \f
10659 /*
10660 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10661 %                                                                             %
10662 %                                                                             %
10663 %                                                                             %
10664 %   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                   %
10665 %                                                                             %
10666 %                                                                             %
10667 %                                                                             %
10668 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10669 %
10670 %  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10671 %  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10672 %  image using a sigmoidal transfer function without saturating highlights or
10673 %  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10674 %  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10675 %  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10676 %  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10677 %  is reduced.
10678 %
10679 %  The format of the MagickSigmoidalContrastImage method is:
10680 %
10681 %      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10682 %        const MagickBooleanType sharpen,const double alpha,const double beta)
10683 %
10684 %  A description of each parameter follows:
10685 %
10686 %    o wand: the magick wand.
10687 %
10688 %    o sharpen: Increase or decrease image contrast.
10689 %
10690 %    o alpha: strength of the contrast, the larger the number the more
10691 %      'threshold-like' it becomes.
10692 %
10693 %    o beta: midpoint of the function as a color value 0 to QuantumRange.
10694 %
10695 */
10696 WandExport MagickBooleanType MagickSigmoidalContrastImage(
10697   MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10698   const double beta)
10699 {
10700   MagickBooleanType
10701     status;
10702
10703   assert(wand != (MagickWand *) NULL);
10704   assert(wand->signature == WandSignature);
10705   if (IfMagickTrue(wand->debug))
10706     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10707   if (wand->images == (Image *) NULL)
10708     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10709   status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10710     wand->exception);
10711   return(status);
10712 }
10713 \f
10714 /*
10715 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10716 %                                                                             %
10717 %                                                                             %
10718 %                                                                             %
10719 %   M a g i c k S i m i l a r i t y I m a g e                                 %
10720 %                                                                             %
10721 %                                                                             %
10722 %                                                                             %
10723 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10724 %
10725 %  MagickSimilarityImage() compares the reference image of the image and
10726 %  returns the best match offset.  In addition, it returns a similarity image
10727 %  such that an exact match location is completely white and if none of the
10728 %  pixels match, black, otherwise some gray level in-between.
10729 %
10730 %  The format of the MagickSimilarityImage method is:
10731 %
10732 %      MagickWand *MagickSimilarityImage(MagickWand *wand,
10733 %        const MagickWand *reference,const MetricType metric,
10734 %        const double similarity_threshold,RectangeInfo *offset,
10735 %        double *similarity)
10736 %
10737 %  A description of each parameter follows:
10738 %
10739 %    o wand: the magick wand.
10740 %
10741 %    o reference: the reference wand.
10742 %
10743 %    o metric: the metric.
10744 %
10745 %    o similarity_threshold: minimum distortion for (sub)image match.
10746 %
10747 %    o offset: the best match offset of the reference image within the image.
10748 %
10749 %    o similarity: the computed similarity between the images.
10750 %
10751 */
10752 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10753   const MagickWand *reference,const MetricType metric,
10754   const double similarity_threshold,RectangleInfo *offset,double *similarity)
10755 {
10756   Image
10757     *similarity_image;
10758
10759   assert(wand != (MagickWand *) NULL);
10760   assert(wand->signature == WandSignature);
10761   if (IfMagickTrue(wand->debug))
10762     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10763   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10764     {
10765       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10766         "ContainsNoImages","`%s'",wand->name);
10767       return((MagickWand *) NULL);
10768     }
10769   similarity_image=SimilarityImage(wand->images,reference->images,metric,
10770     similarity_threshold,offset,similarity,wand->exception);
10771   if (similarity_image == (Image *) NULL)
10772     return((MagickWand *) NULL);
10773   return(CloneMagickWandFromImages(wand,similarity_image));
10774 }
10775 \f
10776 /*
10777 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10778 %                                                                             %
10779 %                                                                             %
10780 %                                                                             %
10781 %   M a g i c k S k e t c h I m a g e                                         %
10782 %                                                                             %
10783 %                                                                             %
10784 %                                                                             %
10785 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10786 %
10787 %  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10788 %  a Gaussian operator of the given radius and standard deviation (sigma).
10789 %  For reasonable results, radius should be larger than sigma.  Use a
10790 %  radius of 0 and SketchImage() selects a suitable radius for you.
10791 %  Angle gives the angle of the blurring motion.
10792 %
10793 %  The format of the MagickSketchImage method is:
10794 %
10795 %      MagickBooleanType MagickSketchImage(MagickWand *wand,
10796 %        const double radius,const double sigma,const double angle)
10797 %
10798 %  A description of each parameter follows:
10799 %
10800 %    o wand: the magick wand.
10801 %
10802 %    o radius: the radius of the Gaussian, in pixels, not counting
10803 %      the center pixel.
10804 %
10805 %    o sigma: the standard deviation of the Gaussian, in pixels.
10806 %
10807 %    o angle: apply the effect along this angle.
10808 %
10809 */
10810 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10811   const double radius,const double sigma,const double angle)
10812 {
10813   Image
10814     *sketch_image;
10815
10816   assert(wand != (MagickWand *) NULL);
10817   assert(wand->signature == WandSignature);
10818   if (IfMagickTrue(wand->debug))
10819     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10820   if (wand->images == (Image *) NULL)
10821     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10822   sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
10823   if (sketch_image == (Image *) NULL)
10824     return(MagickFalse);
10825   ReplaceImageInList(&wand->images,sketch_image);
10826   return(MagickTrue);
10827 }
10828 \f
10829 /*
10830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10831 %                                                                             %
10832 %                                                                             %
10833 %                                                                             %
10834 %   M a g i c k S m u s h I m a g e s                                         %
10835 %                                                                             %
10836 %                                                                             %
10837 %                                                                             %
10838 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10839 %
10840 %  MagickSmushImages() takes all images from the current image pointer to the
10841 %  end of the image list and smushs them to each other top-to-bottom if the
10842 %  stack parameter is true, otherwise left-to-right.
10843 %
10844 %  The format of the MagickSmushImages method is:
10845 %
10846 %      MagickWand *MagickSmushImages(MagickWand *wand,
10847 %        const MagickBooleanType stack,const ssize_t offset)
10848 %
10849 %  A description of each parameter follows:
10850 %
10851 %    o wand: the magick wand.
10852 %
10853 %    o stack: By default, images are stacked left-to-right. Set stack to
10854 %      MagickTrue to stack them top-to-bottom.
10855 %
10856 %    o offset: minimum distance in pixels between images.
10857 %
10858 */
10859 WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10860   const MagickBooleanType stack,const ssize_t offset)
10861 {
10862   Image
10863     *smush_image;
10864
10865   assert(wand != (MagickWand *) NULL);
10866   assert(wand->signature == WandSignature);
10867   if (IfMagickTrue(wand->debug))
10868     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10869   if (wand->images == (Image *) NULL)
10870     return((MagickWand *) NULL);
10871   smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10872   if (smush_image == (Image *) NULL)
10873     return((MagickWand *) NULL);
10874   return(CloneMagickWandFromImages(wand,smush_image));
10875 }
10876 \f
10877 /*
10878 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10879 %                                                                             %
10880 %                                                                             %
10881 %                                                                             %
10882 %     M a g i c k S o l a r i z e I m a g e                                   %
10883 %                                                                             %
10884 %                                                                             %
10885 %                                                                             %
10886 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10887 %
10888 %  MagickSolarizeImage() applies a special effect to the image, similar to the
10889 %  effect achieved in a photo darkroom by selectively exposing areas of photo
10890 %  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
10891 %  measure of the extent of the solarization.
10892 %
10893 %  The format of the MagickSolarizeImage method is:
10894 %
10895 %      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10896 %        const double threshold)
10897 %
10898 %  A description of each parameter follows:
10899 %
10900 %    o wand: the magick wand.
10901 %
10902 %    o threshold:  Define the extent of the solarization.
10903 %
10904 */
10905 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10906   const double threshold)
10907 {
10908   MagickBooleanType
10909     status;
10910
10911   assert(wand != (MagickWand *) NULL);
10912   assert(wand->signature == WandSignature);
10913   if (IfMagickTrue(wand->debug))
10914     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10915   if (wand->images == (Image *) NULL)
10916     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10917   status=SolarizeImage(wand->images,threshold,wand->exception);
10918   return(status);
10919 }
10920 \f
10921 /*
10922 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10923 %                                                                             %
10924 %                                                                             %
10925 %                                                                             %
10926 %   M a g i c k S p a r s e C o l o r I m a g e                               %
10927 %                                                                             %
10928 %                                                                             %
10929 %                                                                             %
10930 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10931 %
10932 %  MagickSparseColorImage(), given a set of coordinates, interpolates the
10933 %  colors found at those coordinates, across the whole image, using various
10934 %  methods.
10935 %
10936 %  The format of the MagickSparseColorImage method is:
10937 %
10938 %      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10939 %        const SparseColorMethod method,const size_t number_arguments,
10940 %        const double *arguments)
10941 %
10942 %  A description of each parameter follows:
10943 %
10944 %    o image: the image to be sparseed.
10945 %
10946 %    o method: the method of image sparseion.
10947 %
10948 %        ArcSparseColorion will always ignore source image offset, and always
10949 %        'bestfit' the destination image with the top left corner offset
10950 %        relative to the polar mapping center.
10951 %
10952 %        Bilinear has no simple inverse mapping so will not allow 'bestfit'
10953 %        style of image sparseion.
10954 %
10955 %        Affine, Perspective, and Bilinear, will do least squares fitting of
10956 %        the distrotion when more than the minimum number of control point
10957 %        pairs are provided.
10958 %
10959 %        Perspective, and Bilinear, will fall back to a Affine sparseion when
10960 %        less than 4 control point pairs are provided. While Affine sparseions
10961 %        will let you use any number of control point pairs, that is Zero pairs
10962 %        is a No-Op (viewport only) distrotion, one pair is a translation and
10963 %        two pairs of control points will do a scale-rotate-translate, without
10964 %        any shearing.
10965 %
10966 %    o number_arguments: the number of arguments given for this sparseion
10967 %      method.
10968 %
10969 %    o arguments: the arguments for this sparseion method.
10970 %
10971 */
10972 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10973   const SparseColorMethod method,const size_t number_arguments,
10974   const double *arguments)
10975 {
10976   Image
10977     *sparse_image;
10978
10979   assert(wand != (MagickWand *) NULL);
10980   assert(wand->signature == WandSignature);
10981   if (IfMagickTrue(wand->debug))
10982     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10983   if (wand->images == (Image *) NULL)
10984     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10985   sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
10986     wand->exception);
10987   if (sparse_image == (Image *) NULL)
10988     return(MagickFalse);
10989   ReplaceImageInList(&wand->images,sparse_image);
10990   return(MagickTrue);
10991 }
10992 \f
10993 /*
10994 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10995 %                                                                             %
10996 %                                                                             %
10997 %                                                                             %
10998 %   M a g i c k S p l i c e I m a g e                                         %
10999 %                                                                             %
11000 %                                                                             %
11001 %                                                                             %
11002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11003 %
11004 %  MagickSpliceImage() splices a solid color into the image.
11005 %
11006 %  The format of the MagickSpliceImage method is:
11007 %
11008 %      MagickBooleanType MagickSpliceImage(MagickWand *wand,
11009 %        const size_t width,const size_t height,const ssize_t x,
11010 %        const ssize_t y)
11011 %
11012 %  A description of each parameter follows:
11013 %
11014 %    o wand: the magick wand.
11015 %
11016 %    o width: the region width.
11017 %
11018 %    o height: the region height.
11019 %
11020 %    o x: the region x offset.
11021 %
11022 %    o y: the region y offset.
11023 %
11024 */
11025 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
11026   const size_t width,const size_t height,const ssize_t x,
11027   const ssize_t y)
11028 {
11029   Image
11030     *splice_image;
11031
11032   RectangleInfo
11033     splice;
11034
11035   assert(wand != (MagickWand *) NULL);
11036   assert(wand->signature == WandSignature);
11037   if (IfMagickTrue(wand->debug))
11038     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11039   if (wand->images == (Image *) NULL)
11040     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11041   splice.width=width;
11042   splice.height=height;
11043   splice.x=x;
11044   splice.y=y;
11045   splice_image=SpliceImage(wand->images,&splice,wand->exception);
11046   if (splice_image == (Image *) NULL)
11047     return(MagickFalse);
11048   ReplaceImageInList(&wand->images,splice_image);
11049   return(MagickTrue);
11050 }
11051 \f
11052 /*
11053 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11054 %                                                                             %
11055 %                                                                             %
11056 %                                                                             %
11057 %   M a g i c k S p r e a d I m a g e                                         %
11058 %                                                                             %
11059 %                                                                             %
11060 %                                                                             %
11061 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11062 %
11063 %  MagickSpreadImage() is a special effects method that randomly displaces each
11064 %  pixel in a block defined by the radius parameter.
11065 %
11066 %  The format of the MagickSpreadImage method is:
11067 %
11068 %      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius,
11069 %        const PixelInterpolateMethod method)
11070 %
11071 %  A description of each parameter follows:
11072 %
11073 %    o wand: the magick wand.
11074 %
11075 %    o radius:  Choose a random pixel in a neighborhood of this extent.
11076 %
11077 %    o method: the pixel interpolation method.
11078 %
11079 */
11080 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11081   const double radius,const PixelInterpolateMethod method)
11082 {
11083   Image
11084     *spread_image;
11085
11086   assert(wand != (MagickWand *) NULL);
11087   assert(wand->signature == WandSignature);
11088   if (IfMagickTrue(wand->debug))
11089     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11090   if (wand->images == (Image *) NULL)
11091     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11092   spread_image=SpreadImage(wand->images,radius,method,wand->exception);
11093   if (spread_image == (Image *) NULL)
11094     return(MagickFalse);
11095   ReplaceImageInList(&wand->images,spread_image);
11096   return(MagickTrue);
11097 }
11098 \f
11099 /*
11100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11101 %                                                                             %
11102 %                                                                             %
11103 %                                                                             %
11104 %   M a g i c k S t a t i s t i c I m a g e                                   %
11105 %                                                                             %
11106 %                                                                             %
11107 %                                                                             %
11108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11109 %
11110 %  MagickStatisticImage() replace each pixel with corresponding statistic from
11111 %  the neighborhood of the specified width and height.
11112 %
11113 %  The format of the MagickStatisticImage method is:
11114 %
11115 %      MagickBooleanType MagickStatisticImage(MagickWand *wand,
11116 %        const StatisticType type,const double width,const size_t height)
11117 %
11118 %  A description of each parameter follows:
11119 %
11120 %    o wand: the magick wand.
11121 %
11122 %    o type: the statistic type (e.g. median, mode, etc.).
11123 %
11124 %    o width: the width of the pixel neighborhood.
11125 %
11126 %    o height: the height of the pixel neighborhood.
11127 %
11128 */
11129 WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
11130   const StatisticType type,const size_t width,const size_t height)
11131 {
11132   Image
11133     *statistic_image;
11134
11135   assert(wand != (MagickWand *) NULL);
11136   assert(wand->signature == WandSignature);
11137   if (IfMagickTrue(wand->debug))
11138     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11139   if (wand->images == (Image *) NULL)
11140     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11141   statistic_image=StatisticImage(wand->images,type,width,height,
11142     wand->exception);
11143   if (statistic_image == (Image *) NULL)
11144     return(MagickFalse);
11145   ReplaceImageInList(&wand->images,statistic_image);
11146   return(MagickTrue);
11147 }
11148 \f
11149 /*
11150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11151 %                                                                             %
11152 %                                                                             %
11153 %                                                                             %
11154 %   M a g i c k S t e g a n o I m a g e                                       %
11155 %                                                                             %
11156 %                                                                             %
11157 %                                                                             %
11158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11159 %
11160 %  MagickSteganoImage() hides a digital watermark within the image.
11161 %  Recover the hidden watermark later to prove that the authenticity of
11162 %  an image.  Offset defines the start position within the image to hide
11163 %  the watermark.
11164 %
11165 %  The format of the MagickSteganoImage method is:
11166 %
11167 %      MagickWand *MagickSteganoImage(MagickWand *wand,
11168 %        const MagickWand *watermark_wand,const ssize_t offset)
11169 %
11170 %  A description of each parameter follows:
11171 %
11172 %    o wand: the magick wand.
11173 %
11174 %    o watermark_wand: the watermark wand.
11175 %
11176 %    o offset: Start hiding at this offset into the image.
11177 %
11178 */
11179 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
11180   const MagickWand *watermark_wand,const ssize_t offset)
11181 {
11182   Image
11183     *stegano_image;
11184
11185   assert(wand != (MagickWand *) NULL);
11186   assert(wand->signature == WandSignature);
11187   if (IfMagickTrue(wand->debug))
11188     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11189   if ((wand->images == (Image *) NULL) ||
11190       (watermark_wand->images == (Image *) NULL))
11191     {
11192       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11193         "ContainsNoImages","`%s'",wand->name);
11194       return((MagickWand *) NULL);
11195     }
11196   wand->images->offset=offset;
11197   stegano_image=SteganoImage(wand->images,watermark_wand->images,
11198     wand->exception);
11199   if (stegano_image == (Image *) NULL)
11200     return((MagickWand *) NULL);
11201   return(CloneMagickWandFromImages(wand,stegano_image));
11202 }
11203 \f
11204 /*
11205 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11206 %                                                                             %
11207 %                                                                             %
11208 %                                                                             %
11209 %   M a g i c k S t e r e o I m a g e                                         %
11210 %                                                                             %
11211 %                                                                             %
11212 %                                                                             %
11213 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11214 %
11215 %  MagickStereoImage() composites two images and produces a single image that
11216 %  is the composite of a left and right image of a stereo pair
11217 %
11218 %  The format of the MagickStereoImage method is:
11219 %
11220 %      MagickWand *MagickStereoImage(MagickWand *wand,
11221 %        const MagickWand *offset_wand)
11222 %
11223 %  A description of each parameter follows:
11224 %
11225 %    o wand: the magick wand.
11226 %
11227 %    o offset_wand: Another image wand.
11228 %
11229 */
11230 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11231   const MagickWand *offset_wand)
11232 {
11233   Image
11234     *stereo_image;
11235
11236   assert(wand != (MagickWand *) NULL);
11237   assert(wand->signature == WandSignature);
11238   if (IfMagickTrue(wand->debug))
11239     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11240   if ((wand->images == (Image *) NULL) ||
11241       (offset_wand->images == (Image *) NULL))
11242     {
11243       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11244         "ContainsNoImages","`%s'",wand->name);
11245       return((MagickWand *) NULL);
11246     }
11247   stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11248   if (stereo_image == (Image *) NULL)
11249     return((MagickWand *) NULL);
11250   return(CloneMagickWandFromImages(wand,stereo_image));
11251 }
11252 \f
11253 /*
11254 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11255 %                                                                             %
11256 %                                                                             %
11257 %                                                                             %
11258 %   M a g i c k S t r i p I m a g e                                           %
11259 %                                                                             %
11260 %                                                                             %
11261 %                                                                             %
11262 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11263 %
11264 %  MagickStripImage() strips an image of all profiles and comments.
11265 %
11266 %  The format of the MagickStripImage method is:
11267 %
11268 %      MagickBooleanType MagickStripImage(MagickWand *wand)
11269 %
11270 %  A description of each parameter follows:
11271 %
11272 %    o wand: the magick wand.
11273 %
11274 */
11275 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11276 {
11277   assert(wand != (MagickWand *) NULL);
11278   assert(wand->signature == WandSignature);
11279   if (IfMagickTrue(wand->debug))
11280     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11281   if (wand->images == (Image *) NULL)
11282     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11283   return(StripImage(wand->images,wand->exception));
11284 }
11285 \f
11286 /*
11287 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11288 %                                                                             %
11289 %                                                                             %
11290 %                                                                             %
11291 %   M a g i c k S w i r l I m a g e                                           %
11292 %                                                                             %
11293 %                                                                             %
11294 %                                                                             %
11295 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11296 %
11297 %  MagickSwirlImage() swirls the pixels about the center of the image, where
11298 %  degrees indicates the sweep of the arc through which each pixel is moved.
11299 %  You get a more dramatic effect as the degrees move from 1 to 360.
11300 %
11301 %  The format of the MagickSwirlImage method is:
11302 %
11303 %      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11304 %        const PixelInterpolateMethod method)
11305 %
11306 %  A description of each parameter follows:
11307 %
11308 %    o wand: the magick wand.
11309 %
11310 %    o degrees: Define the tightness of the swirling effect.
11311 %
11312 %    o method: the pixel interpolation method.
11313 %
11314 */
11315 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11316   const double degrees,const PixelInterpolateMethod method)
11317 {
11318   Image
11319     *swirl_image;
11320
11321   assert(wand != (MagickWand *) NULL);
11322   assert(wand->signature == WandSignature);
11323   if (IfMagickTrue(wand->debug))
11324     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11325   if (wand->images == (Image *) NULL)
11326     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11327   swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
11328   if (swirl_image == (Image *) NULL)
11329     return(MagickFalse);
11330   ReplaceImageInList(&wand->images,swirl_image);
11331   return(MagickTrue);
11332 }
11333 \f
11334 /*
11335 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11336 %                                                                             %
11337 %                                                                             %
11338 %                                                                             %
11339 %   M a g i c k T e x t u r e I m a g e                                       %
11340 %                                                                             %
11341 %                                                                             %
11342 %                                                                             %
11343 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11344 %
11345 %  MagickTextureImage() repeatedly tiles the texture image across and down the
11346 %  image canvas.
11347 %
11348 %  The format of the MagickTextureImage method is:
11349 %
11350 %      MagickWand *MagickTextureImage(MagickWand *wand,
11351 %        const MagickWand *texture_wand)
11352 %
11353 %  A description of each parameter follows:
11354 %
11355 %    o wand: the magick wand.
11356 %
11357 %    o texture_wand: the texture wand
11358 %
11359 */
11360 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11361   const MagickWand *texture_wand)
11362 {
11363   Image
11364     *texture_image;
11365
11366   MagickBooleanType
11367     status;
11368
11369   assert(wand != (MagickWand *) NULL);
11370   assert(wand->signature == WandSignature);
11371   if (IfMagickTrue(wand->debug))
11372     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11373   if ((wand->images == (Image *) NULL) ||
11374       (texture_wand->images == (Image *) NULL))
11375     {
11376       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11377         "ContainsNoImages","`%s'",wand->name);
11378       return((MagickWand *) NULL);
11379     }
11380   texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11381   if (texture_image == (Image *) NULL)
11382     return((MagickWand *) NULL);
11383   status=TextureImage(texture_image,texture_wand->images,wand->exception);
11384   if (IfMagickFalse(status))
11385     {
11386       texture_image=DestroyImage(texture_image);
11387       return((MagickWand *) NULL);
11388     }
11389   return(CloneMagickWandFromImages(wand,texture_image));
11390 }
11391 \f
11392 /*
11393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11394 %                                                                             %
11395 %                                                                             %
11396 %                                                                             %
11397 %   M a g i c k T h r e s h o l d I m a g e                                   %
11398 %                                                                             %
11399 %                                                                             %
11400 %                                                                             %
11401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11402 %
11403 %  MagickThresholdImage() changes the value of individual pixels based on
11404 %  the intensity of each pixel compared to threshold.  The result is a
11405 %  high-contrast, two color image.
11406 %
11407 %  The format of the MagickThresholdImage method is:
11408 %
11409 %      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11410 %        const double threshold)
11411 %      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11412 %        const ChannelType channel,const double threshold)
11413 %
11414 %  A description of each parameter follows:
11415 %
11416 %    o wand: the magick wand.
11417 %
11418 %    o channel: the image channel(s).
11419 %
11420 %    o threshold: Define the threshold value.
11421 %
11422 */
11423 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11424   const double threshold)
11425 {
11426   MagickBooleanType
11427     status;
11428
11429   status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11430   return(status);
11431 }
11432
11433 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11434   const ChannelType channel,const double threshold)
11435 {
11436   MagickBooleanType
11437     status;
11438
11439   assert(wand != (MagickWand *) NULL);
11440   assert(wand->signature == WandSignature);
11441   if (IfMagickTrue(wand->debug))
11442     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11443   if (wand->images == (Image *) NULL)
11444     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11445   status=BilevelImage(wand->images,threshold,wand->exception);
11446   return(status);
11447 }
11448 \f
11449 /*
11450 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11451 %                                                                             %
11452 %                                                                             %
11453 %                                                                             %
11454 %   M a g i c k T h u m b n a i l I m a g e                                   %
11455 %                                                                             %
11456 %                                                                             %
11457 %                                                                             %
11458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11459 %
11460 %  MagickThumbnailImage()  changes the size of an image to the given dimensions
11461 %  and removes any associated profiles.  The goal is to produce small low cost
11462 %  thumbnail images suited for display on the Web.
11463 %
11464 %  The format of the MagickThumbnailImage method is:
11465 %
11466 %      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11467 %        const size_t columns,const size_t rows)
11468 %
11469 %  A description of each parameter follows:
11470 %
11471 %    o wand: the magick wand.
11472 %
11473 %    o columns: the number of columns in the scaled image.
11474 %
11475 %    o rows: the number of rows in the scaled image.
11476 %
11477 */
11478 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11479   const size_t columns,const size_t rows)
11480 {
11481   Image
11482     *thumbnail_image;
11483
11484   assert(wand != (MagickWand *) NULL);
11485   assert(wand->signature == WandSignature);
11486   if (IfMagickTrue(wand->debug))
11487     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11488   if (wand->images == (Image *) NULL)
11489     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11490   thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11491   if (thumbnail_image == (Image *) NULL)
11492     return(MagickFalse);
11493   ReplaceImageInList(&wand->images,thumbnail_image);
11494   return(MagickTrue);
11495 }
11496 \f
11497 /*
11498 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11499 %                                                                             %
11500 %                                                                             %
11501 %                                                                             %
11502 %   M a g i c k T i n t I m a g e                                             %
11503 %                                                                             %
11504 %                                                                             %
11505 %                                                                             %
11506 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11507 %
11508 %  MagickTintImage() applies a color vector to each pixel in the image.  The
11509 %  length of the vector is 0 for black and white and at its maximum for the
11510 %  midtones.  The vector weighting function is
11511 %  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11512 %
11513 %  The format of the MagickTintImage method is:
11514 %
11515 %      MagickBooleanType MagickTintImage(MagickWand *wand,
11516 %        const PixelWand *tint,const PixelWand *blend)
11517 %
11518 %  A description of each parameter follows:
11519 %
11520 %    o wand: the magick wand.
11521 %
11522 %    o tint: the tint pixel wand.
11523 %
11524 %    o alpha: the alpha pixel wand.
11525 %
11526 */
11527 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11528   const PixelWand *tint,const PixelWand *blend)
11529 {
11530   char
11531     percent_blend[MaxTextExtent];
11532
11533   Image
11534     *tint_image;
11535
11536   PixelInfo
11537     target;
11538
11539   assert(wand != (MagickWand *) NULL);
11540   assert(wand->signature == WandSignature);
11541   if (IfMagickTrue(wand->debug))
11542     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11543   if (wand->images == (Image *) NULL)
11544     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11545   if (wand->images->colorspace != CMYKColorspace)
11546     (void) FormatLocaleString(percent_blend,MaxTextExtent,
11547       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11548       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11549       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11550       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11551       PixelGetAlphaQuantum(blend)));
11552   else
11553     (void) FormatLocaleString(percent_blend,MaxTextExtent,
11554       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
11555       PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11556       PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11557       PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11558       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11559       PixelGetAlphaQuantum(blend)));
11560   target=PixelGetPixel(tint);
11561   tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
11562   if (tint_image == (Image *) NULL)
11563     return(MagickFalse);
11564   ReplaceImageInList(&wand->images,tint_image);
11565   return(MagickTrue);
11566 }
11567 \f
11568 /*
11569 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11570 %                                                                             %
11571 %                                                                             %
11572 %                                                                             %
11573 %   M a g i c k T r a n s f o r m I m a g e                                   %
11574 %                                                                             %
11575 %                                                                             %
11576 %                                                                             %
11577 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11578 %
11579 %  MagickTransformImage() is a convenience method that behaves like
11580 %  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11581 %  information as a region geometry specification.  If the operation fails,
11582 %  a NULL image handle is returned.
11583 %
11584 %  The format of the MagickTransformImage method is:
11585 %
11586 %      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11587 %        const char *geometry)
11588 %
11589 %  A description of each parameter follows:
11590 %
11591 %    o wand: the magick wand.
11592 %
11593 %    o crop: A crop geometry string.  This geometry defines a subregion of the
11594 %      image to crop.
11595 %
11596 %    o geometry: An image geometry string.  This geometry defines the final
11597 %      size of the image.
11598 %
11599 */
11600 WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11601   const char *crop,const char *geometry)
11602 {
11603   Image
11604     *transform_image;
11605
11606   MagickBooleanType
11607     status;
11608
11609   assert(wand != (MagickWand *) NULL);
11610   assert(wand->signature == WandSignature);
11611   if (IfMagickTrue(wand->debug))
11612     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11613   if (wand->images == (Image *) NULL)
11614     return((MagickWand *) NULL);
11615   transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11616   if (transform_image == (Image *) NULL)
11617     return((MagickWand *) NULL);
11618   status=TransformImage(&transform_image,crop,geometry,wand->exception);
11619   if (IfMagickFalse(status))
11620     {
11621       transform_image=DestroyImage(transform_image);
11622       return((MagickWand *) NULL);
11623     }
11624   return(CloneMagickWandFromImages(wand,transform_image));
11625 }
11626 \f
11627 /*
11628 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11629 %                                                                             %
11630 %                                                                             %
11631 %                                                                             %
11632 %   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               %
11633 %                                                                             %
11634 %                                                                             %
11635 %                                                                             %
11636 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11637 %
11638 %  MagickTransformImageColorspace() transform the image colorspace, setting
11639 %  the images colorspace while transforming the images data to that
11640 %  colorspace.
11641 %
11642 %  The format of the MagickTransformImageColorspace method is:
11643 %
11644 %      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11645 %        const ColorspaceType colorspace)
11646 %
11647 %  A description of each parameter follows:
11648 %
11649 %    o wand: the magick wand.
11650 %
11651 %    o colorspace: the image colorspace:   UndefinedColorspace,
11652 %      sRGBColorspace, RGBColorspace, GRAYColorspace,
11653 %      OHTAColorspace, XYZColorspace, YCbCrColorspace,
11654 %      YCCColorspace, YIQColorspace, YPbPrColorspace,
11655 %      YPbPrColorspace, YUVColorspace, CMYKColorspace,
11656 %      HSLColorspace, HWBColorspace.
11657 %
11658 */
11659 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11660   const ColorspaceType colorspace)
11661 {
11662   assert(wand != (MagickWand *) NULL);
11663   assert(wand->signature == WandSignature);
11664   if (IfMagickTrue(wand->debug))
11665     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11666   if (wand->images == (Image *) NULL)
11667     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11668   return(TransformImageColorspace(wand->images,colorspace,wand->exception));
11669 }
11670 \f
11671 /*
11672 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11673 %                                                                             %
11674 %                                                                             %
11675 %                                                                             %
11676 %   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                     %
11677 %                                                                             %
11678 %                                                                             %
11679 %                                                                             %
11680 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11681 %
11682 %  MagickTransparentPaintImage() changes any pixel that matches color with the
11683 %  color defined by fill.
11684 %
11685 %  The format of the MagickTransparentPaintImage method is:
11686 %
11687 %      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11688 %        const PixelWand *target,const double alpha,const double fuzz,
11689 %        const MagickBooleanType invert)
11690 %
11691 %  A description of each parameter follows:
11692 %
11693 %    o wand: the magick wand.
11694 %
11695 %    o target: Change this target color to specified alpha value within
11696 %      the image.
11697 %
11698 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11699 %      transparent.
11700 %
11701 %    o fuzz: By default target must match a particular pixel color
11702 %      exactly.  However, in many cases two colors may differ by a small amount.
11703 %      The fuzz member of image defines how much tolerance is acceptable to
11704 %      consider two colors as the same.  For example, set fuzz to 10 and the
11705 %      color red at intensities of 100 and 102 respectively are now interpreted
11706 %      as the same color for the purposes of the floodfill.
11707 %
11708 %    o invert: paint any pixel that does not match the target color.
11709 %
11710 */
11711 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11712   const PixelWand *target,const double alpha,const double fuzz,
11713   const MagickBooleanType invert)
11714 {
11715   MagickBooleanType
11716     status;
11717
11718   PixelInfo
11719     target_pixel;
11720
11721   assert(wand != (MagickWand *) NULL);
11722   assert(wand->signature == WandSignature);
11723   if (IfMagickTrue(wand->debug))
11724     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11725   if (wand->images == (Image *) NULL)
11726     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11727   PixelGetMagickColor(target,&target_pixel);
11728   wand->images->fuzz=fuzz;
11729   status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11730     QuantumRange*alpha),invert,wand->exception);
11731   return(status);
11732 }
11733 \f
11734 /*
11735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11736 %                                                                             %
11737 %                                                                             %
11738 %                                                                             %
11739 %   M a g i c k T r a n s p o s e I m a g e                                   %
11740 %                                                                             %
11741 %                                                                             %
11742 %                                                                             %
11743 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11744 %
11745 %  MagickTransposeImage() creates a vertical mirror image by reflecting the
11746 %  pixels around the central x-axis while rotating them 90-degrees.
11747 %
11748 %  The format of the MagickTransposeImage method is:
11749 %
11750 %      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11751 %
11752 %  A description of each parameter follows:
11753 %
11754 %    o wand: the magick wand.
11755 %
11756 */
11757 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11758 {
11759   Image
11760     *transpose_image;
11761
11762   assert(wand != (MagickWand *) NULL);
11763   assert(wand->signature == WandSignature);
11764   if (IfMagickTrue(wand->debug))
11765     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11766   if (wand->images == (Image *) NULL)
11767     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11768   transpose_image=TransposeImage(wand->images,wand->exception);
11769   if (transpose_image == (Image *) NULL)
11770     return(MagickFalse);
11771   ReplaceImageInList(&wand->images,transpose_image);
11772   return(MagickTrue);
11773 }
11774 \f
11775 /*
11776 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11777 %                                                                             %
11778 %                                                                             %
11779 %                                                                             %
11780 %   M a g i c k T r a n s v e r s e I m a g e                                 %
11781 %                                                                             %
11782 %                                                                             %
11783 %                                                                             %
11784 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11785 %
11786 %  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11787 %  pixels around the central y-axis while rotating them 270-degrees.
11788 %
11789 %  The format of the MagickTransverseImage method is:
11790 %
11791 %      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11792 %
11793 %  A description of each parameter follows:
11794 %
11795 %    o wand: the magick wand.
11796 %
11797 */
11798 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11799 {
11800   Image
11801     *transverse_image;
11802
11803   assert(wand != (MagickWand *) NULL);
11804   assert(wand->signature == WandSignature);
11805   if (IfMagickTrue(wand->debug))
11806     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11807   if (wand->images == (Image *) NULL)
11808     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11809   transverse_image=TransverseImage(wand->images,wand->exception);
11810   if (transverse_image == (Image *) NULL)
11811     return(MagickFalse);
11812   ReplaceImageInList(&wand->images,transverse_image);
11813   return(MagickTrue);
11814 }
11815 \f
11816 /*
11817 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11818 %                                                                             %
11819 %                                                                             %
11820 %                                                                             %
11821 %   M a g i c k T r i m I m a g e                                             %
11822 %                                                                             %
11823 %                                                                             %
11824 %                                                                             %
11825 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11826 %
11827 %  MagickTrimImage() remove edges that are the background color from the image.
11828 %
11829 %  The format of the MagickTrimImage method is:
11830 %
11831 %      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11832 %
11833 %  A description of each parameter follows:
11834 %
11835 %    o wand: the magick wand.
11836 %
11837 %    o fuzz: By default target must match a particular pixel color
11838 %      exactly.  However, in many cases two colors may differ by a small amount.
11839 %      The fuzz member of image defines how much tolerance is acceptable to
11840 %      consider two colors as the same.  For example, set fuzz to 10 and the
11841 %      color red at intensities of 100 and 102 respectively are now interpreted
11842 %      as the same color for the purposes of the floodfill.
11843 %
11844 */
11845 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11846 {
11847   Image
11848     *trim_image;
11849
11850   assert(wand != (MagickWand *) NULL);
11851   assert(wand->signature == WandSignature);
11852   if (IfMagickTrue(wand->debug))
11853     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11854   if (wand->images == (Image *) NULL)
11855     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11856   wand->images->fuzz=fuzz;
11857   trim_image=TrimImage(wand->images,wand->exception);
11858   if (trim_image == (Image *) NULL)
11859     return(MagickFalse);
11860   ReplaceImageInList(&wand->images,trim_image);
11861   return(MagickTrue);
11862 }
11863 \f
11864 /*
11865 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11866 %                                                                             %
11867 %                                                                             %
11868 %                                                                             %
11869 %   M a g i c k U n i q u e I m a g e C o l o r s                             %
11870 %                                                                             %
11871 %                                                                             %
11872 %                                                                             %
11873 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11874 %
11875 %  MagickUniqueImageColors() discards all but one of any pixel color.
11876 %
11877 %  The format of the MagickUniqueImageColors method is:
11878 %
11879 %      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11880 %
11881 %  A description of each parameter follows:
11882 %
11883 %    o wand: the magick wand.
11884 %
11885 */
11886 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11887 {
11888   Image
11889     *unique_image;
11890
11891   assert(wand != (MagickWand *) NULL);
11892   assert(wand->signature == WandSignature);
11893   if (IfMagickTrue(wand->debug))
11894     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11895   if (wand->images == (Image *) NULL)
11896     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11897   unique_image=UniqueImageColors(wand->images,wand->exception);
11898   if (unique_image == (Image *) NULL)
11899     return(MagickFalse);
11900   ReplaceImageInList(&wand->images,unique_image);
11901   return(MagickTrue);
11902 }
11903 \f
11904 /*
11905 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11906 %                                                                             %
11907 %                                                                             %
11908 %                                                                             %
11909 %   M a g i c k U n s h a r p M a s k I m a g e                               %
11910 %                                                                             %
11911 %                                                                             %
11912 %                                                                             %
11913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11914 %
11915 %  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
11916 %  Gaussian operator of the given radius and standard deviation (sigma).
11917 %  For reasonable results, radius should be larger than sigma.  Use a radius
11918 %  of 0 and UnsharpMaskImage() selects a suitable radius for you.
11919 %
11920 %  The format of the MagickUnsharpMaskImage method is:
11921 %
11922 %      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11923 %        const double radius,const double sigma,const double gain,
11924 %        const double threshold)
11925 %
11926 %  A description of each parameter follows:
11927 %
11928 %    o wand: the magick wand.
11929 %
11930 %    o radius: the radius of the Gaussian, in pixels, not counting the center
11931 %      pixel.
11932 %
11933 %    o sigma: the standard deviation of the Gaussian, in pixels.
11934 %
11935 %    o gain: the percentage of the difference between the original and the
11936 %      blur image that is added back into the original.
11937 %
11938 %    o threshold: the threshold in pixels needed to apply the diffence gain.
11939 %
11940 */
11941 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11942   const double radius,const double sigma,const double gain,
11943   const double threshold)
11944 {
11945   Image
11946     *unsharp_image;
11947
11948   assert(wand != (MagickWand *) NULL);
11949   assert(wand->signature == WandSignature);
11950   if (IfMagickTrue(wand->debug))
11951     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11952   if (wand->images == (Image *) NULL)
11953     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11954   unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,gain,threshold,
11955     wand->exception);
11956   if (unsharp_image == (Image *) NULL)
11957     return(MagickFalse);
11958   ReplaceImageInList(&wand->images,unsharp_image);
11959   return(MagickTrue);
11960 }
11961 \f
11962 /*
11963 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11964 %                                                                             %
11965 %                                                                             %
11966 %                                                                             %
11967 %   M a g i c k V i g n e t t e I m a g e                                     %
11968 %                                                                             %
11969 %                                                                             %
11970 %                                                                             %
11971 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11972 %
11973 %  MagickVignetteImage() softens the edges of the image in vignette style.
11974 %
11975 %  The format of the MagickVignetteImage method is:
11976 %
11977 %      MagickBooleanType MagickVignetteImage(MagickWand *wand,
11978 %        const double radius,const double sigma,const ssize_t x,
11979 %        const ssize_t y)
11980 %
11981 %  A description of each parameter follows:
11982 %
11983 %    o wand: the magick wand.
11984 %
11985 %    o radius: the radius.
11986 %
11987 %    o sigma: the sigma.
11988 %
11989 %    o x, y:  Define the x and y ellipse offset.
11990 %
11991 */
11992 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
11993   const double radius,const double sigma,const ssize_t x,const ssize_t y)
11994 {
11995   Image
11996     *vignette_image;
11997
11998   assert(wand != (MagickWand *) NULL);
11999   assert(wand->signature == WandSignature);
12000   if (IfMagickTrue(wand->debug))
12001     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12002   if (wand->images == (Image *) NULL)
12003     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12004   vignette_image=VignetteImage(wand->images,radius,sigma,x,y,wand->exception);
12005   if (vignette_image == (Image *) NULL)
12006     return(MagickFalse);
12007   ReplaceImageInList(&wand->images,vignette_image);
12008   return(MagickTrue);
12009 }
12010 \f
12011 /*
12012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12013 %                                                                             %
12014 %                                                                             %
12015 %                                                                             %
12016 %   M a g i c k W a v e I m a g e                                             %
12017 %                                                                             %
12018 %                                                                             %
12019 %                                                                             %
12020 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12021 %
12022 %  MagickWaveImage()  creates a "ripple" effect in the image by shifting
12023 %  the pixels vertically along a sine wave whose amplitude and wavelength
12024 %  is specified by the given parameters.
12025 %
12026 %  The format of the MagickWaveImage method is:
12027 %
12028 %      MagickBooleanType MagickWaveImage(MagickWand *wand,
12029 %        const double amplitude,const double wave_length,
12030 %        const PixelInterpolateMethod method)
12031 %
12032 %  A description of each parameter follows:
12033 %
12034 %    o wand: the magick wand.
12035 %
12036 %    o amplitude, wave_length:  Define the amplitude and wave length of the
12037 %      sine wave.
12038 %
12039 %    o method: the pixel interpolation method.
12040 %
12041 */
12042 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12043   const double amplitude,const double wave_length,
12044   const PixelInterpolateMethod method)
12045 {
12046   Image
12047     *wave_image;
12048
12049   assert(wand != (MagickWand *) NULL);
12050   assert(wand->signature == WandSignature);
12051   if (IfMagickTrue(wand->debug))
12052     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12053   if (wand->images == (Image *) NULL)
12054     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12055   wave_image=WaveImage(wand->images,amplitude,wave_length,method,
12056     wand->exception);
12057   if (wave_image == (Image *) NULL)
12058     return(MagickFalse);
12059   ReplaceImageInList(&wand->images,wave_image);
12060   return(MagickTrue);
12061 }
12062 \f
12063 /*
12064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12065 %                                                                             %
12066 %                                                                             %
12067 %                                                                             %
12068 %   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                         %
12069 %                                                                             %
12070 %                                                                             %
12071 %                                                                             %
12072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12073 %
12074 %  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
12075 %  above the threshold into white while leaving all pixels below the threshold
12076 %  unchanged.
12077 %
12078 %  The format of the MagickWhiteThresholdImage method is:
12079 %
12080 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12081 %        const PixelWand *threshold)
12082 %
12083 %  A description of each parameter follows:
12084 %
12085 %    o wand: the magick wand.
12086 %
12087 %    o threshold: the pixel wand.
12088 %
12089 */
12090 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12091   const PixelWand *threshold)
12092 {
12093   char
12094     thresholds[MaxTextExtent];
12095
12096   assert(wand != (MagickWand *) NULL);
12097   assert(wand->signature == WandSignature);
12098   if (IfMagickTrue(wand->debug))
12099     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12100   if (wand->images == (Image *) NULL)
12101     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12102   (void) FormatLocaleString(thresholds,MaxTextExtent,
12103     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12104     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12105     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
12106   return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
12107 }
12108 \f
12109 /*
12110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12111 %                                                                             %
12112 %                                                                             %
12113 %                                                                             %
12114 %   M a g i c k W r i t e I m a g e                                           %
12115 %                                                                             %
12116 %                                                                             %
12117 %                                                                             %
12118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12119 %
12120 %  MagickWriteImage() writes an image to the specified filename.  If the
12121 %  filename parameter is NULL, the image is written to the filename set
12122 %  by MagickReadImage() or MagickSetImageFilename().
12123 %
12124 %  The format of the MagickWriteImage method is:
12125 %
12126 %      MagickBooleanType MagickWriteImage(MagickWand *wand,
12127 %        const char *filename)
12128 %
12129 %  A description of each parameter follows:
12130 %
12131 %    o wand: the magick wand.
12132 %
12133 %    o filename: the image filename.
12134 %
12135 %
12136 */
12137 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12138   const char *filename)
12139 {
12140   Image
12141     *image;
12142
12143   ImageInfo
12144     *write_info;
12145
12146   MagickBooleanType
12147     status;
12148
12149   assert(wand != (MagickWand *) NULL);
12150   assert(wand->signature == WandSignature);
12151   if (IfMagickTrue(wand->debug))
12152     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12153   if (wand->images == (Image *) NULL)
12154     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12155   if (filename != (const char *) NULL)
12156     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
12157   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12158   if (image == (Image *) NULL)
12159     return(MagickFalse);
12160   write_info=CloneImageInfo(wand->image_info);
12161   write_info->adjoin=MagickTrue;
12162   status=WriteImage(write_info,image,wand->exception);
12163   image=DestroyImage(image);
12164   write_info=DestroyImageInfo(write_info);
12165   return(status);
12166 }
12167 \f
12168 /*
12169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12170 %                                                                             %
12171 %                                                                             %
12172 %                                                                             %
12173 %   M a g i c k W r i t e I m a g e F i l e                                   %
12174 %                                                                             %
12175 %                                                                             %
12176 %                                                                             %
12177 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12178 %
12179 %  MagickWriteImageFile() writes an image to an open file descriptor.
12180 %
12181 %  The format of the MagickWriteImageFile method is:
12182 %
12183 %      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12184 %
12185 %  A description of each parameter follows:
12186 %
12187 %    o wand: the magick wand.
12188 %
12189 %    o file: the file descriptor.
12190 %
12191 */
12192 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12193 {
12194   Image
12195     *image;
12196
12197   ImageInfo
12198     *write_info;
12199
12200   MagickBooleanType
12201     status;
12202
12203   assert(wand != (MagickWand *) NULL);
12204   assert(wand->signature == WandSignature);
12205   assert(file != (FILE *) NULL);
12206   if (IfMagickTrue(wand->debug))
12207     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12208   if (wand->images == (Image *) NULL)
12209     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12210   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12211   if (image == (Image *) NULL)
12212     return(MagickFalse);
12213   write_info=CloneImageInfo(wand->image_info);
12214   SetImageInfoFile(write_info,file);
12215   write_info->adjoin=MagickTrue;
12216   status=WriteImage(write_info,image,wand->exception);
12217   write_info=DestroyImageInfo(write_info);
12218   image=DestroyImage(image);
12219   return(status);
12220 }
12221 \f
12222 /*
12223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12224 %                                                                             %
12225 %                                                                             %
12226 %                                                                             %
12227 %   M a g i c k W r i t e I m a g e s                                         %
12228 %                                                                             %
12229 %                                                                             %
12230 %                                                                             %
12231 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12232 %
12233 %  MagickWriteImages() writes an image or image sequence.
12234 %
12235 %  The format of the MagickWriteImages method is:
12236 %
12237 %      MagickBooleanType MagickWriteImages(MagickWand *wand,
12238 %        const char *filename,const MagickBooleanType adjoin)
12239 %
12240 %  A description of each parameter follows:
12241 %
12242 %    o wand: the magick wand.
12243 %
12244 %    o filename: the image filename.
12245 %
12246 %    o adjoin: join images into a single multi-image file.
12247 %
12248 */
12249 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12250   const char *filename,const MagickBooleanType adjoin)
12251 {
12252   ImageInfo
12253     *write_info;
12254
12255   MagickBooleanType
12256     status;
12257
12258   assert(wand != (MagickWand *) NULL);
12259   assert(wand->signature == WandSignature);
12260   if (IfMagickTrue(wand->debug))
12261     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12262   if (wand->images == (Image *) NULL)
12263     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12264   write_info=CloneImageInfo(wand->image_info);
12265   write_info->adjoin=adjoin;
12266   status=WriteImages(write_info,wand->images,filename,wand->exception);
12267   write_info=DestroyImageInfo(write_info);
12268   return(status);
12269 }
12270 \f
12271 /*
12272 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12273 %                                                                             %
12274 %                                                                             %
12275 %                                                                             %
12276 %   M a g i c k W r i t e I m a g e s F i l e                                 %
12277 %                                                                             %
12278 %                                                                             %
12279 %                                                                             %
12280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12281 %
12282 %  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12283 %
12284 %  The format of the MagickWriteImagesFile method is:
12285 %
12286 %      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12287 %
12288 %  A description of each parameter follows:
12289 %
12290 %    o wand: the magick wand.
12291 %
12292 %    o file: the file descriptor.
12293 %
12294 */
12295 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12296 {
12297   ImageInfo
12298     *write_info;
12299
12300   MagickBooleanType
12301     status;
12302
12303   assert(wand != (MagickWand *) NULL);
12304   assert(wand->signature == WandSignature);
12305   if (IfMagickTrue(wand->debug))
12306     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12307   if (wand->images == (Image *) NULL)
12308     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12309   write_info=CloneImageInfo(wand->image_info);
12310   SetImageInfoFile(write_info,file);
12311   write_info->adjoin=MagickTrue;
12312   status=WriteImages(write_info,wand->images,(const char *) NULL,
12313     wand->exception);
12314   write_info=DestroyImageInfo(write_info);
12315   return(status);
12316 }