]> granicus.if.org Git - imagemagick/blob - MagickWand/magick-image.c
(no commit message)
[imagemagick] / MagickWand / magick-image.c
1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %                                                                             %
4 %                                                                             %
5 %                                                                             %
6 %                 M   M   AAA    GGGG  IIIII   CCCC  K   K                    %
7 %                 MM MM  A   A  G        I    C      K  K                     %
8 %                 M M M  AAAAA  G GGG    I    C      KKK                      %
9 %                 M   M  A   A  G   G    I    C      K  K                     %
10 %                 M   M  A   A   GGGG  IIIII   CCCC  K   K                    %
11 %                                                                             %
12 %                     IIIII  M   M   AAA    GGGG  EEEEE                       %
13 %                       I    MM MM  A   A  G      E                           %
14 %                       I    M M M  AAAAA  G  GG  EEE                         %
15 %                       I    M   M  A   A  G   G  E                           %
16 %                     IIIII  M   M  A   A   GGGG  EEEEE                       %
17 %                                                                             %
18 %                                                                             %
19 %                          MagickWand Image Methods                           %
20 %                                                                             %
21 %                               Software Design                               %
22 %                                 John Cristy                                 %
23 %                                 August 2003                                 %
24 %                                                                             %
25 %                                                                             %
26 %  Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization      %
27 %  dedicated to making software imaging solutions freely available.           %
28 %                                                                             %
29 %  You may not use this file except in compliance with the License.  You may  %
30 %  obtain a copy of the License at                                            %
31 %                                                                             %
32 %    http://www.imagemagick.org/script/license.php                            %
33 %                                                                             %
34 %  Unless required by applicable law or agreed to in writing, software        %
35 %  distributed under the License is distributed on an "AS IS" BASIS,          %
36 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
37 %  See the License for the specific language governing permissions and        %
38 %  limitations under the License.                                             %
39 %                                                                             %
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 %
42 %
43 %
44 */
45 \f
46 /*
47   Include declarations.
48 */
49 #include "MagickWand/studio.h"
50 #include "MagickWand/MagickWand.h"
51 #include "MagickWand/magick-wand-private.h"
52 #include "MagickWand/wand.h"
53 #include "MagickWand/pixel-wand-private.h"
54 \f
55 /*
56   Define declarations.
57 */
58 #define ThrowWandException(severity,tag,context) \
59 { \
60   (void) ThrowMagickException(wand->exception,GetMagickModule(),severity, \
61     tag,"`%s'",context); \
62   return(MagickFalse); \
63 }
64 #define MagickWandId  "MagickWand"
65 \f
66 /*
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68 %                                                                             %
69 %                                                                             %
70 %                                                                             %
71 +   C l o n e M a g i c k W a n d F r o m I m a g e s                         %
72 %                                                                             %
73 %                                                                             %
74 %                                                                             %
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76 %
77 %  CloneMagickWandFromImages() clones the magick wand and inserts a new image
78 %  list.
79 %
80 %  The format of the CloneMagickWandFromImages method is:
81 %
82 %      MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
83 %        Image *images)
84 %
85 %  A description of each parameter follows:
86 %
87 %    o wand: the magick wand.
88 %
89 %    o images: replace the image list with these image(s).
90 %
91 */
92 static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
93   Image *images)
94 {
95   MagickWand
96     *clone_wand;
97
98   assert(wand != (MagickWand *) NULL);
99   assert(wand->signature == WandSignature);
100   if (IfMagickTrue(wand->debug))
101     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
102   clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
103   if (clone_wand == (MagickWand *) NULL)
104     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
105       images->filename);
106   (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
107   clone_wand->id=AcquireWandId();
108   (void) FormatLocaleString(clone_wand->name,MaxTextExtent,"%s-%.20g",
109     MagickWandId,(double) clone_wand->id);
110   clone_wand->exception=AcquireExceptionInfo();
111   InheritException(clone_wand->exception,wand->exception);
112   clone_wand->image_info=CloneImageInfo(wand->image_info);
113   clone_wand->images=images;
114   clone_wand->debug=IsEventLogging();
115   clone_wand->signature=WandSignature;
116   if (IfMagickTrue(clone_wand->debug))
117     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
118   return(clone_wand);
119 }
120 \f
121 /*
122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
123 %                                                                             %
124 %                                                                             %
125 %                                                                             %
126 %   G e t I m a g e F r o m M a g i c k W a n d                               %
127 %                                                                             %
128 %                                                                             %
129 %                                                                             %
130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
131 %
132 %  GetImageFromMagickWand() returns the current image from the magick wand.
133 %
134 %  The format of the GetImageFromMagickWand method is:
135 %
136 %      Image *GetImageFromMagickWand(const MagickWand *wand)
137 %
138 %  A description of each parameter follows:
139 %
140 %    o wand: the magick wand.
141 %
142 */
143 WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
144 {
145   assert(wand != (MagickWand *) NULL);
146   assert(wand->signature == WandSignature);
147   if (IfMagickTrue(wand->debug))
148     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
149   if (wand->images == (Image *) NULL)
150     {
151       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
152         "ContainsNoImages","`%s'",wand->name);
153       return((Image *) NULL);
154     }
155   return(wand->images);
156 }
157 \f
158 /*
159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
160 %                                                                             %
161 %                                                                             %
162 %                                                                             %
163 %   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                       %
164 %                                                                             %
165 %                                                                             %
166 %                                                                             %
167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
168 %
169 %  MagickAdaptiveBlurImage() adaptively blurs the image by blurring
170 %  less intensely near image edges and more intensely far from edges. We
171 %  blur the image with a Gaussian operator of the given radius and standard
172 %  deviation (sigma).  For reasonable results, radius should be larger than
173 %  sigma.  Use a radius of 0 and MagickAdaptiveBlurImage() selects a
174 %  suitable radius for you.
175 %
176 %  The format of the MagickAdaptiveBlurImage method is:
177 %
178 %      MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
179 %        const double radius,const double sigma)
180 %
181 %  A description of each parameter follows:
182 %
183 %    o wand: the magick wand.
184 %
185 %    o radius: the radius of the Gaussian, in pixels, not counting the center
186 %      pixel.
187 %
188 %    o sigma: the standard deviation of the Gaussian, in pixels.
189 %
190 */
191 WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
192   const double radius,const double sigma)
193 {
194   Image
195     *sharp_image;
196
197   assert(wand != (MagickWand *) NULL);
198   assert(wand->signature == WandSignature);
199   if (IfMagickTrue(wand->debug))
200     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
201   if (wand->images == (Image *) NULL)
202     ThrowWandException(WandError,"ContainsNoImages",wand->name);
203   sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,wand->exception);
204   if (sharp_image == (Image *) NULL)
205     return(MagickFalse);
206   ReplaceImageInList(&wand->images,sharp_image);
207   return(MagickTrue);
208 }
209 \f
210 /*
211 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
212 %                                                                             %
213 %                                                                             %
214 %                                                                             %
215 %   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                         %
216 %                                                                             %
217 %                                                                             %
218 %                                                                             %
219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
220 %
221 %  MagickAdaptiveResizeImage() adaptively resize image with data dependent
222 %  triangulation.
223 %
224 %      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
225 %        const size_t columns,const size_t rows)
226 %
227 %  A description of each parameter follows:
228 %
229 %    o wand: the magick wand.
230 %
231 %    o columns: the number of columns in the scaled image.
232 %
233 %    o rows: the number of rows in the scaled image.
234 %
235 */
236 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
237   const size_t columns,const size_t rows)
238 {
239   Image
240     *resize_image;
241
242   assert(wand != (MagickWand *) NULL);
243   assert(wand->signature == WandSignature);
244   if (IfMagickTrue(wand->debug))
245     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
246   if (wand->images == (Image *) NULL)
247     ThrowWandException(WandError,"ContainsNoImages",wand->name);
248   resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
249   if (resize_image == (Image *) NULL)
250     return(MagickFalse);
251   ReplaceImageInList(&wand->images,resize_image);
252   return(MagickTrue);
253 }
254 \f
255 /*
256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
257 %                                                                             %
258 %                                                                             %
259 %                                                                             %
260 %   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                       %
261 %                                                                             %
262 %                                                                             %
263 %                                                                             %
264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
265 %
266 %  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
267 %  more intensely near image edges and less intensely far from edges. We
268 %  sharpen the image with a Gaussian operator of the given radius and standard
269 %  deviation (sigma).  For reasonable results, radius should be larger than
270 %  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
271 %  suitable radius for you.
272 %
273 %  The format of the MagickAdaptiveSharpenImage method is:
274 %
275 %      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
276 %        const double radius,const double sigma)
277 %
278 %  A description of each parameter follows:
279 %
280 %    o wand: the magick wand.
281 %
282 %    o radius: the radius of the Gaussian, in pixels, not counting the center
283 %      pixel.
284 %
285 %    o sigma: the standard deviation of the Gaussian, in pixels.
286 %
287 */
288 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
289   const double radius,const double sigma)
290 {
291   Image
292     *sharp_image;
293
294   assert(wand != (MagickWand *) NULL);
295   assert(wand->signature == WandSignature);
296   if (IfMagickTrue(wand->debug))
297     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
298   if (wand->images == (Image *) NULL)
299     ThrowWandException(WandError,"ContainsNoImages",wand->name);
300   sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,wand->exception);
301   if (sharp_image == (Image *) NULL)
302     return(MagickFalse);
303   ReplaceImageInList(&wand->images,sharp_image);
304   return(MagickTrue);
305 }
306 \f
307 /*
308 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
309 %                                                                             %
310 %                                                                             %
311 %                                                                             %
312 %   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                   %
313 %                                                                             %
314 %                                                                             %
315 %                                                                             %
316 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
317 %
318 %  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
319 %  based on the range of intensity values in its local neighborhood.  This
320 %  allows for thresholding of an image whose global intensity histogram
321 %  doesn't contain distinctive peaks.
322 %
323 %  The format of the AdaptiveThresholdImage method is:
324 %
325 %      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
326 %        const size_t width,const size_t height,const double bias)
327 %
328 %  A description of each parameter follows:
329 %
330 %    o wand: the magick wand.
331 %
332 %    o width: the width of the local neighborhood.
333 %
334 %    o height: the height of the local neighborhood.
335 %
336 %    o offset: the mean bias.
337 %
338 */
339 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
340   const size_t width,const size_t height,const double bias)
341 {
342   Image
343     *threshold_image;
344
345   assert(wand != (MagickWand *) NULL);
346   assert(wand->signature == WandSignature);
347   if (IfMagickTrue(wand->debug))
348     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
349   if (wand->images == (Image *) NULL)
350     ThrowWandException(WandError,"ContainsNoImages",wand->name);
351   threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
352     wand->exception);
353   if (threshold_image == (Image *) NULL)
354     return(MagickFalse);
355   ReplaceImageInList(&wand->images,threshold_image);
356   return(MagickTrue);
357 }
358 \f
359 /*
360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
361 %                                                                             %
362 %                                                                             %
363 %                                                                             %
364 %   M a g i c k A d d I m a g e                                               %
365 %                                                                             %
366 %                                                                             %
367 %                                                                             %
368 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
369 %
370 %  MagickAddImage() adds a clone of the images from the second wand and
371 %  inserts them into the first wand.
372 %
373 %  Use MagickSetLastIterator(), to append new images into an existing wand,
374 %  current image will be set to last image so later adds with also be
375 %  appened to end of wand.
376 %
377 %  Use MagickSetFirstIterator() to prepend new images into wand, any more
378 %  images added will also be prepended before other images in the wand.
379 %  However the order of a list of new images will not change.
380 %
381 %  Otherwise the new images will be inserted just after the current image,
382 %  and any later image will also be added after this current image but
383 %  before the previously added images.  Caution is advised when multiple
384 %  image adds are inserted into the middle of the wand image list.
385 %
386 %  The format of the MagickAddImage method is:
387 %
388 %      MagickBooleanType MagickAddImage(MagickWand *wand,
389 %        const MagickWand *add_wand)
390 %
391 %  A description of each parameter follows:
392 %
393 %    o wand: the magick wand.
394 %
395 %    o add_wand: A wand that contains the image list to be added
396 %
397 */
398 static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
399   Image *images)
400 {
401   if (wand->images == (Image *) NULL)
402     {
403       /*
404         No images in wand, just add them, set current as appropriate.
405       */
406       if (IfMagickTrue(wand->insert_before))
407         wand->images=GetFirstImageInList(images);
408       else
409         wand->images=GetLastImageInList(images);
410       return(MagickTrue);
411     }
412   /* user jumped to first image, so prepend new images - remain active */
413   if (IfMagickTrue((wand->insert_before)) &&
414        (wand->images->previous == (Image *) NULL))
415     {
416       PrependImageToList(&wand->images,images);
417       wand->images=GetFirstImageInList(images);
418       return(MagickTrue);
419     }
420   /*
421     Note you should never have 'insert_before' true when current image is not
422     the first image in the wand!  That is no insert before current image, only
423     after current image
424   */
425   if (wand->images->next == (Image *) NULL)
426     {
427       /*
428         At last image, append new images.
429       */
430       InsertImageInList(&wand->images,images);
431       wand->images=GetLastImageInList(images);
432       return(MagickTrue);
433     }
434   /*
435     Insert new images, just after the current image.
436   */
437   InsertImageInList(&wand->images,images);
438   return(MagickTrue);
439 }
440
441 WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
442   const MagickWand *add_wand)
443 {
444   Image
445     *images;
446
447   assert(wand != (MagickWand *) NULL);
448   assert(wand->signature == WandSignature);
449   if (IfMagickTrue(wand->debug))
450     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
451   assert(add_wand != (MagickWand *) NULL);
452   assert(add_wand->signature == WandSignature);
453   if (add_wand->images == (Image *) NULL)
454     ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
455   /*
456     Clone images in second wand, and insert into first.
457   */
458   images=CloneImageList(add_wand->images,wand->exception);
459   if (images == (Image *) NULL)
460     return(MagickFalse);
461   return(InsertImageInWand(wand,images));
462 }
463 \f
464 /*
465 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
466 %                                                                             %
467 %                                                                             %
468 %                                                                             %
469 %     M a g i c k A d d N o i s e I m a g e                                   %
470 %                                                                             %
471 %                                                                             %
472 %                                                                             %
473 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
474 %
475 %  MagickAddNoiseImage() adds random noise to the image.
476 %
477 %  The format of the MagickAddNoiseImage method is:
478 %
479 %      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
480 %        const NoiseType noise_type,const double attenuate)
481 %
482 %  A description of each parameter follows:
483 %
484 %    o wand: the magick wand.
485 %
486 %    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
487 %      Impulse, Laplacian, or Poisson.
488 %
489 %    o attenuate:  attenuate the random distribution.
490 %
491 */
492 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
493   const NoiseType noise_type,const double attenuate)
494 {
495   Image
496     *noise_image;
497
498   assert(wand != (MagickWand *) NULL);
499   assert(wand->signature == WandSignature);
500   if (IfMagickTrue(wand->debug))
501     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
502   if (wand->images == (Image *) NULL)
503     ThrowWandException(WandError,"ContainsNoImages",wand->name);
504   noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
505   if (noise_image == (Image *) NULL)
506     return(MagickFalse);
507   ReplaceImageInList(&wand->images,noise_image);
508   return(MagickTrue);
509 }
510 \f
511 /*
512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
513 %                                                                             %
514 %                                                                             %
515 %                                                                             %
516 %   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                       %
517 %                                                                             %
518 %                                                                             %
519 %                                                                             %
520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
521 %
522 %  MagickAffineTransformImage() transforms an image as dictated by the affine
523 %  matrix of the drawing wand.
524 %
525 %  The format of the MagickAffineTransformImage method is:
526 %
527 %      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
528 %        const DrawingWand *drawing_wand)
529 %
530 %  A description of each parameter follows:
531 %
532 %    o wand: the magick wand.
533 %
534 %    o drawing_wand: the draw wand.
535 %
536 */
537 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
538   const DrawingWand *drawing_wand)
539 {
540   DrawInfo
541     *draw_info;
542
543   Image
544     *affine_image;
545
546   assert(wand != (MagickWand *) NULL);
547   assert(wand->signature == WandSignature);
548   if (IfMagickTrue(wand->debug))
549     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
550   if (wand->images == (Image *) NULL)
551     ThrowWandException(WandError,"ContainsNoImages",wand->name);
552   draw_info=PeekDrawingWand(drawing_wand);
553   if (draw_info == (DrawInfo *) NULL)
554     return(MagickFalse);
555   affine_image=AffineTransformImage(wand->images,&draw_info->affine,
556     wand->exception);
557   draw_info=DestroyDrawInfo(draw_info);
558   if (affine_image == (Image *) NULL)
559     return(MagickFalse);
560   ReplaceImageInList(&wand->images,affine_image);
561   return(MagickTrue);
562 }
563 \f
564 /*
565 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
566 %                                                                             %
567 %                                                                             %
568 %                                                                             %
569 %   M a g i c k A n n o t a t e I m a g e                                     %
570 %                                                                             %
571 %                                                                             %
572 %                                                                             %
573 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
574 %
575 %  MagickAnnotateImage() annotates an image with text.
576 %
577 %  The format of the MagickAnnotateImage method is:
578 %
579 %      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
580 %        const DrawingWand *drawing_wand,const double x,const double y,
581 %        const double angle,const char *text)
582 %
583 %  A description of each parameter follows:
584 %
585 %    o wand: the magick wand.
586 %
587 %    o drawing_wand: the draw wand.
588 %
589 %    o x: x ordinate to left of text
590 %
591 %    o y: y ordinate to text baseline
592 %
593 %    o angle: rotate text relative to this angle.
594 %
595 %    o text: text to draw
596 %
597 */
598 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
599   const DrawingWand *drawing_wand,const double x,const double y,
600   const double angle,const char *text)
601 {
602   char
603     geometry[MaxTextExtent];
604
605   DrawInfo
606     *draw_info;
607
608   MagickBooleanType
609     status;
610
611   assert(wand != (MagickWand *) NULL);
612   assert(wand->signature == WandSignature);
613   if (IfMagickTrue(wand->debug))
614     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
615   if (wand->images == (Image *) NULL)
616     ThrowWandException(WandError,"ContainsNoImages",wand->name);
617   draw_info=PeekDrawingWand(drawing_wand);
618   if (draw_info == (DrawInfo *) NULL)
619     return(MagickFalse);
620   (void) CloneString(&draw_info->text,text);
621   (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",x,y);
622   draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0)));
623   draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0)));
624   draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0))));
625   draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0)));
626   (void) CloneString(&draw_info->geometry,geometry);
627   status=AnnotateImage(wand->images,draw_info,wand->exception);
628   draw_info=DestroyDrawInfo(draw_info);
629   return(status);
630 }
631 \f
632 /*
633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
634 %                                                                             %
635 %                                                                             %
636 %                                                                             %
637 %   M a g i c k A n i m a t e I m a g e s                                     %
638 %                                                                             %
639 %                                                                             %
640 %                                                                             %
641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
642 %
643 %  MagickAnimateImages() animates an image or image sequence.
644 %
645 %  The format of the MagickAnimateImages method is:
646 %
647 %      MagickBooleanType MagickAnimateImages(MagickWand *wand,
648 %        const char *server_name)
649 %
650 %  A description of each parameter follows:
651 %
652 %    o wand: the magick wand.
653 %
654 %    o server_name: the X server name.
655 %
656 */
657 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
658   const char *server_name)
659 {
660   MagickBooleanType
661     status;
662
663   assert(wand != (MagickWand *) NULL);
664   assert(wand->signature == WandSignature);
665   if (IfMagickTrue(wand->debug))
666     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
667   (void) CloneString(&wand->image_info->server_name,server_name);
668   status=AnimateImages(wand->image_info,wand->images,wand->exception);
669   return(status);
670 }
671 \f
672 /*
673 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
674 %                                                                             %
675 %                                                                             %
676 %                                                                             %
677 %   M a g i c k A p p e n d I m a g e s                                       %
678 %                                                                             %
679 %                                                                             %
680 %                                                                             %
681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
682 %
683 %  MagickAppendImages() append the images in a wand from the current image
684 %  onwards, creating a new wand with the single image result.  This is
685 %  affected by the gravity and background settings of the first image.
686 %
687 %  Typically you would call either MagickResetIterator() or
688 %  MagickSetFirstImage() before calling this function to ensure that all
689 %  the images in the wand's image list will be appended together.
690 %
691 %  The format of the MagickAppendImages method is:
692 %
693 %      MagickWand *MagickAppendImages(MagickWand *wand,
694 %        const MagickBooleanType stack)
695 %
696 %  A description of each parameter follows:
697 %
698 %    o wand: the magick wand.
699 %
700 %    o stack: By default, images are stacked left-to-right. Set stack to
701 %      MagickTrue to stack them top-to-bottom.
702 %
703 */
704 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
705   const MagickBooleanType stack)
706 {
707   Image
708     *append_image;
709
710   assert(wand != (MagickWand *) NULL);
711   assert(wand->signature == WandSignature);
712   if (IfMagickTrue(wand->debug))
713     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
714   if (wand->images == (Image *) NULL)
715     return((MagickWand *) NULL);
716   append_image=AppendImages(wand->images,stack,wand->exception);
717   if (append_image == (Image *) NULL)
718     return((MagickWand *) NULL);
719   return(CloneMagickWandFromImages(wand,append_image));
720 }
721 \f
722 /*
723 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
724 %                                                                             %
725 %                                                                             %
726 %                                                                             %
727 %   M a g i c k A u t o G a m m a I m a g e                                   %
728 %                                                                             %
729 %                                                                             %
730 %                                                                             %
731 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
732 %
733 %  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
734 %  image to try make set its gamma appropriatally.
735 %
736 %  The format of the MagickAutoGammaImage method is:
737 %
738 %      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
739 %
740 %  A description of each parameter follows:
741 %
742 %    o wand: the magick wand.
743 %
744 */
745 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
746 {
747   MagickBooleanType
748     status;
749
750   assert(wand != (MagickWand *) NULL);
751   assert(wand->signature == WandSignature);
752   if (IfMagickTrue(wand->debug))
753     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
754   if (wand->images == (Image *) NULL)
755     ThrowWandException(WandError,"ContainsNoImages",wand->name);
756   status=AutoGammaImage(wand->images,wand->exception);
757   return(status);
758 }
759 \f
760 /*
761 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
762 %                                                                             %
763 %                                                                             %
764 %                                                                             %
765 %   M a g i c k A u t o L e v e l I m a g e                                   %
766 %                                                                             %
767 %                                                                             %
768 %                                                                             %
769 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
770 %
771 %  MagickAutoLevelImage() adjusts the levels of a particular image channel by
772 %  scaling the minimum and maximum values to the full quantum range.
773 %
774 %  The format of the MagickAutoLevelImage method is:
775 %
776 %      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
777 %
778 %  A description of each parameter follows:
779 %
780 %    o wand: the magick wand.
781 %
782 */
783 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
784 {
785   MagickBooleanType
786     status;
787
788   assert(wand != (MagickWand *) NULL);
789   assert(wand->signature == WandSignature);
790   if (IfMagickTrue(wand->debug))
791     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
792   if (wand->images == (Image *) NULL)
793     ThrowWandException(WandError,"ContainsNoImages",wand->name);
794   status=AutoLevelImage(wand->images,wand->exception);
795   return(status);
796 }
797 \f
798 /*
799 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
800 %                                                                             %
801 %                                                                             %
802 %                                                                             %
803 %   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                         %
804 %                                                                             %
805 %                                                                             %
806 %                                                                             %
807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
808 %
809 %  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
810 %  pixels below the threshold into black while leaving all pixels above the
811 %  threshold unchanged.
812 %
813 %  The format of the MagickBlackThresholdImage method is:
814 %
815 %      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
816 %        const PixelWand *threshold)
817 %
818 %  A description of each parameter follows:
819 %
820 %    o wand: the magick wand.
821 %
822 %    o threshold: the pixel wand.
823 %
824 */
825 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
826   const PixelWand *threshold)
827 {
828   char
829     thresholds[MaxTextExtent];
830
831   MagickBooleanType
832     status;
833
834   assert(wand != (MagickWand *) NULL);
835   assert(wand->signature == WandSignature);
836   if (IfMagickTrue(wand->debug))
837     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
838   if (wand->images == (Image *) NULL)
839     ThrowWandException(WandError,"ContainsNoImages",wand->name);
840   (void) FormatLocaleString(thresholds,MaxTextExtent,
841     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
842     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
843     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
844   status=BlackThresholdImage(wand->images,thresholds,wand->exception);
845   return(status);
846 }
847 \f
848 /*
849 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
850 %                                                                             %
851 %                                                                             %
852 %                                                                             %
853 %   M a g i c k B l u e S h i f t I m a g e                                   %
854 %                                                                             %
855 %                                                                             %
856 %                                                                             %
857 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
858 %
859 %  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
860 %  nighttime in the moonlight.
861 %
862 %  The format of the MagickBlueShiftImage method is:
863 %
864 %      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
865 %        const double factor)
866 %
867 %  A description of each parameter follows:
868 %
869 %    o wand: the magick wand.
870 %
871 %    o factor: the blue shift factor (default 1.5)
872 %
873 */
874 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
875   const double factor)
876 {
877   Image
878     *shift_image;
879
880   assert(wand != (MagickWand *) NULL);
881   assert(wand->signature == WandSignature);
882   if (IfMagickTrue(wand->debug))
883     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
884   if (wand->images == (Image *) NULL)
885     ThrowWandException(WandError,"ContainsNoImages",wand->name);
886   shift_image=BlueShiftImage(wand->images,factor,wand->exception);
887   if (shift_image == (Image *) NULL)
888     return(MagickFalse);
889   ReplaceImageInList(&wand->images,shift_image);
890   return(MagickTrue);
891 }
892 \f
893 /*
894 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
895 %                                                                             %
896 %                                                                             %
897 %                                                                             %
898 %   M a g i c k B l u r I m a g e                                             %
899 %                                                                             %
900 %                                                                             %
901 %                                                                             %
902 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
903 %
904 %  MagickBlurImage() blurs an image.  We convolve the image with a
905 %  gaussian operator of the given radius and standard deviation (sigma).
906 %  For reasonable results, the radius should be larger than sigma.  Use a
907 %  radius of 0 and BlurImage() selects a suitable radius for you.
908 %
909 %  The format of the MagickBlurImage method is:
910 %
911 %      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
912 %        const double sigma)
913 %
914 %  A description of each parameter follows:
915 %
916 %    o wand: the magick wand.
917 %
918 %    o radius: the radius of the , in pixels, not counting the center
919 %      pixel.
920 %
921 %    o sigma: the standard deviation of the , in pixels.
922 %
923 */
924 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
925   const double radius,const double sigma)
926 {
927   Image
928     *blur_image;
929
930   assert(wand != (MagickWand *) NULL);
931   assert(wand->signature == WandSignature);
932   if (IfMagickTrue(wand->debug))
933     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
934   if (wand->images == (Image *) NULL)
935     ThrowWandException(WandError,"ContainsNoImages",wand->name);
936   blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
937   if (blur_image == (Image *) NULL)
938     return(MagickFalse);
939   ReplaceImageInList(&wand->images,blur_image);
940   return(MagickTrue);
941 }
942 \f
943 /*
944 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
945 %                                                                             %
946 %                                                                             %
947 %                                                                             %
948 %   M a g i c k B o r d e r I m a g e                                         %
949 %                                                                             %
950 %                                                                             %
951 %                                                                             %
952 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
953 %
954 %  MagickBorderImage() surrounds the image with a border of the color defined
955 %  by the bordercolor pixel wand.
956 %
957 %  The format of the MagickBorderImage method is:
958 %
959 %      MagickBooleanType MagickBorderImage(MagickWand *wand,
960 %        const PixelWand *bordercolor,const size_t width,
961 %        const size_t height,const CompositeOperator compose)
962 %
963 %  A description of each parameter follows:
964 %
965 %    o wand: the magick wand.
966 %
967 %    o bordercolor: the border color pixel wand.
968 %
969 %    o width: the border width.
970 %
971 %    o height: the border height.
972 %
973 %    o compose: the composite operator.
974 %
975 */
976 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
977   const PixelWand *bordercolor,const size_t width,const size_t height,
978   const CompositeOperator compose)
979 {
980   Image
981     *border_image;
982
983   RectangleInfo
984     border_info;
985
986   assert(wand != (MagickWand *) NULL);
987   assert(wand->signature == WandSignature);
988   if (IfMagickTrue(wand->debug))
989     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
990   if (wand->images == (Image *) NULL)
991     ThrowWandException(WandError,"ContainsNoImages",wand->name);
992   border_info.width=width;
993   border_info.height=height;
994   border_info.x=0;
995   border_info.y=0;
996   PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
997   border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
998   if (border_image == (Image *) NULL)
999     return(MagickFalse);
1000   ReplaceImageInList(&wand->images,border_image);
1001   return(MagickTrue);
1002 }
1003 \f
1004 /*
1005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1006 %                                                                             %
1007 %                                                                             %
1008 %                                                                             %
1009 %   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   %
1010 %                                                                             %
1011 %                                                                             %
1012 %                                                                             %
1013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1014 %
1015 %  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1016 %  of an image.  It converts the brightness and contrast parameters into slope
1017 %  and intercept and calls a polynomical function to apply to the image.
1018
1019 %
1020 %  The format of the MagickBrightnessContrastImage method is:
1021 %
1022 %      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1023 %        const double brightness,const double contrast)
1024 %
1025 %  A description of each parameter follows:
1026 %
1027 %    o wand: the magick wand.
1028 %
1029 %    o brightness: the brightness percent (-100 .. 100).
1030 %
1031 %    o contrast: the contrast percent (-100 .. 100).
1032 %
1033 */
1034 WandExport MagickBooleanType MagickBrightnessContrastImage(
1035   MagickWand *wand,const double brightness,const double contrast)
1036 {
1037   MagickBooleanType
1038     status;
1039
1040   assert(wand != (MagickWand *) NULL);
1041   assert(wand->signature == WandSignature);
1042   if (IfMagickTrue(wand->debug))
1043     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1044   if (wand->images == (Image *) NULL)
1045     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1046   status=BrightnessContrastImage(wand->images,brightness,contrast,
1047     wand->exception);
1048   return(status);
1049 }
1050 \f
1051 /*
1052 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1053 %                                                                             %
1054 %                                                                             %
1055 %                                                                             %
1056 %   M a g i c k C h a n n e l F x I m a g e                                   %
1057 %                                                                             %
1058 %                                                                             %
1059 %                                                                             %
1060 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1061 %
1062 %  MagickChannelFxImage() applies a channel expression to the specified image.
1063 %  The expression consists of one or more channels, either mnemonic or numeric
1064 %  (e.g. red, 1), separated by actions as follows:
1065 %
1066 %    <=>     exchange two channels (e.g. red<=>blue)
1067 %    =>      transfer a channel to another (e.g. red=>green)
1068 %    ,       separate channel operations (e.g. red, green)
1069 %    |       read channels from next input image (e.g. red | green)
1070 %    ;       write channels to next output image (e.g. red; green; blue)
1071 %
1072 %  A channel without a operation symbol implies extract. For example, to create
1073 %  3 grayscale images from the red, green, and blue channels of an image, use:
1074 %
1075 %    -channel-fx "red; green; blue"
1076 %
1077 %  The format of the MagickChannelFxImage method is:
1078 %
1079 %      MagickWand *MagickChannelFxImage(MagickWand *wand,const char *expression)
1080 %
1081 %  A description of each parameter follows:
1082 %
1083 %    o wand: the magick wand.
1084 %
1085 %    o expression: the expression.
1086 %
1087 */
1088 WandExport MagickWand *MagickChannelFxImage(MagickWand *wand,
1089   const char *expression)
1090 {
1091   Image
1092     *fx_image;
1093
1094   assert(wand != (MagickWand *) NULL);
1095   assert(wand->signature == WandSignature);
1096   if (IfMagickTrue(wand->debug))
1097     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1098   if (wand->images == (Image *) NULL)
1099     return((MagickWand *) NULL);
1100   fx_image=ChannelFxImage(wand->images,expression,wand->exception);
1101   if (fx_image == (Image *) NULL)
1102     return((MagickWand *) NULL);
1103   return(CloneMagickWandFromImages(wand,fx_image));
1104 }
1105 \f
1106 /*
1107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1108 %                                                                             %
1109 %                                                                             %
1110 %                                                                             %
1111 %   M a g i c k C h a r c o a l I m a g e                                     %
1112 %                                                                             %
1113 %                                                                             %
1114 %                                                                             %
1115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1116 %
1117 %  MagickCharcoalImage() simulates a charcoal drawing.
1118 %
1119 %  The format of the MagickCharcoalImage method is:
1120 %
1121 %      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1122 %        const double radius,const double sigma)
1123 %
1124 %  A description of each parameter follows:
1125 %
1126 %    o wand: the magick wand.
1127 %
1128 %    o radius: the radius of the Gaussian, in pixels, not counting the center
1129 %      pixel.
1130 %
1131 %    o sigma: the standard deviation of the Gaussian, in pixels.
1132 %
1133 */
1134 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1135   const double radius,const double sigma)
1136 {
1137   Image
1138     *charcoal_image;
1139
1140   assert(wand != (MagickWand *) NULL);
1141   assert(wand->signature == WandSignature);
1142   if (IfMagickTrue(wand->debug))
1143     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1144   if (wand->images == (Image *) NULL)
1145     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1146   charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1147   if (charcoal_image == (Image *) NULL)
1148     return(MagickFalse);
1149   ReplaceImageInList(&wand->images,charcoal_image);
1150   return(MagickTrue);
1151 }
1152 \f
1153 /*
1154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1155 %                                                                             %
1156 %                                                                             %
1157 %                                                                             %
1158 %   M a g i c k C h o p I m a g e                                             %
1159 %                                                                             %
1160 %                                                                             %
1161 %                                                                             %
1162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1163 %
1164 %  MagickChopImage() removes a region of an image and collapses the image to
1165 %  occupy the removed portion
1166 %
1167 %  The format of the MagickChopImage method is:
1168 %
1169 %      MagickBooleanType MagickChopImage(MagickWand *wand,
1170 %        const size_t width,const size_t height,const ssize_t x,
1171 %        const ssize_t y)
1172 %
1173 %  A description of each parameter follows:
1174 %
1175 %    o wand: the magick wand.
1176 %
1177 %    o width: the region width.
1178 %
1179 %    o height: the region height.
1180 %
1181 %    o x: the region x offset.
1182 %
1183 %    o y: the region y offset.
1184 %
1185 %
1186 */
1187 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1188   const size_t width,const size_t height,const ssize_t x,
1189   const ssize_t y)
1190 {
1191   Image
1192     *chop_image;
1193
1194   RectangleInfo
1195     chop;
1196
1197   assert(wand != (MagickWand *) NULL);
1198   assert(wand->signature == WandSignature);
1199   if (IfMagickTrue(wand->debug))
1200     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1201   if (wand->images == (Image *) NULL)
1202     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1203   chop.width=width;
1204   chop.height=height;
1205   chop.x=x;
1206   chop.y=y;
1207   chop_image=ChopImage(wand->images,&chop,wand->exception);
1208   if (chop_image == (Image *) NULL)
1209     return(MagickFalse);
1210   ReplaceImageInList(&wand->images,chop_image);
1211   return(MagickTrue);
1212 }
1213 \f
1214 /*
1215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1216 %                                                                             %
1217 %                                                                             %
1218 %                                                                             %
1219 %   M a g i c k C l a m p I m a g e                                           %
1220 %                                                                             %
1221 %                                                                             %
1222 %                                                                             %
1223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1224 %
1225 %  MagickClampImage() restricts the color range from 0 to the quantum depth.
1226 %
1227 %  The format of the MagickClampImage method is:
1228 %
1229 %      MagickBooleanType MagickClampImage(MagickWand *wand)
1230 %
1231 %  A description of each parameter follows:
1232 %
1233 %    o wand: the magick wand.
1234 %
1235 %    o channel: the channel.
1236 %
1237 */
1238 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1239 {
1240   assert(wand != (MagickWand *) NULL);
1241   assert(wand->signature == WandSignature);
1242   if (IfMagickTrue(wand->debug))
1243     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1244   if (wand->images == (Image *) NULL)
1245     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1246   return(ClampImage(wand->images,wand->exception));
1247 }
1248 \f
1249 /*
1250 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1251 %                                                                             %
1252 %                                                                             %
1253 %                                                                             %
1254 %   M a g i c k C l i p I m a g e                                             %
1255 %                                                                             %
1256 %                                                                             %
1257 %                                                                             %
1258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1259 %
1260 %  MagickClipImage() clips along the first path from the 8BIM profile, if
1261 %  present.
1262 %
1263 %  The format of the MagickClipImage method is:
1264 %
1265 %      MagickBooleanType MagickClipImage(MagickWand *wand)
1266 %
1267 %  A description of each parameter follows:
1268 %
1269 %    o wand: the magick wand.
1270 %
1271 */
1272 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1273 {
1274   MagickBooleanType
1275     status;
1276
1277   assert(wand != (MagickWand *) NULL);
1278   assert(wand->signature == WandSignature);
1279   if (IfMagickTrue(wand->debug))
1280     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1281   if (wand->images == (Image *) NULL)
1282     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1283   status=ClipImage(wand->images,wand->exception);
1284   return(status);
1285 }
1286 \f
1287 /*
1288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1289 %                                                                             %
1290 %                                                                             %
1291 %                                                                             %
1292 %   M a g i c k C l i p I m a g e P a t h                                     %
1293 %                                                                             %
1294 %                                                                             %
1295 %                                                                             %
1296 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1297 %
1298 %  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1299 %  present. Later operations take effect inside the path.  Id may be a number
1300 %  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1301 %  path.
1302 %
1303 %  The format of the MagickClipImagePath method is:
1304 %
1305 %      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1306 %        const char *pathname,const MagickBooleanType inside)
1307 %
1308 %  A description of each parameter follows:
1309 %
1310 %    o wand: the magick wand.
1311 %
1312 %    o pathname: name of clipping path resource. If name is preceded by #, use
1313 %      clipping path numbered by name.
1314 %
1315 %    o inside: if non-zero, later operations take effect inside clipping path.
1316 %      Otherwise later operations take effect outside clipping path.
1317 %
1318 */
1319 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1320   const char *pathname,const MagickBooleanType inside)
1321 {
1322   MagickBooleanType
1323     status;
1324
1325   assert(wand != (MagickWand *) NULL);
1326   assert(wand->signature == WandSignature);
1327   if (IfMagickTrue(wand->debug))
1328     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1329   if (wand->images == (Image *) NULL)
1330     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1331   status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1332   return(status);
1333 }
1334 \f
1335 /*
1336 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1337 %                                                                             %
1338 %                                                                             %
1339 %                                                                             %
1340 %   M a g i c k C l u t I m a g e                                             %
1341 %                                                                             %
1342 %                                                                             %
1343 %                                                                             %
1344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1345 %
1346 %  MagickClutImage() replaces colors in the image from a color lookup table.
1347 %
1348 %  The format of the MagickClutImage method is:
1349 %
1350 %      MagickBooleanType MagickClutImage(MagickWand *wand,
1351 %        const MagickWand *clut_wand,const PixelInterpolateMethod method)
1352 %
1353 %  A description of each parameter follows:
1354 %
1355 %    o wand: the magick wand.
1356 %
1357 %    o clut_image: the clut image.
1358 %
1359 %    o method: the pixel interpolation method.
1360 %
1361 */
1362 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1363   const MagickWand *clut_wand,const PixelInterpolateMethod method)
1364 {
1365   MagickBooleanType
1366     status;
1367
1368   assert(wand != (MagickWand *) NULL);
1369   assert(wand->signature == WandSignature);
1370   if (IfMagickTrue(wand->debug))
1371     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1372   if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1373     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1374   status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1375   return(status);
1376 }
1377 \f
1378 /*
1379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1380 %                                                                             %
1381 %                                                                             %
1382 %                                                                             %
1383 %   M a g i c k C o a l e s c e I m a g e s                                   %
1384 %                                                                             %
1385 %                                                                             %
1386 %                                                                             %
1387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1388 %
1389 %  MagickCoalesceImages() composites a set of images while respecting any page
1390 %  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1391 %  typically start with an image background and each subsequent image
1392 %  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1393 %  where each image in the sequence is the same size as the first and
1394 %  composited with the next image in the sequence.
1395 %
1396 %  The format of the MagickCoalesceImages method is:
1397 %
1398 %      MagickWand *MagickCoalesceImages(MagickWand *wand)
1399 %
1400 %  A description of each parameter follows:
1401 %
1402 %    o wand: the magick wand.
1403 %
1404 */
1405 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1406 {
1407   Image
1408     *coalesce_image;
1409
1410   assert(wand != (MagickWand *) NULL);
1411   assert(wand->signature == WandSignature);
1412   if (IfMagickTrue(wand->debug))
1413     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1414   if (wand->images == (Image *) NULL)
1415     return((MagickWand *) NULL);
1416   coalesce_image=CoalesceImages(wand->images,wand->exception);
1417   if (coalesce_image == (Image *) NULL)
1418     return((MagickWand *) NULL);
1419   return(CloneMagickWandFromImages(wand,coalesce_image));
1420 }
1421 \f
1422 /*
1423 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1424 %                                                                             %
1425 %                                                                             %
1426 %                                                                             %
1427 %   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1428 %                                                                             %
1429 %                                                                             %
1430 %                                                                             %
1431 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1432 %
1433 %  MagickColorDecisionListImage() accepts a lightweight Color Correction
1434 %  Collection (CCC) file which solely contains one or more color corrections
1435 %  and applies the color correction to the image.  Here is a sample CCC file:
1436 %
1437 %    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1438 %          <ColorCorrection id="cc03345">
1439 %                <SOPNode>
1440 %                     <Slope> 0.9 1.2 0.5 </Slope>
1441 %                     <Offset> 0.4 -0.5 0.6 </Offset>
1442 %                     <Power> 1.0 0.8 1.5 </Power>
1443 %                </SOPNode>
1444 %                <SATNode>
1445 %                     <Saturation> 0.85 </Saturation>
1446 %                </SATNode>
1447 %          </ColorCorrection>
1448 %    </ColorCorrectionCollection>
1449 %
1450 %  which includes the offset, slope, and power for each of the RGB channels
1451 %  as well as the saturation.
1452 %
1453 %  The format of the MagickColorDecisionListImage method is:
1454 %
1455 %      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1456 %        const char *color_correction_collection)
1457 %
1458 %  A description of each parameter follows:
1459 %
1460 %    o wand: the magick wand.
1461 %
1462 %    o color_correction_collection: the color correction collection in XML.
1463 %
1464 */
1465 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1466   const char *color_correction_collection)
1467 {
1468   MagickBooleanType
1469     status;
1470
1471   assert(wand != (MagickWand *) NULL);
1472   assert(wand->signature == WandSignature);
1473   if (IfMagickTrue(wand->debug))
1474     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1475   if (wand->images == (Image *) NULL)
1476     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1477   status=ColorDecisionListImage(wand->images,color_correction_collection,
1478     wand->exception);
1479   return(status);
1480 }
1481 \f
1482 /*
1483 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1484 %                                                                             %
1485 %                                                                             %
1486 %                                                                             %
1487 %   M a g i c k C o l o r i z e I m a g e                                     %
1488 %                                                                             %
1489 %                                                                             %
1490 %                                                                             %
1491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1492 %
1493 %  MagickColorizeImage() blends the fill color with each pixel in the image.
1494 %
1495 %  The format of the MagickColorizeImage method is:
1496 %
1497 %      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1498 %        const PixelWand *colorize,const PixelWand *blend)
1499 %
1500 %  A description of each parameter follows:
1501 %
1502 %    o wand: the magick wand.
1503 %
1504 %    o colorize: the colorize pixel wand.
1505 %
1506 %    o alpha: the alpha pixel wand.
1507 %
1508 */
1509 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1510   const PixelWand *colorize,const PixelWand *blend)
1511 {
1512   char
1513     percent_blend[MaxTextExtent];
1514
1515   Image
1516     *colorize_image;
1517
1518   PixelInfo
1519     target;
1520
1521   assert(wand != (MagickWand *) NULL);
1522   assert(wand->signature == WandSignature);
1523   if (IfMagickTrue(wand->debug))
1524     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1525   if (wand->images == (Image *) NULL)
1526     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1527   GetPixelInfo(wand->images,&target);
1528   if (target.colorspace != CMYKColorspace)
1529     (void) FormatLocaleString(percent_blend,MaxTextExtent,
1530       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1531       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1532       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1533       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1534       PixelGetAlphaQuantum(blend)));
1535   else
1536     (void) FormatLocaleString(percent_blend,MaxTextExtent,
1537       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1538       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1539       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1540       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1541       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1542       PixelGetAlphaQuantum(blend)));
1543   target=PixelGetPixel(colorize);
1544   colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1545     wand->exception);
1546   if (colorize_image == (Image *) NULL)
1547     return(MagickFalse);
1548   ReplaceImageInList(&wand->images,colorize_image);
1549   return(MagickTrue);
1550 }
1551 \f
1552 /*
1553 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1554 %                                                                             %
1555 %                                                                             %
1556 %                                                                             %
1557 %   M a g i c k C o l o r M a t r i x I m a g e                               %
1558 %                                                                             %
1559 %                                                                             %
1560 %                                                                             %
1561 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1562 %
1563 %  MagickColorMatrixImage() apply color transformation to an image. The method
1564 %  permits saturation changes, hue rotation, luminance to alpha, and various
1565 %  other effects.  Although variable-sized transformation matrices can be used,
1566 %  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1567 %  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1568 %  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1569 %  and offsets are normalized (divide Flash offset by 255).
1570 %
1571 %  The format of the MagickColorMatrixImage method is:
1572 %
1573 %      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1574 %        const KernelInfo *color_matrix)
1575 %
1576 %  A description of each parameter follows:
1577 %
1578 %    o wand: the magick wand.
1579 %
1580 %    o color_matrix:  the color matrix.
1581 %
1582 */
1583 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1584   const KernelInfo *color_matrix)
1585 {
1586   Image
1587     *color_image;
1588
1589   assert(wand != (MagickWand *) NULL);
1590   assert(wand->signature == WandSignature);
1591   if (IfMagickTrue(wand->debug))
1592     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1593   if (color_matrix == (const KernelInfo *) NULL)
1594     return(MagickFalse);
1595   if (wand->images == (Image *) NULL)
1596     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1597   color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1598   if (color_image == (Image *) NULL)
1599     return(MagickFalse);
1600   ReplaceImageInList(&wand->images,color_image);
1601   return(MagickTrue);
1602 }
1603 \f
1604 /*
1605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1606 %                                                                             %
1607 %                                                                             %
1608 %                                                                             %
1609 %   M a g i c k C o m b i n e I m a g e s                                     %
1610 %                                                                             %
1611 %                                                                             %
1612 %                                                                             %
1613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1614 %
1615 %  MagickCombineImages() combines one or more images into a single image.  The
1616 %  grayscale value of the pixels of each image in the sequence is assigned in
1617 %  order to the specified  hannels of the combined image.   The typical
1618 %  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1619 %
1620 %  The format of the MagickCombineImages method is:
1621 %
1622 %      MagickWand *MagickCombineImages(MagickWand *wand,
1623 %        const ColorspaceType colorspace)
1624 %
1625 %  A description of each parameter follows:
1626 %
1627 %    o wand: the magick wand.
1628 %
1629 %    o colorspace: the colorspace.
1630 %
1631 */
1632 WandExport MagickWand *MagickCombineImages(MagickWand *wand,
1633   const ColorspaceType colorspace)
1634 {
1635   Image
1636     *combine_image;
1637
1638   assert(wand != (MagickWand *) NULL);
1639   assert(wand->signature == WandSignature);
1640   if (IfMagickTrue(wand->debug))
1641     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1642   if (wand->images == (Image *) NULL)
1643     return((MagickWand *) NULL);
1644   combine_image=CombineImages(wand->images,colorspace,wand->exception);
1645   if (combine_image == (Image *) NULL)
1646     return((MagickWand *) NULL);
1647   return(CloneMagickWandFromImages(wand,combine_image));
1648 }
1649 \f
1650 /*
1651 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1652 %                                                                             %
1653 %                                                                             %
1654 %                                                                             %
1655 %   M a g i c k C o m m e n t I m a g e                                       %
1656 %                                                                             %
1657 %                                                                             %
1658 %                                                                             %
1659 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1660 %
1661 %  MagickCommentImage() adds a comment to your image.
1662 %
1663 %  The format of the MagickCommentImage method is:
1664 %
1665 %      MagickBooleanType MagickCommentImage(MagickWand *wand,
1666 %        const char *comment)
1667 %
1668 %  A description of each parameter follows:
1669 %
1670 %    o wand: the magick wand.
1671 %
1672 %    o comment: the image comment.
1673 %
1674 */
1675 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1676   const char *comment)
1677 {
1678   MagickBooleanType
1679     status;
1680
1681   assert(wand != (MagickWand *) NULL);
1682   assert(wand->signature == WandSignature);
1683   if (IfMagickTrue(wand->debug))
1684     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1685   if (wand->images == (Image *) NULL)
1686     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1687   status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1688   return(status);
1689 }
1690 \f
1691 /*
1692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1693 %                                                                             %
1694 %                                                                             %
1695 %                                                                             %
1696 %   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1697 %                                                                             %
1698 %                                                                             %
1699 %                                                                             %
1700 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1701 %
1702 %  MagickCompareImagesLayers() compares each image with the next in a sequence
1703 %  and returns the maximum bounding region of any pixel differences it
1704 %  discovers.
1705 %
1706 %  The format of the MagickCompareImagesLayers method is:
1707 %
1708 %      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1709 %        const LayerMethod method)
1710 %
1711 %  A description of each parameter follows:
1712 %
1713 %    o wand: the magick wand.
1714 %
1715 %    o method: the compare method.
1716 %
1717 */
1718 WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1719   const LayerMethod method)
1720 {
1721   Image
1722     *layers_image;
1723
1724   assert(wand != (MagickWand *) NULL);
1725   assert(wand->signature == WandSignature);
1726   if (IfMagickTrue(wand->debug))
1727     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1728   if (wand->images == (Image *) NULL)
1729     return((MagickWand *) NULL);
1730   layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1731   if (layers_image == (Image *) NULL)
1732     return((MagickWand *) NULL);
1733   return(CloneMagickWandFromImages(wand,layers_image));
1734 }
1735 \f
1736 /*
1737 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1738 %                                                                             %
1739 %                                                                             %
1740 %                                                                             %
1741 %   M a g i c k C o m p a r e I m a g e s                                     %
1742 %                                                                             %
1743 %                                                                             %
1744 %                                                                             %
1745 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1746 %
1747 %  MagickCompareImages() compares an image to a reconstructed image and returns
1748 %  the specified difference image.
1749 %
1750 %  The format of the MagickCompareImages method is:
1751 %
1752 %      MagickWand *MagickCompareImages(MagickWand *wand,
1753 %        const MagickWand *reference,const MetricType metric,
1754 %        double *distortion)
1755 %
1756 %  A description of each parameter follows:
1757 %
1758 %    o wand: the magick wand.
1759 %
1760 %    o reference: the reference wand.
1761 %
1762 %    o metric: the metric.
1763 %
1764 %    o distortion: the computed distortion between the images.
1765 %
1766 */
1767 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1768   const MagickWand *reference,const MetricType metric,double *distortion)
1769 {
1770   Image
1771     *compare_image;
1772
1773
1774   assert(wand != (MagickWand *) NULL);
1775   assert(wand->signature == WandSignature);
1776   if (IfMagickTrue(wand->debug))
1777     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1778   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1779     {
1780       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1781         "ContainsNoImages","`%s'",wand->name);
1782       return((MagickWand *) NULL);
1783     }
1784   compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1785     wand->exception);
1786   if (compare_image == (Image *) NULL)
1787     return((MagickWand *) NULL);
1788   return(CloneMagickWandFromImages(wand,compare_image));
1789 }
1790 \f
1791 /*
1792 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1793 %                                                                             %
1794 %                                                                             %
1795 %                                                                             %
1796 %   M a g i c k C o m p o s i t e I m a g e                                   %
1797 %                                                                             %
1798 %                                                                             %
1799 %                                                                             %
1800 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1801 %
1802 %  MagickCompositeImage() composite one image onto another at the specified
1803 %  offset.
1804 %
1805 %  The format of the MagickCompositeImage method is:
1806 %
1807 %      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1808 %        const MagickWand *source_wand,const CompositeOperator compose,
1809 %        const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1810 %
1811 %  A description of each parameter follows:
1812 %
1813 %    o wand: the magick wand holding the destination images
1814 %
1815 %    o source_image: the magick wand holding source image.
1816 %
1817 %    o compose: This operator affects how the composite is applied to the
1818 %      image.  The default is Over.  These are some of the compose methods
1819 %      availble.
1820 %
1821 %        OverCompositeOp       InCompositeOp         OutCompositeOp
1822 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1823 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1824 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1825 %        DisplaceCompositeOp
1826 %
1827 %    o clip_to_self: set to MagickTrue to limit composition to area composed.
1828 %
1829 %    o x: the column offset of the composited image.
1830 %
1831 %    o y: the row offset of the composited image.
1832 %
1833 */
1834 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1835   const MagickWand *source_wand,const CompositeOperator compose,
1836   const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1837 {
1838   MagickBooleanType
1839     status;
1840
1841   assert(wand != (MagickWand *) NULL);
1842   assert(wand->signature == WandSignature);
1843   if (IfMagickTrue(wand->debug))
1844     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1845   if ((wand->images == (Image *) NULL) ||
1846       (source_wand->images == (Image *) NULL))
1847     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1848   status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self,
1849     x,y,wand->exception);
1850   return(status);
1851 }
1852 \f
1853 /*
1854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1855 %                                                                             %
1856 %                                                                             %
1857 %                                                                             %
1858 %   M a g i c k C o m p o s i t e L a y e r s                                 %
1859 %                                                                             %
1860 %                                                                             %
1861 %                                                                             %
1862 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1863 %
1864 %  MagickCompositeLayers() composite the images in the source wand over the
1865 %  images in the destination wand in sequence, starting with the current
1866 %  image in both lists.
1867 %
1868 %  Each layer from the two image lists are composted together until the end of
1869 %  one of the image lists is reached.  The offset of each composition is also
1870 %  adjusted to match the virtual canvas offsets of each layer. As such the
1871 %  given offset is relative to the virtual canvas, and not the actual image.
1872 %
1873 %  Composition uses given x and y offsets, as the 'origin' location of the
1874 %  source images virtual canvas (not the real image) allowing you to compose a
1875 %  list of 'layer images' into the destiantioni images.  This makes it well
1876 %  sutiable for directly composing 'Clears Frame Animations' or 'Coaleased
1877 %  Animations' onto a static or other 'Coaleased Animation' destination image
1878 %  list.  GIF disposal handling is not looked at.
1879 %
1880 %  Special case:- If one of the image sequences is the last image (just a
1881 %  single image remaining), that image is repeatally composed with all the
1882 %  images in the other image list.  Either the source or destination lists may
1883 %  be the single image, for this situation.
1884 %
1885 %  In the case of a single destination image (or last image given), that image
1886 %  will ve cloned to match the number of images remaining in the source image
1887 %  list.
1888 %
1889 %  This is equivelent to the "-layer Composite" Shell API operator.
1890 %
1891 %  The format of the MagickCompositeLayers method is:
1892 %
1893 %      MagickBooleanType MagickCompositeLayers(MagickWand *wand,
1894 %        const MagickWand *source_wand, const CompositeOperator compose,
1895 %        const ssize_t x,const ssize_t y)
1896 %
1897 %  A description of each parameter follows:
1898 %
1899 %    o wand: the magick wand holding destaintion images
1900 %
1901 %    o source_wand: the wand holding the source images
1902 %
1903 %    o compose, x, y:  composition arguments
1904 %
1905 */
1906 WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand,
1907   const MagickWand *source_wand,const CompositeOperator compose,
1908   const ssize_t x,const ssize_t y)
1909 {
1910   MagickBooleanType
1911     status;
1912
1913   assert(wand != (MagickWand *) NULL);
1914   assert(wand->signature == WandSignature);
1915   if (IfMagickTrue(wand->debug))
1916     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1917   if ((wand->images == (Image *) NULL) ||
1918       (source_wand->images == (Image *) NULL))
1919     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1920   CompositeLayers(wand->images,compose,source_wand->images,x,y,wand->exception);
1921   status=MagickTrue;  /* FUTURE: determine status from exceptions */
1922   return(status);
1923 }
1924 \f
1925 /*
1926 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1927 %                                                                             %
1928 %                                                                             %
1929 %                                                                             %
1930 %   M a g i c k C o n t r a s t I m a g e                                     %
1931 %                                                                             %
1932 %                                                                             %
1933 %                                                                             %
1934 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1935 %
1936 %  MagickContrastImage() enhances the intensity differences between the lighter
1937 %  and darker elements of the image.  Set sharpen to a value other than 0 to
1938 %  increase the image contrast otherwise the contrast is reduced.
1939 %
1940 %  The format of the MagickContrastImage method is:
1941 %
1942 %      MagickBooleanType MagickContrastImage(MagickWand *wand,
1943 %        const MagickBooleanType sharpen)
1944 %
1945 %  A description of each parameter follows:
1946 %
1947 %    o wand: the magick wand.
1948 %
1949 %    o sharpen: Increase or decrease image contrast.
1950 %
1951 %
1952 */
1953 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1954   const MagickBooleanType sharpen)
1955 {
1956   MagickBooleanType
1957     status;
1958
1959   assert(wand != (MagickWand *) NULL);
1960   assert(wand->signature == WandSignature);
1961   if (IfMagickTrue(wand->debug))
1962     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1963   if (wand->images == (Image *) NULL)
1964     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1965   status=ContrastImage(wand->images,sharpen,wand->exception);
1966   return(status);
1967 }
1968 \f
1969 /*
1970 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1971 %                                                                             %
1972 %                                                                             %
1973 %                                                                             %
1974 %   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                       %
1975 %                                                                             %
1976 %                                                                             %
1977 %                                                                             %
1978 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1979 %
1980 %  MagickContrastStretchImage() enhances the contrast of a color image by
1981 %  adjusting the pixels color to span the entire range of colors available.
1982 %  You can also reduce the influence of a particular channel with a gamma
1983 %  value of 0.
1984 %
1985 %  The format of the MagickContrastStretchImage method is:
1986 %
1987 %      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1988 %        const double black_point,const double white_point)
1989 %
1990 %  A description of each parameter follows:
1991 %
1992 %    o wand: the magick wand.
1993 %
1994 %    o black_point: the black point.
1995 %
1996 %    o white_point: the white point.
1997 %
1998 */
1999 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2000   const double black_point,const double white_point)
2001 {
2002   MagickBooleanType
2003     status;
2004
2005   assert(wand != (MagickWand *) NULL);
2006   assert(wand->signature == WandSignature);
2007   if (IfMagickTrue(wand->debug))
2008     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2009   if (wand->images == (Image *) NULL)
2010     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2011   status=ContrastStretchImage(wand->images,black_point,white_point,
2012     wand->exception);
2013   return(status);
2014 }
2015 \f
2016 /*
2017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2018 %                                                                             %
2019 %                                                                             %
2020 %                                                                             %
2021 %   M a g i c k C o n v o l v e I m a g e                                     %
2022 %                                                                             %
2023 %                                                                             %
2024 %                                                                             %
2025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2026 %
2027 %  MagickConvolveImage() applies a custom convolution kernel to the image.
2028 %
2029 %  The format of the MagickConvolveImage method is:
2030 %
2031 %      MagickBooleanType MagickConvolveImage(MagickWand *wand,
2032 %        const KernelInfo *kernel)
2033 %
2034 %  A description of each parameter follows:
2035 %
2036 %    o wand: the magick wand.
2037 %
2038 %    o kernel: An array of doubles representing the convolution kernel.
2039 %
2040 */
2041 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2042   const KernelInfo *kernel)
2043 {
2044   Image
2045     *filter_image;
2046
2047   assert(wand != (MagickWand *) NULL);
2048   assert(wand->signature == WandSignature);
2049   if (IfMagickTrue(wand->debug))
2050     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2051   if (kernel == (const KernelInfo *) NULL)
2052     return(MagickFalse);
2053   if (wand->images == (Image *) NULL)
2054     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2055   filter_image=ConvolveImage(wand->images,kernel,wand->exception);
2056   if (filter_image == (Image *) NULL)
2057     return(MagickFalse);
2058   ReplaceImageInList(&wand->images,filter_image);
2059   return(MagickTrue);
2060 }
2061 \f
2062 /*
2063 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2064 %                                                                             %
2065 %                                                                             %
2066 %                                                                             %
2067 %   M a g i c k C r o p I m a g e                                             %
2068 %                                                                             %
2069 %                                                                             %
2070 %                                                                             %
2071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2072 %
2073 %  MagickCropImage() extracts a region of the image.
2074 %
2075 %  The format of the MagickCropImage method is:
2076 %
2077 %      MagickBooleanType MagickCropImage(MagickWand *wand,
2078 %        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2079 %
2080 %  A description of each parameter follows:
2081 %
2082 %    o wand: the magick wand.
2083 %
2084 %    o width: the region width.
2085 %
2086 %    o height: the region height.
2087 %
2088 %    o x: the region x-offset.
2089 %
2090 %    o y: the region y-offset.
2091 %
2092 */
2093 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2094   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2095 {
2096   Image
2097     *crop_image;
2098
2099   RectangleInfo
2100     crop;
2101
2102   assert(wand != (MagickWand *) NULL);
2103   assert(wand->signature == WandSignature);
2104   if (IfMagickTrue(wand->debug))
2105     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2106   if (wand->images == (Image *) NULL)
2107     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2108   crop.width=width;
2109   crop.height=height;
2110   crop.x=x;
2111   crop.y=y;
2112   crop_image=CropImage(wand->images,&crop,wand->exception);
2113   if (crop_image == (Image *) NULL)
2114     return(MagickFalse);
2115   ReplaceImageInList(&wand->images,crop_image);
2116   return(MagickTrue);
2117 }
2118 \f
2119 /*
2120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2121 %                                                                             %
2122 %                                                                             %
2123 %                                                                             %
2124 %   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2125 %                                                                             %
2126 %                                                                             %
2127 %                                                                             %
2128 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2129 %
2130 %  MagickCycleColormapImage() displaces an image's colormap by a given number
2131 %  of positions.  If you cycle the colormap a number of times you can produce
2132 %  a psychodelic effect.
2133 %
2134 %  The format of the MagickCycleColormapImage method is:
2135 %
2136 %      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2137 %        const ssize_t displace)
2138 %
2139 %  A description of each parameter follows:
2140 %
2141 %    o wand: the magick wand.
2142 %
2143 %    o pixel_wand: the pixel wand.
2144 %
2145 */
2146 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2147   const ssize_t displace)
2148 {
2149   MagickBooleanType
2150     status;
2151
2152   assert(wand != (MagickWand *) NULL);
2153   assert(wand->signature == WandSignature);
2154   if (IfMagickTrue(wand->debug))
2155     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2156   if (wand->images == (Image *) NULL)
2157     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2158   status=CycleColormapImage(wand->images,displace,wand->exception);
2159   return(status);
2160 }
2161 \f
2162 /*
2163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2164 %                                                                             %
2165 %                                                                             %
2166 %                                                                             %
2167 %   M a g i c k C o n s t i t u t e I m a g e                                 %
2168 %                                                                             %
2169 %                                                                             %
2170 %                                                                             %
2171 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2172 %
2173 %  MagickConstituteImage() adds an image to the wand comprised of the pixel
2174 %  data you supply.  The pixel data must be in scanline order top-to-bottom.
2175 %  The data can be char, short int, int, float, or double.  Float and double
2176 %  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2177 %  is the maximum value the type can accomodate (e.g. 255 for char).  For
2178 %  example, to create a 640x480 image from unsigned red-green-blue character
2179 %  data, use
2180 %
2181 %      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2182 %
2183 %  The format of the MagickConstituteImage method is:
2184 %
2185 %      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2186 %        const size_t columns,const size_t rows,const char *map,
2187 %        const StorageType storage,void *pixels)
2188 %
2189 %  A description of each parameter follows:
2190 %
2191 %    o wand: the magick wand.
2192 %
2193 %    o columns: width in pixels of the image.
2194 %
2195 %    o rows: height in pixels of the image.
2196 %
2197 %    o map:  This string reflects the expected ordering of the pixel array.
2198 %      It can be any combination or order of R = red, G = green, B = blue,
2199 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2200 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2201 %      P = pad.
2202 %
2203 %    o storage: Define the data type of the pixels.  Float and double types are
2204 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2205 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2206 %      LongPixel, QuantumPixel, or ShortPixel.
2207 %
2208 %    o pixels: This array of values contain the pixel components as defined by
2209 %      map and type.  You must preallocate this array where the expected
2210 %      length varies depending on the values of width, height, map, and type.
2211 %
2212 %
2213 */
2214 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2215   const size_t columns,const size_t rows,const char *map,
2216   const StorageType storage,const void *pixels)
2217 {
2218   Image
2219     *images;
2220
2221   assert(wand != (MagickWand *) NULL);
2222   assert(wand->signature == WandSignature);
2223   if (IfMagickTrue(wand->debug))
2224     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2225   images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2226   if (images == (Image *) NULL)
2227     return(MagickFalse);
2228   return(InsertImageInWand(wand,images));
2229 }
2230 \f
2231 /*
2232 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2233 %                                                                             %
2234 %                                                                             %
2235 %                                                                             %
2236 %   M a g i c k D e c i p h e r I m a g e                                     %
2237 %                                                                             %
2238 %                                                                             %
2239 %                                                                             %
2240 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2241 %
2242 %  MagickDecipherImage() converts cipher pixels to plain pixels.
2243 %
2244 %  The format of the MagickDecipherImage method is:
2245 %
2246 %      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2247 %        const char *passphrase)
2248 %
2249 %  A description of each parameter follows:
2250 %
2251 %    o wand: the magick wand.
2252 %
2253 %    o passphrase: the passphrase.
2254 %
2255 */
2256 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2257   const char *passphrase)
2258 {
2259   assert(wand != (MagickWand *) NULL);
2260   assert(wand->signature == WandSignature);
2261   if (IfMagickTrue(wand->debug))
2262     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2263   if (wand->images == (Image *) NULL)
2264     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2265   return(DecipherImage(wand->images,passphrase,wand->exception));
2266 }
2267 \f
2268 /*
2269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2270 %                                                                             %
2271 %                                                                             %
2272 %                                                                             %
2273 %   M a g i c k D e c o n s t r u c t I m a g e s                             %
2274 %                                                                             %
2275 %                                                                             %
2276 %                                                                             %
2277 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2278 %
2279 %  MagickDeconstructImages() compares each image with the next in a sequence
2280 %  and returns the maximum bounding region of any pixel differences it
2281 %  discovers.
2282 %
2283 %  The format of the MagickDeconstructImages method is:
2284 %
2285 %      MagickWand *MagickDeconstructImages(MagickWand *wand)
2286 %
2287 %  A description of each parameter follows:
2288 %
2289 %    o wand: the magick wand.
2290 %
2291 */
2292 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2293 {
2294   Image
2295     *deconstruct_image;
2296
2297   assert(wand != (MagickWand *) NULL);
2298   assert(wand->signature == WandSignature);
2299   if (IfMagickTrue(wand->debug))
2300     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2301   if (wand->images == (Image *) NULL)
2302     return((MagickWand *) NULL);
2303   deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2304     wand->exception);
2305   if (deconstruct_image == (Image *) NULL)
2306     return((MagickWand *) NULL);
2307   return(CloneMagickWandFromImages(wand,deconstruct_image));
2308 }
2309 \f
2310 /*
2311 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2312 %                                                                             %
2313 %                                                                             %
2314 %                                                                             %
2315 %     M a g i c k D e s k e w I m a g e                                       %
2316 %                                                                             %
2317 %                                                                             %
2318 %                                                                             %
2319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2320 %
2321 %  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2322 %  occurs in scanned images because of the camera being misaligned,
2323 %  imperfections in the scanning or surface, or simply because the paper was
2324 %  not placed completely flat when scanned.
2325 %
2326 %  The format of the MagickDeskewImage method is:
2327 %
2328 %      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2329 %        const double threshold)
2330 %
2331 %  A description of each parameter follows:
2332 %
2333 %    o wand: the magick wand.
2334 %
2335 %    o threshold: separate background from foreground.
2336 %
2337 */
2338 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2339   const double threshold)
2340 {
2341   Image
2342     *sepia_image;
2343
2344   assert(wand != (MagickWand *) NULL);
2345   assert(wand->signature == WandSignature);
2346   if (IfMagickTrue(wand->debug))
2347     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2348   if (wand->images == (Image *) NULL)
2349     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2350   sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2351   if (sepia_image == (Image *) NULL)
2352     return(MagickFalse);
2353   ReplaceImageInList(&wand->images,sepia_image);
2354   return(MagickTrue);
2355 }
2356 \f
2357 /*
2358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2359 %                                                                             %
2360 %                                                                             %
2361 %                                                                             %
2362 %     M a g i c k D e s p e c k l e I m a g e                                 %
2363 %                                                                             %
2364 %                                                                             %
2365 %                                                                             %
2366 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2367 %
2368 %  MagickDespeckleImage() reduces the speckle noise in an image while
2369 %  perserving the edges of the original image.
2370 %
2371 %  The format of the MagickDespeckleImage method is:
2372 %
2373 %      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2374 %
2375 %  A description of each parameter follows:
2376 %
2377 %    o wand: the magick wand.
2378 %
2379 */
2380 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2381 {
2382   Image
2383     *despeckle_image;
2384
2385   assert(wand != (MagickWand *) NULL);
2386   assert(wand->signature == WandSignature);
2387   if (IfMagickTrue(wand->debug))
2388     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2389   if (wand->images == (Image *) NULL)
2390     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2391   despeckle_image=DespeckleImage(wand->images,wand->exception);
2392   if (despeckle_image == (Image *) NULL)
2393     return(MagickFalse);
2394   ReplaceImageInList(&wand->images,despeckle_image);
2395   return(MagickTrue);
2396 }
2397 \f
2398 /*
2399 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2400 %                                                                             %
2401 %                                                                             %
2402 %                                                                             %
2403 %   M a g i c k D e s t r o y I m a g e                                       %
2404 %                                                                             %
2405 %                                                                             %
2406 %                                                                             %
2407 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2408 %
2409 %  MagickDestroyImage() dereferences an image, deallocating memory associated
2410 %  with the image if the reference count becomes zero.
2411 %
2412 %  The format of the MagickDestroyImage method is:
2413 %
2414 %      Image *MagickDestroyImage(Image *image)
2415 %
2416 %  A description of each parameter follows:
2417 %
2418 %    o image: the image.
2419 %
2420 */
2421 WandExport Image *MagickDestroyImage(Image *image)
2422 {
2423   return(DestroyImage(image));
2424 }
2425 \f
2426 /*
2427 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2428 %                                                                             %
2429 %                                                                             %
2430 %                                                                             %
2431 %   M a g i c k D i s p l a y I m a g e                                       %
2432 %                                                                             %
2433 %                                                                             %
2434 %                                                                             %
2435 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2436 %
2437 %  MagickDisplayImage() displays an image.
2438 %
2439 %  The format of the MagickDisplayImage method is:
2440 %
2441 %      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2442 %        const char *server_name)
2443 %
2444 %  A description of each parameter follows:
2445 %
2446 %    o wand: the magick wand.
2447 %
2448 %    o server_name: the X server name.
2449 %
2450 */
2451 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2452   const char *server_name)
2453 {
2454   Image
2455     *image;
2456
2457   MagickBooleanType
2458     status;
2459
2460   assert(wand != (MagickWand *) NULL);
2461   assert(wand->signature == WandSignature);
2462   if (IfMagickTrue(wand->debug))
2463     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2464   if (wand->images == (Image *) NULL)
2465     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2466   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2467   if (image == (Image *) NULL)
2468     return(MagickFalse);
2469   (void) CloneString(&wand->image_info->server_name,server_name);
2470   status=DisplayImages(wand->image_info,image,wand->exception);
2471   image=DestroyImage(image);
2472   return(status);
2473 }
2474 \f
2475 /*
2476 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2477 %                                                                             %
2478 %                                                                             %
2479 %                                                                             %
2480 %   M a g i c k D i s p l a y I m a g e s                                     %
2481 %                                                                             %
2482 %                                                                             %
2483 %                                                                             %
2484 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2485 %
2486 %  MagickDisplayImages() displays an image or image sequence.
2487 %
2488 %  The format of the MagickDisplayImages method is:
2489 %
2490 %      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2491 %        const char *server_name)
2492 %
2493 %  A description of each parameter follows:
2494 %
2495 %    o wand: the magick wand.
2496 %
2497 %    o server_name: the X server name.
2498 %
2499 */
2500 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2501   const char *server_name)
2502 {
2503   MagickBooleanType
2504     status;
2505
2506   assert(wand != (MagickWand *) NULL);
2507   assert(wand->signature == WandSignature);
2508   if (IfMagickTrue(wand->debug))
2509     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2510   (void) CloneString(&wand->image_info->server_name,server_name);
2511   status=DisplayImages(wand->image_info,wand->images,wand->exception);
2512   return(status);
2513 }
2514 \f
2515 /*
2516 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2517 %                                                                             %
2518 %                                                                             %
2519 %                                                                             %
2520 %   M a g i c k D i s t o r t I m a g e                                       %
2521 %                                                                             %
2522 %                                                                             %
2523 %                                                                             %
2524 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2525 %
2526 %  MagickDistortImage() distorts an image using various distortion methods, by
2527 %  mapping color lookups of the source image to a new destination image
2528 %  usally of the same size as the source image, unless 'bestfit' is set to
2529 %  true.
2530 %
2531 %  If 'bestfit' is enabled, and distortion allows it, the destination image is
2532 %  adjusted to ensure the whole source 'image' will just fit within the final
2533 %  destination image, which will be sized and offset accordingly.  Also in
2534 %  many cases the virtual offset of the source image will be taken into
2535 %  account in the mapping.
2536 %
2537 %  The format of the MagickDistortImage method is:
2538 %
2539 %      MagickBooleanType MagickDistortImage(MagickWand *wand,
2540 %        const DistortImageMethod method,const size_t number_arguments,
2541 %        const double *arguments,const MagickBooleanType bestfit)
2542 %
2543 %  A description of each parameter follows:
2544 %
2545 %    o image: the image to be distorted.
2546 %
2547 %    o method: the method of image distortion.
2548 %
2549 %        ArcDistortion always ignores the source image offset, and always
2550 %        'bestfit' the destination image with the top left corner offset
2551 %        relative to the polar mapping center.
2552 %
2553 %        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2554 %        style of image distortion.
2555 %
2556 %        Affine, Perspective, and Bilinear, do least squares fitting of the
2557 %        distortion when more than the minimum number of control point pairs
2558 %        are provided.
2559 %
2560 %        Perspective, and Bilinear, falls back to a Affine distortion when less
2561 %        that 4 control point pairs are provided. While Affine distortions let
2562 %        you use any number of control point pairs, that is Zero pairs is a
2563 %        no-Op (viewport only) distrotion, one pair is a translation and two
2564 %        pairs of control points do a scale-rotate-translate, without any
2565 %        shearing.
2566 %
2567 %    o number_arguments: the number of arguments given for this distortion
2568 %      method.
2569 %
2570 %    o arguments: the arguments for this distortion method.
2571 %
2572 %    o bestfit: Attempt to resize destination to fit distorted source.
2573 %
2574 */
2575 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2576   const DistortImageMethod method,const size_t number_arguments,
2577   const double *arguments,const MagickBooleanType bestfit)
2578 {
2579   Image
2580     *distort_image;
2581
2582   assert(wand != (MagickWand *) NULL);
2583   assert(wand->signature == WandSignature);
2584   if (IfMagickTrue(wand->debug))
2585     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2586   if (wand->images == (Image *) NULL)
2587     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2588   distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2589     bestfit,wand->exception);
2590   if (distort_image == (Image *) NULL)
2591     return(MagickFalse);
2592   ReplaceImageInList(&wand->images,distort_image);
2593   return(MagickTrue);
2594 }
2595 \f
2596 /*
2597 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2598 %                                                                             %
2599 %                                                                             %
2600 %                                                                             %
2601 %   M a g i c k D r a w I m a g e                                             %
2602 %                                                                             %
2603 %                                                                             %
2604 %                                                                             %
2605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2606 %
2607 %  MagickDrawImage() renders the drawing wand on the current image.
2608 %
2609 %  The format of the MagickDrawImage method is:
2610 %
2611 %      MagickBooleanType MagickDrawImage(MagickWand *wand,
2612 %        const DrawingWand *drawing_wand)
2613 %
2614 %  A description of each parameter follows:
2615 %
2616 %    o wand: the magick wand.
2617 %
2618 %    o drawing_wand: the draw wand.
2619 %
2620 */
2621 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2622   const DrawingWand *drawing_wand)
2623 {
2624   char
2625     *primitive;
2626
2627   DrawInfo
2628     *draw_info;
2629
2630   MagickBooleanType
2631     status;
2632
2633   assert(wand != (MagickWand *) NULL);
2634   assert(wand->signature == WandSignature);
2635   if (IfMagickTrue(wand->debug))
2636     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2637   if (wand->images == (Image *) NULL)
2638     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2639   draw_info=PeekDrawingWand(drawing_wand);
2640   if ((draw_info == (DrawInfo *) NULL) ||
2641       (draw_info->primitive == (char *) NULL))
2642     return(MagickFalse);
2643   primitive=AcquireString(draw_info->primitive);
2644   draw_info=DestroyDrawInfo(draw_info);
2645   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2646   draw_info->primitive=primitive;
2647   status=DrawImage(wand->images,draw_info,wand->exception);
2648   draw_info=DestroyDrawInfo(draw_info);
2649   return(status);
2650 }
2651 \f
2652 /*
2653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2654 %                                                                             %
2655 %                                                                             %
2656 %                                                                             %
2657 %   M a g i c k E d g e I m a g e                                             %
2658 %                                                                             %
2659 %                                                                             %
2660 %                                                                             %
2661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2662 %
2663 %  MagickEdgeImage() enhance edges within the image with a convolution filter
2664 %  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2665 %  radius for you.
2666 %
2667 %  The format of the MagickEdgeImage method is:
2668 %
2669 %      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2670 %
2671 %  A description of each parameter follows:
2672 %
2673 %    o wand: the magick wand.
2674 %
2675 %    o radius: the radius of the pixel neighborhood.
2676 %
2677 */
2678 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2679   const double radius)
2680 {
2681   Image
2682     *edge_image;
2683
2684   assert(wand != (MagickWand *) NULL);
2685   assert(wand->signature == WandSignature);
2686   if (IfMagickTrue(wand->debug))
2687     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2688   if (wand->images == (Image *) NULL)
2689     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2690   edge_image=EdgeImage(wand->images,radius,wand->exception);
2691   if (edge_image == (Image *) NULL)
2692     return(MagickFalse);
2693   ReplaceImageInList(&wand->images,edge_image);
2694   return(MagickTrue);
2695 }
2696 \f
2697 /*
2698 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2699 %                                                                             %
2700 %                                                                             %
2701 %                                                                             %
2702 %   M a g i c k E m b o s s I m a g e                                         %
2703 %                                                                             %
2704 %                                                                             %
2705 %                                                                             %
2706 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2707 %
2708 %  MagickEmbossImage() returns a grayscale image with a three-dimensional
2709 %  effect.  We convolve the image with a Gaussian operator of the given radius
2710 %  and standard deviation (sigma).  For reasonable results, radius should be
2711 %  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2712 %  radius for you.
2713 %
2714 %  The format of the MagickEmbossImage method is:
2715 %
2716 %      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2717 %        const double sigma)
2718 %
2719 %  A description of each parameter follows:
2720 %
2721 %    o wand: the magick wand.
2722 %
2723 %    o radius: the radius of the Gaussian, in pixels, not counting the center
2724 %      pixel.
2725 %
2726 %    o sigma: the standard deviation of the Gaussian, in pixels.
2727 %
2728 */
2729 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2730   const double radius,const double sigma)
2731 {
2732   Image
2733     *emboss_image;
2734
2735   assert(wand != (MagickWand *) NULL);
2736   assert(wand->signature == WandSignature);
2737   if (IfMagickTrue(wand->debug))
2738     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2739   if (wand->images == (Image *) NULL)
2740     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2741   emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2742   if (emboss_image == (Image *) NULL)
2743     return(MagickFalse);
2744   ReplaceImageInList(&wand->images,emboss_image);
2745   return(MagickTrue);
2746 }
2747 \f
2748 /*
2749 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2750 %                                                                             %
2751 %                                                                             %
2752 %                                                                             %
2753 %   M a g i c k E n c i p h e r I m a g e                                     %
2754 %                                                                             %
2755 %                                                                             %
2756 %                                                                             %
2757 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2758 %
2759 %  MagickEncipherImage() converts plaint pixels to cipher pixels.
2760 %
2761 %  The format of the MagickEncipherImage method is:
2762 %
2763 %      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2764 %        const char *passphrase)
2765 %
2766 %  A description of each parameter follows:
2767 %
2768 %    o wand: the magick wand.
2769 %
2770 %    o passphrase: the passphrase.
2771 %
2772 */
2773 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2774   const char *passphrase)
2775 {
2776   assert(wand != (MagickWand *) NULL);
2777   assert(wand->signature == WandSignature);
2778   if (IfMagickTrue(wand->debug))
2779     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2780   if (wand->images == (Image *) NULL)
2781     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2782   return(EncipherImage(wand->images,passphrase,wand->exception));
2783 }
2784 \f
2785 /*
2786 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2787 %                                                                             %
2788 %                                                                             %
2789 %                                                                             %
2790 %   M a g i c k E n h a n c e I m a g e                                       %
2791 %                                                                             %
2792 %                                                                             %
2793 %                                                                             %
2794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2795 %
2796 %  MagickEnhanceImage() applies a digital filter that improves the quality of a
2797 %  noisy image.
2798 %
2799 %  The format of the MagickEnhanceImage method is:
2800 %
2801 %      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2802 %
2803 %  A description of each parameter follows:
2804 %
2805 %    o wand: the magick wand.
2806 %
2807 */
2808 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2809 {
2810   Image
2811     *enhance_image;
2812
2813   assert(wand != (MagickWand *) NULL);
2814   assert(wand->signature == WandSignature);
2815   if (IfMagickTrue(wand->debug))
2816     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2817   if (wand->images == (Image *) NULL)
2818     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2819   enhance_image=EnhanceImage(wand->images,wand->exception);
2820   if (enhance_image == (Image *) NULL)
2821     return(MagickFalse);
2822   ReplaceImageInList(&wand->images,enhance_image);
2823   return(MagickTrue);
2824 }
2825 \f
2826 /*
2827 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2828 %                                                                             %
2829 %                                                                             %
2830 %                                                                             %
2831 %   M a g i c k E q u a l i z e I m a g e                                     %
2832 %                                                                             %
2833 %                                                                             %
2834 %                                                                             %
2835 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2836 %
2837 %  MagickEqualizeImage() equalizes the image histogram.
2838 %
2839 %  The format of the MagickEqualizeImage method is:
2840 %
2841 %      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2842 %
2843 %  A description of each parameter follows:
2844 %
2845 %    o wand: the magick wand.
2846 %
2847 %    o channel: the image channel(s).
2848 %
2849 */
2850 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2851 {
2852   MagickBooleanType
2853     status;
2854
2855   assert(wand != (MagickWand *) NULL);
2856   assert(wand->signature == WandSignature);
2857   if (IfMagickTrue(wand->debug))
2858     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2859   if (wand->images == (Image *) NULL)
2860     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2861   status=EqualizeImage(wand->images,wand->exception);
2862   return(status);
2863 }
2864 \f
2865 /*
2866 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2867 %                                                                             %
2868 %                                                                             %
2869 %                                                                             %
2870 %   M a g i c k E v a l u a t e I m a g e                                     %
2871 %                                                                             %
2872 %                                                                             %
2873 %                                                                             %
2874 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2875 %
2876 %  MagickEvaluateImage() applys an arithmetic, relational, or logical
2877 %  expression to an image.  Use these operators to lighten or darken an image,
2878 %  to increase or decrease contrast in an image, or to produce the "negative"
2879 %  of an image.
2880 %
2881 %  The format of the MagickEvaluateImage method is:
2882 %
2883 %      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2884 %        const MagickEvaluateOperator operator,const double value)
2885 %      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2886 %        const MagickEvaluateOperator operator)
2887 %
2888 %  A description of each parameter follows:
2889 %
2890 %    o wand: the magick wand.
2891 %
2892 %    o op: A channel operator.
2893 %
2894 %    o value: A value value.
2895 %
2896 */
2897
2898 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2899   const MagickEvaluateOperator op)
2900 {
2901   Image
2902     *evaluate_image;
2903
2904   assert(wand != (MagickWand *) NULL);
2905   assert(wand->signature == WandSignature);
2906   if (IfMagickTrue(wand->debug))
2907     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2908   if (wand->images == (Image *) NULL)
2909     return((MagickWand *) NULL);
2910   evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2911   if (evaluate_image == (Image *) NULL)
2912     return((MagickWand *) NULL);
2913   return(CloneMagickWandFromImages(wand,evaluate_image));
2914 }
2915
2916 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2917   const MagickEvaluateOperator op,const double value)
2918 {
2919   MagickBooleanType
2920     status;
2921
2922   assert(wand != (MagickWand *) NULL);
2923   assert(wand->signature == WandSignature);
2924   if (IfMagickTrue(wand->debug))
2925     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2926   if (wand->images == (Image *) NULL)
2927     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2928   status=EvaluateImage(wand->images,op,value,wand->exception);
2929   return(status);
2930 }
2931 \f
2932 /*
2933 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2934 %                                                                             %
2935 %                                                                             %
2936 %                                                                             %
2937 %   M a g i c k E x p o r t I m a g e P i x e l s                             %
2938 %                                                                             %
2939 %                                                                             %
2940 %                                                                             %
2941 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2942 %
2943 %  MagickExportImagePixels() extracts pixel data from an image and returns it
2944 %  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2945 %  an error is encountered.  The data is returned as char, short int, int,
2946 %  ssize_t, float, or double in the order specified by map.
2947 %
2948 %  Suppose you want to extract the first scanline of a 640x480 image as
2949 %  character data in red-green-blue order:
2950 %
2951 %      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
2952 %
2953 %  The format of the MagickExportImagePixels method is:
2954 %
2955 %      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2956 %        const ssize_t x,const ssize_t y,const size_t columns,
2957 %        const size_t rows,const char *map,const StorageType storage,
2958 %        void *pixels)
2959 %
2960 %  A description of each parameter follows:
2961 %
2962 %    o wand: the magick wand.
2963 %
2964 %    o x, y, columns, rows:  These values define the perimeter
2965 %      of a region of pixels you want to extract.
2966 %
2967 %    o map:  This string reflects the expected ordering of the pixel array.
2968 %      It can be any combination or order of R = red, G = green, B = blue,
2969 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2970 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2971 %      P = pad.
2972 %
2973 %    o storage: Define the data type of the pixels.  Float and double types are
2974 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2975 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2976 %      LongPixel, QuantumPixel, or ShortPixel.
2977 %
2978 %    o pixels: This array of values contain the pixel components as defined by
2979 %      map and type.  You must preallocate this array where the expected
2980 %      length varies depending on the values of width, height, map, and type.
2981 %
2982 */
2983 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2984   const ssize_t x,const ssize_t y,const size_t columns,
2985   const size_t rows,const char *map,const StorageType storage,
2986   void *pixels)
2987 {
2988   MagickBooleanType
2989     status;
2990
2991   assert(wand != (MagickWand *) NULL);
2992   assert(wand->signature == WandSignature);
2993   if (IfMagickTrue(wand->debug))
2994     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2995   if (wand->images == (Image *) NULL)
2996     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2997   status=ExportImagePixels(wand->images,x,y,columns,rows,map,
2998     storage,pixels,wand->exception);
2999   return(status);
3000 }
3001 \f
3002 /*
3003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3004 %                                                                             %
3005 %                                                                             %
3006 %                                                                             %
3007 %   M a g i c k E x t e n t I m a g e                                         %
3008 %                                                                             %
3009 %                                                                             %
3010 %                                                                             %
3011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3012 %
3013 %  MagickExtentImage() extends the image as defined by the geometry, gravity,
3014 %  and wand background color.  Set the (x,y) offset of the geometry to move
3015 %  the original wand relative to the extended wand.
3016 %
3017 %  The format of the MagickExtentImage method is:
3018 %
3019 %      MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
3020 %        const size_t height,const ssize_t x,const ssize_t y)
3021 %
3022 %  A description of each parameter follows:
3023 %
3024 %    o wand: the magick wand.
3025 %
3026 %    o width: the region width.
3027 %
3028 %    o height: the region height.
3029 %
3030 %    o x: the region x offset.
3031 %
3032 %    o y: the region y offset.
3033 %
3034 */
3035 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3036   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
3037 {
3038   Image
3039     *extent_image;
3040
3041   RectangleInfo
3042     extent;
3043
3044   assert(wand != (MagickWand *) NULL);
3045   assert(wand->signature == WandSignature);
3046   if (IfMagickTrue(wand->debug))
3047     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3048   if (wand->images == (Image *) NULL)
3049     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3050   extent.width=width;
3051   extent.height=height;
3052   extent.x=x;
3053   extent.y=y;
3054   extent_image=ExtentImage(wand->images,&extent,wand->exception);
3055   if (extent_image == (Image *) NULL)
3056     return(MagickFalse);
3057   ReplaceImageInList(&wand->images,extent_image);
3058   return(MagickTrue);
3059 }
3060 \f
3061 /*
3062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3063 %                                                                             %
3064 %                                                                             %
3065 %                                                                             %
3066 %   M a g i c k F l i p I m a g e                                             %
3067 %                                                                             %
3068 %                                                                             %
3069 %                                                                             %
3070 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3071 %
3072 %  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3073 %  around the central x-axis.
3074 %
3075 %  The format of the MagickFlipImage method is:
3076 %
3077 %      MagickBooleanType MagickFlipImage(MagickWand *wand)
3078 %
3079 %  A description of each parameter follows:
3080 %
3081 %    o wand: the magick wand.
3082 %
3083 */
3084 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3085 {
3086   Image
3087     *flip_image;
3088
3089   assert(wand != (MagickWand *) NULL);
3090   assert(wand->signature == WandSignature);
3091   if (IfMagickTrue(wand->debug))
3092     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3093   if (wand->images == (Image *) NULL)
3094     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3095   flip_image=FlipImage(wand->images,wand->exception);
3096   if (flip_image == (Image *) NULL)
3097     return(MagickFalse);
3098   ReplaceImageInList(&wand->images,flip_image);
3099   return(MagickTrue);
3100 }
3101 \f
3102 /*
3103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3104 %                                                                             %
3105 %                                                                             %
3106 %                                                                             %
3107 %   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                         %
3108 %                                                                             %
3109 %                                                                             %
3110 %                                                                             %
3111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3112 %
3113 %  MagickFloodfillPaintImage() changes the color value of any pixel that matches
3114 %  target and is an immediate neighbor.  If the method FillToBorderMethod is
3115 %  specified, the color value is changed for any neighbor pixel that does not
3116 %  match the bordercolor member of image.
3117 %
3118 %  The format of the MagickFloodfillPaintImage method is:
3119 %
3120 %      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3121 %        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3122 %        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3123 %
3124 %  A description of each parameter follows:
3125 %
3126 %    o wand: the magick wand.
3127 %
3128 %    o fill: the floodfill color pixel wand.
3129 %
3130 %    o fuzz: By default target must match a particular pixel color
3131 %      exactly.  However, in many cases two colors may differ by a small amount.
3132 %      The fuzz member of image defines how much tolerance is acceptable to
3133 %      consider two colors as the same.  For example, set fuzz to 10 and the
3134 %      color red at intensities of 100 and 102 respectively are now interpreted
3135 %      as the same color for the purposes of the floodfill.
3136 %
3137 %    o bordercolor: the border color pixel wand.
3138 %
3139 %    o x,y: the starting location of the operation.
3140 %
3141 %    o invert: paint any pixel that does not match the target color.
3142 %
3143 */
3144 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3145   const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3146   const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3147 {
3148   DrawInfo
3149     *draw_info;
3150
3151   MagickBooleanType
3152     status;
3153
3154   PixelInfo
3155     target;
3156
3157   assert(wand != (MagickWand *) NULL);
3158   assert(wand->signature == WandSignature);
3159   if (IfMagickTrue(wand->debug))
3160     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3161   if (wand->images == (Image *) NULL)
3162     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3163   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3164   PixelGetQuantumPacket(fill,&draw_info->fill);
3165   (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
3166     wand->images->columns,y % wand->images->rows,&target,wand->exception);
3167   if (bordercolor != (PixelWand *) NULL)
3168     PixelGetMagickColor(bordercolor,&target);
3169   wand->images->fuzz=fuzz;
3170   status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3171     wand->exception);
3172   draw_info=DestroyDrawInfo(draw_info);
3173   return(status);
3174 }
3175 \f
3176 /*
3177 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3178 %                                                                             %
3179 %                                                                             %
3180 %                                                                             %
3181 %   M a g i c k F l o p I m a g e                                             %
3182 %                                                                             %
3183 %                                                                             %
3184 %                                                                             %
3185 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3186 %
3187 %  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3188 %  around the central y-axis.
3189 %
3190 %  The format of the MagickFlopImage method is:
3191 %
3192 %      MagickBooleanType MagickFlopImage(MagickWand *wand)
3193 %
3194 %  A description of each parameter follows:
3195 %
3196 %    o wand: the magick wand.
3197 %
3198 */
3199 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3200 {
3201   Image
3202     *flop_image;
3203
3204   assert(wand != (MagickWand *) NULL);
3205   assert(wand->signature == WandSignature);
3206   if (IfMagickTrue(wand->debug))
3207     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3208   if (wand->images == (Image *) NULL)
3209     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3210   flop_image=FlopImage(wand->images,wand->exception);
3211   if (flop_image == (Image *) NULL)
3212     return(MagickFalse);
3213   ReplaceImageInList(&wand->images,flop_image);
3214   return(MagickTrue);
3215 }
3216 \f
3217 /*
3218 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3219 %                                                                             %
3220 %                                                                             %
3221 %                                                                             %
3222 %   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                     %
3223 %                                                                             %
3224 %                                                                             %
3225 %                                                                             %
3226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3227 %
3228 %  MagickForwardFourierTransformImage() implements the discrete Fourier
3229 %  transform (DFT) of the image either as a magnitude / phase or real /
3230 %  imaginary image pair.
3231 %
3232 %  The format of the MagickForwardFourierTransformImage method is:
3233 %
3234 %      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3235 %        const MagickBooleanType magnitude)
3236 %
3237 %  A description of each parameter follows:
3238 %
3239 %    o wand: the magick wand.
3240 %
3241 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3242 %      imaginary image pair.
3243 %
3244 */
3245 WandExport MagickBooleanType MagickForwardFourierTransformImage(
3246   MagickWand *wand,const MagickBooleanType magnitude)
3247 {
3248   Image
3249     *forward_image;
3250
3251   assert(wand != (MagickWand *) NULL);
3252   assert(wand->signature == WandSignature);
3253   if (IfMagickTrue(wand->debug))
3254     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3255   if (wand->images == (Image *) NULL)
3256     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3257   forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3258     wand->exception);
3259   if (forward_image == (Image *) NULL)
3260     return(MagickFalse);
3261   ReplaceImageInList(&wand->images,forward_image);
3262   return(MagickTrue);
3263 }
3264 \f
3265 /*
3266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3267 %                                                                             %
3268 %                                                                             %
3269 %                                                                             %
3270 %   M a g i c k F r a m e I m a g e                                           %
3271 %                                                                             %
3272 %                                                                             %
3273 %                                                                             %
3274 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3275 %
3276 %  MagickFrameImage() adds a simulated three-dimensional border around the
3277 %  image.  The width and height specify the border width of the vertical and
3278 %  horizontal sides of the frame.  The inner and outer bevels indicate the
3279 %  width of the inner and outer shadows of the frame.
3280 %
3281 %  The format of the MagickFrameImage method is:
3282 %
3283 %      MagickBooleanType MagickFrameImage(MagickWand *wand,
3284 %        const PixelWand *matte_color,const size_t width,
3285 %        const size_t height,const ssize_t inner_bevel,
3286 %        const ssize_t outer_bevel,const CompositeOperator compose)
3287 %
3288 %  A description of each parameter follows:
3289 %
3290 %    o wand: the magick wand.
3291 %
3292 %    o matte_color: the frame color pixel wand.
3293 %
3294 %    o width: the border width.
3295 %
3296 %    o height: the border height.
3297 %
3298 %    o inner_bevel: the inner bevel width.
3299 %
3300 %    o outer_bevel: the outer bevel width.
3301 %
3302 %    o compose: the composite operator.
3303 %
3304 */
3305 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3306   const PixelWand *matte_color,const size_t width,const size_t height,
3307   const ssize_t inner_bevel,const ssize_t outer_bevel,
3308   const CompositeOperator compose)
3309 {
3310   Image
3311     *frame_image;
3312
3313   FrameInfo
3314     frame_info;
3315
3316   assert(wand != (MagickWand *) NULL);
3317   assert(wand->signature == WandSignature);
3318   if (IfMagickTrue(wand->debug))
3319     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3320   if (wand->images == (Image *) NULL)
3321     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3322   (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3323   frame_info.width=wand->images->columns+2*width;
3324   frame_info.height=wand->images->rows+2*height;
3325   frame_info.x=(ssize_t) width;
3326   frame_info.y=(ssize_t) height;
3327   frame_info.inner_bevel=inner_bevel;
3328   frame_info.outer_bevel=outer_bevel;
3329   PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3330   frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3331   if (frame_image == (Image *) NULL)
3332     return(MagickFalse);
3333   ReplaceImageInList(&wand->images,frame_image);
3334   return(MagickTrue);
3335 }
3336 \f
3337 /*
3338 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3339 %                                                                             %
3340 %                                                                             %
3341 %                                                                             %
3342 %   M a g i c k F u n c t i o n I m a g e                                     %
3343 %                                                                             %
3344 %                                                                             %
3345 %                                                                             %
3346 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3347 %
3348 %  MagickFunctionImage() applys an arithmetic, relational, or logical
3349 %  expression to an image.  Use these operators to lighten or darken an image,
3350 %  to increase or decrease contrast in an image, or to produce the "negative"
3351 %  of an image.
3352 %
3353 %  The format of the MagickFunctionImage method is:
3354 %
3355 %      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3356 %        const MagickFunction function,const size_t number_arguments,
3357 %        const double *arguments)
3358 %
3359 %  A description of each parameter follows:
3360 %
3361 %    o wand: the magick wand.
3362 %
3363 %    o function: the image function.
3364 %
3365 %    o number_arguments: the number of function arguments.
3366 %
3367 %    o arguments: the function arguments.
3368 %
3369 */
3370 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3371   const MagickFunction function,const size_t number_arguments,
3372   const double *arguments)
3373 {
3374   MagickBooleanType
3375     status;
3376
3377   assert(wand != (MagickWand *) NULL);
3378   assert(wand->signature == WandSignature);
3379   if (IfMagickTrue(wand->debug))
3380     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3381   if (wand->images == (Image *) NULL)
3382     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3383   status=FunctionImage(wand->images,function,number_arguments,arguments,
3384     wand->exception);
3385   return(status);
3386 }
3387 \f
3388 /*
3389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3390 %                                                                             %
3391 %                                                                             %
3392 %                                                                             %
3393 %   M a g i c k F x I m a g e                                                 %
3394 %                                                                             %
3395 %                                                                             %
3396 %                                                                             %
3397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3398 %
3399 %  MagickFxImage() evaluate expression for each pixel in the image.
3400 %
3401 %  The format of the MagickFxImage method is:
3402 %
3403 %      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3404 %
3405 %  A description of each parameter follows:
3406 %
3407 %    o wand: the magick wand.
3408 %
3409 %    o expression: the expression.
3410 %
3411 */
3412 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3413 {
3414   Image
3415     *fx_image;
3416
3417   assert(wand != (MagickWand *) NULL);
3418   assert(wand->signature == WandSignature);
3419   if (IfMagickTrue(wand->debug))
3420     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3421   if (wand->images == (Image *) NULL)
3422     return((MagickWand *) NULL);
3423   fx_image=FxImage(wand->images,expression,wand->exception);
3424   if (fx_image == (Image *) NULL)
3425     return((MagickWand *) NULL);
3426   return(CloneMagickWandFromImages(wand,fx_image));
3427 }
3428 \f
3429 /*
3430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3431 %                                                                             %
3432 %                                                                             %
3433 %                                                                             %
3434 %   M a g i c k G a m m a I m a g e                                           %
3435 %                                                                             %
3436 %                                                                             %
3437 %                                                                             %
3438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3439 %
3440 %  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3441 %  different devices will have perceptual differences in the way the image's
3442 %  intensities are represented on the screen.  Specify individual gamma levels
3443 %  for the red, green, and blue channels, or adjust all three with the gamma
3444 %  parameter.  Values typically range from 0.8 to 2.3.
3445 %
3446 %  You can also reduce the influence of a particular channel with a gamma
3447 %  value of 0.
3448 %
3449 %  The format of the MagickGammaImage method is:
3450 %
3451 %      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3452 %
3453 %  A description of each parameter follows:
3454 %
3455 %    o wand: the magick wand.
3456 %
3457 %    o level: Define the level of gamma correction.
3458 %
3459 */
3460 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3461   const double gamma)
3462 {
3463   MagickBooleanType
3464     status;
3465
3466   assert(wand != (MagickWand *) NULL);
3467   assert(wand->signature == WandSignature);
3468   if (IfMagickTrue(wand->debug))
3469     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3470   if (wand->images == (Image *) NULL)
3471     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3472   status=GammaImage(wand->images,gamma,wand->exception);
3473   return(status);
3474 }
3475 \f
3476 /*
3477 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3478 %                                                                             %
3479 %                                                                             %
3480 %                                                                             %
3481 %   M a g i c k G a u s s i a n B l u r I m a g e                             %
3482 %                                                                             %
3483 %                                                                             %
3484 %                                                                             %
3485 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3486 %
3487 %  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3488 %  Gaussian operator of the given radius and standard deviation (sigma).
3489 %  For reasonable results, the radius should be larger than sigma.  Use a
3490 %  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3491 %
3492 %  The format of the MagickGaussianBlurImage method is:
3493 %
3494 %      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3495 %        const double radius,const double sigma)
3496 %
3497 %  A description of each parameter follows:
3498 %
3499 %    o wand: the magick wand.
3500 %
3501 %    o radius: the radius of the Gaussian, in pixels, not counting the center
3502 %      pixel.
3503 %
3504 %    o sigma: the standard deviation of the Gaussian, in pixels.
3505 %
3506 */
3507 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3508   const double radius,const double sigma)
3509 {
3510   Image
3511     *blur_image;
3512
3513   assert(wand != (MagickWand *) NULL);
3514   assert(wand->signature == WandSignature);
3515   if (IfMagickTrue(wand->debug))
3516     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3517   if (wand->images == (Image *) NULL)
3518     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3519   blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3520   if (blur_image == (Image *) NULL)
3521     return(MagickFalse);
3522   ReplaceImageInList(&wand->images,blur_image);
3523   return(MagickTrue);
3524 }
3525 \f
3526 /*
3527 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3528 %                                                                             %
3529 %                                                                             %
3530 %                                                                             %
3531 %   M a g i c k G e t I m a g e                                               %
3532 %                                                                             %
3533 %                                                                             %
3534 %                                                                             %
3535 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3536 %
3537 %  MagickGetImage() gets the image at the current image index.
3538 %
3539 %  The format of the MagickGetImage method is:
3540 %
3541 %      MagickWand *MagickGetImage(MagickWand *wand)
3542 %
3543 %  A description of each parameter follows:
3544 %
3545 %    o wand: the magick wand.
3546 %
3547 */
3548 WandExport MagickWand *MagickGetImage(MagickWand *wand)
3549 {
3550   Image
3551     *image;
3552
3553   assert(wand != (MagickWand *) NULL);
3554   assert(wand->signature == WandSignature);
3555   if (IfMagickTrue(wand->debug))
3556     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3557   if (wand->images == (Image *) NULL)
3558     {
3559       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3560         "ContainsNoImages","`%s'",wand->name);
3561       return((MagickWand *) NULL);
3562     }
3563   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3564   if (image == (Image *) NULL)
3565     return((MagickWand *) NULL);
3566   return(CloneMagickWandFromImages(wand,image));
3567 }
3568 \f
3569 /*
3570 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3571 %                                                                             %
3572 %                                                                             %
3573 %                                                                             %
3574 %   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                       %
3575 %                                                                             %
3576 %                                                                             %
3577 %                                                                             %
3578 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3579 %
3580 %  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3581 %  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3582 %  than CMYKA.
3583 %
3584 %  The format of the MagickGetImageAlphaChannel method is:
3585 %
3586 %      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3587 %
3588 %  A description of each parameter follows:
3589 %
3590 %    o wand: the magick wand.
3591 %
3592 */
3593 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3594 {
3595   assert(wand != (MagickWand *) NULL);
3596   assert(wand->signature == WandSignature);
3597   if (IfMagickTrue(wand->debug))
3598     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3599   if (wand->images == (Image *) NULL)
3600     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3601   return(GetImageAlphaChannel(wand->images));
3602 }
3603 \f
3604 /*
3605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3606 %                                                                             %
3607 %                                                                             %
3608 %                                                                             %
3609 %   M a g i c k G e t I m a g e C l i p M a s k                               %
3610 %                                                                             %
3611 %                                                                             %
3612 %                                                                             %
3613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3614 %
3615 %  MagickGetImageMask() gets the image clip mask at the current image index.
3616 %
3617 %  The format of the MagickGetImageMask method is:
3618 %
3619 %      MagickWand *MagickGetImageMask(MagickWand *wand)
3620 %
3621 %  A description of each parameter follows:
3622 %
3623 %    o wand: the magick wand.
3624 %
3625 */
3626 WandExport MagickWand *MagickGetImageMask(MagickWand *wand)
3627 {
3628   Image
3629     *image;
3630
3631   assert(wand != (MagickWand *) NULL);
3632   assert(wand->signature == WandSignature);
3633   if (IfMagickTrue(wand->debug))
3634     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3635   if (wand->images == (Image *) NULL)
3636     {
3637       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3638         "ContainsNoImages","`%s'",wand->name);
3639       return((MagickWand *) NULL);
3640     }
3641   image=GetImageMask(wand->images,wand->exception);
3642   if (image == (Image *) NULL)
3643     return((MagickWand *) NULL);
3644   return(CloneMagickWandFromImages(wand,image));
3645 }
3646 \f
3647 /*
3648 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3649 %                                                                             %
3650 %                                                                             %
3651 %                                                                             %
3652 %   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                 %
3653 %                                                                             %
3654 %                                                                             %
3655 %                                                                             %
3656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3657 %
3658 %  MagickGetImageBackgroundColor() returns the image background color.
3659 %
3660 %  The format of the MagickGetImageBackgroundColor method is:
3661 %
3662 %      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3663 %        PixelWand *background_color)
3664 %
3665 %  A description of each parameter follows:
3666 %
3667 %    o wand: the magick wand.
3668 %
3669 %    o background_color: Return the background color.
3670 %
3671 */
3672 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3673   PixelWand *background_color)
3674 {
3675   assert(wand != (MagickWand *) NULL);
3676   assert(wand->signature == WandSignature);
3677   if (IfMagickTrue(wand->debug))
3678     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3679   if (wand->images == (Image *) NULL)
3680     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3681   PixelSetPixelColor(background_color,&wand->images->background_color);
3682   return(MagickTrue);
3683 }
3684 \f
3685 /*
3686 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3687 %                                                                             %
3688 %                                                                             %
3689 %                                                                             %
3690 %   M a g i c k G e t I m a g e B l o b                                       %
3691 %                                                                             %
3692 %                                                                             %
3693 %                                                                             %
3694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3695 %
3696 %  MagickGetImageBlob() implements direct to memory image formats.  It returns
3697 %  the image as a blob (a formatted "file" in memory) and its length, starting
3698 %  from the current position in the image sequence.  Use MagickSetImageFormat()
3699 %  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3700 %
3701 %  Utilize MagickResetIterator() to ensure the write is from the beginning of
3702 %  the image sequence.
3703 %
3704 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
3705 %
3706 %  The format of the MagickGetImageBlob method is:
3707 %
3708 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3709 %
3710 %  A description of each parameter follows:
3711 %
3712 %    o wand: the magick wand.
3713 %
3714 %    o length: the length of the blob.
3715 %
3716 */
3717 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3718 {
3719   assert(wand != (MagickWand *) NULL);
3720   assert(wand->signature == WandSignature);
3721   if (IfMagickTrue(wand->debug))
3722     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3723   if (wand->images == (Image *) NULL)
3724     {
3725       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3726         "ContainsNoImages","`%s'",wand->name);
3727       return((unsigned char *) NULL);
3728     }
3729   return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3730 }
3731 \f
3732 /*
3733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3734 %                                                                             %
3735 %                                                                             %
3736 %                                                                             %
3737 %   M a g i c k G e t I m a g e s B l o b                                     %
3738 %                                                                             %
3739 %                                                                             %
3740 %                                                                             %
3741 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3742 %
3743 %  MagickGetImageBlob() implements direct to memory image formats.  It
3744 %  returns the image sequence as a blob and its length.  The format of the image
3745 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3746 %  return a different image format, use MagickSetImageFormat().
3747 %
3748 %  Note, some image formats do not permit multiple images to the same image
3749 %  stream (e.g. JPEG).  in this instance, just the first image of the
3750 %  sequence is returned as a blob.
3751 %
3752 %  The format of the MagickGetImagesBlob method is:
3753 %
3754 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3755 %
3756 %  A description of each parameter follows:
3757 %
3758 %    o wand: the magick wand.
3759 %
3760 %    o length: the length of the blob.
3761 %
3762 */
3763 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3764 {
3765   unsigned char
3766     *blob;
3767
3768   assert(wand != (MagickWand *) NULL);
3769   assert(wand->signature == WandSignature);
3770   if (IfMagickTrue(wand->debug))
3771     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3772   if (wand->images == (Image *) NULL)
3773     {
3774       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3775         "ContainsNoImages","`%s'",wand->name);
3776       return((unsigned char *) NULL);
3777     }
3778   blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3779     wand->exception);
3780   return(blob);
3781 }
3782 \f
3783 /*
3784 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3785 %                                                                             %
3786 %                                                                             %
3787 %                                                                             %
3788 %   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                         %
3789 %                                                                             %
3790 %                                                                             %
3791 %                                                                             %
3792 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3793 %
3794 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3795 %  image.
3796 %
3797 %  The format of the MagickGetImageBluePrimary method is:
3798 %
3799 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3800 %        double *y)
3801 %
3802 %  A description of each parameter follows:
3803 %
3804 %    o wand: the magick wand.
3805 %
3806 %    o x: the chromaticity blue primary x-point.
3807 %
3808 %    o y: the chromaticity blue primary y-point.
3809 %
3810 */
3811 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3812   double *x,double *y)
3813 {
3814   assert(wand != (MagickWand *) NULL);
3815   assert(wand->signature == WandSignature);
3816   if (IfMagickTrue(wand->debug))
3817     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3818   if (wand->images == (Image *) NULL)
3819     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3820   *x=wand->images->chromaticity.blue_primary.x;
3821   *y=wand->images->chromaticity.blue_primary.y;
3822   return(MagickTrue);
3823 }
3824 \f
3825 /*
3826 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3827 %                                                                             %
3828 %                                                                             %
3829 %                                                                             %
3830 %   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                         %
3831 %                                                                             %
3832 %                                                                             %
3833 %                                                                             %
3834 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3835 %
3836 %  MagickGetImageBorderColor() returns the image border color.
3837 %
3838 %  The format of the MagickGetImageBorderColor method is:
3839 %
3840 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3841 %        PixelWand *border_color)
3842 %
3843 %  A description of each parameter follows:
3844 %
3845 %    o wand: the magick wand.
3846 %
3847 %    o border_color: Return the border color.
3848 %
3849 */
3850 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3851   PixelWand *border_color)
3852 {
3853   assert(wand != (MagickWand *) NULL);
3854   assert(wand->signature == WandSignature);
3855   if (IfMagickTrue(wand->debug))
3856     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3857   if (wand->images == (Image *) NULL)
3858     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3859   PixelSetPixelColor(border_color,&wand->images->border_color);
3860   return(MagickTrue);
3861 }
3862 \f
3863 /*
3864 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3865 %                                                                             %
3866 %                                                                             %
3867 %                                                                             %
3868 %   M a g i c k G e t I m a g e F e a t u r e s                               %
3869 %                                                                             %
3870 %                                                                             %
3871 %                                                                             %
3872 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3873 %
3874 %  MagickGetImageFeatures() returns features for each channel in the
3875 %  image in each of four directions (horizontal, vertical, left and right
3876 %  diagonals) for the specified distance.  The features include the angular
3877 %  second moment, contrast, correlation, sum of squares: variance, inverse
3878 %  difference moment, sum average, sum varience, sum entropy, entropy,
3879 %  difference variance, difference entropy, information measures of
3880 %  correlation 1, information measures of correlation 2, and maximum
3881 %  correlation coefficient.  You can access the red channel contrast, for
3882 %  example, like this:
3883 %
3884 %      channel_features=MagickGetImageFeatures(wand,1);
3885 %      contrast=channel_features[RedPixelChannel].contrast[0];
3886 %
3887 %  Use MagickRelinquishMemory() to free the statistics buffer.
3888 %
3889 %  The format of the MagickGetImageFeatures method is:
3890 %
3891 %      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3892 %        const size_t distance)
3893 %
3894 %  A description of each parameter follows:
3895 %
3896 %    o wand: the magick wand.
3897 %
3898 %    o distance: the distance.
3899 %
3900 */
3901 WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3902   const size_t distance)
3903 {
3904   assert(wand != (MagickWand *) NULL);
3905   assert(wand->signature == WandSignature);
3906   if (IfMagickTrue(wand->debug))
3907     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3908   if (wand->images == (Image *) NULL)
3909     {
3910       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3911         "ContainsNoImages","`%s'",wand->name);
3912       return((ChannelFeatures *) NULL);
3913     }
3914   return(GetImageFeatures(wand->images,distance,wand->exception));
3915 }
3916 \f
3917 /*
3918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3919 %                                                                             %
3920 %                                                                             %
3921 %                                                                             %
3922 %   M a g i c k G e t I m a g e K u r t o s i s                               %
3923 %                                                                             %
3924 %                                                                             %
3925 %                                                                             %
3926 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3927 %
3928 %  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
3929 %  more image channels.
3930 %
3931 %  The format of the MagickGetImageKurtosis method is:
3932 %
3933 %      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3934 %        double *kurtosis,double *skewness)
3935 %
3936 %  A description of each parameter follows:
3937 %
3938 %    o wand: the magick wand.
3939 %
3940 %    o kurtosis:  The kurtosis for the specified channel(s).
3941 %
3942 %    o skewness:  The skewness for the specified channel(s).
3943 %
3944 */
3945 WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3946   double *kurtosis,double *skewness)
3947 {
3948   MagickBooleanType
3949     status;
3950
3951   assert(wand != (MagickWand *) NULL);
3952   assert(wand->signature == WandSignature);
3953   if (IfMagickTrue(wand->debug))
3954     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3955   if (wand->images == (Image *) NULL)
3956     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3957   status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
3958   return(status);
3959 }
3960 \f
3961 /*
3962 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3963 %                                                                             %
3964 %                                                                             %
3965 %                                                                             %
3966 %   M a g i c k G e t I m a g e M e a n                                       %
3967 %                                                                             %
3968 %                                                                             %
3969 %                                                                             %
3970 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3971 %
3972 %  MagickGetImageMean() gets the mean and standard deviation of one or more
3973 %  image channels.
3974 %
3975 %  The format of the MagickGetImageMean method is:
3976 %
3977 %      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3978 %        double *standard_deviation)
3979 %
3980 %  A description of each parameter follows:
3981 %
3982 %    o wand: the magick wand.
3983 %
3984 %    o channel: the image channel(s).
3985 %
3986 %    o mean:  The mean pixel value for the specified channel(s).
3987 %
3988 %    o standard_deviation:  The standard deviation for the specified channel(s).
3989 %
3990 */
3991 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3992   double *standard_deviation)
3993 {
3994   MagickBooleanType
3995     status;
3996
3997   assert(wand != (MagickWand *) NULL);
3998   assert(wand->signature == WandSignature);
3999   if (IfMagickTrue(wand->debug))
4000     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4001   if (wand->images == (Image *) NULL)
4002     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4003   status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
4004   return(status);
4005 }
4006 \f
4007 /*
4008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4009 %                                                                             %
4010 %                                                                             %
4011 %                                                                             %
4012 %   M a g i c k G e t I m a g e R a n g e                                     %
4013 %                                                                             %
4014 %                                                                             %
4015 %                                                                             %
4016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4017 %
4018 %  MagickGetImageRange() gets the range for one or more image channels.
4019 %
4020 %  The format of the MagickGetImageRange method is:
4021 %
4022 %      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
4023 %        double *maxima)
4024 %
4025 %  A description of each parameter follows:
4026 %
4027 %    o wand: the magick wand.
4028 %
4029 %    o minima:  The minimum pixel value for the specified channel(s).
4030 %
4031 %    o maxima:  The maximum pixel value for the specified channel(s).
4032 %
4033 */
4034 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
4035   double *minima,double *maxima)
4036 {
4037   MagickBooleanType
4038     status;
4039
4040   assert(wand != (MagickWand *) NULL);
4041   assert(wand->signature == WandSignature);
4042   if (IfMagickTrue(wand->debug))
4043     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4044   if (wand->images == (Image *) NULL)
4045     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4046   status=GetImageRange(wand->images,minima,maxima,wand->exception);
4047   return(status);
4048 }
4049 \f
4050 /*
4051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4052 %                                                                             %
4053 %                                                                             %
4054 %                                                                             %
4055 %   M a g i c k G e t I m a g e S t a t i s t i c s                           %
4056 %                                                                             %
4057 %                                                                             %
4058 %                                                                             %
4059 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4060 %
4061 %  MagickGetImageStatistics() returns statistics for each channel in the
4062 %  image.  The statistics include the channel depth, its minima and
4063 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
4064 %  You can access the red channel mean, for example, like this:
4065 %
4066 %      channel_statistics=MagickGetImageStatistics(wand);
4067 %      red_mean=channel_statistics[RedPixelChannel].mean;
4068 %
4069 %  Use MagickRelinquishMemory() to free the statistics buffer.
4070 %
4071 %  The format of the MagickGetImageStatistics method is:
4072 %
4073 %      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4074 %
4075 %  A description of each parameter follows:
4076 %
4077 %    o wand: the magick wand.
4078 %
4079 */
4080 WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4081 {
4082   assert(wand != (MagickWand *) NULL);
4083   assert(wand->signature == WandSignature);
4084   if (IfMagickTrue(wand->debug))
4085     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4086   if (wand->images == (Image *) NULL)
4087     {
4088       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4089         "ContainsNoImages","`%s'",wand->name);
4090       return((ChannelStatistics *) NULL);
4091     }
4092   return(GetImageStatistics(wand->images,wand->exception));
4093 }
4094 \f
4095 /*
4096 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4097 %                                                                             %
4098 %                                                                             %
4099 %                                                                             %
4100 %   M a g i c k G e t I m a g e C o l o r m a p C o l o r                     %
4101 %                                                                             %
4102 %                                                                             %
4103 %                                                                             %
4104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4105 %
4106 %  MagickGetImageColormapColor() returns the color of the specified colormap
4107 %  index.
4108 %
4109 %  The format of the MagickGetImageColormapColor method is:
4110 %
4111 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4112 %        const size_t index,PixelWand *color)
4113 %
4114 %  A description of each parameter follows:
4115 %
4116 %    o wand: the magick wand.
4117 %
4118 %    o index: the offset into the image colormap.
4119 %
4120 %    o color: Return the colormap color in this wand.
4121 %
4122 */
4123 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4124   const size_t index,PixelWand *color)
4125 {
4126   assert(wand != (MagickWand *) NULL);
4127   assert(wand->signature == WandSignature);
4128   if (IfMagickTrue(wand->debug))
4129     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4130   if (wand->images == (Image *) NULL)
4131     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4132   if ((wand->images->colormap == (PixelInfo *) NULL) ||
4133       (index >= wand->images->colors))
4134     {
4135       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4136         "InvalidColormapIndex","`%s'",wand->name);
4137       return(MagickFalse);
4138     }
4139   PixelSetPixelColor(color,wand->images->colormap+index);
4140   return(MagickTrue);
4141 }
4142 \f
4143 /*
4144 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4145 %                                                                             %
4146 %                                                                             %
4147 %                                                                             %
4148 %   M a g i c k G e t I m a g e C o l o r s                                   %
4149 %                                                                             %
4150 %                                                                             %
4151 %                                                                             %
4152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4153 %
4154 %  MagickGetImageColors() gets the number of unique colors in the image.
4155 %
4156 %  The format of the MagickGetImageColors method is:
4157 %
4158 %      size_t MagickGetImageColors(MagickWand *wand)
4159 %
4160 %  A description of each parameter follows:
4161 %
4162 %    o wand: the magick wand.
4163 %
4164 */
4165 WandExport size_t MagickGetImageColors(MagickWand *wand)
4166 {
4167   assert(wand != (MagickWand *) NULL);
4168   assert(wand->signature == WandSignature);
4169   if (IfMagickTrue(wand->debug))
4170     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4171   if (wand->images == (Image *) NULL)
4172     {
4173       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4174         "ContainsNoImages","`%s'",wand->name);
4175       return(0);
4176     }
4177   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4178 }
4179 \f
4180 /*
4181 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4182 %                                                                             %
4183 %                                                                             %
4184 %                                                                             %
4185 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4186 %                                                                             %
4187 %                                                                             %
4188 %                                                                             %
4189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4190 %
4191 %  MagickGetImageColorspace() gets the image colorspace.
4192 %
4193 %  The format of the MagickGetImageColorspace method is:
4194 %
4195 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4196 %
4197 %  A description of each parameter follows:
4198 %
4199 %    o wand: the magick wand.
4200 %
4201 */
4202 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4203 {
4204   assert(wand != (MagickWand *) NULL);
4205   assert(wand->signature == WandSignature);
4206   if (IfMagickTrue(wand->debug))
4207     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4208   if (wand->images == (Image *) NULL)
4209     {
4210       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4211         "ContainsNoImages","`%s'",wand->name);
4212       return(UndefinedColorspace);
4213     }
4214   return(wand->images->colorspace);
4215 }
4216 \f
4217 /*
4218 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4219 %                                                                             %
4220 %                                                                             %
4221 %                                                                             %
4222 %   M a g i c k G e t I m a g e C o m p o s e                                 %
4223 %                                                                             %
4224 %                                                                             %
4225 %                                                                             %
4226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4227 %
4228 %  MagickGetImageCompose() returns the composite operator associated with the
4229 %  image.
4230 %
4231 %  The format of the MagickGetImageCompose method is:
4232 %
4233 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4234 %
4235 %  A description of each parameter follows:
4236 %
4237 %    o wand: the magick wand.
4238 %
4239 */
4240 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4241 {
4242   assert(wand != (MagickWand *) NULL);
4243   assert(wand->signature == WandSignature);
4244   if (IfMagickTrue(wand->debug))
4245     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4246   if (wand->images == (Image *) NULL)
4247     {
4248       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4249         "ContainsNoImages","`%s'",wand->name);
4250       return(UndefinedCompositeOp);
4251     }
4252   return(wand->images->compose);
4253 }
4254 \f
4255 /*
4256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4257 %                                                                             %
4258 %                                                                             %
4259 %                                                                             %
4260 %   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                         %
4261 %                                                                             %
4262 %                                                                             %
4263 %                                                                             %
4264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4265 %
4266 %  MagickGetImageCompression() gets the image compression.
4267 %
4268 %  The format of the MagickGetImageCompression method is:
4269 %
4270 %      CompressionType MagickGetImageCompression(MagickWand *wand)
4271 %
4272 %  A description of each parameter follows:
4273 %
4274 %    o wand: the magick wand.
4275 %
4276 */
4277 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4278 {
4279   assert(wand != (MagickWand *) NULL);
4280   assert(wand->signature == WandSignature);
4281   if (IfMagickTrue(wand->debug))
4282     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4283   if (wand->images == (Image *) NULL)
4284     {
4285       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4286         "ContainsNoImages","`%s'",wand->name);
4287       return(UndefinedCompression);
4288     }
4289   return(wand->images->compression);
4290 }
4291 \f
4292 /*
4293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4294 %                                                                             %
4295 %                                                                             %
4296 %                                                                             %
4297 %   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           %
4298 %                                                                             %
4299 %                                                                             %
4300 %                                                                             %
4301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4302 %
4303 %  MagickGetImageCompressionQuality() gets the image compression quality.
4304 %
4305 %  The format of the MagickGetImageCompressionQuality method is:
4306 %
4307 %      size_t MagickGetImageCompressionQuality(MagickWand *wand)
4308 %
4309 %  A description of each parameter follows:
4310 %
4311 %    o wand: the magick wand.
4312 %
4313 */
4314 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4315 {
4316   assert(wand != (MagickWand *) NULL);
4317   assert(wand->signature == WandSignature);
4318   if (IfMagickTrue(wand->debug))
4319     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4320   if (wand->images == (Image *) NULL)
4321     {
4322       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4323         "ContainsNoImages","`%s'",wand->name);
4324       return(0UL);
4325     }
4326   return(wand->images->quality);
4327 }
4328 \f
4329 /*
4330 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4331 %                                                                             %
4332 %                                                                             %
4333 %                                                                             %
4334 %   M a g i c k G e t I m a g e D e l a y                                     %
4335 %                                                                             %
4336 %                                                                             %
4337 %                                                                             %
4338 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4339 %
4340 %  MagickGetImageDelay() gets the image delay.
4341 %
4342 %  The format of the MagickGetImageDelay method is:
4343 %
4344 %      size_t MagickGetImageDelay(MagickWand *wand)
4345 %
4346 %  A description of each parameter follows:
4347 %
4348 %    o wand: the magick wand.
4349 %
4350 */
4351 WandExport size_t MagickGetImageDelay(MagickWand *wand)
4352 {
4353   assert(wand != (MagickWand *) NULL);
4354   assert(wand->signature == WandSignature);
4355   if (IfMagickTrue(wand->debug))
4356     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4357   if (wand->images == (Image *) NULL)
4358     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4359   return(wand->images->delay);
4360 }
4361 \f
4362 /*
4363 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4364 %                                                                             %
4365 %                                                                             %
4366 %                                                                             %
4367 %   M a g i c k G e t I m a g e D e p t h                                     %
4368 %                                                                             %
4369 %                                                                             %
4370 %                                                                             %
4371 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4372 %
4373 %  MagickGetImageDepth() gets the image depth.
4374 %
4375 %  The format of the MagickGetImageDepth method is:
4376 %
4377 %      size_t MagickGetImageDepth(MagickWand *wand)
4378 %
4379 %  A description of each parameter follows:
4380 %
4381 %    o wand: the magick wand.
4382 %
4383 */
4384 WandExport size_t MagickGetImageDepth(MagickWand *wand)
4385 {
4386   assert(wand != (MagickWand *) NULL);
4387   assert(wand->signature == WandSignature);
4388   if (IfMagickTrue(wand->debug))
4389     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4390   if (wand->images == (Image *) NULL)
4391     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4392   return(wand->images->depth);
4393 }
4394 \f
4395 /*
4396 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4397 %                                                                             %
4398 %                                                                             %
4399 %                                                                             %
4400 %   M a g i c k G e t I m a g e D i s p o s e                                 %
4401 %                                                                             %
4402 %                                                                             %
4403 %                                                                             %
4404 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4405 %
4406 %  MagickGetImageDispose() gets the image disposal method.
4407 %
4408 %  The format of the MagickGetImageDispose method is:
4409 %
4410 %      DisposeType MagickGetImageDispose(MagickWand *wand)
4411 %
4412 %  A description of each parameter follows:
4413 %
4414 %    o wand: the magick wand.
4415 %
4416 */
4417 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4418 {
4419   assert(wand != (MagickWand *) NULL);
4420   assert(wand->signature == WandSignature);
4421   if (IfMagickTrue(wand->debug))
4422     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4423   if (wand->images == (Image *) NULL)
4424     {
4425       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4426         "ContainsNoImages","`%s'",wand->name);
4427       return(UndefinedDispose);
4428     }
4429   return((DisposeType) wand->images->dispose);
4430 }
4431 \f
4432 /*
4433 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4434 %                                                                             %
4435 %                                                                             %
4436 %                                                                             %
4437 %   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4438 %                                                                             %
4439 %                                                                             %
4440 %                                                                             %
4441 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4442 %
4443 %  MagickGetImageDistortion() compares an image to a reconstructed image and
4444 %  returns the specified distortion metric.
4445 %
4446 %  The format of the MagickGetImageDistortion method is:
4447 %
4448 %      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4449 %        const MagickWand *reference,const MetricType metric,
4450 %        double *distortion)
4451 %
4452 %  A description of each parameter follows:
4453 %
4454 %    o wand: the magick wand.
4455 %
4456 %    o reference: the reference wand.
4457 %
4458 %    o metric: the metric.
4459 %
4460 %    o distortion: the computed distortion between the images.
4461 %
4462 */
4463 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4464   const MagickWand *reference,const MetricType metric,double *distortion)
4465 {
4466   MagickBooleanType
4467     status;
4468
4469   assert(wand != (MagickWand *) NULL);
4470   assert(wand->signature == WandSignature);
4471   if (IfMagickTrue(wand->debug))
4472     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4473   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4474     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4475   status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4476     wand->exception);
4477   return(status);
4478 }
4479 \f
4480 /*
4481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4482 %                                                                             %
4483 %                                                                             %
4484 %                                                                             %
4485 %   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                         %
4486 %                                                                             %
4487 %                                                                             %
4488 %                                                                             %
4489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4490 %
4491 %  MagickGetImageDistortions() compares one or more pixel channels of an
4492 %  image to a reconstructed image and returns the specified distortion metrics.
4493 %
4494 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4495 %
4496 %  The format of the MagickGetImageDistortion method is:
4497 %
4498 %      double *MagickGetImageDistortion(MagickWand *wand,
4499 %        const MagickWand *reference,const MetricType metric)
4500 %
4501 %  A description of each parameter follows:
4502 %
4503 %    o wand: the magick wand.
4504 %
4505 %    o reference: the reference wand.
4506 %
4507 %    o metric: the metric.
4508 %
4509 */
4510 WandExport double *MagickGetImageDistortions(MagickWand *wand,
4511   const MagickWand *reference,const MetricType metric)
4512 {
4513   double
4514     *channel_distortion;
4515
4516   assert(wand != (MagickWand *) NULL);
4517   assert(wand->signature == WandSignature);
4518   if (IfMagickTrue(wand->debug))
4519     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4520   assert(reference != (MagickWand *) NULL);
4521   assert(reference->signature == WandSignature);
4522   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4523     {
4524       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4525         "ContainsNoImages","`%s'",wand->name);
4526       return((double *) NULL);
4527     }
4528   channel_distortion=GetImageDistortions(wand->images,reference->images,
4529     metric,wand->exception);
4530   return(channel_distortion);
4531 }
4532 \f
4533 /*
4534 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4535 %                                                                             %
4536 %                                                                             %
4537 %                                                                             %
4538 %   M a g i c k G e t I m a g e E n d i a n                                   %
4539 %                                                                             %
4540 %                                                                             %
4541 %                                                                             %
4542 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4543 %
4544 %  MagickGetImageEndian() gets the image endian.
4545 %
4546 %  The format of the MagickGetImageEndian method is:
4547 %
4548 %      EndianType MagickGetImageEndian(MagickWand *wand)
4549 %
4550 %  A description of each parameter follows:
4551 %
4552 %    o wand: the magick wand.
4553 %
4554 */
4555 WandExport EndianType MagickGetImageEndian(MagickWand *wand)
4556 {
4557   assert(wand != (MagickWand *) NULL);
4558   assert(wand->signature == WandSignature);
4559   if (IfMagickTrue(wand->debug))
4560     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4561   if (wand->images == (Image *) NULL)
4562     {
4563       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4564         "ContainsNoImages","`%s'",wand->name);
4565       return(UndefinedEndian);
4566     }
4567   return(wand->images->endian);
4568 }
4569 \f
4570 /*
4571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4572 %                                                                             %
4573 %                                                                             %
4574 %                                                                             %
4575 %   M a g i c k G e t I m a g e F i l e n a m e                               %
4576 %                                                                             %
4577 %                                                                             %
4578 %                                                                             %
4579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4580 %
4581 %  MagickGetImageFilename() returns the filename of a particular image in a
4582 %  sequence.
4583 %
4584 %  The format of the MagickGetImageFilename method is:
4585 %
4586 %      char *MagickGetImageFilename(MagickWand *wand)
4587 %
4588 %  A description of each parameter follows:
4589 %
4590 %    o wand: the magick wand.
4591 %
4592 */
4593 WandExport char *MagickGetImageFilename(MagickWand *wand)
4594 {
4595   assert(wand != (MagickWand *) NULL);
4596   assert(wand->signature == WandSignature);
4597   if (IfMagickTrue(wand->debug))
4598     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4599   if (wand->images == (Image *) NULL)
4600     {
4601       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4602         "ContainsNoImages","`%s'",wand->name);
4603       return((char *) NULL);
4604     }
4605   return(AcquireString(wand->images->filename));
4606 }
4607 \f
4608 /*
4609 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4610 %                                                                             %
4611 %                                                                             %
4612 %                                                                             %
4613 %   M a g i c k G e t I m a g e F o r m a t                                   %
4614 %                                                                             %
4615 %                                                                             %
4616 %                                                                             %
4617 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4618 %
4619 %  MagickGetImageFormat() returns the format of a particular image in a
4620 %  sequence.
4621 %
4622 %  The format of the MagickGetImageFormat method is:
4623 %
4624 %      char *MagickGetImageFormat(MagickWand *wand)
4625 %
4626 %  A description of each parameter follows:
4627 %
4628 %    o wand: the magick wand.
4629 %
4630 */
4631 WandExport char *MagickGetImageFormat(MagickWand *wand)
4632 {
4633   assert(wand != (MagickWand *) NULL);
4634   assert(wand->signature == WandSignature);
4635   if (IfMagickTrue(wand->debug))
4636     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4637   if (wand->images == (Image *) NULL)
4638     {
4639       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4640         "ContainsNoImages","`%s'",wand->name);
4641       return((char *) NULL);
4642     }
4643   return(AcquireString(wand->images->magick));
4644 }
4645 \f
4646 /*
4647 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4648 %                                                                             %
4649 %                                                                             %
4650 %                                                                             %
4651 %   M a g i c k G e t I m a g e F u z z                                       %
4652 %                                                                             %
4653 %                                                                             %
4654 %                                                                             %
4655 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4656 %
4657 %  MagickGetImageFuzz() gets the image fuzz.
4658 %
4659 %  The format of the MagickGetImageFuzz method is:
4660 %
4661 %      double MagickGetImageFuzz(MagickWand *wand)
4662 %
4663 %  A description of each parameter follows:
4664 %
4665 %    o wand: the magick wand.
4666 %
4667 */
4668 WandExport double MagickGetImageFuzz(MagickWand *wand)
4669 {
4670   assert(wand != (MagickWand *) NULL);
4671   assert(wand->signature == WandSignature);
4672   if (IfMagickTrue(wand->debug))
4673     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4674   if (wand->images == (Image *) NULL)
4675     {
4676       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4677         "ContainsNoImages","`%s'",wand->name);
4678       return(0.0);
4679     }
4680   return(wand->images->fuzz);
4681 }
4682 \f
4683 /*
4684 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4685 %                                                                             %
4686 %                                                                             %
4687 %                                                                             %
4688 %   M a g i c k G e t I m a g e G a m m a                                     %
4689 %                                                                             %
4690 %                                                                             %
4691 %                                                                             %
4692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4693 %
4694 %  MagickGetImageGamma() gets the image gamma.
4695 %
4696 %  The format of the MagickGetImageGamma method is:
4697 %
4698 %      double MagickGetImageGamma(MagickWand *wand)
4699 %
4700 %  A description of each parameter follows:
4701 %
4702 %    o wand: the magick wand.
4703 %
4704 */
4705 WandExport double MagickGetImageGamma(MagickWand *wand)
4706 {
4707   assert(wand != (MagickWand *) NULL);
4708   assert(wand->signature == WandSignature);
4709   if (IfMagickTrue(wand->debug))
4710     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4711   if (wand->images == (Image *) NULL)
4712     {
4713       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4714         "ContainsNoImages","`%s'",wand->name);
4715       return(0.0);
4716     }
4717   return(wand->images->gamma);
4718 }
4719 \f
4720 /*
4721 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4722 %                                                                             %
4723 %                                                                             %
4724 %                                                                             %
4725 %   M a g i c k G e t I m a g e G r a v i t y                                 %
4726 %                                                                             %
4727 %                                                                             %
4728 %                                                                             %
4729 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4730 %
4731 %  MagickGetImageGravity() gets the image gravity.
4732 %
4733 %  The format of the MagickGetImageGravity method is:
4734 %
4735 %      GravityType MagickGetImageGravity(MagickWand *wand)
4736 %
4737 %  A description of each parameter follows:
4738 %
4739 %    o wand: the magick wand.
4740 %
4741 */
4742 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4743 {
4744   assert(wand != (MagickWand *) NULL);
4745   assert(wand->signature == WandSignature);
4746   if (IfMagickTrue(wand->debug))
4747     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4748   if (wand->images == (Image *) NULL)
4749     {
4750       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4751         "ContainsNoImages","`%s'",wand->name);
4752       return(UndefinedGravity);
4753     }
4754   return(wand->images->gravity);
4755 }
4756 \f
4757 /*
4758 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4759 %                                                                             %
4760 %                                                                             %
4761 %                                                                             %
4762 %   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                       %
4763 %                                                                             %
4764 %                                                                             %
4765 %                                                                             %
4766 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4767 %
4768 %  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4769 %
4770 %  The format of the MagickGetImageGreenPrimary method is:
4771 %
4772 %      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4773 %        double *y)
4774 %
4775 %  A description of each parameter follows:
4776 %
4777 %    o wand: the magick wand.
4778 %
4779 %    o x: the chromaticity green primary x-point.
4780 %
4781 %    o y: the chromaticity green primary y-point.
4782 %
4783 */
4784 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4785   double *x,double *y)
4786 {
4787   assert(wand != (MagickWand *) NULL);
4788   assert(wand->signature == WandSignature);
4789   if (IfMagickTrue(wand->debug))
4790     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4791   if (wand->images == (Image *) NULL)
4792     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4793   *x=wand->images->chromaticity.green_primary.x;
4794   *y=wand->images->chromaticity.green_primary.y;
4795   return(MagickTrue);
4796 }
4797 \f
4798 /*
4799 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4800 %                                                                             %
4801 %                                                                             %
4802 %                                                                             %
4803 %   M a g i c k G e t I m a g e H e i g h t                                   %
4804 %                                                                             %
4805 %                                                                             %
4806 %                                                                             %
4807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4808 %
4809 %  MagickGetImageHeight() returns the image height.
4810 %
4811 %  The format of the MagickGetImageHeight method is:
4812 %
4813 %      size_t MagickGetImageHeight(MagickWand *wand)
4814 %
4815 %  A description of each parameter follows:
4816 %
4817 %    o wand: the magick wand.
4818 %
4819 */
4820 WandExport size_t MagickGetImageHeight(MagickWand *wand)
4821 {
4822   assert(wand != (MagickWand *) NULL);
4823   assert(wand->signature == WandSignature);
4824   if (IfMagickTrue(wand->debug))
4825     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4826   if (wand->images == (Image *) NULL)
4827     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4828   return(wand->images->rows);
4829 }
4830 \f
4831 /*
4832 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4833 %                                                                             %
4834 %                                                                             %
4835 %                                                                             %
4836 %   M a g i c k G e t I m a g e H i s t o g r a m                             %
4837 %                                                                             %
4838 %                                                                             %
4839 %                                                                             %
4840 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4841 %
4842 %  MagickGetImageHistogram() returns the image histogram as an array of
4843 %  PixelWand wands.
4844 %
4845 %  The format of the MagickGetImageHistogram method is:
4846 %
4847 %      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4848 %        size_t *number_colors)
4849 %
4850 %  A description of each parameter follows:
4851 %
4852 %    o wand: the magick wand.
4853 %
4854 %    o number_colors: the number of unique colors in the image and the number
4855 %      of pixel wands returned.
4856 %
4857 */
4858 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4859   size_t *number_colors)
4860 {
4861   PixelInfo
4862     *histogram;
4863
4864   PixelWand
4865     **pixel_wands;
4866
4867   register ssize_t
4868     i;
4869
4870   assert(wand != (MagickWand *) NULL);
4871   assert(wand->signature == WandSignature);
4872   if (IfMagickTrue(wand->debug))
4873     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4874   if (wand->images == (Image *) NULL)
4875     {
4876       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4877         "ContainsNoImages","`%s'",wand->name);
4878       return((PixelWand **) NULL);
4879     }
4880   histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4881   if (histogram == (PixelInfo *) NULL)
4882     return((PixelWand **) NULL);
4883   pixel_wands=NewPixelWands(*number_colors);
4884   for (i=0; i < (ssize_t) *number_colors; i++)
4885   {
4886     PixelSetPixelColor(pixel_wands[i],&histogram[i]);
4887     PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4888   }
4889   histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
4890   return(pixel_wands);
4891 }
4892 \f
4893 /*
4894 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4895 %                                                                             %
4896 %                                                                             %
4897 %                                                                             %
4898 %   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                 %
4899 %                                                                             %
4900 %                                                                             %
4901 %                                                                             %
4902 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4903 %
4904 %  MagickGetImageInterlaceScheme() gets the image interlace scheme.
4905 %
4906 %  The format of the MagickGetImageInterlaceScheme method is:
4907 %
4908 %      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4909 %
4910 %  A description of each parameter follows:
4911 %
4912 %    o wand: the magick wand.
4913 %
4914 */
4915 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4916 {
4917   assert(wand != (MagickWand *) NULL);
4918   assert(wand->signature == WandSignature);
4919   if (IfMagickTrue(wand->debug))
4920     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4921   if (wand->images == (Image *) NULL)
4922     {
4923       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4924         "ContainsNoImages","`%s'",wand->name);
4925       return(UndefinedInterlace);
4926     }
4927   return(wand->images->interlace);
4928 }
4929 \f
4930 /*
4931 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4932 %                                                                             %
4933 %                                                                             %
4934 %                                                                             %
4935 %   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             %
4936 %                                                                             %
4937 %                                                                             %
4938 %                                                                             %
4939 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4940 %
4941 %  MagickGetImageInterpolateMethod() returns the interpolation method for the
4942 %  sepcified image.
4943 %
4944 %  The format of the MagickGetImageInterpolateMethod method is:
4945 %
4946 %      PixelInterpolateMethod MagickGetImagePixelInterpolateMethod(
4947 %        MagickWand *wand)
4948 %
4949 %  A description of each parameter follows:
4950 %
4951 %    o wand: the magick wand.
4952 %
4953 */
4954 WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
4955   MagickWand *wand)
4956 {
4957   assert(wand != (MagickWand *) NULL);
4958   assert(wand->signature == WandSignature);
4959   if (IfMagickTrue(wand->debug))
4960     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4961   if (wand->images == (Image *) NULL)
4962     {
4963       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4964         "ContainsNoImages","`%s'",wand->name);
4965       return(UndefinedInterpolatePixel);
4966     }
4967   return(wand->images->interpolate);
4968 }
4969 \f
4970 /*
4971 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4972 %                                                                             %
4973 %                                                                             %
4974 %                                                                             %
4975 %   M a g i c k G e t I m a g e I t e r a t i o n s                           %
4976 %                                                                             %
4977 %                                                                             %
4978 %                                                                             %
4979 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4980 %
4981 %  MagickGetImageIterations() gets the image iterations.
4982 %
4983 %  The format of the MagickGetImageIterations method is:
4984 %
4985 %      size_t MagickGetImageIterations(MagickWand *wand)
4986 %
4987 %  A description of each parameter follows:
4988 %
4989 %    o wand: the magick wand.
4990 %
4991 */
4992 WandExport size_t MagickGetImageIterations(MagickWand *wand)
4993 {
4994   assert(wand != (MagickWand *) NULL);
4995   assert(wand->signature == WandSignature);
4996   if (IfMagickTrue(wand->debug))
4997     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4998   if (wand->images == (Image *) NULL)
4999     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5000   return(wand->images->iterations);
5001 }
5002 \f
5003 /*
5004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5005 %                                                                             %
5006 %                                                                             %
5007 %                                                                             %
5008 %   M a g i c k G e t I m a g e L e n g t h                                   %
5009 %                                                                             %
5010 %                                                                             %
5011 %                                                                             %
5012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5013 %
5014 %  MagickGetImageLength() returns the image length in bytes.
5015 %
5016 %  The format of the MagickGetImageLength method is:
5017 %
5018 %      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5019 %        MagickSizeType *length)
5020 %
5021 %  A description of each parameter follows:
5022 %
5023 %    o wand: the magick wand.
5024 %
5025 %    o length: the image length in bytes.
5026 %
5027 */
5028 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5029   MagickSizeType *length)
5030 {
5031   assert(wand != (MagickWand *) NULL);
5032   assert(wand->signature == WandSignature);
5033   if (IfMagickTrue(wand->debug))
5034     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5035   if (wand->images == (Image *) NULL)
5036     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5037   *length=GetBlobSize(wand->images);
5038   return(MagickTrue);
5039 }
5040 \f
5041 /*
5042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5043 %                                                                             %
5044 %                                                                             %
5045 %                                                                             %
5046 %   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5047 %                                                                             %
5048 %                                                                             %
5049 %                                                                             %
5050 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5051 %
5052 %  MagickGetImageMatteColor() returns the image matte color.
5053 %
5054 %  The format of the MagickGetImageMatteColor method is:
5055 %
5056 %      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5057 %        PixelWand *matte_color)
5058 %
5059 %  A description of each parameter follows:
5060 %
5061 %    o wand: the magick wand.
5062 %
5063 %    o matte_color: Return the matte color.
5064 %
5065 */
5066 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5067   PixelWand *matte_color)
5068 {
5069   assert(wand != (MagickWand *) NULL);
5070   assert(wand->signature == WandSignature);
5071   if (IfMagickTrue(wand->debug))
5072     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5073   if (wand->images == (Image *) NULL)
5074     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5075   PixelSetPixelColor(matte_color,&wand->images->matte_color);
5076   return(MagickTrue);
5077 }
5078 \f
5079 /*
5080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5081 %                                                                             %
5082 %                                                                             %
5083 %                                                                             %
5084 %   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                         %
5085 %                                                                             %
5086 %                                                                             %
5087 %                                                                             %
5088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5089 %
5090 %  MagickGetImageOrientation() returns the image orientation.
5091 %
5092 %  The format of the MagickGetImageOrientation method is:
5093 %
5094 %      OrientationType MagickGetImageOrientation(MagickWand *wand)
5095 %
5096 %  A description of each parameter follows:
5097 %
5098 %    o wand: the magick wand.
5099 %
5100 */
5101 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5102 {
5103   assert(wand != (MagickWand *) NULL);
5104   assert(wand->signature == WandSignature);
5105   if (IfMagickTrue(wand->debug))
5106     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5107   if (wand->images == (Image *) NULL)
5108     {
5109       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5110         "ContainsNoImages","`%s'",wand->name);
5111       return(UndefinedOrientation);
5112     }
5113   return(wand->images->orientation);
5114 }
5115 \f
5116 /*
5117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5118 %                                                                             %
5119 %                                                                             %
5120 %                                                                             %
5121 %   M a g i c k G e t I m a g e P a g e                                       %
5122 %                                                                             %
5123 %                                                                             %
5124 %                                                                             %
5125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5126 %
5127 %  MagickGetImagePage() returns the page geometry associated with the image.
5128 %
5129 %  The format of the MagickGetImagePage method is:
5130 %
5131 %      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5132 %        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5133 %
5134 %  A description of each parameter follows:
5135 %
5136 %    o wand: the magick wand.
5137 %
5138 %    o width: the page width.
5139 %
5140 %    o height: the page height.
5141 %
5142 %    o x: the page x-offset.
5143 %
5144 %    o y: the page y-offset.
5145 %
5146 */
5147 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5148   size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5149 {
5150   assert(wand != (const MagickWand *) NULL);
5151   assert(wand->signature == WandSignature);
5152   if (IfMagickTrue(wand->debug))
5153     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5154   if (wand->images == (Image *) NULL)
5155     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5156   *width=wand->images->page.width;
5157   *height=wand->images->page.height;
5158   *x=wand->images->page.x;
5159   *y=wand->images->page.y;
5160   return(MagickTrue);
5161 }
5162 \f
5163 /*
5164 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5165 %                                                                             %
5166 %                                                                             %
5167 %                                                                             %
5168 %   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5169 %                                                                             %
5170 %                                                                             %
5171 %                                                                             %
5172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5173 %
5174 %  MagickGetImagePixelColor() returns the color of the specified pixel.
5175 %
5176 %  The format of the MagickGetImagePixelColor method is:
5177 %
5178 %      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5179 %        const ssize_t x,const ssize_t y,PixelWand *color)
5180 %
5181 %  A description of each parameter follows:
5182 %
5183 %    o wand: the magick wand.
5184 %
5185 %    o x,y: the pixel offset into the image.
5186 %
5187 %    o color: Return the colormap color in this wand.
5188 %
5189 */
5190 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5191   const ssize_t x,const ssize_t y,PixelWand *color)
5192 {
5193   register const Quantum
5194     *p;
5195
5196   CacheView
5197     *image_view;
5198
5199   assert(wand != (MagickWand *) NULL);
5200   assert(wand->signature == WandSignature);
5201   if (IfMagickTrue(wand->debug))
5202     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5203   if (wand->images == (Image *) NULL)
5204     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5205   image_view=AcquireVirtualCacheView(wand->images,wand->exception);
5206   p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5207   if (p == (const Quantum *) NULL)
5208     {
5209       image_view=DestroyCacheView(image_view);
5210       return(MagickFalse);
5211     }
5212   PixelSetQuantumPixel(wand->images,p,color);
5213   image_view=DestroyCacheView(image_view);
5214   return(MagickTrue);
5215 }
5216 \f
5217 /*
5218 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5219 %                                                                             %
5220 %                                                                             %
5221 %                                                                             %
5222 %   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5223 %                                                                             %
5224 %                                                                             %
5225 %                                                                             %
5226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5227 %
5228 %  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5229 %
5230 %  The format of the MagickGetImageRedPrimary method is:
5231 %
5232 %      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5233 %        double *y)
5234 %
5235 %  A description of each parameter follows:
5236 %
5237 %    o wand: the magick wand.
5238 %
5239 %    o x: the chromaticity red primary x-point.
5240 %
5241 %    o y: the chromaticity red primary y-point.
5242 %
5243 */
5244 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5245   double *x,double *y)
5246 {
5247   assert(wand != (MagickWand *) NULL);
5248   assert(wand->signature == WandSignature);
5249   if (IfMagickTrue(wand->debug))
5250     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5251   if (wand->images == (Image *) NULL)
5252     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5253   *x=wand->images->chromaticity.red_primary.x;
5254   *y=wand->images->chromaticity.red_primary.y;
5255   return(MagickTrue);
5256 }
5257 \f
5258 /*
5259 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5260 %                                                                             %
5261 %                                                                             %
5262 %                                                                             %
5263 %   M a g i c k G e t I m a g e R e g i o n                                   %
5264 %                                                                             %
5265 %                                                                             %
5266 %                                                                             %
5267 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5268 %
5269 %  MagickGetImageRegion() extracts a region of the image and returns it as a
5270 %  a new wand.
5271 %
5272 %  The format of the MagickGetImageRegion method is:
5273 %
5274 %      MagickWand *MagickGetImageRegion(MagickWand *wand,
5275 %        const size_t width,const size_t height,const ssize_t x,
5276 %        const ssize_t y)
5277 %
5278 %  A description of each parameter follows:
5279 %
5280 %    o wand: the magick wand.
5281 %
5282 %    o width: the region width.
5283 %
5284 %    o height: the region height.
5285 %
5286 %    o x: the region x offset.
5287 %
5288 %    o y: the region y offset.
5289 %
5290 */
5291 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5292   const size_t width,const size_t height,const ssize_t x,
5293   const ssize_t y)
5294 {
5295   Image
5296     *region_image;
5297
5298   RectangleInfo
5299     region;
5300
5301   assert(wand != (MagickWand *) NULL);
5302   assert(wand->signature == WandSignature);
5303   if (IfMagickTrue(wand->debug))
5304     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5305   if (wand->images == (Image *) NULL)
5306     return((MagickWand *) NULL);
5307   region.width=width;
5308   region.height=height;
5309   region.x=x;
5310   region.y=y;
5311   region_image=CropImage(wand->images,&region,wand->exception);
5312   if (region_image == (Image *) NULL)
5313     return((MagickWand *) NULL);
5314   return(CloneMagickWandFromImages(wand,region_image));
5315 }
5316 \f
5317 /*
5318 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5319 %                                                                             %
5320 %                                                                             %
5321 %                                                                             %
5322 %   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                 %
5323 %                                                                             %
5324 %                                                                             %
5325 %                                                                             %
5326 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5327 %
5328 %  MagickGetImageRenderingIntent() gets the image rendering intent.
5329 %
5330 %  The format of the MagickGetImageRenderingIntent method is:
5331 %
5332 %      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5333 %
5334 %  A description of each parameter follows:
5335 %
5336 %    o wand: the magick wand.
5337 %
5338 */
5339 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5340 {
5341   assert(wand != (MagickWand *) NULL);
5342   assert(wand->signature == WandSignature);
5343   if (IfMagickTrue(wand->debug))
5344     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5345   if (wand->images == (Image *) NULL)
5346     {
5347       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5348         "ContainsNoImages","`%s'",wand->name);
5349       return(UndefinedIntent);
5350     }
5351   return((RenderingIntent) wand->images->rendering_intent);
5352 }
5353 \f
5354 /*
5355 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5356 %                                                                             %
5357 %                                                                             %
5358 %                                                                             %
5359 %   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5360 %                                                                             %
5361 %                                                                             %
5362 %                                                                             %
5363 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5364 %
5365 %  MagickGetImageResolution() gets the image X and Y resolution.
5366 %
5367 %  The format of the MagickGetImageResolution method is:
5368 %
5369 %      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5370 %        double *y)
5371 %
5372 %  A description of each parameter follows:
5373 %
5374 %    o wand: the magick wand.
5375 %
5376 %    o x: the image x-resolution.
5377 %
5378 %    o y: the image y-resolution.
5379 %
5380 */
5381 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5382   double *x,double *y)
5383 {
5384   assert(wand != (MagickWand *) NULL);
5385   assert(wand->signature == WandSignature);
5386   if (IfMagickTrue(wand->debug))
5387     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5388   if (wand->images == (Image *) NULL)
5389     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5390   *x=wand->images->resolution.x;
5391   *y=wand->images->resolution.y;
5392   return(MagickTrue);
5393 }
5394 \f
5395 /*
5396 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5397 %                                                                             %
5398 %                                                                             %
5399 %                                                                             %
5400 %   M a g i c k G e t I m a g e S c e n e                                     %
5401 %                                                                             %
5402 %                                                                             %
5403 %                                                                             %
5404 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5405 %
5406 %  MagickGetImageScene() gets the image scene.
5407 %
5408 %  The format of the MagickGetImageScene method is:
5409 %
5410 %      size_t MagickGetImageScene(MagickWand *wand)
5411 %
5412 %  A description of each parameter follows:
5413 %
5414 %    o wand: the magick wand.
5415 %
5416 */
5417 WandExport size_t MagickGetImageScene(MagickWand *wand)
5418 {
5419   assert(wand != (MagickWand *) NULL);
5420   assert(wand->signature == WandSignature);
5421   if (IfMagickTrue(wand->debug))
5422     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5423   if (wand->images == (Image *) NULL)
5424     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5425   return(wand->images->scene);
5426 }
5427 \f
5428 /*
5429 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5430 %                                                                             %
5431 %                                                                             %
5432 %                                                                             %
5433 %   M a g i c k G e t I m a g e S i g n a t u r e                             %
5434 %                                                                             %
5435 %                                                                             %
5436 %                                                                             %
5437 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5438 %
5439 %  MagickGetImageSignature() generates an SHA-256 message digest for the image
5440 %  pixel stream.
5441 %
5442 %  The format of the MagickGetImageSignature method is:
5443 %
5444 %      char *MagickGetImageSignature(MagickWand *wand)
5445 %
5446 %  A description of each parameter follows:
5447 %
5448 %    o wand: the magick wand.
5449 %
5450 */
5451 WandExport char *MagickGetImageSignature(MagickWand *wand)
5452 {
5453   const char
5454     *value;
5455
5456   MagickBooleanType
5457     status;
5458
5459   assert(wand != (MagickWand *) NULL);
5460   assert(wand->signature == WandSignature);
5461   if (IfMagickTrue(wand->debug))
5462     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5463   if (wand->images == (Image *) NULL)
5464     {
5465       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5466         "ContainsNoImages","`%s'",wand->name);
5467       return((char *) NULL);
5468     }
5469   status=SignatureImage(wand->images,wand->exception);
5470   if (IfMagickFalse(status))
5471     return((char *) NULL);
5472   value=GetImageProperty(wand->images,"signature",wand->exception);
5473   if (value == (const char *) NULL)
5474     return((char *) NULL);
5475   return(AcquireString(value));
5476 }
5477 \f
5478 /*
5479 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5480 %                                                                             %
5481 %                                                                             %
5482 %                                                                             %
5483 %   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                   %
5484 %                                                                             %
5485 %                                                                             %
5486 %                                                                             %
5487 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5488 %
5489 %  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5490 %
5491 %  The format of the MagickGetImageTicksPerSecond method is:
5492 %
5493 %      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5494 %
5495 %  A description of each parameter follows:
5496 %
5497 %    o wand: the magick wand.
5498 %
5499 */
5500 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5501 {
5502   assert(wand != (MagickWand *) NULL);
5503   assert(wand->signature == WandSignature);
5504   if (IfMagickTrue(wand->debug))
5505     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5506   if (wand->images == (Image *) NULL)
5507     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5508   return((size_t) wand->images->ticks_per_second);
5509 }
5510 \f
5511 /*
5512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5513 %                                                                             %
5514 %                                                                             %
5515 %                                                                             %
5516 %   M a g i c k G e t I m a g e T y p e                                       %
5517 %                                                                             %
5518 %                                                                             %
5519 %                                                                             %
5520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5521 %
5522 %  MagickGetImageType() gets the potential image type:
5523 %
5524 %        Bilevel        Grayscale       GrayscaleMatte
5525 %        Palette        PaletteMatte    TrueColor
5526 %        TrueColorMatte ColorSeparation ColorSeparationMatte
5527 %
5528 %  To ensure the image type matches its potential, use MagickSetImageType():
5529 %
5530 %    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5531 %
5532 %  The format of the MagickGetImageType method is:
5533 %
5534 %      ImageType MagickGetImageType(MagickWand *wand)
5535 %
5536 %  A description of each parameter follows:
5537 %
5538 %    o wand: the magick wand.
5539 %
5540 */
5541 WandExport ImageType MagickGetImageType(MagickWand *wand)
5542 {
5543   assert(wand != (MagickWand *) NULL);
5544   assert(wand->signature == WandSignature);
5545   if (IfMagickTrue(wand->debug))
5546     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5547   if (wand->images == (Image *) NULL)
5548     {
5549       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5550         "ContainsNoImages","`%s'",wand->name);
5551       return(UndefinedType);
5552     }
5553   return(GetImageType(wand->images,wand->exception));
5554 }
5555 \f
5556 /*
5557 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5558 %                                                                             %
5559 %                                                                             %
5560 %                                                                             %
5561 %   M a g i c k G e t I m a g e U n i t s                                     %
5562 %                                                                             %
5563 %                                                                             %
5564 %                                                                             %
5565 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5566 %
5567 %  MagickGetImageUnits() gets the image units of resolution.
5568 %
5569 %  The format of the MagickGetImageUnits method is:
5570 %
5571 %      ResolutionType MagickGetImageUnits(MagickWand *wand)
5572 %
5573 %  A description of each parameter follows:
5574 %
5575 %    o wand: the magick wand.
5576 %
5577 */
5578 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5579 {
5580   assert(wand != (MagickWand *) NULL);
5581   assert(wand->signature == WandSignature);
5582   if (IfMagickTrue(wand->debug))
5583     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5584   if (wand->images == (Image *) NULL)
5585     {
5586       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5587         "ContainsNoImages","`%s'",wand->name);
5588       return(UndefinedResolution);
5589     }
5590   return(wand->images->units);
5591 }
5592 \f
5593 /*
5594 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5595 %                                                                             %
5596 %                                                                             %
5597 %                                                                             %
5598 %   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           %
5599 %                                                                             %
5600 %                                                                             %
5601 %                                                                             %
5602 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5603 %
5604 %  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5605 %  sepcified image.
5606 %
5607 %  The format of the MagickGetImageVirtualPixelMethod method is:
5608 %
5609 %      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5610 %
5611 %  A description of each parameter follows:
5612 %
5613 %    o wand: the magick wand.
5614 %
5615 */
5616 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5617 {
5618   assert(wand != (MagickWand *) NULL);
5619   assert(wand->signature == WandSignature);
5620   if (IfMagickTrue(wand->debug))
5621     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5622   if (wand->images == (Image *) NULL)
5623     {
5624       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5625         "ContainsNoImages","`%s'",wand->name);
5626       return(UndefinedVirtualPixelMethod);
5627     }
5628   return(GetImageVirtualPixelMethod(wand->images));
5629 }
5630 \f
5631 /*
5632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5633 %                                                                             %
5634 %                                                                             %
5635 %                                                                             %
5636 %   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5637 %                                                                             %
5638 %                                                                             %
5639 %                                                                             %
5640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5641 %
5642 %  MagickGetImageWhitePoint() returns the chromaticy white point.
5643 %
5644 %  The format of the MagickGetImageWhitePoint method is:
5645 %
5646 %      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5647 %        double *y)
5648 %
5649 %  A description of each parameter follows:
5650 %
5651 %    o wand: the magick wand.
5652 %
5653 %    o x: the chromaticity white x-point.
5654 %
5655 %    o y: the chromaticity white y-point.
5656 %
5657 */
5658 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5659   double *x,double *y)
5660 {
5661   assert(wand != (MagickWand *) NULL);
5662   assert(wand->signature == WandSignature);
5663   if (IfMagickTrue(wand->debug))
5664     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5665   if (wand->images == (Image *) NULL)
5666     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5667   *x=wand->images->chromaticity.white_point.x;
5668   *y=wand->images->chromaticity.white_point.y;
5669   return(MagickTrue);
5670 }
5671 \f
5672 /*
5673 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5674 %                                                                             %
5675 %                                                                             %
5676 %                                                                             %
5677 %   M a g i c k G e t I m a g e W i d t h                                     %
5678 %                                                                             %
5679 %                                                                             %
5680 %                                                                             %
5681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5682 %
5683 %  MagickGetImageWidth() returns the image width.
5684 %
5685 %  The format of the MagickGetImageWidth method is:
5686 %
5687 %      size_t MagickGetImageWidth(MagickWand *wand)
5688 %
5689 %  A description of each parameter follows:
5690 %
5691 %    o wand: the magick wand.
5692 %
5693 */
5694 WandExport size_t MagickGetImageWidth(MagickWand *wand)
5695 {
5696   assert(wand != (MagickWand *) NULL);
5697   assert(wand->signature == WandSignature);
5698   if (IfMagickTrue(wand->debug))
5699     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5700   if (wand->images == (Image *) NULL)
5701     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5702   return(wand->images->columns);
5703 }
5704 \f
5705 /*
5706 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5707 %                                                                             %
5708 %                                                                             %
5709 %                                                                             %
5710 %   M a g i c k G e t N u m b e r I m a g e s                                 %
5711 %                                                                             %
5712 %                                                                             %
5713 %                                                                             %
5714 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5715 %
5716 %  MagickGetNumberImages() returns the number of images associated with a
5717 %  magick wand.
5718 %
5719 %  The format of the MagickGetNumberImages method is:
5720 %
5721 %      size_t MagickGetNumberImages(MagickWand *wand)
5722 %
5723 %  A description of each parameter follows:
5724 %
5725 %    o wand: the magick wand.
5726 %
5727 */
5728 WandExport size_t MagickGetNumberImages(MagickWand *wand)
5729 {
5730   assert(wand != (MagickWand *) NULL);
5731   assert(wand->signature == WandSignature);
5732   if (IfMagickTrue(wand->debug))
5733     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5734   return(GetImageListLength(wand->images));
5735 }
5736 \f
5737 /*
5738 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5739 %                                                                             %
5740 %                                                                             %
5741 %                                                                             %
5742 %   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                 %
5743 %                                                                             %
5744 %                                                                             %
5745 %                                                                             %
5746 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5747 %
5748 %  MagickGetImageTotalInkDensity() gets the image total ink density.
5749 %
5750 %  The format of the MagickGetImageTotalInkDensity method is:
5751 %
5752 %      double MagickGetImageTotalInkDensity(MagickWand *wand)
5753 %
5754 %  A description of each parameter follows:
5755 %
5756 %    o wand: the magick wand.
5757 %
5758 */
5759 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5760 {
5761   assert(wand != (MagickWand *) NULL);
5762   assert(wand->signature == WandSignature);
5763   if (IfMagickTrue(wand->debug))
5764     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5765   if (wand->images == (Image *) NULL)
5766     {
5767       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5768         "ContainsNoImages","`%s'",wand->name);
5769       return(0.0);
5770     }
5771   return(GetImageTotalInkDensity(wand->images,wand->exception));
5772 }
5773 \f
5774 /*
5775 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5776 %                                                                             %
5777 %                                                                             %
5778 %                                                                             %
5779 %   M a g i c k H a l d C l u t I m a g e                                     %
5780 %                                                                             %
5781 %                                                                             %
5782 %                                                                             %
5783 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5784 %
5785 %  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5786 %  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5787 %  dimensions.  Create it with the HALD coder.  You can apply any color
5788 %  transformation to the Hald image and then use this method to apply the
5789 %  transform to the image.
5790 %
5791 %  The format of the MagickHaldClutImage method is:
5792 %
5793 %      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5794 %        const MagickWand *hald_wand)
5795 %
5796 %  A description of each parameter follows:
5797 %
5798 %    o wand: the magick wand.
5799 %
5800 %    o hald_image: the hald CLUT image.
5801 %
5802 */
5803 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5804   const MagickWand *hald_wand)
5805 {
5806   MagickBooleanType
5807     status;
5808
5809   assert(wand != (MagickWand *) NULL);
5810   assert(wand->signature == WandSignature);
5811   if (IfMagickTrue(wand->debug))
5812     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5813   if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5814     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5815   status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
5816   return(status);
5817 }
5818 \f
5819 /*
5820 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5821 %                                                                             %
5822 %                                                                             %
5823 %                                                                             %
5824 %   M a g i c k H a s N e x t I m a g e                                       %
5825 %                                                                             %
5826 %                                                                             %
5827 %                                                                             %
5828 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5829 %
5830 %  MagickHasNextImage() returns MagickTrue if the wand has more images when
5831 %  traversing the list in the forward direction
5832 %
5833 %  The format of the MagickHasNextImage method is:
5834 %
5835 %      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5836 %
5837 %  A description of each parameter follows:
5838 %
5839 %    o wand: the magick wand.
5840 %
5841 */
5842 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5843 {
5844   assert(wand != (MagickWand *) NULL);
5845   assert(wand->signature == WandSignature);
5846   if (IfMagickTrue(wand->debug))
5847     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5848   if (wand->images == (Image *) NULL)
5849     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5850   if (GetNextImageInList(wand->images) == (Image *) NULL)
5851     return(MagickFalse);
5852   return(MagickTrue);
5853 }
5854 \f
5855 /*
5856 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5857 %                                                                             %
5858 %                                                                             %
5859 %                                                                             %
5860 %   M a g i c k H a s P r e v i o u s I m a g e                               %
5861 %                                                                             %
5862 %                                                                             %
5863 %                                                                             %
5864 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5865 %
5866 %  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5867 %  traversing the list in the reverse direction
5868 %
5869 %  The format of the MagickHasPreviousImage method is:
5870 %
5871 %      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5872 %
5873 %  A description of each parameter follows:
5874 %
5875 %    o wand: the magick wand.
5876 %
5877 */
5878 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5879 {
5880   assert(wand != (MagickWand *) NULL);
5881   assert(wand->signature == WandSignature);
5882   if (IfMagickTrue(wand->debug))
5883     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5884   if (wand->images == (Image *) NULL)
5885     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5886   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5887     return(MagickFalse);
5888   return(MagickTrue);
5889 }
5890 \f
5891 /*
5892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5893 %                                                                             %
5894 %                                                                             %
5895 %                                                                             %
5896 %   M a g i c k I d e n t i f y I m a g e                                     %
5897 %                                                                             %
5898 %                                                                             %
5899 %                                                                             %
5900 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5901 %
5902 %  MagickIdentifyImage() identifies an image by printing its attributes to the
5903 %  file.  Attributes include the image width, height, size, and others.
5904 %
5905 %  The format of the MagickIdentifyImage method is:
5906 %
5907 %      const char *MagickIdentifyImage(MagickWand *wand)
5908 %
5909 %  A description of each parameter follows:
5910 %
5911 %    o wand: the magick wand.
5912 %
5913 */
5914 WandExport char *MagickIdentifyImage(MagickWand *wand)
5915 {
5916   char
5917     *description,
5918     filename[MaxTextExtent];
5919
5920   FILE
5921     *file;
5922
5923   int
5924     unique_file;
5925
5926   assert(wand != (MagickWand *) NULL);
5927   assert(wand->signature == WandSignature);
5928   if (IfMagickTrue(wand->debug))
5929     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5930   if (wand->images == (Image *) NULL)
5931     {
5932       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5933         "ContainsNoImages","`%s'",wand->name);
5934       return((char *) NULL);
5935     }
5936   description=(char *) NULL;
5937   unique_file=AcquireUniqueFileResource(filename);
5938   file=(FILE *) NULL;
5939   if (unique_file != -1)
5940     file=fdopen(unique_file,"wb");
5941   if ((unique_file == -1) || (file == (FILE *) NULL))
5942     {
5943       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5944         "UnableToCreateTemporaryFile","`%s'",wand->name);
5945       return((char *) NULL);
5946     }
5947   (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
5948   (void) fclose(file);
5949   description=FileToString(filename,~0,wand->exception);
5950   (void) RelinquishUniqueFileResource(filename);
5951   return(description);
5952 }
5953 \f
5954 /*
5955 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5956 %                                                                             %
5957 %                                                                             %
5958 %                                                                             %
5959 %   M a g i c k I m p l o d e I m a g e                                       %
5960 %                                                                             %
5961 %                                                                             %
5962 %                                                                             %
5963 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5964 %
5965 %  MagickImplodeImage() creates a new image that is a copy of an existing
5966 %  one with the image pixels "implode" by the specified percentage.  It
5967 %  allocates the memory necessary for the new Image structure and returns a
5968 %  pointer to the new image.
5969 %
5970 %  The format of the MagickImplodeImage method is:
5971 %
5972 %      MagickBooleanType MagickImplodeImage(MagickWand *wand,
5973 %        const double radius,const PixelInterpolateMethod method)
5974 %
5975 %  A description of each parameter follows:
5976 %
5977 %    o wand: the magick wand.
5978 %
5979 %    o amount: Define the extent of the implosion.
5980 %
5981 %    o method: the pixel interpolation method.
5982 %
5983 */
5984 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
5985   const double amount,const PixelInterpolateMethod method)
5986 {
5987   Image
5988     *implode_image;
5989
5990   assert(wand != (MagickWand *) NULL);
5991   assert(wand->signature == WandSignature);
5992   if (IfMagickTrue(wand->debug))
5993     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5994   if (wand->images == (Image *) NULL)
5995     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5996   implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
5997   if (implode_image == (Image *) NULL)
5998     return(MagickFalse);
5999   ReplaceImageInList(&wand->images,implode_image);
6000   return(MagickTrue);
6001 }
6002 \f
6003 /*
6004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6005 %                                                                             %
6006 %                                                                             %
6007 %                                                                             %
6008 %   M a g i c k I m p o r t I m a g e P i x e l s                             %
6009 %                                                                             %
6010 %                                                                             %
6011 %                                                                             %
6012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6013 %
6014 %  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6015 %  location you specify.  The method returns MagickFalse on success otherwise
6016 %  MagickTrue if an error is encountered.  The pixel data can be either char,
6017 %  short int, int, ssize_t, float, or double in the order specified by map.
6018 %
6019 %  Suppose your want to upload the first scanline of a 640x480 image from
6020 %  character data in red-green-blue order:
6021 %
6022 %      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6023 %
6024 %  The format of the MagickImportImagePixels method is:
6025 %
6026 %      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6027 %        const ssize_t x,const ssize_t y,const size_t columns,
6028 %        const size_t rows,const char *map,const StorageType storage,
6029 %        const void *pixels)
6030 %
6031 %  A description of each parameter follows:
6032 %
6033 %    o wand: the magick wand.
6034 %
6035 %    o x, y, columns, rows:  These values define the perimeter of a region
6036 %      of pixels you want to define.
6037 %
6038 %    o map:  This string reflects the expected ordering of the pixel array.
6039 %      It can be any combination or order of R = red, G = green, B = blue,
6040 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
6041 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6042 %      P = pad.
6043 %
6044 %    o storage: Define the data type of the pixels.  Float and double types are
6045 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6046 %      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6047 %      or DoublePixel.
6048 %
6049 %    o pixels: This array of values contain the pixel components as defined by
6050 %      map and type.  You must preallocate this array where the expected
6051 %      length varies depending on the values of width, height, map, and type.
6052 %
6053 */
6054 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6055   const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
6056   const char *map,const StorageType storage,const void *pixels)
6057 {
6058   MagickBooleanType
6059     status;
6060
6061   assert(wand != (MagickWand *) NULL);
6062   assert(wand->signature == WandSignature);
6063   if (IfMagickTrue(wand->debug))
6064     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6065   if (wand->images == (Image *) NULL)
6066     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6067   status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
6068     wand->exception);
6069   return(status);
6070 }
6071 \f
6072 /*
6073 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6074 %                                                                             %
6075 %                                                                             %
6076 %                                                                             %
6077 %   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               %
6078 %                                                                             %
6079 %                                                                             %
6080 %                                                                             %
6081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6082 %
6083 %  MagickInterpolativeResizeImage() resize image using a interpolative
6084 %  method.
6085 %
6086 %      MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6087 %        const size_t columns,const size_t rows,
6088 %        const PixelInterpolateMethod method)
6089 %
6090 %  A description of each parameter follows:
6091 %
6092 %    o wand: the magick wand.
6093 %
6094 %    o columns: the number of columns in the scaled image.
6095 %
6096 %    o rows: the number of rows in the scaled image.
6097 %
6098 %    o interpolate: the pixel interpolation method.
6099 %
6100 */
6101 WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6102   const size_t columns,const size_t rows,const PixelInterpolateMethod method)
6103 {
6104   Image
6105     *resize_image;
6106
6107   assert(wand != (MagickWand *) NULL);
6108   assert(wand->signature == WandSignature);
6109   if (IfMagickTrue(wand->debug))
6110     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6111   if (wand->images == (Image *) NULL)
6112     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6113   resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
6114     wand->exception);
6115   if (resize_image == (Image *) NULL)
6116     return(MagickFalse);
6117   ReplaceImageInList(&wand->images,resize_image);
6118   return(MagickTrue);
6119 }
6120 \f
6121 /*
6122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6123 %                                                                             %
6124 %                                                                             %
6125 %                                                                             %
6126 %   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       %
6127 %                                                                             %
6128 %                                                                             %
6129 %                                                                             %
6130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6131 %
6132 %  MagickInverseFourierTransformImage() implements the inverse discrete
6133 %  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6134 %  imaginary image pair.
6135 %
6136 %  The format of the MagickInverseFourierTransformImage method is:
6137 %
6138 %      MagickBooleanType MagickInverseFourierTransformImage(
6139 %        MagickWand *magnitude_wand,MagickWand *phase_wand,
6140 %        const MagickBooleanType magnitude)
6141 %
6142 %  A description of each parameter follows:
6143 %
6144 %    o magnitude_wand: the magnitude or real wand.
6145 %
6146 %    o phase_wand: the phase or imaginary wand.
6147 %
6148 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6149 %      imaginary image pair.
6150 %
6151 */
6152 WandExport MagickBooleanType MagickInverseFourierTransformImage(
6153   MagickWand *magnitude_wand,MagickWand *phase_wand,
6154   const MagickBooleanType magnitude)
6155 {
6156   Image
6157     *inverse_image;
6158
6159   MagickWand
6160     *wand;
6161
6162   assert(magnitude_wand != (MagickWand *) NULL);
6163   assert(magnitude_wand->signature == WandSignature);
6164   if (IfMagickTrue(magnitude_wand->debug))
6165     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6166       magnitude_wand->name);
6167   wand=magnitude_wand;
6168   if (magnitude_wand->images == (Image *) NULL)
6169     ThrowWandException(WandError,"ContainsNoImages",
6170       magnitude_wand->name);
6171   assert(phase_wand != (MagickWand *) NULL);
6172   assert(phase_wand->signature == WandSignature);
6173   inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6174     phase_wand->images,magnitude,wand->exception);
6175   if (inverse_image == (Image *) NULL)
6176     return(MagickFalse);
6177   ReplaceImageInList(&wand->images,inverse_image);
6178   return(MagickTrue);
6179 }
6180 \f
6181 /*
6182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6183 %                                                                             %
6184 %                                                                             %
6185 %                                                                             %
6186 %   M a g i c k L a b e l I m a g e                                           %
6187 %                                                                             %
6188 %                                                                             %
6189 %                                                                             %
6190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6191 %
6192 %  MagickLabelImage() adds a label to your image.
6193 %
6194 %  The format of the MagickLabelImage method is:
6195 %
6196 %      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6197 %
6198 %  A description of each parameter follows:
6199 %
6200 %    o wand: the magick wand.
6201 %
6202 %    o label: the image label.
6203 %
6204 */
6205 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6206   const char *label)
6207 {
6208   MagickBooleanType
6209     status;
6210
6211   assert(wand != (MagickWand *) NULL);
6212   assert(wand->signature == WandSignature);
6213   if (IfMagickTrue(wand->debug))
6214     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6215   if (wand->images == (Image *) NULL)
6216     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6217   status=SetImageProperty(wand->images,"label",label,wand->exception);
6218   return(status);
6219 }
6220 \f
6221 /*
6222 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6223 %                                                                             %
6224 %                                                                             %
6225 %                                                                             %
6226 %   M a g i c k L e v e l I m a g e                                           %
6227 %                                                                             %
6228 %                                                                             %
6229 %                                                                             %
6230 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6231 %
6232 %  MagickLevelImage() adjusts the levels of an image by scaling the colors
6233 %  falling between specified white and black points to the full available
6234 %  quantum range. The parameters provided represent the black, mid, and white
6235 %  points. The black point specifies the darkest color in the image. Colors
6236 %  darker than the black point are set to zero. Mid point specifies a gamma
6237 %  correction to apply to the image.  White point specifies the lightest color
6238 %  in the image. Colors brighter than the white point are set to the maximum
6239 %  quantum value.
6240 %
6241 %  The format of the MagickLevelImage method is:
6242 %
6243 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6244 %        const double black_point,const double gamma,const double white_point)
6245 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6246 %        const ChannelType channel,const double black_point,const double gamma,
6247 %        const double white_point)
6248 %
6249 %  A description of each parameter follows:
6250 %
6251 %    o wand: the magick wand.
6252 %
6253 %    o channel: Identify which channel to level: RedPixelChannel,
6254 %      GreenPixelChannel, etc.
6255 %
6256 %    o black_point: the black point.
6257 %
6258 %    o gamma: the gamma.
6259 %
6260 %    o white_point: the white point.
6261 %
6262 */
6263 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6264   const double black_point,const double gamma,const double white_point)
6265 {
6266   MagickBooleanType
6267     status;
6268
6269   assert(wand != (MagickWand *) NULL);
6270   assert(wand->signature == WandSignature);
6271   if (IfMagickTrue(wand->debug))
6272     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6273   if (wand->images == (Image *) NULL)
6274     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6275   status=LevelImage(wand->images,black_point,white_point,gamma,
6276     wand->exception);
6277   return(status);
6278 }
6279 \f
6280 /*
6281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6282 %                                                                             %
6283 %                                                                             %
6284 %                                                                             %
6285 %   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6286 %                                                                             %
6287 %                                                                             %
6288 %                                                                             %
6289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6290 %
6291 %  MagickLinearStretchImage() stretches with saturation the image intensity.
6292 %
6293 %  You can also reduce the influence of a particular channel with a gamma
6294 %  value of 0.
6295 %
6296 %  The format of the MagickLinearStretchImage method is:
6297 %
6298 %      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6299 %        const double black_point,const double white_point)
6300 %
6301 %  A description of each parameter follows:
6302 %
6303 %    o wand: the magick wand.
6304 %
6305 %    o black_point: the black point.
6306 %
6307 %    o white_point: the white point.
6308 %
6309 */
6310 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6311   const double black_point,const double white_point)
6312 {
6313   MagickBooleanType
6314     status;
6315
6316   assert(wand != (MagickWand *) NULL);
6317   assert(wand->signature == WandSignature);
6318   if (IfMagickTrue(wand->debug))
6319     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6320   if (wand->images == (Image *) NULL)
6321     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6322   status=LinearStretchImage(wand->images,black_point,white_point,
6323     wand->exception);
6324   return(status);
6325 }
6326 \f
6327 /*
6328 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6329 %                                                                             %
6330 %                                                                             %
6331 %                                                                             %
6332 %   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6333 %                                                                             %
6334 %                                                                             %
6335 %                                                                             %
6336 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6337 %
6338 %  MagickLiquidRescaleImage() rescales image with seam carving.
6339 %
6340 %      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6341 %        const size_t columns,const size_t rows,
6342 %        const double delta_x,const double rigidity)
6343 %
6344 %  A description of each parameter follows:
6345 %
6346 %    o wand: the magick wand.
6347 %
6348 %    o columns: the number of columns in the scaled image.
6349 %
6350 %    o rows: the number of rows in the scaled image.
6351 %
6352 %    o delta_x: maximum seam transversal step (0 means straight seams).
6353 %
6354 %    o rigidity: introduce a bias for non-straight seams (typically 0).
6355 %
6356 */
6357 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6358   const size_t columns,const size_t rows,const double delta_x,
6359   const double rigidity)
6360 {
6361   Image
6362     *rescale_image;
6363
6364   assert(wand != (MagickWand *) NULL);
6365   assert(wand->signature == WandSignature);
6366   if (IfMagickTrue(wand->debug))
6367     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6368   if (wand->images == (Image *) NULL)
6369     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6370   rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6371     rigidity,wand->exception);
6372   if (rescale_image == (Image *) NULL)
6373     return(MagickFalse);
6374   ReplaceImageInList(&wand->images,rescale_image);
6375   return(MagickTrue);
6376 }
6377 \f
6378 /*
6379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6380 %                                                                             %
6381 %                                                                             %
6382 %                                                                             %
6383 %   M a g i c k M a g n i f y I m a g e                                       %
6384 %                                                                             %
6385 %                                                                             %
6386 %                                                                             %
6387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6388 %
6389 %  MagickMagnifyImage() is a convenience method that scales an image
6390 %  proportionally to twice its original size.
6391 %
6392 %  The format of the MagickMagnifyImage method is:
6393 %
6394 %      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6395 %
6396 %  A description of each parameter follows:
6397 %
6398 %    o wand: the magick wand.
6399 %
6400 */
6401 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6402 {
6403   Image
6404     *magnify_image;
6405
6406   assert(wand != (MagickWand *) NULL);
6407   assert(wand->signature == WandSignature);
6408   if (IfMagickTrue(wand->debug))
6409     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6410   if (wand->images == (Image *) NULL)
6411     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6412   magnify_image=MagnifyImage(wand->images,wand->exception);
6413   if (magnify_image == (Image *) NULL)
6414     return(MagickFalse);
6415   ReplaceImageInList(&wand->images,magnify_image);
6416   return(MagickTrue);
6417 }
6418 \f
6419 /*
6420 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6421 %                                                                             %
6422 %                                                                             %
6423 %                                                                             %
6424 %   M a g i c k M e r g e I m a g e L a y e r s                               %
6425 %                                                                             %
6426 %                                                                             %
6427 %                                                                             %
6428 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6429 %
6430 %  MagickMergeImageLayers() composes all the image layers from the current
6431 %  given image onward to produce a single image of the merged layers.
6432 %
6433 %  The inital canvas's size depends on the given LayerMethod, and is
6434 %  initialized using the first images background color.  The images
6435 %  are then compositied onto that image in sequence using the given
6436 %  composition that has been assigned to each individual image.
6437 %
6438 %  The format of the MagickMergeImageLayers method is:
6439 %
6440 %      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6441 %        const LayerMethod method)
6442 %
6443 %  A description of each parameter follows:
6444 %
6445 %    o wand: the magick wand.
6446 %
6447 %    o method: the method of selecting the size of the initial canvas.
6448 %
6449 %        MergeLayer: Merge all layers onto a canvas just large enough
6450 %           to hold all the actual images. The virtual canvas of the
6451 %           first image is preserved but otherwise ignored.
6452 %
6453 %        FlattenLayer: Use the virtual canvas size of first image.
6454 %           Images which fall outside this canvas is clipped.
6455 %           This can be used to 'fill out' a given virtual canvas.
6456 %
6457 %        MosaicLayer: Start with the virtual canvas of the first image,
6458 %           enlarging left and right edges to contain all images.
6459 %           Images with negative offsets will be clipped.
6460 %
6461 */
6462 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6463   const LayerMethod method)
6464 {
6465   Image
6466     *mosaic_image;
6467
6468   assert(wand != (MagickWand *) NULL);
6469   assert(wand->signature == WandSignature);
6470   if (IfMagickTrue(wand->debug))
6471     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6472   if (wand->images == (Image *) NULL)
6473     return((MagickWand *) NULL);
6474   mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6475   if (mosaic_image == (Image *) NULL)
6476     return((MagickWand *) NULL);
6477   return(CloneMagickWandFromImages(wand,mosaic_image));
6478 }
6479 \f
6480 /*
6481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6482 %                                                                             %
6483 %                                                                             %
6484 %                                                                             %
6485 %   M a g i c k M i n i f y I m a g e                                         %
6486 %                                                                             %
6487 %                                                                             %
6488 %                                                                             %
6489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6490 %
6491 %  MagickMinifyImage() is a convenience method that scales an image
6492 %  proportionally to one-half its original size
6493 %
6494 %  The format of the MagickMinifyImage method is:
6495 %
6496 %      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6497 %
6498 %  A description of each parameter follows:
6499 %
6500 %    o wand: the magick wand.
6501 %
6502 */
6503 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6504 {
6505   Image
6506     *minify_image;
6507
6508   assert(wand != (MagickWand *) NULL);
6509   assert(wand->signature == WandSignature);
6510   if (IfMagickTrue(wand->debug))
6511     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6512   if (wand->images == (Image *) NULL)
6513     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6514   minify_image=MinifyImage(wand->images,wand->exception);
6515   if (minify_image == (Image *) NULL)
6516     return(MagickFalse);
6517   ReplaceImageInList(&wand->images,minify_image);
6518   return(MagickTrue);
6519 }
6520 \f
6521 /*
6522 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6523 %                                                                             %
6524 %                                                                             %
6525 %                                                                             %
6526 %   M a g i c k M o d u l a t e I m a g e                                     %
6527 %                                                                             %
6528 %                                                                             %
6529 %                                                                             %
6530 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6531 %
6532 %  MagickModulateImage() lets you control the brightness, saturation, and hue
6533 %  of an image.  Hue is the percentage of absolute rotation from the current
6534 %  position.  For example 50 results in a counter-clockwise rotation of 90
6535 %  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6536 %  both resulting in a rotation of 180 degrees.
6537 %
6538 %  To increase the color brightness by 20% and decrease the color saturation by
6539 %  10% and leave the hue unchanged, use: 120,90,100.
6540 %
6541 %  The format of the MagickModulateImage method is:
6542 %
6543 %      MagickBooleanType MagickModulateImage(MagickWand *wand,
6544 %        const double brightness,const double saturation,const double hue)
6545 %
6546 %  A description of each parameter follows:
6547 %
6548 %    o wand: the magick wand.
6549 %
6550 %    o brightness: the percent change in brighness.
6551 %
6552 %    o saturation: the percent change in saturation.
6553 %
6554 %    o hue: the percent change in hue.
6555 %
6556 */
6557 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6558   const double brightness,const double saturation,const double hue)
6559 {
6560   char
6561     modulate[MaxTextExtent];
6562
6563   MagickBooleanType
6564     status;
6565
6566   assert(wand != (MagickWand *) NULL);
6567   assert(wand->signature == WandSignature);
6568   if (IfMagickTrue(wand->debug))
6569     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6570   if (wand->images == (Image *) NULL)
6571     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6572   (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6573     brightness,saturation,hue);
6574   status=ModulateImage(wand->images,modulate,wand->exception);
6575   return(status);
6576 }
6577 \f
6578 /*
6579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6580 %                                                                             %
6581 %                                                                             %
6582 %                                                                             %
6583 %   M a g i c k M o n t a g e I m a g e                                       %
6584 %                                                                             %
6585 %                                                                             %
6586 %                                                                             %
6587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6588 %
6589 %  MagickMontageImage() creates a composite image by combining several
6590 %  separate images. The images are tiled on the composite image with the name
6591 %  of the image optionally appearing just below the individual tile.
6592 %
6593 %  The format of the MagickMontageImage method is:
6594 %
6595 %      MagickWand *MagickMontageImage(MagickWand *wand,
6596 %        const DrawingWand drawing_wand,const char *tile_geometry,
6597 %        const char *thumbnail_geometry,const MontageMode mode,
6598 %        const char *frame)
6599 %
6600 %  A description of each parameter follows:
6601 %
6602 %    o wand: the magick wand.
6603 %
6604 %    o drawing_wand: the drawing wand.  The font name, size, and color are
6605 %      obtained from this wand.
6606 %
6607 %    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6608 %
6609 %    o thumbnail_geometry: Preferred image size and border size of each
6610 %      thumbnail (e.g. 120x120+4+3>).
6611 %
6612 %    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6613 %
6614 %    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6615 %      The frame color is that of the thumbnail's matte color.
6616 %
6617 */
6618 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6619   const DrawingWand *drawing_wand,const char *tile_geometry,
6620   const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6621 {
6622   char
6623     *font;
6624
6625   Image
6626     *montage_image;
6627
6628   MontageInfo
6629     *montage_info;
6630
6631   PixelWand
6632     *pixel_wand;
6633
6634   assert(wand != (MagickWand *) NULL);
6635   assert(wand->signature == WandSignature);
6636   if (IfMagickTrue(wand->debug))
6637     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6638   if (wand->images == (Image *) NULL)
6639     return((MagickWand *) NULL);
6640   montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6641   switch (mode)
6642   {
6643     case FrameMode:
6644     {
6645       (void) CloneString(&montage_info->frame,"15x15+3+3");
6646       montage_info->shadow=MagickTrue;
6647       break;
6648     }
6649     case UnframeMode:
6650     {
6651       montage_info->frame=(char *) NULL;
6652       montage_info->shadow=MagickFalse;
6653       montage_info->border_width=0;
6654       break;
6655     }
6656     case ConcatenateMode:
6657     {
6658       montage_info->frame=(char *) NULL;
6659       montage_info->shadow=MagickFalse;
6660       (void) CloneString(&montage_info->geometry,"+0+0");
6661       montage_info->border_width=0;
6662       break;
6663     }
6664     default:
6665       break;
6666   }
6667   font=DrawGetFont(drawing_wand);
6668   if (font != (char *) NULL)
6669     (void) CloneString(&montage_info->font,font);
6670   if (frame != (char *) NULL)
6671     (void) CloneString(&montage_info->frame,frame);
6672   montage_info->pointsize=DrawGetFontSize(drawing_wand);
6673   pixel_wand=NewPixelWand();
6674   DrawGetFillColor(drawing_wand,pixel_wand);
6675   PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6676   DrawGetStrokeColor(drawing_wand,pixel_wand);
6677   PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6678   pixel_wand=DestroyPixelWand(pixel_wand);
6679   if (thumbnail_geometry != (char *) NULL)
6680     (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6681   if (tile_geometry != (char *) NULL)
6682     (void) CloneString(&montage_info->tile,tile_geometry);
6683   montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6684     wand->exception);
6685   montage_info=DestroyMontageInfo(montage_info);
6686   if (montage_image == (Image *) NULL)
6687     return((MagickWand *) NULL);
6688   return(CloneMagickWandFromImages(wand,montage_image));
6689 }
6690 \f
6691 /*
6692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6693 %                                                                             %
6694 %                                                                             %
6695 %                                                                             %
6696 %   M a g i c k M o r p h I m a g e s                                         %
6697 %                                                                             %
6698 %                                                                             %
6699 %                                                                             %
6700 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6701 %
6702 %  MagickMorphImages() method morphs a set of images.  Both the image pixels
6703 %  and size are linearly interpolated to give the appearance of a
6704 %  meta-morphosis from one image to the next.
6705 %
6706 %  The format of the MagickMorphImages method is:
6707 %
6708 %      MagickWand *MagickMorphImages(MagickWand *wand,
6709 %        const size_t number_frames)
6710 %
6711 %  A description of each parameter follows:
6712 %
6713 %    o wand: the magick wand.
6714 %
6715 %    o number_frames: the number of in-between images to generate.
6716 %
6717 */
6718 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6719   const size_t number_frames)
6720 {
6721   Image
6722     *morph_image;
6723
6724   assert(wand != (MagickWand *) NULL);
6725   assert(wand->signature == WandSignature);
6726   if (IfMagickTrue(wand->debug))
6727     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6728   if (wand->images == (Image *) NULL)
6729     return((MagickWand *) NULL);
6730   morph_image=MorphImages(wand->images,number_frames,wand->exception);
6731   if (morph_image == (Image *) NULL)
6732     return((MagickWand *) NULL);
6733   return(CloneMagickWandFromImages(wand,morph_image));
6734 }
6735 \f
6736 /*
6737 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6738 %                                                                             %
6739 %                                                                             %
6740 %                                                                             %
6741 %   M a g i c k M o r p h o l o g y I m a g e                                 %
6742 %                                                                             %
6743 %                                                                             %
6744 %                                                                             %
6745 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6746 %
6747 %  MagickMorphologyImage() applies a user supplied kernel to the image
6748 %  according to the given mophology method.
6749 %
6750 %  The format of the MagickMorphologyImage method is:
6751 %
6752 %      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6753 %        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6754 %
6755 %  A description of each parameter follows:
6756 %
6757 %    o wand: the magick wand.
6758 %
6759 %    o method: the morphology method to be applied.
6760 %
6761 %    o iterations: apply the operation this many times (or no change).
6762 %      A value of -1 means loop until no change found.  How this is applied
6763 %      may depend on the morphology method.  Typically this is a value of 1.
6764 %
6765 %    o kernel: An array of doubles representing the morphology kernel.
6766 %
6767 */
6768 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6769   MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6770 {
6771   Image
6772     *morphology_image;
6773
6774   assert(wand != (MagickWand *) NULL);
6775   assert(wand->signature == WandSignature);
6776   if (IfMagickTrue(wand->debug))
6777     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6778   if (kernel == (const KernelInfo *) NULL)
6779     return(MagickFalse);
6780   if (wand->images == (Image *) NULL)
6781     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6782   morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6783     wand->exception);
6784   if (morphology_image == (Image *) NULL)
6785     return(MagickFalse);
6786   ReplaceImageInList(&wand->images,morphology_image);
6787   return(MagickTrue);
6788 }
6789 \f
6790 /*
6791 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6792 %                                                                             %
6793 %                                                                             %
6794 %                                                                             %
6795 %   M a g i c k M o t i o n B l u r I m a g e                                 %
6796 %                                                                             %
6797 %                                                                             %
6798 %                                                                             %
6799 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6800 %
6801 %  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6802 %  Gaussian operator of the given radius and standard deviation (sigma).
6803 %  For reasonable results, radius should be larger than sigma.  Use a
6804 %  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6805 %  Angle gives the angle of the blurring motion.
6806 %
6807 %  The format of the MagickMotionBlurImage method is:
6808 %
6809 %      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6810 %        const double radius,const double sigma,const double angle)
6811 %
6812 %  A description of each parameter follows:
6813 %
6814 %    o wand: the magick wand.
6815 %
6816 %    o radius: the radius of the Gaussian, in pixels, not counting
6817 %      the center pixel.
6818 %
6819 %    o sigma: the standard deviation of the Gaussian, in pixels.
6820 %
6821 %    o angle: Apply the effect along this angle.
6822 %
6823 */
6824 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6825   const double radius,const double sigma,const double angle)
6826 {
6827   Image
6828     *blur_image;
6829
6830   assert(wand != (MagickWand *) NULL);
6831   assert(wand->signature == WandSignature);
6832   if (IfMagickTrue(wand->debug))
6833     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6834   if (wand->images == (Image *) NULL)
6835     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6836   blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
6837   if (blur_image == (Image *) NULL)
6838     return(MagickFalse);
6839   ReplaceImageInList(&wand->images,blur_image);
6840   return(MagickTrue);
6841 }
6842 \f
6843 /*
6844 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6845 %                                                                             %
6846 %                                                                             %
6847 %                                                                             %
6848 %   M a g i c k N e g a t e I m a g e                                         %
6849 %                                                                             %
6850 %                                                                             %
6851 %                                                                             %
6852 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6853 %
6854 %  MagickNegateImage() negates the colors in the reference image.  The
6855 %  Grayscale option means that only grayscale values within the image are
6856 %  negated.
6857 %
6858 %  You can also reduce the influence of a particular channel with a gamma
6859 %  value of 0.
6860 %
6861 %  The format of the MagickNegateImage method is:
6862 %
6863 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
6864 %        const MagickBooleanType gray)
6865 %
6866 %  A description of each parameter follows:
6867 %
6868 %    o wand: the magick wand.
6869 %
6870 %    o gray: If MagickTrue, only negate grayscale pixels within the image.
6871 %
6872 */
6873 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6874   const MagickBooleanType gray)
6875 {
6876   MagickBooleanType
6877     status;
6878
6879   assert(wand != (MagickWand *) NULL);
6880   assert(wand->signature == WandSignature);
6881   if (IfMagickTrue(wand->debug))
6882     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6883   if (wand->images == (Image *) NULL)
6884     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6885   status=NegateImage(wand->images,gray,wand->exception);
6886   return(status);
6887 }
6888 \f
6889 /*
6890 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6891 %                                                                             %
6892 %                                                                             %
6893 %                                                                             %
6894 %   M a g i c k N e w I m a g e                                               %
6895 %                                                                             %
6896 %                                                                             %
6897 %                                                                             %
6898 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6899 %
6900 %  MagickNewImage() adds a blank image canvas of the specified size and
6901 %  background color to the wand.
6902 %
6903 %  The format of the MagickNewImage method is:
6904 %
6905 %      MagickBooleanType MagickNewImage(MagickWand *wand,
6906 %        const size_t columns,const size_t rows,
6907 %        const PixelWand *background)
6908 %
6909 %  A description of each parameter follows:
6910 %
6911 %    o wand: the magick wand.
6912 %
6913 %    o width: the image width.
6914 %
6915 %    o height: the image height.
6916 %
6917 %    o background: the image color.
6918 %
6919 */
6920 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
6921   const size_t height,const PixelWand *background)
6922 {
6923   Image
6924     *images;
6925
6926   PixelInfo
6927     pixel;
6928
6929   assert(wand != (MagickWand *) NULL);
6930   assert(wand->signature == WandSignature);
6931   if (IfMagickTrue(wand->debug))
6932     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6933   PixelGetMagickColor(background,&pixel);
6934   images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
6935   if (images == (Image *) NULL)
6936     return(MagickFalse);
6937   return(InsertImageInWand(wand,images));
6938 }
6939 \f
6940 /*
6941 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6942 %                                                                             %
6943 %                                                                             %
6944 %                                                                             %
6945 %   M a g i c k N e x t I m a g e                                             %
6946 %                                                                             %
6947 %                                                                             %
6948 %                                                                             %
6949 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6950 %
6951 %  MagickNextImage() sets the next image in the wand as the current image.
6952 %
6953 %  It is typically used after MagickResetIterator(), after which its first use
6954 %  will set the first image as the current image (unless the wand is empty).
6955 %
6956 %  It will return MagickFalse when no more images are left to be returned
6957 %  which happens when the wand is empty, or the current image is the last
6958 %  image.
6959 %
6960 %  When the above condition (end of image list) is reached, the iterator is
6961 %  automaticall set so that you can start using MagickPreviousImage() to
6962 %  again iterate over the images in the reverse direction, starting with the
6963 %  last image (again).  You can jump to this condition immeditally using
6964 %  MagickSetLastIterator().
6965 %
6966 %  The format of the MagickNextImage method is:
6967 %
6968 %      MagickBooleanType MagickNextImage(MagickWand *wand)
6969 %
6970 %  A description of each parameter follows:
6971 %
6972 %    o wand: the magick wand.
6973 %
6974 */
6975 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
6976 {
6977   assert(wand != (MagickWand *) NULL);
6978   assert(wand->signature == WandSignature);
6979   if (IfMagickTrue(wand->debug))
6980     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6981   if (wand->images == (Image *) NULL)
6982     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6983   wand->insert_before=MagickFalse; /* Inserts is now appended */
6984   if (IfMagickTrue(wand->image_pending))
6985     {
6986       wand->image_pending=MagickFalse;
6987       return(MagickTrue);
6988     }
6989   if (GetNextImageInList(wand->images) == (Image *) NULL)
6990     {
6991       wand->image_pending=MagickTrue; /* No image, PreviousImage re-gets */
6992       return(MagickFalse);
6993     }
6994   wand->images=GetNextImageInList(wand->images);
6995   return(MagickTrue);
6996 }
6997 \f
6998 /*
6999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7000 %                                                                             %
7001 %                                                                             %
7002 %                                                                             %
7003 %   M a g i c k N o r m a l i z e I m a g e                                   %
7004 %                                                                             %
7005 %                                                                             %
7006 %                                                                             %
7007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7008 %
7009 %  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7010 %  the pixels color to span the entire range of colors available
7011 %
7012 %  You can also reduce the influence of a particular channel with a gamma
7013 %  value of 0.
7014 %
7015 %  The format of the MagickNormalizeImage method is:
7016 %
7017 %      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7018 %
7019 %  A description of each parameter follows:
7020 %
7021 %    o wand: the magick wand.
7022 %
7023 */
7024 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7025 {
7026   MagickBooleanType
7027     status;
7028
7029   assert(wand != (MagickWand *) NULL);
7030   assert(wand->signature == WandSignature);
7031   if (IfMagickTrue(wand->debug))
7032     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7033   if (wand->images == (Image *) NULL)
7034     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7035   status=NormalizeImage(wand->images,wand->exception);
7036   return(status);
7037 }
7038 \f
7039 /*
7040 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7041 %                                                                             %
7042 %                                                                             %
7043 %                                                                             %
7044 %   M a g i c k O i l P a i n t I m a g e                                     %
7045 %                                                                             %
7046 %                                                                             %
7047 %                                                                             %
7048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7049 %
7050 %  MagickOilPaintImage() applies a special effect filter that simulates an oil
7051 %  painting.  Each pixel is replaced by the most frequent color occurring
7052 %  in a circular region defined by radius.
7053 %
7054 %  The format of the MagickOilPaintImage method is:
7055 %
7056 %      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7057 %        const double radius,const double sigma)
7058 %
7059 %  A description of each parameter follows:
7060 %
7061 %    o wand: the magick wand.
7062 %
7063 %    o radius: the radius of the circular neighborhood.
7064 %
7065 %    o sigma: the standard deviation of the Gaussian, in pixels.
7066 %
7067 */
7068 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7069   const double radius,const double sigma)
7070 {
7071   Image
7072     *paint_image;
7073
7074   assert(wand != (MagickWand *) NULL);
7075   assert(wand->signature == WandSignature);
7076   if (IfMagickTrue(wand->debug))
7077     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7078   if (wand->images == (Image *) NULL)
7079     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7080   paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
7081   if (paint_image == (Image *) NULL)
7082     return(MagickFalse);
7083   ReplaceImageInList(&wand->images,paint_image);
7084   return(MagickTrue);
7085 }
7086 \f
7087 /*
7088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7089 %                                                                             %
7090 %                                                                             %
7091 %                                                                             %
7092 %   M a g i c k O p a q u e P a i n t I m a g e                               %
7093 %                                                                             %
7094 %                                                                             %
7095 %                                                                             %
7096 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7097 %
7098 %  MagickOpaquePaintImage() changes any pixel that matches color with the color
7099 %  defined by fill.
7100 %
7101 %  The format of the MagickOpaquePaintImage method is:
7102 %
7103 %      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7104 %        const PixelWand *target,const PixelWand *fill,const double fuzz,
7105 %        const MagickBooleanType invert)
7106 %
7107 %  A description of each parameter follows:
7108 %
7109 %    o wand: the magick wand.
7110 %
7111 %    o target: Change this target color to the fill color within the image.
7112 %
7113 %    o fill: the fill pixel wand.
7114 %
7115 %    o fuzz: By default target must match a particular pixel color
7116 %      exactly.  However, in many cases two colors may differ by a small amount.
7117 %      The fuzz member of image defines how much tolerance is acceptable to
7118 %      consider two colors as the same.  For example, set fuzz to 10 and the
7119 %      color red at intensities of 100 and 102 respectively are now interpreted
7120 %      as the same color for the purposes of the floodfill.
7121 %
7122 %    o invert: paint any pixel that does not match the target color.
7123 %
7124 */
7125 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7126   const PixelWand *target,const PixelWand *fill,const double fuzz,
7127   const MagickBooleanType invert)
7128 {
7129   MagickBooleanType
7130     status;
7131
7132   PixelInfo
7133     fill_pixel,
7134     target_pixel;
7135
7136   assert(wand != (MagickWand *) NULL);
7137   assert(wand->signature == WandSignature);
7138   if (IfMagickTrue(wand->debug))
7139     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7140   if (wand->images == (Image *) NULL)
7141     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7142   PixelGetMagickColor(target,&target_pixel);
7143   PixelGetMagickColor(fill,&fill_pixel);
7144   wand->images->fuzz=fuzz;
7145   status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
7146     wand->exception);
7147   return(status);
7148 }
7149 \f
7150 /*
7151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7152 %                                                                             %
7153 %                                                                             %
7154 %                                                                             %
7155 %   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                         %
7156 %                                                                             %
7157 %                                                                             %
7158 %                                                                             %
7159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7160 %
7161 %  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7162 %  previous image in the sequence.  From this it attempts to select the
7163 %  smallest cropped image to replace each frame, while preserving the results
7164 %  of the animation.
7165 %
7166 %  The format of the MagickOptimizeImageLayers method is:
7167 %
7168 %      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7169 %
7170 %  A description of each parameter follows:
7171 %
7172 %    o wand: the magick wand.
7173 %
7174 */
7175 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7176 {
7177   Image
7178     *optimize_image;
7179
7180   assert(wand != (MagickWand *) NULL);
7181   assert(wand->signature == WandSignature);
7182   if (IfMagickTrue(wand->debug))
7183     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7184   if (wand->images == (Image *) NULL)
7185     return((MagickWand *) NULL);
7186   optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7187   if (optimize_image == (Image *) NULL)
7188     return((MagickWand *) NULL);
7189   return(CloneMagickWandFromImages(wand,optimize_image));
7190 }
7191 \f
7192 /*
7193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7194 %                                                                             %
7195 %                                                                             %
7196 %                                                                             %
7197 %   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             %
7198 %                                                                             %
7199 %                                                                             %
7200 %                                                                             %
7201 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7202 %
7203 %  MagickOptimizeImageTransparency() takes a frame optimized GIF animation, and
7204 %  compares the overlayed pixels against the disposal image resulting from all
7205 %  the previous frames in the animation.  Any pixel that does not change the
7206 %  disposal image (and thus does not effect the outcome of an overlay) is made
7207 %  transparent.
7208 %
7209 %  WARNING: This modifies the current images directly, rather than generate
7210 %  a new image sequence.
7211 %  The format of the MagickOptimizeImageTransparency method is:
7212 %
7213 %      MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7214 %
7215 %  A description of each parameter follows:
7216 %
7217 %    o wand: the magick wand.
7218 %
7219 */
7220 WandExport MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7221 {
7222   assert(wand != (MagickWand *) NULL);
7223   assert(wand->signature == WandSignature);
7224   if (IfMagickTrue(wand->debug))
7225     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7226   if (wand->images == (Image *) NULL)
7227     return(MagickFalse);
7228   OptimizeImageTransparency(wand->images,wand->exception);
7229   return(MagickTrue);
7230 }
7231 \f
7232 /*
7233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7234 %                                                                             %
7235 %                                                                             %
7236 %                                                                             %
7237 %     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                   %
7238 %                                                                             %
7239 %                                                                             %
7240 %                                                                             %
7241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7242 %
7243 %  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7244 %  of pre-defined dithering threshold maps, but over multiple intensity levels,
7245 %  which can be different for different channels, according to the input
7246 %  arguments.
7247 %
7248 %  The format of the MagickOrderedPosterizeImage method is:
7249 %
7250 %      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7251 %        const char *threshold_map)
7252 %
7253 %  A description of each parameter follows:
7254 %
7255 %    o image: the image.
7256 %
7257 %    o threshold_map: A string containing the name of the threshold dither
7258 %      map to use, followed by zero or more numbers representing the number of
7259 %      color levels tho dither between.
7260 %
7261 %      Any level number less than 2 is equivalent to 2, and means only binary
7262 %      dithering will be applied to each color channel.
7263 %
7264 %      No numbers also means a 2 level (bitmap) dither will be applied to all
7265 %      channels, while a single number is the number of levels applied to each
7266 %      channel in sequence.  More numbers will be applied in turn to each of
7267 %      the color channels.
7268 %
7269 %      For example: "o3x3,6" generates a 6 level posterization of the image
7270 %      with a ordered 3x3 diffused pixel dither being applied between each
7271 %      level. While checker,8,8,4 will produce a 332 colormaped image with
7272 %      only a single checkerboard hash pattern (50% grey) between each color
7273 %      level, to basically double the number of color levels with a bare
7274 %      minimim of dithering.
7275 %
7276 */
7277 WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7278   const char *threshold_map)
7279 {
7280   MagickBooleanType
7281     status;
7282
7283   assert(wand != (MagickWand *) NULL);
7284   assert(wand->signature == WandSignature);
7285   if (IfMagickTrue(wand->debug))
7286     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7287   if (wand->images == (Image *) NULL)
7288     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7289   status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7290   return(status);
7291 }
7292 \f
7293 /*
7294 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7295 %                                                                             %
7296 %                                                                             %
7297 %                                                                             %
7298 %   M a g i c k P i n g I m a g e                                             %
7299 %                                                                             %
7300 %                                                                             %
7301 %                                                                             %
7302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7303 %
7304 %  MagickPingImage() is the same as MagickReadImage() except the only valid
7305 %  information returned is the image width, height, size, and format.  It
7306 %  is designed to efficiently obtain this information from a file without
7307 %  reading the entire image sequence into memory.
7308 %
7309 %  The format of the MagickPingImage method is:
7310 %
7311 %      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7312 %
7313 %  A description of each parameter follows:
7314 %
7315 %    o wand: the magick wand.
7316 %
7317 %    o filename: the image filename.
7318 %
7319 */
7320 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7321   const char *filename)
7322 {
7323   Image
7324     *images;
7325
7326   ImageInfo
7327     *ping_info;
7328
7329   assert(wand != (MagickWand *) NULL);
7330   assert(wand->signature == WandSignature);
7331   if (IfMagickTrue(wand->debug))
7332     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7333   ping_info=CloneImageInfo(wand->image_info);
7334   if (filename != (const char *) NULL)
7335     (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7336   images=PingImage(ping_info,wand->exception);
7337   ping_info=DestroyImageInfo(ping_info);
7338   if (images == (Image *) NULL)
7339     return(MagickFalse);
7340   return(InsertImageInWand(wand,images));
7341 }
7342 \f
7343 /*
7344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7345 %                                                                             %
7346 %                                                                             %
7347 %                                                                             %
7348 %   M a g i c k P i n g I m a g e B l o b                                     %
7349 %                                                                             %
7350 %                                                                             %
7351 %                                                                             %
7352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7353 %
7354 %  MagickPingImageBlob() pings an image or image sequence from a blob.
7355 %
7356 %  The format of the MagickPingImageBlob method is:
7357 %
7358 %      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7359 %        const void *blob,const size_t length)
7360 %
7361 %  A description of each parameter follows:
7362 %
7363 %    o wand: the magick wand.
7364 %
7365 %    o blob: the blob.
7366 %
7367 %    o length: the blob length.
7368 %
7369 */
7370 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7371   const void *blob,const size_t length)
7372 {
7373   Image
7374     *images;
7375
7376   ImageInfo
7377     *read_info;
7378
7379   assert(wand != (MagickWand *) NULL);
7380   assert(wand->signature == WandSignature);
7381   if (IfMagickTrue(wand->debug))
7382     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7383   read_info=CloneImageInfo(wand->image_info);
7384   SetImageInfoBlob(read_info,blob,length);
7385   images=PingImage(read_info,wand->exception);
7386   read_info=DestroyImageInfo(read_info);
7387   if (images == (Image *) NULL)
7388     return(MagickFalse);
7389   return(InsertImageInWand(wand,images));
7390 }
7391 \f
7392 /*
7393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7394 %                                                                             %
7395 %                                                                             %
7396 %                                                                             %
7397 %   M a g i c k P i n g I m a g e F i l e                                     %
7398 %                                                                             %
7399 %                                                                             %
7400 %                                                                             %
7401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7402 %
7403 %  MagickPingImageFile() pings an image or image sequence from an open file
7404 %  descriptor.
7405 %
7406 %  The format of the MagickPingImageFile method is:
7407 %
7408 %      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7409 %
7410 %  A description of each parameter follows:
7411 %
7412 %    o wand: the magick wand.
7413 %
7414 %    o file: the file descriptor.
7415 %
7416 */
7417 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7418 {
7419   Image
7420     *images;
7421
7422   ImageInfo
7423     *read_info;
7424
7425   assert(wand != (MagickWand *) NULL);
7426   assert(wand->signature == WandSignature);
7427   assert(file != (FILE *) NULL);
7428   if (IfMagickTrue(wand->debug))
7429     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7430   read_info=CloneImageInfo(wand->image_info);
7431   SetImageInfoFile(read_info,file);
7432   images=PingImage(read_info,wand->exception);
7433   read_info=DestroyImageInfo(read_info);
7434   if (images == (Image *) NULL)
7435     return(MagickFalse);
7436   return(InsertImageInWand(wand,images));
7437 }
7438 \f
7439 /*
7440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7441 %                                                                             %
7442 %                                                                             %
7443 %                                                                             %
7444 %   M a g i c k P o l a r o i d I m a g e                                     %
7445 %                                                                             %
7446 %                                                                             %
7447 %                                                                             %
7448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7449 %
7450 %  MagickPolaroidImage() simulates a Polaroid picture.
7451 %
7452 %  The format of the MagickPolaroidImage method is:
7453 %
7454 %      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7455 %        const DrawingWand *drawing_wand,const char *caption,const double angle,
7456 %        const PixelInterpolateMethod method)
7457 %
7458 %  A description of each parameter follows:
7459 %
7460 %    o wand: the magick wand.
7461 %
7462 %    o drawing_wand: the draw wand.
7463 %
7464 %    o caption: the Polaroid caption.
7465 %
7466 %    o angle: Apply the effect along this angle.
7467 %
7468 %    o method: the pixel interpolation method.
7469 %
7470 */
7471 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7472   const DrawingWand *drawing_wand,const char *caption,const double angle,
7473   const PixelInterpolateMethod method)
7474 {
7475   DrawInfo
7476     *draw_info;
7477
7478   Image
7479     *polaroid_image;
7480
7481   assert(wand != (MagickWand *) NULL);
7482   assert(wand->signature == WandSignature);
7483   if (IfMagickTrue(wand->debug))
7484     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7485   if (wand->images == (Image *) NULL)
7486     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7487   draw_info=PeekDrawingWand(drawing_wand);
7488   if (draw_info == (DrawInfo *) NULL)
7489     return(MagickFalse);
7490   polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
7491     wand->exception);
7492   if (polaroid_image == (Image *) NULL)
7493     return(MagickFalse);
7494   ReplaceImageInList(&wand->images,polaroid_image);
7495   return(MagickTrue);
7496 }
7497 \f
7498 /*
7499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7500 %                                                                             %
7501 %                                                                             %
7502 %                                                                             %
7503 %   M a g i c k P o s t e r i z e I m a g e                                   %
7504 %                                                                             %
7505 %                                                                             %
7506 %                                                                             %
7507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7508 %
7509 %  MagickPosterizeImage() reduces the image to a limited number of color level.
7510 %
7511 %  The format of the MagickPosterizeImage method is:
7512 %
7513 %      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7514 %        const size_t levels,const DitherMethod method)
7515 %
7516 %  A description of each parameter follows:
7517 %
7518 %    o wand: the magick wand.
7519 %
7520 %    o levels: Number of color levels allowed in each channel.  Very low values
7521 %      (2, 3, or 4) have the most visible effect.
7522 %
7523 %    o method: choose the dither method: UndefinedDitherMethod,
7524 %      NoDitherMethod, RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7525 %
7526 */
7527 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7528   const size_t levels,const DitherMethod dither)
7529 {
7530   MagickBooleanType
7531     status;
7532
7533   assert(wand != (MagickWand *) NULL);
7534   assert(wand->signature == WandSignature);
7535   if (IfMagickTrue(wand->debug))
7536     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7537   if (wand->images == (Image *) NULL)
7538     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7539   status=PosterizeImage(wand->images,levels,dither,wand->exception);
7540   return(status);
7541 }
7542 \f
7543 /*
7544 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7545 %                                                                             %
7546 %                                                                             %
7547 %                                                                             %
7548 %   M a g i c k P r e v i e w I m a g e s                                     %
7549 %                                                                             %
7550 %                                                                             %
7551 %                                                                             %
7552 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7553 %
7554 %  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7555 %  image processing operation applied at varying strengths.  This helpful
7556 %  to quickly pin-point an appropriate parameter for an image processing
7557 %  operation.
7558 %
7559 %  The format of the MagickPreviewImages method is:
7560 %
7561 %      MagickWand *MagickPreviewImages(MagickWand *wand,
7562 %        const PreviewType preview)
7563 %
7564 %  A description of each parameter follows:
7565 %
7566 %    o wand: the magick wand.
7567 %
7568 %    o preview: the preview type.
7569 %
7570 */
7571 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7572   const PreviewType preview)
7573 {
7574   Image
7575     *preview_image;
7576
7577   assert(wand != (MagickWand *) NULL);
7578   assert(wand->signature == WandSignature);
7579   if (IfMagickTrue(wand->debug))
7580     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7581   if (wand->images == (Image *) NULL)
7582     return((MagickWand *) NULL);
7583   preview_image=PreviewImage(wand->images,preview,wand->exception);
7584   if (preview_image == (Image *) NULL)
7585     return((MagickWand *) NULL);
7586   return(CloneMagickWandFromImages(wand,preview_image));
7587 }
7588 \f
7589 /*
7590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7591 %                                                                             %
7592 %                                                                             %
7593 %                                                                             %
7594 %   M a g i c k P r e v i o u s I m a g e                                     %
7595 %                                                                             %
7596 %                                                                             %
7597 %                                                                             %
7598 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7599 %
7600 %  MagickPreviousImage() sets the previous image in the wand as the current
7601 %  image.
7602 %
7603 %  It is typically used after MagickSetLastIterator(), after which its first
7604 %  use will set the last image as the current image (unless the wand is empty).
7605 %
7606 %  It will return MagickFalse when no more images are left to be returned
7607 %  which happens when the wand is empty, or the current image is the first
7608 %  image.  At that point the iterator is than reset to again process images in
7609 %  the forward direction, again starting with the first image in list. Images
7610 %  added at this point are prepended.
7611 %
7612 %  Also at that point any images added to the wand using MagickAddImages() or
7613 %  MagickReadImages() will be prepended before the first image. In this sense
7614 %  the condition is not quite exactly the same as MagickResetIterator().
7615 %
7616 %  The format of the MagickPreviousImage method is:
7617 %
7618 %      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7619 %
7620 %  A description of each parameter follows:
7621 %
7622 %    o wand: the magick wand.
7623 %
7624 */
7625 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7626 {
7627   assert(wand != (MagickWand *) NULL);
7628   assert(wand->signature == WandSignature);
7629   if (IfMagickTrue(wand->debug))
7630     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7631   if (wand->images == (Image *) NULL)
7632     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7633   if (IfMagickTrue(wand->image_pending))
7634     {
7635       wand->image_pending=MagickFalse;  /* image returned no longer pending */
7636       return(MagickTrue);
7637     }
7638   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7639     {
7640       wand->image_pending=MagickTrue;   /* Next now re-gets first image */
7641       wand->insert_before=MagickTrue;   /* insert/add prepends new images */
7642       return(MagickFalse);
7643     }
7644   wand->images=GetPreviousImageInList(wand->images);
7645   return(MagickTrue);
7646 }
7647 \f
7648 /*
7649 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7650 %                                                                             %
7651 %                                                                             %
7652 %                                                                             %
7653 %   M a g i c k Q u a n t i z e I m a g e                                     %
7654 %                                                                             %
7655 %                                                                             %
7656 %                                                                             %
7657 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7658 %
7659 %  MagickQuantizeImage() analyzes the colors within a reference image and
7660 %  chooses a fixed number of colors to represent the image.  The goal of the
7661 %  algorithm is to minimize the color difference between the input and output
7662 %  image while minimizing the processing time.
7663 %
7664 %  The format of the MagickQuantizeImage method is:
7665 %
7666 %      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7667 %        const size_t number_colors,const ColorspaceType colorspace,
7668 %        const size_t treedepth,const DitherMethod dither_method,
7669 %        const MagickBooleanType measure_error)
7670 %
7671 %  A description of each parameter follows:
7672 %
7673 %    o wand: the magick wand.
7674 %
7675 %    o number_colors: the number of colors.
7676 %
7677 %    o colorspace: Perform color reduction in this colorspace, typically
7678 %      RGBColorspace.
7679 %
7680 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7681 %      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
7682 %      reference image with the least amount of memory and the fastest
7683 %      computational speed.  In some cases, such as an image with low color
7684 %      dispersion (a few number of colors), a value other than
7685 %      Log4(number_colors) is required.  To expand the color tree completely,
7686 %      use a value of 8.
7687 %
7688 %    o dither_method: choose from UndefinedDitherMethod, NoDitherMethod,
7689 %      RiemersmaDitherMethod, FloydSteinbergDitherMethod.
7690 %
7691 %    o measure_error: A value other than zero measures the difference between
7692 %      the original and quantized images.  This difference is the total
7693 %      quantization error.  The error is computed by summing over all pixels
7694 %      in an image the distance squared in RGB space between each reference
7695 %      pixel value and its quantized value.
7696 %
7697 */
7698 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7699   const size_t number_colors,const ColorspaceType colorspace,
7700   const size_t treedepth,const DitherMethod dither_method,
7701   const MagickBooleanType measure_error)
7702 {
7703   MagickBooleanType
7704     status;
7705
7706   QuantizeInfo
7707     *quantize_info;
7708
7709   assert(wand != (MagickWand *) NULL);
7710   assert(wand->signature == WandSignature);
7711   if (IfMagickTrue(wand->debug))
7712     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7713   if (wand->images == (Image *) NULL)
7714     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7715   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7716   quantize_info->number_colors=number_colors;
7717   quantize_info->dither_method=dither_method;
7718   quantize_info->tree_depth=treedepth;
7719   quantize_info->colorspace=colorspace;
7720   quantize_info->measure_error=measure_error;
7721   status=QuantizeImage(quantize_info,wand->images,wand->exception);
7722   quantize_info=DestroyQuantizeInfo(quantize_info);
7723   return(status);
7724 }
7725 \f
7726 /*
7727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7728 %                                                                             %
7729 %                                                                             %
7730 %                                                                             %
7731 %   M a g i c k Q u a n t i z e I m a g e s                                   %
7732 %                                                                             %
7733 %                                                                             %
7734 %                                                                             %
7735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7736 %
7737 %  MagickQuantizeImages() analyzes the colors within a sequence of images and
7738 %  chooses a fixed number of colors to represent the image.  The goal of the
7739 %  algorithm is to minimize the color difference between the input and output
7740 %  image while minimizing the processing time.
7741 %
7742 %  The format of the MagickQuantizeImages method is:
7743 %
7744 %      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7745 %        const size_t number_colors,const ColorspaceType colorspace,
7746 %        const size_t treedepth,const DitherMethod dither_method,
7747 %        const MagickBooleanType measure_error)
7748 %
7749 %  A description of each parameter follows:
7750 %
7751 %    o wand: the magick wand.
7752 %
7753 %    o number_colors: the number of colors.
7754 %
7755 %    o colorspace: Perform color reduction in this colorspace, typically
7756 %      RGBColorspace.
7757 %
7758 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7759 %      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
7760 %      reference image with the least amount of memory and the fastest
7761 %      computational speed.  In some cases, such as an image with low color
7762 %      dispersion (a few number of colors), a value other than
7763 %      Log4(number_colors) is required.  To expand the color tree completely,
7764 %      use a value of 8.
7765 %
7766 %    o dither_method: choose from these dither methods: NoDitherMethod,
7767 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7768 %
7769 %    o measure_error: A value other than zero measures the difference between
7770 %      the original and quantized images.  This difference is the total
7771 %      quantization error.  The error is computed by summing over all pixels
7772 %      in an image the distance squared in RGB space between each reference
7773 %      pixel value and its quantized value.
7774 %
7775 */
7776 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7777   const size_t number_colors,const ColorspaceType colorspace,
7778   const size_t treedepth,const DitherMethod dither_method,
7779   const MagickBooleanType measure_error)
7780 {
7781   MagickBooleanType
7782     status;
7783
7784   QuantizeInfo
7785     *quantize_info;
7786
7787   assert(wand != (MagickWand *) NULL);
7788   assert(wand->signature == WandSignature);
7789   if (IfMagickTrue(wand->debug))
7790     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7791   if (wand->images == (Image *) NULL)
7792     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7793   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7794   quantize_info->number_colors=number_colors;
7795   quantize_info->dither_method=dither_method;
7796   quantize_info->tree_depth=treedepth;
7797   quantize_info->colorspace=colorspace;
7798   quantize_info->measure_error=measure_error;
7799   status=QuantizeImages(quantize_info,wand->images,wand->exception);
7800   quantize_info=DestroyQuantizeInfo(quantize_info);
7801   return(status);
7802 }
7803 \f
7804 /*
7805 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7806 %                                                                             %
7807 %                                                                             %
7808 %                                                                             %
7809 %   M a g i c k R a d i a l B l u r I m a g e                                 %
7810 %                                                                             %
7811 %                                                                             %
7812 %                                                                             %
7813 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7814 %
7815 %  MagickRadialBlurImage() radial blurs an image.
7816 %
7817 %  The format of the MagickRadialBlurImage method is:
7818 %
7819 %      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7820 %        const double angle)
7821 %
7822 %  A description of each parameter follows:
7823 %
7824 %    o wand: the magick wand.
7825 %
7826 %    o angle: the angle of the blur in degrees.
7827 %
7828 */
7829 WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7830   const double angle)
7831 {
7832   Image
7833     *blur_image;
7834
7835   assert(wand != (MagickWand *) NULL);
7836   assert(wand->signature == WandSignature);
7837   if (IfMagickTrue(wand->debug))
7838     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7839   if (wand->images == (Image *) NULL)
7840     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7841   blur_image=RadialBlurImage(wand->images,angle,wand->exception);
7842   if (blur_image == (Image *) NULL)
7843     return(MagickFalse);
7844   ReplaceImageInList(&wand->images,blur_image);
7845   return(MagickTrue);
7846 }
7847 \f
7848 /*
7849 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7850 %                                                                             %
7851 %                                                                             %
7852 %                                                                             %
7853 %   M a g i c k R a i s e I m a g e                                           %
7854 %                                                                             %
7855 %                                                                             %
7856 %                                                                             %
7857 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7858 %
7859 %  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7860 %  by lightening and darkening the edges of the image.  Members width and
7861 %  height of raise_info define the width of the vertical and horizontal
7862 %  edge of the effect.
7863 %
7864 %  The format of the MagickRaiseImage method is:
7865 %
7866 %      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7867 %        const size_t width,const size_t height,const ssize_t x,
7868 %        const ssize_t y,const MagickBooleanType raise)
7869 %
7870 %  A description of each parameter follows:
7871 %
7872 %    o wand: the magick wand.
7873 %
7874 %    o width,height,x,y:  Define the dimensions of the area to raise.
7875 %
7876 %    o raise: A value other than zero creates a 3-D raise effect,
7877 %      otherwise it has a lowered effect.
7878 %
7879 */
7880 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7881   const size_t width,const size_t height,const ssize_t x,
7882   const ssize_t y,const MagickBooleanType raise)
7883 {
7884   MagickBooleanType
7885     status;
7886
7887   RectangleInfo
7888     raise_info;
7889
7890   assert(wand != (MagickWand *) NULL);
7891   assert(wand->signature == WandSignature);
7892   if (IfMagickTrue(wand->debug))
7893     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7894   if (wand->images == (Image *) NULL)
7895     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7896   raise_info.width=width;
7897   raise_info.height=height;
7898   raise_info.x=x;
7899   raise_info.y=y;
7900   status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
7901   return(status);
7902 }
7903 \f
7904 /*
7905 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7906 %                                                                             %
7907 %                                                                             %
7908 %                                                                             %
7909 %   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                       %
7910 %                                                                             %
7911 %                                                                             %
7912 %                                                                             %
7913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7914 %
7915 %  MagickRandomThresholdImage() changes the value of individual pixels based on
7916 %  the intensity of each pixel compared to threshold.  The result is a
7917 %  high-contrast, two color image.
7918 %
7919 %  The format of the MagickRandomThresholdImage method is:
7920 %
7921 %      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7922 %        const double low,const double high)
7923 %
7924 %  A description of each parameter follows:
7925 %
7926 %    o wand: the magick wand.
7927 %
7928 %    o low,high: Specify the high and low thresholds.  These values range from
7929 %      0 to QuantumRange.
7930 %
7931 */
7932 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7933   const double low,const double high)
7934 {
7935   char
7936     threshold[MaxTextExtent];
7937
7938   assert(wand != (MagickWand *) NULL);
7939   assert(wand->signature == WandSignature);
7940   if (IfMagickTrue(wand->debug))
7941     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7942   if (wand->images == (Image *) NULL)
7943     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7944   (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
7945   return(RandomThresholdImage(wand->images,threshold,wand->exception));
7946 }
7947 \f
7948 /*
7949 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7950 %                                                                             %
7951 %                                                                             %
7952 %                                                                             %
7953 %   M a g i c k R e a d I m a g e                                             %
7954 %                                                                             %
7955 %                                                                             %
7956 %                                                                             %
7957 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7958 %
7959 %  MagickReadImage() reads an image or image sequence.  The images are inserted
7960 %  jjust before the current image pointer position.
7961 %
7962 %  Use MagickSetFirstIterator(), to insert new images before all the current
7963 %  images in the wand, MagickSetLastIterator() to append add to the end,
7964 %  MagickSetImageIndex() to place images just after the given index.
7965 %
7966 %  The format of the MagickReadImage method is:
7967 %
7968 %      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
7969 %
7970 %  A description of each parameter follows:
7971 %
7972 %    o wand: the magick wand.
7973 %
7974 %    o filename: the image filename.
7975 %
7976 */
7977 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
7978   const char *filename)
7979 {
7980   Image
7981     *images;
7982
7983   ImageInfo
7984     *read_info;
7985
7986   assert(wand != (MagickWand *) NULL);
7987   assert(wand->signature == WandSignature);
7988   if (IfMagickTrue(wand->debug))
7989     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7990   read_info=CloneImageInfo(wand->image_info);
7991   if (filename != (const char *) NULL)
7992     (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
7993   images=ReadImage(read_info,wand->exception);
7994   read_info=DestroyImageInfo(read_info);
7995   if (images == (Image *) NULL)
7996     return(MagickFalse);
7997   return(InsertImageInWand(wand,images));
7998 }
7999 \f
8000 /*
8001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8002 %                                                                             %
8003 %                                                                             %
8004 %                                                                             %
8005 %   M a g i c k R e a d I m a g e B l o b                                     %
8006 %                                                                             %
8007 %                                                                             %
8008 %                                                                             %
8009 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8010 %
8011 %  MagickReadImageBlob() reads an image or image sequence from a blob.
8012 %  In all other respects it is like MagickReadImage().
8013 %
8014 %  The format of the MagickReadImageBlob method is:
8015 %
8016 %      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8017 %        const void *blob,const size_t length)
8018 %
8019 %  A description of each parameter follows:
8020 %
8021 %    o wand: the magick wand.
8022 %
8023 %    o blob: the blob.
8024 %
8025 %    o length: the blob length.
8026 %
8027 */
8028 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8029   const void *blob,const size_t length)
8030 {
8031   Image
8032     *images;
8033
8034   assert(wand != (MagickWand *) NULL);
8035   assert(wand->signature == WandSignature);
8036   if (IfMagickTrue(wand->debug))
8037     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8038   images=BlobToImage(wand->image_info,blob,length,wand->exception);
8039   if (images == (Image *) NULL)
8040     return(MagickFalse);
8041   return(InsertImageInWand(wand,images));
8042 }
8043 \f
8044 /*
8045 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8046 %                                                                             %
8047 %                                                                             %
8048 %                                                                             %
8049 %   M a g i c k R e a d I m a g e F i l e                                     %
8050 %                                                                             %
8051 %                                                                             %
8052 %                                                                             %
8053 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8054 %
8055 %  MagickReadImageFile() reads an image or image sequence from an already
8056 %  opened file descriptor.  Otherwise it is like MagickReadImage().
8057 %
8058 %  The format of the MagickReadImageFile method is:
8059 %
8060 %      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8061 %
8062 %  A description of each parameter follows:
8063 %
8064 %    o wand: the magick wand.
8065 %
8066 %    o file: the file descriptor.
8067 %
8068 */
8069 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8070 {
8071   Image
8072     *images;
8073
8074   ImageInfo
8075     *read_info;
8076
8077   assert(wand != (MagickWand *) NULL);
8078   assert(wand->signature == WandSignature);
8079   assert(file != (FILE *) NULL);
8080   if (IfMagickTrue(wand->debug))
8081     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8082   read_info=CloneImageInfo(wand->image_info);
8083   SetImageInfoFile(read_info,file);
8084   images=ReadImage(read_info,wand->exception);
8085   read_info=DestroyImageInfo(read_info);
8086   if (images == (Image *) NULL)
8087     return(MagickFalse);
8088   return(InsertImageInWand(wand,images));
8089 }
8090 \f
8091 /*
8092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8093 %                                                                             %
8094 %                                                                             %
8095 %                                                                             %
8096 %   M a g i c k R e m a p I m a g e                                           %
8097 %                                                                             %
8098 %                                                                             %
8099 %                                                                             %
8100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8101 %
8102 %  MagickRemapImage() replaces the colors of an image with the closest color
8103 %  from a reference image.
8104 %
8105 %  The format of the MagickRemapImage method is:
8106 %
8107 %      MagickBooleanType MagickRemapImage(MagickWand *wand,
8108 %        const MagickWand *remap_wand,const DitherMethod method)
8109 %
8110 %  A description of each parameter follows:
8111 %
8112 %    o wand: the magick wand.
8113 %
8114 %    o affinity: the affinity wand.
8115 %
8116 %    o method: choose from these dither methods: NoDitherMethod,
8117 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8118 %
8119 */
8120 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8121   const MagickWand *remap_wand,const DitherMethod dither_method)
8122 {
8123   MagickBooleanType
8124     status;
8125
8126   QuantizeInfo
8127     *quantize_info;
8128
8129   assert(wand != (MagickWand *) NULL);
8130   assert(wand->signature == WandSignature);
8131   if (IfMagickTrue(wand->debug))
8132     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8133   if ((wand->images == (Image *) NULL) ||
8134       (remap_wand->images == (Image *) NULL))
8135     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8136   quantize_info=AcquireQuantizeInfo(wand->image_info);
8137   quantize_info->dither_method=dither_method;
8138   status=RemapImage(quantize_info,wand->images,remap_wand->images,
8139     wand->exception);
8140   quantize_info=DestroyQuantizeInfo(quantize_info);
8141   return(status);
8142 }
8143 \f
8144 /*
8145 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8146 %                                                                             %
8147 %                                                                             %
8148 %                                                                             %
8149 %   M a g i c k R e m o v e I m a g e                                         %
8150 %                                                                             %
8151 %                                                                             %
8152 %                                                                             %
8153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8154 %
8155 %  MagickRemoveImage() removes an image from the image list.
8156 %
8157 %  The format of the MagickRemoveImage method is:
8158 %
8159 %      MagickBooleanType MagickRemoveImage(MagickWand *wand)
8160 %
8161 %  A description of each parameter follows:
8162 %
8163 %    o wand: the magick wand.
8164 %
8165 %    o insert: the splice wand.
8166 %
8167 */
8168 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8169 {
8170   assert(wand != (MagickWand *) NULL);
8171   assert(wand->signature == WandSignature);
8172   if (IfMagickTrue(wand->debug))
8173     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8174   if (wand->images == (Image *) NULL)
8175     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8176   DeleteImageFromList(&wand->images);
8177   return(MagickTrue);
8178 }
8179 \f
8180 /*
8181 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8182 %                                                                             %
8183 %                                                                             %
8184 %                                                                             %
8185 %   M a g i c k R e s a m p l e I m a g e                                     %
8186 %                                                                             %
8187 %                                                                             %
8188 %                                                                             %
8189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8190 %
8191 %  MagickResampleImage() resample image to desired resolution.
8192 %
8193 %    Bessel   Blackman   Box
8194 %    Catrom   Cubic      Gaussian
8195 %    Hanning  Hermite    Lanczos
8196 %    Mitchell Point      Quandratic
8197 %    Sinc     Triangle
8198 %
8199 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8200 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8201 %  are windowed (brought down to zero) with the Blackman filter.
8202 %
8203 %  The format of the MagickResampleImage method is:
8204 %
8205 %      MagickBooleanType MagickResampleImage(MagickWand *wand,
8206 %        const double x_resolution,const double y_resolution,
8207 %        const FilterTypes filter)
8208 %
8209 %  A description of each parameter follows:
8210 %
8211 %    o wand: the magick wand.
8212 %
8213 %    o x_resolution: the new image x resolution.
8214 %
8215 %    o y_resolution: the new image y resolution.
8216 %
8217 %    o filter: Image filter to use.
8218 %
8219 */
8220 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8221   const double x_resolution,const double y_resolution,const FilterTypes filter)
8222 {
8223   Image
8224     *resample_image;
8225
8226   assert(wand != (MagickWand *) NULL);
8227   assert(wand->signature == WandSignature);
8228   if (IfMagickTrue(wand->debug))
8229     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8230   if (wand->images == (Image *) NULL)
8231     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8232   resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8233     wand->exception);
8234   if (resample_image == (Image *) NULL)
8235     return(MagickFalse);
8236   ReplaceImageInList(&wand->images,resample_image);
8237   return(MagickTrue);
8238 }
8239 \f
8240 /*
8241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8242 %                                                                             %
8243 %                                                                             %
8244 %                                                                             %
8245 %   M a g i c k R e s e t I m a g e P a g e                                   %
8246 %                                                                             %
8247 %                                                                             %
8248 %                                                                             %
8249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8250 %
8251 %  MagickResetImagePage() resets the Wand page canvas and position.
8252 %
8253 %  The format of the MagickResetImagePage method is:
8254 %
8255 %      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8256 %        const char *page)
8257 %
8258 %  A description of each parameter follows:
8259 %
8260 %    o wand: the magick wand.
8261 %
8262 %    o page: the relative page specification.
8263 %
8264 */
8265 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8266   const char *page)
8267 {
8268   assert(wand != (MagickWand *) NULL);
8269   assert(wand->signature == WandSignature);
8270   if (IfMagickTrue(wand->debug))
8271     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8272   if (wand->images == (Image *) NULL)
8273     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8274   if ((page == (char *) NULL) || (*page == '\0'))
8275     {
8276       (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8277       return(MagickTrue);
8278     }
8279   return(ResetImagePage(wand->images,page));
8280 }
8281 \f
8282 /*
8283 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8284 %                                                                             %
8285 %                                                                             %
8286 %                                                                             %
8287 %   M a g i c k R e s i z e I m a g e                                         %
8288 %                                                                             %
8289 %                                                                             %
8290 %                                                                             %
8291 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8292 %
8293 %  MagickResizeImage() scales an image to the desired dimensions with one of
8294 %  these filters:
8295 %
8296 %    Bessel   Blackman   Box
8297 %    Catrom   Cubic      Gaussian
8298 %    Hanning  Hermite    Lanczos
8299 %    Mitchell Point      Quandratic
8300 %    Sinc     Triangle
8301 %
8302 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8303 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8304 %  are windowed (brought down to zero) with the Blackman filter.
8305 %
8306 %  The format of the MagickResizeImage method is:
8307 %
8308 %      MagickBooleanType MagickResizeImage(MagickWand *wand,
8309 %        const size_t columns,const size_t rows,const FilterTypes filter)
8310 %
8311 %  A description of each parameter follows:
8312 %
8313 %    o wand: the magick wand.
8314 %
8315 %    o columns: the number of columns in the scaled image.
8316 %
8317 %    o rows: the number of rows in the scaled image.
8318 %
8319 %    o filter: Image filter to use.
8320 %
8321 */
8322 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8323   const size_t columns,const size_t rows,const FilterTypes filter)
8324 {
8325   Image
8326     *resize_image;
8327
8328   assert(wand != (MagickWand *) NULL);
8329   assert(wand->signature == WandSignature);
8330   if (IfMagickTrue(wand->debug))
8331     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8332   if (wand->images == (Image *) NULL)
8333     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8334   resize_image=ResizeImage(wand->images,columns,rows,filter,wand->exception);
8335   if (resize_image == (Image *) NULL)
8336     return(MagickFalse);
8337   ReplaceImageInList(&wand->images,resize_image);
8338   return(MagickTrue);
8339 }
8340 \f
8341 /*
8342 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8343 %                                                                             %
8344 %                                                                             %
8345 %                                                                             %
8346 %   M a g i c k R o l l I m a g e                                             %
8347 %                                                                             %
8348 %                                                                             %
8349 %                                                                             %
8350 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8351 %
8352 %  MagickRollImage() offsets an image as defined by x and y.
8353 %
8354 %  The format of the MagickRollImage method is:
8355 %
8356 %      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8357 %        const size_t y)
8358 %
8359 %  A description of each parameter follows:
8360 %
8361 %    o wand: the magick wand.
8362 %
8363 %    o x: the x offset.
8364 %
8365 %    o y: the y offset.
8366 %
8367 %
8368 */
8369 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8370   const ssize_t x,const ssize_t y)
8371 {
8372   Image
8373     *roll_image;
8374
8375   assert(wand != (MagickWand *) NULL);
8376   assert(wand->signature == WandSignature);
8377   if (IfMagickTrue(wand->debug))
8378     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8379   if (wand->images == (Image *) NULL)
8380     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8381   roll_image=RollImage(wand->images,x,y,wand->exception);
8382   if (roll_image == (Image *) NULL)
8383     return(MagickFalse);
8384   ReplaceImageInList(&wand->images,roll_image);
8385   return(MagickTrue);
8386 }
8387 \f
8388 /*
8389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8390 %                                                                             %
8391 %                                                                             %
8392 %                                                                             %
8393 %   M a g i c k R o t a t e I m a g e                                         %
8394 %                                                                             %
8395 %                                                                             %
8396 %                                                                             %
8397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8398 %
8399 %  MagickRotateImage() rotates an image the specified number of degrees. Empty
8400 %  triangles left over from rotating the image are filled with the
8401 %  background color.
8402 %
8403 %  The format of the MagickRotateImage method is:
8404 %
8405 %      MagickBooleanType MagickRotateImage(MagickWand *wand,
8406 %        const PixelWand *background,const double degrees)
8407 %
8408 %  A description of each parameter follows:
8409 %
8410 %    o wand: the magick wand.
8411 %
8412 %    o background: the background pixel wand.
8413 %
8414 %    o degrees: the number of degrees to rotate the image.
8415 %
8416 %
8417 */
8418 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8419   const PixelWand *background,const double degrees)
8420 {
8421   Image
8422     *rotate_image;
8423
8424   assert(wand != (MagickWand *) NULL);
8425   assert(wand->signature == WandSignature);
8426   if (IfMagickTrue(wand->debug))
8427     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8428   if (wand->images == (Image *) NULL)
8429     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8430   PixelGetQuantumPacket(background,&wand->images->background_color);
8431   rotate_image=RotateImage(wand->images,degrees,wand->exception);
8432   if (rotate_image == (Image *) NULL)
8433     return(MagickFalse);
8434   ReplaceImageInList(&wand->images,rotate_image);
8435   return(MagickTrue);
8436 }
8437 \f
8438 /*
8439 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8440 %                                                                             %
8441 %                                                                             %
8442 %                                                                             %
8443 %   M a g i c k S a m p l e I m a g e                                         %
8444 %                                                                             %
8445 %                                                                             %
8446 %                                                                             %
8447 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8448 %
8449 %  MagickSampleImage() scales an image to the desired dimensions with pixel
8450 %  sampling.  Unlike other scaling methods, this method does not introduce
8451 %  any additional color into the scaled image.
8452 %
8453 %  The format of the MagickSampleImage method is:
8454 %
8455 %      MagickBooleanType MagickSampleImage(MagickWand *wand,
8456 %        const size_t columns,const size_t rows)
8457 %
8458 %  A description of each parameter follows:
8459 %
8460 %    o wand: the magick wand.
8461 %
8462 %    o columns: the number of columns in the scaled image.
8463 %
8464 %    o rows: the number of rows in the scaled image.
8465 %
8466 %
8467 */
8468 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8469   const size_t columns,const size_t rows)
8470 {
8471   Image
8472     *sample_image;
8473
8474   assert(wand != (MagickWand *) NULL);
8475   assert(wand->signature == WandSignature);
8476   if (IfMagickTrue(wand->debug))
8477     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8478   if (wand->images == (Image *) NULL)
8479     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8480   sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8481   if (sample_image == (Image *) NULL)
8482     return(MagickFalse);
8483   ReplaceImageInList(&wand->images,sample_image);
8484   return(MagickTrue);
8485 }
8486 \f
8487 /*
8488 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8489 %                                                                             %
8490 %                                                                             %
8491 %                                                                             %
8492 %   M a g i c k S c a l e I m a g e                                           %
8493 %                                                                             %
8494 %                                                                             %
8495 %                                                                             %
8496 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8497 %
8498 %  MagickScaleImage() scales the size of an image to the given dimensions.
8499 %
8500 %  The format of the MagickScaleImage method is:
8501 %
8502 %      MagickBooleanType MagickScaleImage(MagickWand *wand,
8503 %        const size_t columns,const size_t rows)
8504 %
8505 %  A description of each parameter follows:
8506 %
8507 %    o wand: the magick wand.
8508 %
8509 %    o columns: the number of columns in the scaled image.
8510 %
8511 %    o rows: the number of rows in the scaled image.
8512 %
8513 %
8514 */
8515 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8516   const size_t columns,const size_t rows)
8517 {
8518   Image
8519     *scale_image;
8520
8521   assert(wand != (MagickWand *) NULL);
8522   assert(wand->signature == WandSignature);
8523   if (IfMagickTrue(wand->debug))
8524     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8525   if (wand->images == (Image *) NULL)
8526     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8527   scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8528   if (scale_image == (Image *) NULL)
8529     return(MagickFalse);
8530   ReplaceImageInList(&wand->images,scale_image);
8531   return(MagickTrue);
8532 }
8533 \f
8534 /*
8535 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8536 %                                                                             %
8537 %                                                                             %
8538 %                                                                             %
8539 %   M a g i c k S e g m e n t I m a g e                                       %
8540 %                                                                             %
8541 %                                                                             %
8542 %                                                                             %
8543 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8544 %
8545 %  MagickSegmentImage() segments an image by analyzing the histograms of the
8546 %  color components and identifying units that are homogeneous with the fuzzy
8547 %  C-means technique.
8548 %
8549 %  The format of the SegmentImage method is:
8550 %
8551 %      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8552 %        const ColorspaceType colorspace,const MagickBooleanType verbose,
8553 %        const double cluster_threshold,const double smooth_threshold)
8554 %
8555 %  A description of each parameter follows.
8556 %
8557 %    o wand: the wand.
8558 %
8559 %    o colorspace: the image colorspace.
8560 %
8561 %    o verbose:  Set to MagickTrue to print detailed information about the
8562 %      identified classes.
8563 %
8564 %    o cluster_threshold:  This represents the minimum number of pixels
8565 %      contained in a hexahedra before it can be considered valid (expressed as
8566 %      a percentage).
8567 %
8568 %    o smooth_threshold: the smoothing threshold eliminates noise in the second
8569 %      derivative of the histogram.  As the value is increased, you can expect a
8570 %      smoother second derivative.
8571 %
8572 */
8573 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8574   const ColorspaceType colorspace,const MagickBooleanType verbose,
8575   const double cluster_threshold,const double smooth_threshold)
8576 {
8577   MagickBooleanType
8578     status;
8579
8580   assert(wand != (MagickWand *) NULL);
8581   assert(wand->signature == WandSignature);
8582   if (IfMagickTrue(wand->debug))
8583     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8584   if (wand->images == (Image *) NULL)
8585     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8586   status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8587     smooth_threshold,wand->exception);
8588   return(status);
8589 }
8590 \f
8591 /*
8592 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8593 %                                                                             %
8594 %                                                                             %
8595 %                                                                             %
8596 %   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8597 %                                                                             %
8598 %                                                                             %
8599 %                                                                             %
8600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8601 %
8602 %  MagickSelectiveBlurImage() selectively blur an image within a contrast
8603 %  threshold. It is similar to the unsharpen mask that sharpens everything with
8604 %  contrast above a certain threshold.
8605 %
8606 %  The format of the MagickSelectiveBlurImage method is:
8607 %
8608 %      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8609 %        const double radius,const double sigma,const double threshold)
8610 %
8611 %  A description of each parameter follows:
8612 %
8613 %    o wand: the magick wand.
8614 %
8615 %    o radius: the radius of the gaussian, in pixels, not counting the center
8616 %      pixel.
8617 %
8618 %    o sigma: the standard deviation of the gaussian, in pixels.
8619 %
8620 %    o threshold: only pixels within this contrast threshold are included
8621 %      in the blur operation.
8622 %
8623 */
8624 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8625   const double radius,const double sigma,const double threshold)
8626 {
8627   Image
8628     *blur_image;
8629
8630   assert(wand != (MagickWand *) NULL);
8631   assert(wand->signature == WandSignature);
8632   if (IfMagickTrue(wand->debug))
8633     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8634   if (wand->images == (Image *) NULL)
8635     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8636   blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
8637     wand->exception);
8638   if (blur_image == (Image *) NULL)
8639     return(MagickFalse);
8640   ReplaceImageInList(&wand->images,blur_image);
8641   return(MagickTrue);
8642 }
8643 \f
8644 /*
8645 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8646 %                                                                             %
8647 %                                                                             %
8648 %                                                                             %
8649 %   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                       %
8650 %                                                                             %
8651 %                                                                             %
8652 %                                                                             %
8653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8654 %
8655 %  MagickSeparateImage() separates a channel from the image and returns a
8656 %  grayscale image.  A channel is a particular color component of each pixel
8657 %  in the image.
8658 %
8659 %  The format of the MagickSeparateImage method is:
8660 %
8661 %      MagickBooleanType MagickSeparateImage(MagickWand *wand,
8662 %        const ChannelType channel)
8663 %
8664 %  A description of each parameter follows:
8665 %
8666 %    o wand: the magick wand.
8667 %
8668 %    o channel: the channel.
8669 %
8670 */
8671 WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
8672   const ChannelType channel)
8673 {
8674   Image
8675     *separate_image;
8676
8677   assert(wand != (MagickWand *) NULL);
8678   assert(wand->signature == WandSignature);
8679   if (IfMagickTrue(wand->debug))
8680     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8681   if (wand->images == (Image *) NULL)
8682     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8683   separate_image=SeparateImage(wand->images,channel,wand->exception);
8684   if (separate_image == (Image *) NULL)
8685     return(MagickFalse);
8686   ReplaceImageInList(&wand->images,separate_image);
8687   return(MagickTrue);
8688 }
8689 \f
8690 /*
8691 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8692 %                                                                             %
8693 %                                                                             %
8694 %                                                                             %
8695 %     M a g i c k S e p i a T o n e I m a g e                                 %
8696 %                                                                             %
8697 %                                                                             %
8698 %                                                                             %
8699 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8700 %
8701 %  MagickSepiaToneImage() applies a special effect to the image, similar to the
8702 %  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8703 %  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8704 %  threshold of 80% is a good starting point for a reasonable tone.
8705 %
8706 %  The format of the MagickSepiaToneImage method is:
8707 %
8708 %      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8709 %        const double threshold)
8710 %
8711 %  A description of each parameter follows:
8712 %
8713 %    o wand: the magick wand.
8714 %
8715 %    o threshold:  Define the extent of the sepia toning.
8716 %
8717 */
8718 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8719   const double threshold)
8720 {
8721   Image
8722     *sepia_image;
8723
8724   assert(wand != (MagickWand *) NULL);
8725   assert(wand->signature == WandSignature);
8726   if (IfMagickTrue(wand->debug))
8727     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8728   if (wand->images == (Image *) NULL)
8729     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8730   sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8731   if (sepia_image == (Image *) NULL)
8732     return(MagickFalse);
8733   ReplaceImageInList(&wand->images,sepia_image);
8734   return(MagickTrue);
8735 }
8736 \f
8737 /*
8738 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8739 %                                                                             %
8740 %                                                                             %
8741 %                                                                             %
8742 %   M a g i c k S e t I m a g e                                               %
8743 %                                                                             %
8744 %                                                                             %
8745 %                                                                             %
8746 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8747 %
8748 %  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8749 %  MagickNextImage(), MagickPreviousImage() with the images from the specified
8750 %  wand.
8751 %
8752 %  The format of the MagickSetImage method is:
8753 %
8754 %      MagickBooleanType MagickSetImage(MagickWand *wand,
8755 %        const MagickWand *set_wand)
8756 %
8757 %  A description of each parameter follows:
8758 %
8759 %    o wand: the magick wand.
8760 %
8761 %    o set_wand: the set_wand wand.
8762 %
8763 */
8764 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8765   const MagickWand *set_wand)
8766 {
8767   Image
8768     *images;
8769
8770   assert(wand != (MagickWand *) NULL);
8771   assert(wand->signature == WandSignature);
8772   if (IfMagickTrue(wand->debug))
8773     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8774   assert(set_wand != (MagickWand *) NULL);
8775   assert(set_wand->signature == WandSignature);
8776   if (IfMagickTrue(wand->debug))
8777     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8778   if (set_wand->images == (Image *) NULL)
8779     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8780   images=CloneImageList(set_wand->images,wand->exception);
8781   if (images == (Image *) NULL)
8782     return(MagickFalse);
8783   ReplaceImageInList(&wand->images,images);
8784   return(MagickTrue);
8785 }
8786 \f
8787 /*
8788 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8789 %                                                                             %
8790 %                                                                             %
8791 %                                                                             %
8792 %   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                       %
8793 %                                                                             %
8794 %                                                                             %
8795 %                                                                             %
8796 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8797 %
8798 %  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8799 %  alpha channel.
8800 %
8801 %  The format of the MagickSetImageAlphaChannel method is:
8802 %
8803 %      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8804 %        const AlphaChannelOption alpha_type)
8805 %
8806 %  A description of each parameter follows:
8807 %
8808 %    o wand: the magick wand.
8809 %
8810 %    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8811 %      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8812 %
8813 */
8814 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8815   const AlphaChannelOption alpha_type)
8816 {
8817   assert(wand != (MagickWand *) NULL);
8818   assert(wand->signature == WandSignature);
8819   if (IfMagickTrue(wand->debug))
8820     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8821   if (wand->images == (Image *) NULL)
8822     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8823   return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
8824 }
8825 \f
8826 /*
8827 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8828 %                                                                             %
8829 %                                                                             %
8830 %                                                                             %
8831 %   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                 %
8832 %                                                                             %
8833 %                                                                             %
8834 %                                                                             %
8835 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8836 %
8837 %  MagickSetImageBackgroundColor() sets the image background color.
8838 %
8839 %  The format of the MagickSetImageBackgroundColor method is:
8840 %
8841 %      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8842 %        const PixelWand *background)
8843 %
8844 %  A description of each parameter follows:
8845 %
8846 %    o wand: the magick wand.
8847 %
8848 %    o background: the background pixel wand.
8849 %
8850 */
8851 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8852   const PixelWand *background)
8853 {
8854   assert(wand != (MagickWand *) NULL);
8855   assert(wand->signature == WandSignature);
8856   if (IfMagickTrue(wand->debug))
8857     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8858   if (wand->images == (Image *) NULL)
8859     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8860   PixelGetQuantumPacket(background,&wand->images->background_color);
8861   return(MagickTrue);
8862 }
8863 \f
8864 /*
8865 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8866 %                                                                             %
8867 %                                                                             %
8868 %                                                                             %
8869 %   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                         %
8870 %                                                                             %
8871 %                                                                             %
8872 %                                                                             %
8873 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8874 %
8875 %  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8876 %
8877 %  The format of the MagickSetImageBluePrimary method is:
8878 %
8879 %      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8880 %        const double x,const double y)
8881 %
8882 %  A description of each parameter follows:
8883 %
8884 %    o wand: the magick wand.
8885 %
8886 %    o x: the blue primary x-point.
8887 %
8888 %    o y: the blue primary y-point.
8889 %
8890 */
8891 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8892   const double x,const double y)
8893 {
8894   assert(wand != (MagickWand *) NULL);
8895   assert(wand->signature == WandSignature);
8896   if (IfMagickTrue(wand->debug))
8897     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8898   if (wand->images == (Image *) NULL)
8899     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8900   wand->images->chromaticity.blue_primary.x=x;
8901   wand->images->chromaticity.blue_primary.y=y;
8902   return(MagickTrue);
8903 }
8904 \f
8905 /*
8906 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8907 %                                                                             %
8908 %                                                                             %
8909 %                                                                             %
8910 %   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                         %
8911 %                                                                             %
8912 %                                                                             %
8913 %                                                                             %
8914 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8915 %
8916 %  MagickSetImageBorderColor() sets the image border color.
8917 %
8918 %  The format of the MagickSetImageBorderColor method is:
8919 %
8920 %      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8921 %        const PixelWand *border)
8922 %
8923 %  A description of each parameter follows:
8924 %
8925 %    o wand: the magick wand.
8926 %
8927 %    o border: the border pixel wand.
8928 %
8929 */
8930 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8931   const PixelWand *border)
8932 {
8933   assert(wand != (MagickWand *) NULL);
8934   assert(wand->signature == WandSignature);
8935   if (IfMagickTrue(wand->debug))
8936     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8937   if (wand->images == (Image *) NULL)
8938     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8939   PixelGetQuantumPacket(border,&wand->images->border_color);
8940   return(MagickTrue);
8941 }
8942 \f
8943 /*
8944 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8945 %                                                                             %
8946 %                                                                             %
8947 %                                                                             %
8948 %   M a g i c k S e t I m a g e C l i p M a s k                               %
8949 %                                                                             %
8950 %                                                                             %
8951 %                                                                             %
8952 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8953 %
8954 %  MagickSetImageMask() sets image clip mask.
8955 %
8956 %  The format of the MagickSetImageMask method is:
8957 %
8958 %      MagickBooleanType MagickSetImageMask(MagickWand *wand,
8959 %        const MagickWand *clip_mask)
8960 %
8961 %  A description of each parameter follows:
8962 %
8963 %    o wand: the magick wand.
8964 %
8965 %    o clip_mask: the clip_mask wand.
8966 %
8967 */
8968 WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
8969   const MagickWand *clip_mask)
8970 {
8971   assert(wand != (MagickWand *) NULL);
8972   assert(wand->signature == WandSignature);
8973   if (IfMagickTrue(wand->debug))
8974     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8975   assert(clip_mask != (MagickWand *) NULL);
8976   assert(clip_mask->signature == WandSignature);
8977   if (IfMagickTrue(clip_mask->debug))
8978     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
8979   if (clip_mask->images == (Image *) NULL)
8980     ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
8981   return(SetImageMask(wand->images,clip_mask->images,wand->exception));
8982 }
8983 \f
8984 /*
8985 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8986 %                                                                             %
8987 %                                                                             %
8988 %                                                                             %
8989 %   M a g i c k S e t I m a g e C o l o r                                     %
8990 %                                                                             %
8991 %                                                                             %
8992 %                                                                             %
8993 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8994 %
8995 %  MagickSetImageColor() set the entire wand canvas to the specified color.
8996 %
8997 %  The format of the MagickSetImageColor method is:
8998 %
8999 %      MagickBooleanType MagickSetImageColor(MagickWand *wand,
9000 %        const PixelWand *color)
9001 %
9002 %  A description of each parameter follows:
9003 %
9004 %    o wand: the magick wand.
9005 %
9006 %    o background: the image color.
9007 %
9008 */
9009 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9010   const PixelWand *color)
9011 {
9012   PixelInfo
9013     pixel;
9014
9015   assert(wand != (MagickWand *) NULL);
9016   assert(wand->signature == WandSignature);
9017   if (IfMagickTrue(wand->debug))
9018     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9019   PixelGetMagickColor(color,&pixel);
9020   return(SetImageColor(wand->images,&pixel,wand->exception));
9021 }
9022 \f
9023 /*
9024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9025 %                                                                             %
9026 %                                                                             %
9027 %                                                                             %
9028 %   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                     %
9029 %                                                                             %
9030 %                                                                             %
9031 %                                                                             %
9032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9033 %
9034 %  MagickSetImageColormapColor() sets the color of the specified colormap
9035 %  index.
9036 %
9037 %  The format of the MagickSetImageColormapColor method is:
9038 %
9039 %      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9040 %        const size_t index,const PixelWand *color)
9041 %
9042 %  A description of each parameter follows:
9043 %
9044 %    o wand: the magick wand.
9045 %
9046 %    o index: the offset into the image colormap.
9047 %
9048 %    o color: Return the colormap color in this wand.
9049 %
9050 */
9051 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9052   const size_t index,const PixelWand *color)
9053 {
9054   assert(wand != (MagickWand *) NULL);
9055   assert(wand->signature == WandSignature);
9056   if (IfMagickTrue(wand->debug))
9057     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9058   if (wand->images == (Image *) NULL)
9059     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9060   if ((wand->images->colormap == (PixelInfo *) NULL) ||
9061       (index >= wand->images->colors))
9062     ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9063   PixelGetQuantumPacket(color,wand->images->colormap+index);
9064   return(SyncImage(wand->images,wand->exception));
9065 }
9066 \f
9067 /*
9068 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9069 %                                                                             %
9070 %                                                                             %
9071 %                                                                             %
9072 %   M a g i c k S e t I m a g e C o l o r s p a c e                           %
9073 %                                                                             %
9074 %                                                                             %
9075 %                                                                             %
9076 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9077 %
9078 %  MagickSetImageColorspace() sets the image colorspace. But does not modify
9079 %  the image data.
9080 %
9081 %  The format of the MagickSetImageColorspace method is:
9082 %
9083 %      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9084 %        const ColorspaceType colorspace)
9085 %
9086 %  A description of each parameter follows:
9087 %
9088 %    o wand: the magick wand.
9089 %
9090 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
9091 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9092 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9093 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9094 %      HSLColorspace, or HWBColorspace.
9095 %
9096 */
9097 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9098   const ColorspaceType colorspace)
9099 {
9100   assert(wand != (MagickWand *) NULL);
9101   assert(wand->signature == WandSignature);
9102   if (IfMagickTrue(wand->debug))
9103     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9104   if (wand->images == (Image *) NULL)
9105     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9106   return(SetImageColorspace(wand->images,colorspace,wand->exception));
9107 }
9108 \f
9109 /*
9110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9111 %                                                                             %
9112 %                                                                             %
9113 %                                                                             %
9114 %   M a g i c k S e t I m a g e C o m p o s e                                 %
9115 %                                                                             %
9116 %                                                                             %
9117 %                                                                             %
9118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9119 %
9120 %  MagickSetImageCompose() sets the image composite operator, useful for
9121 %  specifying how to composite the image thumbnail when using the
9122 %  MagickMontageImage() method.
9123 %
9124 %  The format of the MagickSetImageCompose method is:
9125 %
9126 %      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9127 %        const CompositeOperator compose)
9128 %
9129 %  A description of each parameter follows:
9130 %
9131 %    o wand: the magick wand.
9132 %
9133 %    o compose: the image composite operator.
9134 %
9135 */
9136 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9137   const CompositeOperator compose)
9138 {
9139   assert(wand != (MagickWand *) NULL);
9140   assert(wand->signature == WandSignature);
9141   if (IfMagickTrue(wand->debug))
9142     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9143   if (wand->images == (Image *) NULL)
9144     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9145   wand->images->compose=compose;
9146   return(MagickTrue);
9147 }
9148 \f
9149 /*
9150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9151 %                                                                             %
9152 %                                                                             %
9153 %                                                                             %
9154 %   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                         %
9155 %                                                                             %
9156 %                                                                             %
9157 %                                                                             %
9158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9159 %
9160 %  MagickSetImageCompression() sets the image compression.
9161 %
9162 %  The format of the MagickSetImageCompression method is:
9163 %
9164 %      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9165 %        const CompressionType compression)
9166 %
9167 %  A description of each parameter follows:
9168 %
9169 %    o wand: the magick wand.
9170 %
9171 %    o compression: the image compression type.
9172 %
9173 */
9174 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9175   const CompressionType compression)
9176 {
9177   assert(wand != (MagickWand *) NULL);
9178   assert(wand->signature == WandSignature);
9179   if (IfMagickTrue(wand->debug))
9180     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9181   if (wand->images == (Image *) NULL)
9182     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9183   wand->images->compression=compression;
9184   return(MagickTrue);
9185 }
9186 \f
9187 /*
9188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9189 %                                                                             %
9190 %                                                                             %
9191 %                                                                             %
9192 %   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           %
9193 %                                                                             %
9194 %                                                                             %
9195 %                                                                             %
9196 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9197 %
9198 %  MagickSetImageCompressionQuality() sets the image compression quality.
9199 %
9200 %  The format of the MagickSetImageCompressionQuality method is:
9201 %
9202 %      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9203 %        const size_t quality)
9204 %
9205 %  A description of each parameter follows:
9206 %
9207 %    o wand: the magick wand.
9208 %
9209 %    o quality: the image compression tlityype.
9210 %
9211 */
9212 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9213   const size_t quality)
9214 {
9215   assert(wand != (MagickWand *) NULL);
9216   assert(wand->signature == WandSignature);
9217   if (IfMagickTrue(wand->debug))
9218     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9219   if (wand->images == (Image *) NULL)
9220     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9221   wand->images->quality=quality;
9222   return(MagickTrue);
9223 }
9224 \f
9225 /*
9226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9227 %                                                                             %
9228 %                                                                             %
9229 %                                                                             %
9230 %   M a g i c k S e t I m a g e D e l a y                                     %
9231 %                                                                             %
9232 %                                                                             %
9233 %                                                                             %
9234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9235 %
9236 %  MagickSetImageDelay() sets the image delay.
9237 %
9238 %  The format of the MagickSetImageDelay method is:
9239 %
9240 %      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9241 %        const size_t delay)
9242 %
9243 %  A description of each parameter follows:
9244 %
9245 %    o wand: the magick wand.
9246 %
9247 %    o delay: the image delay in ticks-per-second units.
9248 %
9249 */
9250 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9251   const size_t delay)
9252 {
9253   assert(wand != (MagickWand *) NULL);
9254   assert(wand->signature == WandSignature);
9255   if (IfMagickTrue(wand->debug))
9256     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9257   if (wand->images == (Image *) NULL)
9258     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9259   wand->images->delay=delay;
9260   return(MagickTrue);
9261 }
9262 \f
9263 /*
9264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9265 %                                                                             %
9266 %                                                                             %
9267 %                                                                             %
9268 %   M a g i c k S e t I m a g e D e p t h                                     %
9269 %                                                                             %
9270 %                                                                             %
9271 %                                                                             %
9272 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9273 %
9274 %  MagickSetImageDepth() sets the image depth.
9275 %
9276 %  The format of the MagickSetImageDepth method is:
9277 %
9278 %      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9279 %        const size_t depth)
9280 %
9281 %  A description of each parameter follows:
9282 %
9283 %    o wand: the magick wand.
9284 %
9285 %    o depth: the image depth in bits: 8, 16, or 32.
9286 %
9287 */
9288 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9289   const size_t depth)
9290 {
9291   assert(wand != (MagickWand *) NULL);
9292   assert(wand->signature == WandSignature);
9293   if (IfMagickTrue(wand->debug))
9294     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9295   if (wand->images == (Image *) NULL)
9296     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9297   return(SetImageDepth(wand->images,depth,wand->exception));
9298 }
9299 \f
9300 /*
9301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9302 %                                                                             %
9303 %                                                                             %
9304 %                                                                             %
9305 %   M a g i c k S e t I m a g e D i s p o s e                                 %
9306 %                                                                             %
9307 %                                                                             %
9308 %                                                                             %
9309 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9310 %
9311 %  MagickSetImageDispose() sets the image disposal method.
9312 %
9313 %  The format of the MagickSetImageDispose method is:
9314 %
9315 %      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9316 %        const DisposeType dispose)
9317 %
9318 %  A description of each parameter follows:
9319 %
9320 %    o wand: the magick wand.
9321 %
9322 %    o dispose: the image disposeal type.
9323 %
9324 */
9325 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9326   const DisposeType dispose)
9327 {
9328   assert(wand != (MagickWand *) NULL);
9329   assert(wand->signature == WandSignature);
9330   if (IfMagickTrue(wand->debug))
9331     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9332   if (wand->images == (Image *) NULL)
9333     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9334   wand->images->dispose=dispose;
9335   return(MagickTrue);
9336 }
9337 \f
9338 /*
9339 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9340 %                                                                             %
9341 %                                                                             %
9342 %                                                                             %
9343 %   M a g i c k S e t I m a g e E n d i a n                                   %
9344 %                                                                             %
9345 %                                                                             %
9346 %                                                                             %
9347 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9348 %
9349 %  MagickSetImageEndian() sets the image endian method.
9350 %
9351 %  The format of the MagickSetImageEndian method is:
9352 %
9353 %      MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9354 %        const EndianType endian)
9355 %
9356 %  A description of each parameter follows:
9357 %
9358 %    o wand: the magick wand.
9359 %
9360 %    o endian: the image endian type.
9361 %
9362 */
9363 WandExport MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9364   const EndianType endian)
9365 {
9366   assert(wand != (MagickWand *) NULL);
9367   assert(wand->signature == WandSignature);
9368   if (wand->debug != MagickFalse)
9369     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9370   if (wand->images == (Image *) NULL)
9371     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9372   wand->images->endian=endian;
9373   return(MagickTrue);
9374 }
9375 \f
9376 /*
9377 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9378 %                                                                             %
9379 %                                                                             %
9380 %                                                                             %
9381 %   M a g i c k S e t I m a g e E x t e n t                                   %
9382 %                                                                             %
9383 %                                                                             %
9384 %                                                                             %
9385 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9386 %
9387 %  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9388 %
9389 %  The format of the MagickSetImageExtent method is:
9390 %
9391 %      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9392 %        const size_t columns,const unsigned rows)
9393 %
9394 %  A description of each parameter follows:
9395 %
9396 %    o wand: the magick wand.
9397 %
9398 %    o columns:  The image width in pixels.
9399 %
9400 %    o rows:  The image height in pixels.
9401 %
9402 */
9403 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9404   const size_t columns,const size_t rows)
9405 {
9406   assert(wand != (MagickWand *) NULL);
9407   assert(wand->signature == WandSignature);
9408   if (IfMagickTrue(wand->debug))
9409     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9410   if (wand->images == (Image *) NULL)
9411     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9412   return(SetImageExtent(wand->images,columns,rows,wand->exception));
9413 }
9414 \f
9415 /*
9416 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9417 %                                                                             %
9418 %                                                                             %
9419 %                                                                             %
9420 %   M a g i c k S e t I m a g e F i l e n a m e                               %
9421 %                                                                             %
9422 %                                                                             %
9423 %                                                                             %
9424 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9425 %
9426 %  MagickSetImageFilename() sets the filename of a particular image in a
9427 %  sequence.
9428 %
9429 %  The format of the MagickSetImageFilename method is:
9430 %
9431 %      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9432 %        const char *filename)
9433 %
9434 %  A description of each parameter follows:
9435 %
9436 %    o wand: the magick wand.
9437 %
9438 %    o filename: the image filename.
9439 %
9440 */
9441 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9442   const char *filename)
9443 {
9444   assert(wand != (MagickWand *) NULL);
9445   assert(wand->signature == WandSignature);
9446   if (IfMagickTrue(wand->debug))
9447     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9448   if (wand->images == (Image *) NULL)
9449     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9450   if (filename != (const char *) NULL)
9451     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9452   return(MagickTrue);
9453 }
9454 \f
9455 /*
9456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9457 %                                                                             %
9458 %                                                                             %
9459 %                                                                             %
9460 %   M a g i c k S e t I m a g e F o r m a t                                   %
9461 %                                                                             %
9462 %                                                                             %
9463 %                                                                             %
9464 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9465 %
9466 %  MagickSetImageFormat() sets the format of a particular image in a
9467 %  sequence.
9468 %
9469 %  The format of the MagickSetImageFormat method is:
9470 %
9471 %      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9472 %        const char *format)
9473 %
9474 %  A description of each parameter follows:
9475 %
9476 %    o wand: the magick wand.
9477 %
9478 %    o format: the image format.
9479 %
9480 */
9481 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9482   const char *format)
9483 {
9484   const MagickInfo
9485     *magick_info;
9486
9487   assert(wand != (MagickWand *) NULL);
9488   assert(wand->signature == WandSignature);
9489   if (IfMagickTrue(wand->debug))
9490     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9491   if (wand->images == (Image *) NULL)
9492     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9493   if ((format == (char *) NULL) || (*format == '\0'))
9494     {
9495       *wand->images->magick='\0';
9496       return(MagickTrue);
9497     }
9498   magick_info=GetMagickInfo(format,wand->exception);
9499   if (magick_info == (const MagickInfo *) NULL)
9500     return(MagickFalse);
9501   ClearMagickException(wand->exception);
9502   (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9503   return(MagickTrue);
9504 }
9505 \f
9506 /*
9507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9508 %                                                                             %
9509 %                                                                             %
9510 %                                                                             %
9511 %   M a g i c k S e t I m a g e F u z z                                       %
9512 %                                                                             %
9513 %                                                                             %
9514 %                                                                             %
9515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9516 %
9517 %  MagickSetImageFuzz() sets the image fuzz.
9518 %
9519 %  The format of the MagickSetImageFuzz method is:
9520 %
9521 %      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9522 %        const double fuzz)
9523 %
9524 %  A description of each parameter follows:
9525 %
9526 %    o wand: the magick wand.
9527 %
9528 %    o fuzz: the image fuzz.
9529 %
9530 */
9531 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9532   const double fuzz)
9533 {
9534   assert(wand != (MagickWand *) NULL);
9535   assert(wand->signature == WandSignature);
9536   if (IfMagickTrue(wand->debug))
9537     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9538   if (wand->images == (Image *) NULL)
9539     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9540   wand->images->fuzz=fuzz;
9541   return(MagickTrue);
9542 }
9543 \f
9544 /*
9545 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9546 %                                                                             %
9547 %                                                                             %
9548 %                                                                             %
9549 %   M a g i c k S e t I m a g e G a m m a                                     %
9550 %                                                                             %
9551 %                                                                             %
9552 %                                                                             %
9553 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9554 %
9555 %  MagickSetImageGamma() sets the image gamma.
9556 %
9557 %  The format of the MagickSetImageGamma method is:
9558 %
9559 %      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9560 %        const double gamma)
9561 %
9562 %  A description of each parameter follows:
9563 %
9564 %    o wand: the magick wand.
9565 %
9566 %    o gamma: the image gamma.
9567 %
9568 */
9569 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9570   const double gamma)
9571 {
9572   assert(wand != (MagickWand *) NULL);
9573   assert(wand->signature == WandSignature);
9574   if (IfMagickTrue(wand->debug))
9575     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9576   if (wand->images == (Image *) NULL)
9577     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9578   wand->images->gamma=gamma;
9579   return(MagickTrue);
9580 }
9581 \f
9582 /*
9583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9584 %                                                                             %
9585 %                                                                             %
9586 %                                                                             %
9587 %   M a g i c k S e t I m a g e G r a v i t y                                 %
9588 %                                                                             %
9589 %                                                                             %
9590 %                                                                             %
9591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9592 %
9593 %  MagickSetImageGravity() sets the image gravity type.
9594 %
9595 %  The format of the MagickSetImageGravity method is:
9596 %
9597 %      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9598 %        const GravityType gravity)
9599 %
9600 %  A description of each parameter follows:
9601 %
9602 %    o wand: the magick wand.
9603 %
9604 %    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9605 %      PlaneInterlace, PartitionInterlace.
9606 %
9607 */
9608 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9609   const GravityType gravity)
9610 {
9611   assert(wand != (MagickWand *) NULL);
9612   assert(wand->signature == WandSignature);
9613   if (IfMagickTrue(wand->debug))
9614     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9615   if (wand->images == (Image *) NULL)
9616     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9617   wand->images->gravity=gravity;
9618   return(MagickTrue);
9619 }
9620 \f
9621 /*
9622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9623 %                                                                             %
9624 %                                                                             %
9625 %                                                                             %
9626 %   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                       %
9627 %                                                                             %
9628 %                                                                             %
9629 %                                                                             %
9630 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9631 %
9632 %  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9633 %  point.
9634 %
9635 %  The format of the MagickSetImageGreenPrimary method is:
9636 %
9637 %      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9638 %        const double x,const double y)
9639 %
9640 %  A description of each parameter follows:
9641 %
9642 %    o wand: the magick wand.
9643 %
9644 %    o x: the green primary x-point.
9645 %
9646 %    o y: the green primary y-point.
9647 %
9648 %
9649 */
9650 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9651   const double x,const double y)
9652 {
9653   assert(wand != (MagickWand *) NULL);
9654   assert(wand->signature == WandSignature);
9655   if (IfMagickTrue(wand->debug))
9656     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9657   if (wand->images == (Image *) NULL)
9658     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9659   wand->images->chromaticity.green_primary.x=x;
9660   wand->images->chromaticity.green_primary.y=y;
9661   return(MagickTrue);
9662 }
9663 \f
9664 /*
9665 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9666 %                                                                             %
9667 %                                                                             %
9668 %                                                                             %
9669 %   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                 %
9670 %                                                                             %
9671 %                                                                             %
9672 %                                                                             %
9673 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9674 %
9675 %  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9676 %
9677 %  The format of the MagickSetImageInterlaceScheme method is:
9678 %
9679 %      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9680 %        const InterlaceType interlace)
9681 %
9682 %  A description of each parameter follows:
9683 %
9684 %    o wand: the magick wand.
9685 %
9686 %    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9687 %      PlaneInterlace, PartitionInterlace.
9688 %
9689 */
9690 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9691   const InterlaceType interlace)
9692 {
9693   assert(wand != (MagickWand *) NULL);
9694   assert(wand->signature == WandSignature);
9695   if (IfMagickTrue(wand->debug))
9696     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9697   if (wand->images == (Image *) NULL)
9698     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9699   wand->images->interlace=interlace;
9700   return(MagickTrue);
9701 }
9702 \f
9703 /*
9704 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9705 %                                                                             %
9706 %                                                                             %
9707 %                                                                             %
9708 %   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             %
9709 %                                                                             %
9710 %                                                                             %
9711 %                                                                             %
9712 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9713 %
9714 %  MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel
9715 %  method.
9716 %
9717 %  The format of the MagickSetImagePixelInterpolateMethod method is:
9718 %
9719 %      MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9720 %        const PixelInterpolateMethod method)
9721 %
9722 %  A description of each parameter follows:
9723 %
9724 %    o wand: the magick wand.
9725 %
9726 %    o method: the image interpole pixel methods: choose from Undefined,
9727 %      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9728 %
9729 */
9730 WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(
9731   MagickWand *wand,const PixelInterpolateMethod method)
9732 {
9733   assert(wand != (MagickWand *) NULL);
9734   assert(wand->signature == WandSignature);
9735   if (IfMagickTrue(wand->debug))
9736     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9737   if (wand->images == (Image *) NULL)
9738     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9739   wand->images->interpolate=method;
9740   return(MagickTrue);
9741 }
9742 \f
9743 /*
9744 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9745 %                                                                             %
9746 %                                                                             %
9747 %                                                                             %
9748 %   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9749 %                                                                             %
9750 %                                                                             %
9751 %                                                                             %
9752 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9753 %
9754 %  MagickSetImageIterations() sets the image iterations.
9755 %
9756 %  The format of the MagickSetImageIterations method is:
9757 %
9758 %      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9759 %        const size_t iterations)
9760 %
9761 %  A description of each parameter follows:
9762 %
9763 %    o wand: the magick wand.
9764 %
9765 %    o delay: the image delay in 1/100th of a second.
9766 %
9767 */
9768 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9769   const size_t iterations)
9770 {
9771   assert(wand != (MagickWand *) NULL);
9772   assert(wand->signature == WandSignature);
9773   if (IfMagickTrue(wand->debug))
9774     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9775   if (wand->images == (Image *) NULL)
9776     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9777   wand->images->iterations=iterations;
9778   return(MagickTrue);
9779 }
9780 \f
9781 /*
9782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9783 %                                                                             %
9784 %                                                                             %
9785 %                                                                             %
9786 %   M a g i c k S e t I m a g e M a t t e                                     %
9787 %                                                                             %
9788 %                                                                             %
9789 %                                                                             %
9790 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9791 %
9792 %  MagickSetImageMatte() sets the image matte channel.
9793 %
9794 %  The format of the MagickSetImageMatteColor method is:
9795 %
9796 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9797 %        const MagickBooleanType *matte)
9798 %
9799 %  A description of each parameter follows:
9800 %
9801 %    o wand: the magick wand.
9802 %
9803 %    o matte: Set to MagickTrue to enable the image matte channel otherwise
9804 %      MagickFalse.
9805 %
9806 */
9807 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9808   const MagickBooleanType matte)
9809 {
9810   assert(wand != (MagickWand *) NULL);
9811   assert(wand->signature == WandSignature);
9812   if (IfMagickTrue(wand->debug))
9813     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9814   if (wand->images == (Image *) NULL)
9815     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9816   if ((wand->images->alpha_trait != BlendPixelTrait) && IsMagickTrue(matte))
9817     (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
9818   wand->images->alpha_trait=matte != MagickFalse ? BlendPixelTrait :
9819     UndefinedPixelTrait;
9820   return(MagickTrue);
9821 }
9822 \f
9823 /*
9824 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9825 %                                                                             %
9826 %                                                                             %
9827 %                                                                             %
9828 %   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9829 %                                                                             %
9830 %                                                                             %
9831 %                                                                             %
9832 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9833 %
9834 %  MagickSetImageMatteColor() sets the image matte color.
9835 %
9836 %  The format of the MagickSetImageMatteColor method is:
9837 %
9838 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9839 %        const PixelWand *matte)
9840 %
9841 %  A description of each parameter follows:
9842 %
9843 %    o wand: the magick wand.
9844 %
9845 %    o matte: the matte pixel wand.
9846 %
9847 */
9848 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9849   const PixelWand *matte)
9850 {
9851   assert(wand != (MagickWand *) NULL);
9852   assert(wand->signature == WandSignature);
9853   if (IfMagickTrue(wand->debug))
9854     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9855   if (wand->images == (Image *) NULL)
9856     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9857   PixelGetQuantumPacket(matte,&wand->images->matte_color);
9858   return(MagickTrue);
9859 }
9860 \f
9861 /*
9862 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9863 %                                                                             %
9864 %                                                                             %
9865 %                                                                             %
9866 %   M a g i c k S e t I m a g e O p a c i t y                                 %
9867 %                                                                             %
9868 %                                                                             %
9869 %                                                                             %
9870 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9871 %
9872 %  MagickSetImageAlpha() sets the image to the specified alpha level.
9873 %
9874 %  The format of the MagickSetImageAlpha method is:
9875 %
9876 %      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9877 %        const double alpha)
9878 %
9879 %  A description of each parameter follows:
9880 %
9881 %    o wand: the magick wand.
9882 %
9883 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9884 %      transparent.
9885 %
9886 */
9887 WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9888   const double alpha)
9889 {
9890   MagickBooleanType
9891     status;
9892
9893   assert(wand != (MagickWand *) NULL);
9894   assert(wand->signature == WandSignature);
9895   if (IfMagickTrue(wand->debug))
9896     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9897   if (wand->images == (Image *) NULL)
9898     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9899   status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
9900     wand->exception);
9901   return(status);
9902 }
9903 \f
9904 /*
9905 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9906 %                                                                             %
9907 %                                                                             %
9908 %                                                                             %
9909 %   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                         %
9910 %                                                                             %
9911 %                                                                             %
9912 %                                                                             %
9913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9914 %
9915 %  MagickSetImageOrientation() sets the image orientation.
9916 %
9917 %  The format of the MagickSetImageOrientation method is:
9918 %
9919 %      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9920 %        const OrientationType orientation)
9921 %
9922 %  A description of each parameter follows:
9923 %
9924 %    o wand: the magick wand.
9925 %
9926 %    o orientation: the image orientation type.
9927 %
9928 */
9929 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9930   const OrientationType orientation)
9931 {
9932   assert(wand != (MagickWand *) NULL);
9933   assert(wand->signature == WandSignature);
9934   if (IfMagickTrue(wand->debug))
9935     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9936   if (wand->images == (Image *) NULL)
9937     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9938   wand->images->orientation=orientation;
9939   return(MagickTrue);
9940 }
9941 \f
9942 /*
9943 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9944 %                                                                             %
9945 %                                                                             %
9946 %                                                                             %
9947 %   M a g i c k S e t I m a g e P a g e                                       %
9948 %                                                                             %
9949 %                                                                             %
9950 %                                                                             %
9951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9952 %
9953 %  MagickSetImagePage() sets the page geometry of the image.
9954 %
9955 %  The format of the MagickSetImagePage method is:
9956 %
9957 %      MagickBooleanType MagickSetImagePage(MagickWand *wand,const size_t width,%        const size_t height,const ssize_t x,const ssize_t y)
9958 %
9959 %  A description of each parameter follows:
9960 %
9961 %    o wand: the magick wand.
9962 %
9963 %    o width: the page width.
9964 %
9965 %    o height: the page height.
9966 %
9967 %    o x: the page x-offset.
9968 %
9969 %    o y: the page y-offset.
9970 %
9971 */
9972 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
9973   const size_t width,const size_t height,const ssize_t x,
9974   const ssize_t y)
9975 {
9976   assert(wand != (MagickWand *) NULL);
9977   assert(wand->signature == WandSignature);
9978   if (IfMagickTrue(wand->debug))
9979     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9980   if (wand->images == (Image *) NULL)
9981     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9982   wand->images->page.width=width;
9983   wand->images->page.height=height;
9984   wand->images->page.x=x;
9985   wand->images->page.y=y;
9986   return(MagickTrue);
9987 }
9988 \f
9989 /*
9990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9991 %                                                                             %
9992 %                                                                             %
9993 %                                                                             %
9994 %   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                 %
9995 %                                                                             %
9996 %                                                                             %
9997 %                                                                             %
9998 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9999 %
10000 %  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10001 %  specified method and returns the previous progress monitor if any.  The
10002 %  progress monitor method looks like this:
10003 %
10004 %    MagickBooleanType MagickProgressMonitor(const char *text,
10005 %      const MagickOffsetType offset,const MagickSizeType span,
10006 %      void *client_data)
10007 %
10008 %  If the progress monitor returns MagickFalse, the current operation is
10009 %  interrupted.
10010 %
10011 %  The format of the MagickSetImageProgressMonitor method is:
10012 %
10013 %      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10014 %        const MagickProgressMonitor progress_monitor,void *client_data)
10015 %
10016 %  A description of each parameter follows:
10017 %
10018 %    o wand: the magick wand.
10019 %
10020 %    o progress_monitor: Specifies a pointer to a method to monitor progress
10021 %      of an image operation.
10022 %
10023 %    o client_data: Specifies a pointer to any client data.
10024 %
10025 */
10026 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10027   const MagickProgressMonitor progress_monitor,void *client_data)
10028 {
10029   MagickProgressMonitor
10030     previous_monitor;
10031
10032   assert(wand != (MagickWand *) NULL);
10033   assert(wand->signature == WandSignature);
10034   if (IfMagickTrue(wand->debug))
10035     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10036   if (wand->images == (Image *) NULL)
10037     {
10038       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10039         "ContainsNoImages","`%s'",wand->name);
10040       return((MagickProgressMonitor) NULL);
10041     }
10042   previous_monitor=SetImageProgressMonitor(wand->images,
10043     progress_monitor,client_data);
10044   return(previous_monitor);
10045 }
10046 \f
10047 /*
10048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10049 %                                                                             %
10050 %                                                                             %
10051 %                                                                             %
10052 %   M a g i c k S e t I m a g e R e d P r i m a r y                           %
10053 %                                                                             %
10054 %                                                                             %
10055 %                                                                             %
10056 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10057 %
10058 %  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10059 %
10060 %  The format of the MagickSetImageRedPrimary method is:
10061 %
10062 %      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10063 %        const double x,const double y)
10064 %
10065 %  A description of each parameter follows:
10066 %
10067 %    o wand: the magick wand.
10068 %
10069 %    o x: the red primary x-point.
10070 %
10071 %    o y: the red primary y-point.
10072 %
10073 */
10074 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10075   const double x,const double y)
10076 {
10077   assert(wand != (MagickWand *) NULL);
10078   assert(wand->signature == WandSignature);
10079   if (IfMagickTrue(wand->debug))
10080     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10081   if (wand->images == (Image *) NULL)
10082     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10083   wand->images->chromaticity.red_primary.x=x;
10084   wand->images->chromaticity.red_primary.y=y;
10085   return(MagickTrue);
10086 }
10087 \f
10088 /*
10089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10090 %                                                                             %
10091 %                                                                             %
10092 %                                                                             %
10093 %   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                 %
10094 %                                                                             %
10095 %                                                                             %
10096 %                                                                             %
10097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10098 %
10099 %  MagickSetImageRenderingIntent() sets the image rendering intent.
10100 %
10101 %  The format of the MagickSetImageRenderingIntent method is:
10102 %
10103 %      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10104 %        const RenderingIntent rendering_intent)
10105 %
10106 %  A description of each parameter follows:
10107 %
10108 %    o wand: the magick wand.
10109 %
10110 %    o rendering_intent: the image rendering intent: UndefinedIntent,
10111 %      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10112 %
10113 */
10114 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10115   const RenderingIntent rendering_intent)
10116 {
10117   assert(wand != (MagickWand *) NULL);
10118   assert(wand->signature == WandSignature);
10119   if (IfMagickTrue(wand->debug))
10120     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10121   if (wand->images == (Image *) NULL)
10122     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10123   wand->images->rendering_intent=rendering_intent;
10124   return(MagickTrue);
10125 }
10126 \f
10127 /*
10128 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10129 %                                                                             %
10130 %                                                                             %
10131 %                                                                             %
10132 %   M a g i c k S e t I m a g e R e s o l u t i o n                           %
10133 %                                                                             %
10134 %                                                                             %
10135 %                                                                             %
10136 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10137 %
10138 %  MagickSetImageResolution() sets the image resolution.
10139 %
10140 %  The format of the MagickSetImageResolution method is:
10141 %
10142 %      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10143 %        const double x_resolution,const double y_resolution)
10144 %
10145 %  A description of each parameter follows:
10146 %
10147 %    o wand: the magick wand.
10148 %
10149 %    o x_resolution: the image x resolution.
10150 %
10151 %    o y_resolution: the image y resolution.
10152 %
10153 */
10154 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10155   const double x_resolution,const double y_resolution)
10156 {
10157   assert(wand != (MagickWand *) NULL);
10158   assert(wand->signature == WandSignature);
10159   if (IfMagickTrue(wand->debug))
10160     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10161   if (wand->images == (Image *) NULL)
10162     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10163   wand->images->resolution.x=x_resolution;
10164   wand->images->resolution.y=y_resolution;
10165   return(MagickTrue);
10166 }
10167 \f
10168 /*
10169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10170 %                                                                             %
10171 %                                                                             %
10172 %                                                                             %
10173 %   M a g i c k S e t I m a g e S c e n e                                     %
10174 %                                                                             %
10175 %                                                                             %
10176 %                                                                             %
10177 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10178 %
10179 %  MagickSetImageScene() sets the image scene.
10180 %
10181 %  The format of the MagickSetImageScene method is:
10182 %
10183 %      MagickBooleanType MagickSetImageScene(MagickWand *wand,
10184 %        const size_t scene)
10185 %
10186 %  A description of each parameter follows:
10187 %
10188 %    o wand: the magick wand.
10189 %
10190 %    o delay: the image scene number.
10191 %
10192 */
10193 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
10194   const size_t scene)
10195 {
10196   assert(wand != (MagickWand *) NULL);
10197   assert(wand->signature == WandSignature);
10198   if (IfMagickTrue(wand->debug))
10199     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10200   if (wand->images == (Image *) NULL)
10201     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10202   wand->images->scene=scene;
10203   return(MagickTrue);
10204 }
10205 \f
10206 /*
10207 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10208 %                                                                             %
10209 %                                                                             %
10210 %                                                                             %
10211 %   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                   %
10212 %                                                                             %
10213 %                                                                             %
10214 %                                                                             %
10215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10216 %
10217 %  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10218 %
10219 %  The format of the MagickSetImageTicksPerSecond method is:
10220 %
10221 %      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10222 %        const ssize_t ticks_per-second)
10223 %
10224 %  A description of each parameter follows:
10225 %
10226 %    o wand: the magick wand.
10227 %
10228 %    o ticks_per_second: the units to use for the image delay.
10229 %
10230 */
10231 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10232   const ssize_t ticks_per_second)
10233 {
10234   assert(wand != (MagickWand *) NULL);
10235   assert(wand->signature == WandSignature);
10236   if (IfMagickTrue(wand->debug))
10237     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10238   if (wand->images == (Image *) NULL)
10239     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10240   wand->images->ticks_per_second=ticks_per_second;
10241   return(MagickTrue);
10242 }
10243 \f
10244 /*
10245 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10246 %                                                                             %
10247 %                                                                             %
10248 %                                                                             %
10249 %   M a g i c k S e t I m a g e T y p e                                       %
10250 %                                                                             %
10251 %                                                                             %
10252 %                                                                             %
10253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10254 %
10255 %  MagickSetImageType() sets the image type.
10256 %
10257 %  The format of the MagickSetImageType method is:
10258 %
10259 %      MagickBooleanType MagickSetImageType(MagickWand *wand,
10260 %        const ImageType image_type)
10261 %
10262 %  A description of each parameter follows:
10263 %
10264 %    o wand: the magick wand.
10265 %
10266 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10267 %      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10268 %      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10269 %      or OptimizeType.
10270 %
10271 */
10272 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10273   const ImageType image_type)
10274 {
10275   assert(wand != (MagickWand *) NULL);
10276   assert(wand->signature == WandSignature);
10277   if (IfMagickTrue(wand->debug))
10278     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10279   if (wand->images == (Image *) NULL)
10280     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10281   return(SetImageType(wand->images,image_type,wand->exception));
10282 }
10283 \f
10284 /*
10285 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10286 %                                                                             %
10287 %                                                                             %
10288 %                                                                             %
10289 %   M a g i c k S e t I m a g e U n i t s                                     %
10290 %                                                                             %
10291 %                                                                             %
10292 %                                                                             %
10293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10294 %
10295 %  MagickSetImageUnits() sets the image units of resolution.
10296 %
10297 %  The format of the MagickSetImageUnits method is:
10298 %
10299 %      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10300 %        const ResolutionType units)
10301 %
10302 %  A description of each parameter follows:
10303 %
10304 %    o wand: the magick wand.
10305 %
10306 %    o units: the image units of resolution : UndefinedResolution,
10307 %      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10308 %
10309 */
10310 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10311   const ResolutionType units)
10312 {
10313   assert(wand != (MagickWand *) NULL);
10314   assert(wand->signature == WandSignature);
10315   if (IfMagickTrue(wand->debug))
10316     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10317   if (wand->images == (Image *) NULL)
10318     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10319   wand->images->units=units;
10320   return(MagickTrue);
10321 }
10322 \f
10323 /*
10324 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10325 %                                                                             %
10326 %                                                                             %
10327 %                                                                             %
10328 %   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           %
10329 %                                                                             %
10330 %                                                                             %
10331 %                                                                             %
10332 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10333 %
10334 %  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10335 %
10336 %  The format of the MagickSetImageVirtualPixelMethod method is:
10337 %
10338 %      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10339 %        const VirtualPixelMethod method)
10340 %
10341 %  A description of each parameter follows:
10342 %
10343 %    o wand: the magick wand.
10344 %
10345 %    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10346 %      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10347 %      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10348 %
10349 */
10350 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10351   const VirtualPixelMethod method)
10352 {
10353   assert(wand != (MagickWand *) NULL);
10354   assert(wand->signature == WandSignature);
10355   if (IfMagickTrue(wand->debug))
10356     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10357   if (wand->images == (Image *) NULL)
10358     return(UndefinedVirtualPixelMethod);
10359   return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
10360 }
10361 \f
10362 /*
10363 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10364 %                                                                             %
10365 %                                                                             %
10366 %                                                                             %
10367 %   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10368 %                                                                             %
10369 %                                                                             %
10370 %                                                                             %
10371 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10372 %
10373 %  MagickSetImageWhitePoint() sets the image chromaticity white point.
10374 %
10375 %  The format of the MagickSetImageWhitePoint method is:
10376 %
10377 %      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10378 %        const double x,const double y)
10379 %
10380 %  A description of each parameter follows:
10381 %
10382 %    o wand: the magick wand.
10383 %
10384 %    o x: the white x-point.
10385 %
10386 %    o y: the white y-point.
10387 %
10388 */
10389 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10390   const double x,const double y)
10391 {
10392   assert(wand != (MagickWand *) NULL);
10393   assert(wand->signature == WandSignature);
10394   if (IfMagickTrue(wand->debug))
10395     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10396   if (wand->images == (Image *) NULL)
10397     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10398   wand->images->chromaticity.white_point.x=x;
10399   wand->images->chromaticity.white_point.y=y;
10400   return(MagickTrue);
10401 }
10402 \f
10403 /*
10404 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10405 %                                                                             %
10406 %                                                                             %
10407 %                                                                             %
10408 %   M a g i c k S h a d e I m a g e C h a n n e l                             %
10409 %                                                                             %
10410 %                                                                             %
10411 %                                                                             %
10412 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10413 %
10414 %  MagickShadeImage() shines a distant light on an image to create a
10415 %  three-dimensional effect. You control the positioning of the light with
10416 %  azimuth and elevation; azimuth is measured in degrees off the x axis
10417 %  and elevation is measured in pixels above the Z axis.
10418 %
10419 %  The format of the MagickShadeImage method is:
10420 %
10421 %      MagickBooleanType MagickShadeImage(MagickWand *wand,
10422 %        const MagickBooleanType gray,const double azimuth,
10423 %        const double elevation)
10424 %
10425 %  A description of each parameter follows:
10426 %
10427 %    o wand: the magick wand.
10428 %
10429 %    o gray: A value other than zero shades the intensity of each pixel.
10430 %
10431 %    o azimuth, elevation:  Define the light source direction.
10432 %
10433 */
10434 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10435   const MagickBooleanType gray,const double asimuth,const double elevation)
10436 {
10437   Image
10438     *shade_image;
10439
10440   assert(wand != (MagickWand *) NULL);
10441   assert(wand->signature == WandSignature);
10442   if (IfMagickTrue(wand->debug))
10443     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10444   if (wand->images == (Image *) NULL)
10445     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10446   shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10447   if (shade_image == (Image *) NULL)
10448     return(MagickFalse);
10449   ReplaceImageInList(&wand->images,shade_image);
10450   return(MagickTrue);
10451 }
10452 \f
10453 /*
10454 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10455 %                                                                             %
10456 %                                                                             %
10457 %                                                                             %
10458 %   M a g i c k S h a d o w I m a g e                                         %
10459 %                                                                             %
10460 %                                                                             %
10461 %                                                                             %
10462 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10463 %
10464 %  MagickShadowImage() simulates an image shadow.
10465 %
10466 %  The format of the MagickShadowImage method is:
10467 %
10468 %      MagickBooleanType MagickShadowImage(MagickWand *wand,const double alpha,
10469 %        const double sigma,const ssize_t x,const ssize_t y)
10470 %
10471 %  A description of each parameter follows:
10472 %
10473 %    o wand: the magick wand.
10474 %
10475 %    o alpha: percentage transparency.
10476 %
10477 %    o sigma: the standard deviation of the Gaussian, in pixels.
10478 %
10479 %    o x: the shadow x-offset.
10480 %
10481 %    o y: the shadow y-offset.
10482 %
10483 */
10484 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10485   const double alpha,const double sigma,const ssize_t x,const ssize_t y)
10486 {
10487   Image
10488     *shadow_image;
10489
10490   assert(wand != (MagickWand *) NULL);
10491   assert(wand->signature == WandSignature);
10492   if (IfMagickTrue(wand->debug))
10493     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10494   if (wand->images == (Image *) NULL)
10495     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10496   shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
10497   if (shadow_image == (Image *) NULL)
10498     return(MagickFalse);
10499   ReplaceImageInList(&wand->images,shadow_image);
10500   return(MagickTrue);
10501 }
10502 \f
10503 /*
10504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10505 %                                                                             %
10506 %                                                                             %
10507 %                                                                             %
10508 %   M a g i c k S h a r p e n I m a g e                                       %
10509 %                                                                             %
10510 %                                                                             %
10511 %                                                                             %
10512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10513 %
10514 %  MagickSharpenImage() sharpens an image.  We convolve the image with a
10515 %  Gaussian operator of the given radius and standard deviation (sigma).
10516 %  For reasonable results, the radius should be larger than sigma.  Use a
10517 %  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10518 %
10519 %  The format of the MagickSharpenImage method is:
10520 %
10521 %      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10522 %        const double radius,const double sigma)
10523 %
10524 %  A description of each parameter follows:
10525 %
10526 %    o wand: the magick wand.
10527 %
10528 %    o radius: the radius of the Gaussian, in pixels, not counting the center
10529 %      pixel.
10530 %
10531 %    o sigma: the standard deviation of the Gaussian, in pixels.
10532 %
10533 */
10534 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10535   const double radius,const double sigma)
10536 {
10537   Image
10538     *sharp_image;
10539
10540   assert(wand != (MagickWand *) NULL);
10541   assert(wand->signature == WandSignature);
10542   if (IfMagickTrue(wand->debug))
10543     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10544   if (wand->images == (Image *) NULL)
10545     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10546   sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
10547   if (sharp_image == (Image *) NULL)
10548     return(MagickFalse);
10549   ReplaceImageInList(&wand->images,sharp_image);
10550   return(MagickTrue);
10551 }
10552 \f
10553 /*
10554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10555 %                                                                             %
10556 %                                                                             %
10557 %                                                                             %
10558 %   M a g i c k S h a v e I m a g e                                           %
10559 %                                                                             %
10560 %                                                                             %
10561 %                                                                             %
10562 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10563 %
10564 %  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10565 %  memory necessary for the new Image structure and returns a pointer to the
10566 %  new image.
10567 %
10568 %  The format of the MagickShaveImage method is:
10569 %
10570 %      MagickBooleanType MagickShaveImage(MagickWand *wand,
10571 %        const size_t columns,const size_t rows)
10572 %
10573 %  A description of each parameter follows:
10574 %
10575 %    o wand: the magick wand.
10576 %
10577 %    o columns: the number of columns in the scaled image.
10578 %
10579 %    o rows: the number of rows in the scaled image.
10580 %
10581 %
10582 */
10583 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10584   const size_t columns,const size_t rows)
10585 {
10586   Image
10587     *shave_image;
10588
10589   RectangleInfo
10590     shave_info;
10591
10592   assert(wand != (MagickWand *) NULL);
10593   assert(wand->signature == WandSignature);
10594   if (IfMagickTrue(wand->debug))
10595     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10596   if (wand->images == (Image *) NULL)
10597     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10598   shave_info.width=columns;
10599   shave_info.height=rows;
10600   shave_info.x=0;
10601   shave_info.y=0;
10602   shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10603   if (shave_image == (Image *) NULL)
10604     return(MagickFalse);
10605   ReplaceImageInList(&wand->images,shave_image);
10606   return(MagickTrue);
10607 }
10608 \f
10609 /*
10610 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10611 %                                                                             %
10612 %                                                                             %
10613 %                                                                             %
10614 %   M a g i c k S h e a r I m a g e                                           %
10615 %                                                                             %
10616 %                                                                             %
10617 %                                                                             %
10618 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10619 %
10620 %  MagickShearImage() slides one edge of an image along the X or Y axis,
10621 %  creating a parallelogram.  An X direction shear slides an edge along the X
10622 %  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10623 %  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10624 %  is measured relative to the Y axis, and similarly, for Y direction shears
10625 %  y_shear is measured relative to the X axis.  Empty triangles left over from
10626 %  shearing the image are filled with the background color.
10627 %
10628 %  The format of the MagickShearImage method is:
10629 %
10630 %      MagickBooleanType MagickShearImage(MagickWand *wand,
10631 %        const PixelWand *background,const double x_shear,const double y_shear)
10632 %
10633 %  A description of each parameter follows:
10634 %
10635 %    o wand: the magick wand.
10636 %
10637 %    o background: the background pixel wand.
10638 %
10639 %    o x_shear: the number of degrees to shear the image.
10640 %
10641 %    o y_shear: the number of degrees to shear the image.
10642 %
10643 */
10644 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10645   const PixelWand *background,const double x_shear,const double y_shear)
10646 {
10647   Image
10648     *shear_image;
10649
10650   assert(wand != (MagickWand *) NULL);
10651   assert(wand->signature == WandSignature);
10652   if (IfMagickTrue(wand->debug))
10653     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10654   if (wand->images == (Image *) NULL)
10655     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10656   PixelGetQuantumPacket(background,&wand->images->background_color);
10657   shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10658   if (shear_image == (Image *) NULL)
10659     return(MagickFalse);
10660   ReplaceImageInList(&wand->images,shear_image);
10661   return(MagickTrue);
10662 }
10663 \f
10664 /*
10665 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10666 %                                                                             %
10667 %                                                                             %
10668 %                                                                             %
10669 %   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                   %
10670 %                                                                             %
10671 %                                                                             %
10672 %                                                                             %
10673 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10674 %
10675 %  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10676 %  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10677 %  image using a sigmoidal transfer function without saturating highlights or
10678 %  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10679 %  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10680 %  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10681 %  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10682 %  is reduced.
10683 %
10684 %  The format of the MagickSigmoidalContrastImage method is:
10685 %
10686 %      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10687 %        const MagickBooleanType sharpen,const double alpha,const double beta)
10688 %
10689 %  A description of each parameter follows:
10690 %
10691 %    o wand: the magick wand.
10692 %
10693 %    o sharpen: Increase or decrease image contrast.
10694 %
10695 %    o alpha: strength of the contrast, the larger the number the more
10696 %      'threshold-like' it becomes.
10697 %
10698 %    o beta: midpoint of the function as a color value 0 to QuantumRange.
10699 %
10700 */
10701 WandExport MagickBooleanType MagickSigmoidalContrastImage(
10702   MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10703   const double beta)
10704 {
10705   MagickBooleanType
10706     status;
10707
10708   assert(wand != (MagickWand *) NULL);
10709   assert(wand->signature == WandSignature);
10710   if (IfMagickTrue(wand->debug))
10711     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10712   if (wand->images == (Image *) NULL)
10713     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10714   status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10715     wand->exception);
10716   return(status);
10717 }
10718 \f
10719 /*
10720 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10721 %                                                                             %
10722 %                                                                             %
10723 %                                                                             %
10724 %   M a g i c k S i m i l a r i t y I m a g e                                 %
10725 %                                                                             %
10726 %                                                                             %
10727 %                                                                             %
10728 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10729 %
10730 %  MagickSimilarityImage() compares the reference image of the image and
10731 %  returns the best match offset.  In addition, it returns a similarity image
10732 %  such that an exact match location is completely white and if none of the
10733 %  pixels match, black, otherwise some gray level in-between.
10734 %
10735 %  The format of the MagickSimilarityImage method is:
10736 %
10737 %      MagickWand *MagickSimilarityImage(MagickWand *wand,
10738 %        const MagickWand *reference,const MetricType metric,
10739 %        const double similarity_threshold,RectangeInfo *offset,
10740 %        double *similarity)
10741 %
10742 %  A description of each parameter follows:
10743 %
10744 %    o wand: the magick wand.
10745 %
10746 %    o reference: the reference wand.
10747 %
10748 %    o metric: the metric.
10749 %
10750 %    o similarity_threshold: minimum distortion for (sub)image match.
10751 %
10752 %    o offset: the best match offset of the reference image within the image.
10753 %
10754 %    o similarity: the computed similarity between the images.
10755 %
10756 */
10757 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10758   const MagickWand *reference,const MetricType metric,
10759   const double similarity_threshold,RectangleInfo *offset,double *similarity)
10760 {
10761   Image
10762     *similarity_image;
10763
10764   assert(wand != (MagickWand *) NULL);
10765   assert(wand->signature == WandSignature);
10766   if (IfMagickTrue(wand->debug))
10767     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10768   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10769     {
10770       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10771         "ContainsNoImages","`%s'",wand->name);
10772       return((MagickWand *) NULL);
10773     }
10774   similarity_image=SimilarityImage(wand->images,reference->images,metric,
10775     similarity_threshold,offset,similarity,wand->exception);
10776   if (similarity_image == (Image *) NULL)
10777     return((MagickWand *) NULL);
10778   return(CloneMagickWandFromImages(wand,similarity_image));
10779 }
10780 \f
10781 /*
10782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10783 %                                                                             %
10784 %                                                                             %
10785 %                                                                             %
10786 %   M a g i c k S k e t c h I m a g e                                         %
10787 %                                                                             %
10788 %                                                                             %
10789 %                                                                             %
10790 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10791 %
10792 %  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10793 %  a Gaussian operator of the given radius and standard deviation (sigma).
10794 %  For reasonable results, radius should be larger than sigma.  Use a
10795 %  radius of 0 and SketchImage() selects a suitable radius for you.
10796 %  Angle gives the angle of the blurring motion.
10797 %
10798 %  The format of the MagickSketchImage method is:
10799 %
10800 %      MagickBooleanType MagickSketchImage(MagickWand *wand,
10801 %        const double radius,const double sigma,const double angle)
10802 %
10803 %  A description of each parameter follows:
10804 %
10805 %    o wand: the magick wand.
10806 %
10807 %    o radius: the radius of the Gaussian, in pixels, not counting
10808 %      the center pixel.
10809 %
10810 %    o sigma: the standard deviation of the Gaussian, in pixels.
10811 %
10812 %    o angle: apply the effect along this angle.
10813 %
10814 */
10815 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10816   const double radius,const double sigma,const double angle)
10817 {
10818   Image
10819     *sketch_image;
10820
10821   assert(wand != (MagickWand *) NULL);
10822   assert(wand->signature == WandSignature);
10823   if (IfMagickTrue(wand->debug))
10824     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10825   if (wand->images == (Image *) NULL)
10826     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10827   sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
10828   if (sketch_image == (Image *) NULL)
10829     return(MagickFalse);
10830   ReplaceImageInList(&wand->images,sketch_image);
10831   return(MagickTrue);
10832 }
10833 \f
10834 /*
10835 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10836 %                                                                             %
10837 %                                                                             %
10838 %                                                                             %
10839 %   M a g i c k S m u s h I m a g e s                                         %
10840 %                                                                             %
10841 %                                                                             %
10842 %                                                                             %
10843 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10844 %
10845 %  MagickSmushImages() takes all images from the current image pointer to the
10846 %  end of the image list and smushs them to each other top-to-bottom if the
10847 %  stack parameter is true, otherwise left-to-right.
10848 %
10849 %  The format of the MagickSmushImages method is:
10850 %
10851 %      MagickWand *MagickSmushImages(MagickWand *wand,
10852 %        const MagickBooleanType stack,const ssize_t offset)
10853 %
10854 %  A description of each parameter follows:
10855 %
10856 %    o wand: the magick wand.
10857 %
10858 %    o stack: By default, images are stacked left-to-right. Set stack to
10859 %      MagickTrue to stack them top-to-bottom.
10860 %
10861 %    o offset: minimum distance in pixels between images.
10862 %
10863 */
10864 WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10865   const MagickBooleanType stack,const ssize_t offset)
10866 {
10867   Image
10868     *smush_image;
10869
10870   assert(wand != (MagickWand *) NULL);
10871   assert(wand->signature == WandSignature);
10872   if (IfMagickTrue(wand->debug))
10873     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10874   if (wand->images == (Image *) NULL)
10875     return((MagickWand *) NULL);
10876   smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10877   if (smush_image == (Image *) NULL)
10878     return((MagickWand *) NULL);
10879   return(CloneMagickWandFromImages(wand,smush_image));
10880 }
10881 \f
10882 /*
10883 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10884 %                                                                             %
10885 %                                                                             %
10886 %                                                                             %
10887 %     M a g i c k S o l a r i z e I m a g e                                   %
10888 %                                                                             %
10889 %                                                                             %
10890 %                                                                             %
10891 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10892 %
10893 %  MagickSolarizeImage() applies a special effect to the image, similar to the
10894 %  effect achieved in a photo darkroom by selectively exposing areas of photo
10895 %  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
10896 %  measure of the extent of the solarization.
10897 %
10898 %  The format of the MagickSolarizeImage method is:
10899 %
10900 %      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10901 %        const double threshold)
10902 %
10903 %  A description of each parameter follows:
10904 %
10905 %    o wand: the magick wand.
10906 %
10907 %    o threshold:  Define the extent of the solarization.
10908 %
10909 */
10910 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10911   const double threshold)
10912 {
10913   MagickBooleanType
10914     status;
10915
10916   assert(wand != (MagickWand *) NULL);
10917   assert(wand->signature == WandSignature);
10918   if (IfMagickTrue(wand->debug))
10919     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10920   if (wand->images == (Image *) NULL)
10921     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10922   status=SolarizeImage(wand->images,threshold,wand->exception);
10923   return(status);
10924 }
10925 \f
10926 /*
10927 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10928 %                                                                             %
10929 %                                                                             %
10930 %                                                                             %
10931 %   M a g i c k S p a r s e C o l o r I m a g e                               %
10932 %                                                                             %
10933 %                                                                             %
10934 %                                                                             %
10935 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10936 %
10937 %  MagickSparseColorImage(), given a set of coordinates, interpolates the
10938 %  colors found at those coordinates, across the whole image, using various
10939 %  methods.
10940 %
10941 %  The format of the MagickSparseColorImage method is:
10942 %
10943 %      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10944 %        const SparseColorMethod method,const size_t number_arguments,
10945 %        const double *arguments)
10946 %
10947 %  A description of each parameter follows:
10948 %
10949 %    o image: the image to be sparseed.
10950 %
10951 %    o method: the method of image sparseion.
10952 %
10953 %        ArcSparseColorion will always ignore source image offset, and always
10954 %        'bestfit' the destination image with the top left corner offset
10955 %        relative to the polar mapping center.
10956 %
10957 %        Bilinear has no simple inverse mapping so will not allow 'bestfit'
10958 %        style of image sparseion.
10959 %
10960 %        Affine, Perspective, and Bilinear, will do least squares fitting of
10961 %        the distrotion when more than the minimum number of control point
10962 %        pairs are provided.
10963 %
10964 %        Perspective, and Bilinear, will fall back to a Affine sparseion when
10965 %        less than 4 control point pairs are provided. While Affine sparseions
10966 %        will let you use any number of control point pairs, that is Zero pairs
10967 %        is a No-Op (viewport only) distrotion, one pair is a translation and
10968 %        two pairs of control points will do a scale-rotate-translate, without
10969 %        any shearing.
10970 %
10971 %    o number_arguments: the number of arguments given for this sparseion
10972 %      method.
10973 %
10974 %    o arguments: the arguments for this sparseion method.
10975 %
10976 */
10977 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10978   const SparseColorMethod method,const size_t number_arguments,
10979   const double *arguments)
10980 {
10981   Image
10982     *sparse_image;
10983
10984   assert(wand != (MagickWand *) NULL);
10985   assert(wand->signature == WandSignature);
10986   if (IfMagickTrue(wand->debug))
10987     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10988   if (wand->images == (Image *) NULL)
10989     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10990   sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
10991     wand->exception);
10992   if (sparse_image == (Image *) NULL)
10993     return(MagickFalse);
10994   ReplaceImageInList(&wand->images,sparse_image);
10995   return(MagickTrue);
10996 }
10997 \f
10998 /*
10999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11000 %                                                                             %
11001 %                                                                             %
11002 %                                                                             %
11003 %   M a g i c k S p l i c e I m a g e                                         %
11004 %                                                                             %
11005 %                                                                             %
11006 %                                                                             %
11007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11008 %
11009 %  MagickSpliceImage() splices a solid color into the image.
11010 %
11011 %  The format of the MagickSpliceImage method is:
11012 %
11013 %      MagickBooleanType MagickSpliceImage(MagickWand *wand,
11014 %        const size_t width,const size_t height,const ssize_t x,
11015 %        const ssize_t y)
11016 %
11017 %  A description of each parameter follows:
11018 %
11019 %    o wand: the magick wand.
11020 %
11021 %    o width: the region width.
11022 %
11023 %    o height: the region height.
11024 %
11025 %    o x: the region x offset.
11026 %
11027 %    o y: the region y offset.
11028 %
11029 */
11030 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
11031   const size_t width,const size_t height,const ssize_t x,
11032   const ssize_t y)
11033 {
11034   Image
11035     *splice_image;
11036
11037   RectangleInfo
11038     splice;
11039
11040   assert(wand != (MagickWand *) NULL);
11041   assert(wand->signature == WandSignature);
11042   if (IfMagickTrue(wand->debug))
11043     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11044   if (wand->images == (Image *) NULL)
11045     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11046   splice.width=width;
11047   splice.height=height;
11048   splice.x=x;
11049   splice.y=y;
11050   splice_image=SpliceImage(wand->images,&splice,wand->exception);
11051   if (splice_image == (Image *) NULL)
11052     return(MagickFalse);
11053   ReplaceImageInList(&wand->images,splice_image);
11054   return(MagickTrue);
11055 }
11056 \f
11057 /*
11058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11059 %                                                                             %
11060 %                                                                             %
11061 %                                                                             %
11062 %   M a g i c k S p r e a d I m a g e                                         %
11063 %                                                                             %
11064 %                                                                             %
11065 %                                                                             %
11066 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11067 %
11068 %  MagickSpreadImage() is a special effects method that randomly displaces each
11069 %  pixel in a block defined by the radius parameter.
11070 %
11071 %  The format of the MagickSpreadImage method is:
11072 %
11073 %      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius,
11074 %        const PixelInterpolateMethod method)
11075 %
11076 %  A description of each parameter follows:
11077 %
11078 %    o wand: the magick wand.
11079 %
11080 %    o radius:  Choose a random pixel in a neighborhood of this extent.
11081 %
11082 %    o method: the pixel interpolation method.
11083 %
11084 */
11085 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11086   const double radius,const PixelInterpolateMethod method)
11087 {
11088   Image
11089     *spread_image;
11090
11091   assert(wand != (MagickWand *) NULL);
11092   assert(wand->signature == WandSignature);
11093   if (IfMagickTrue(wand->debug))
11094     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11095   if (wand->images == (Image *) NULL)
11096     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11097   spread_image=SpreadImage(wand->images,radius,method,wand->exception);
11098   if (spread_image == (Image *) NULL)
11099     return(MagickFalse);
11100   ReplaceImageInList(&wand->images,spread_image);
11101   return(MagickTrue);
11102 }
11103 \f
11104 /*
11105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11106 %                                                                             %
11107 %                                                                             %
11108 %                                                                             %
11109 %   M a g i c k S t a t i s t i c I m a g e                                   %
11110 %                                                                             %
11111 %                                                                             %
11112 %                                                                             %
11113 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11114 %
11115 %  MagickStatisticImage() replace each pixel with corresponding statistic from
11116 %  the neighborhood of the specified width and height.
11117 %
11118 %  The format of the MagickStatisticImage method is:
11119 %
11120 %      MagickBooleanType MagickStatisticImage(MagickWand *wand,
11121 %        const StatisticType type,const double width,const size_t height)
11122 %
11123 %  A description of each parameter follows:
11124 %
11125 %    o wand: the magick wand.
11126 %
11127 %    o type: the statistic type (e.g. median, mode, etc.).
11128 %
11129 %    o width: the width of the pixel neighborhood.
11130 %
11131 %    o height: the height of the pixel neighborhood.
11132 %
11133 */
11134 WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
11135   const StatisticType type,const size_t width,const size_t height)
11136 {
11137   Image
11138     *statistic_image;
11139
11140   assert(wand != (MagickWand *) NULL);
11141   assert(wand->signature == WandSignature);
11142   if (IfMagickTrue(wand->debug))
11143     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11144   if (wand->images == (Image *) NULL)
11145     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11146   statistic_image=StatisticImage(wand->images,type,width,height,
11147     wand->exception);
11148   if (statistic_image == (Image *) NULL)
11149     return(MagickFalse);
11150   ReplaceImageInList(&wand->images,statistic_image);
11151   return(MagickTrue);
11152 }
11153 \f
11154 /*
11155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11156 %                                                                             %
11157 %                                                                             %
11158 %                                                                             %
11159 %   M a g i c k S t e g a n o I m a g e                                       %
11160 %                                                                             %
11161 %                                                                             %
11162 %                                                                             %
11163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11164 %
11165 %  MagickSteganoImage() hides a digital watermark within the image.
11166 %  Recover the hidden watermark later to prove that the authenticity of
11167 %  an image.  Offset defines the start position within the image to hide
11168 %  the watermark.
11169 %
11170 %  The format of the MagickSteganoImage method is:
11171 %
11172 %      MagickWand *MagickSteganoImage(MagickWand *wand,
11173 %        const MagickWand *watermark_wand,const ssize_t offset)
11174 %
11175 %  A description of each parameter follows:
11176 %
11177 %    o wand: the magick wand.
11178 %
11179 %    o watermark_wand: the watermark wand.
11180 %
11181 %    o offset: Start hiding at this offset into the image.
11182 %
11183 */
11184 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
11185   const MagickWand *watermark_wand,const ssize_t offset)
11186 {
11187   Image
11188     *stegano_image;
11189
11190   assert(wand != (MagickWand *) NULL);
11191   assert(wand->signature == WandSignature);
11192   if (IfMagickTrue(wand->debug))
11193     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11194   if ((wand->images == (Image *) NULL) ||
11195       (watermark_wand->images == (Image *) NULL))
11196     {
11197       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11198         "ContainsNoImages","`%s'",wand->name);
11199       return((MagickWand *) NULL);
11200     }
11201   wand->images->offset=offset;
11202   stegano_image=SteganoImage(wand->images,watermark_wand->images,
11203     wand->exception);
11204   if (stegano_image == (Image *) NULL)
11205     return((MagickWand *) NULL);
11206   return(CloneMagickWandFromImages(wand,stegano_image));
11207 }
11208 \f
11209 /*
11210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11211 %                                                                             %
11212 %                                                                             %
11213 %                                                                             %
11214 %   M a g i c k S t e r e o I m a g e                                         %
11215 %                                                                             %
11216 %                                                                             %
11217 %                                                                             %
11218 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11219 %
11220 %  MagickStereoImage() composites two images and produces a single image that
11221 %  is the composite of a left and right image of a stereo pair
11222 %
11223 %  The format of the MagickStereoImage method is:
11224 %
11225 %      MagickWand *MagickStereoImage(MagickWand *wand,
11226 %        const MagickWand *offset_wand)
11227 %
11228 %  A description of each parameter follows:
11229 %
11230 %    o wand: the magick wand.
11231 %
11232 %    o offset_wand: Another image wand.
11233 %
11234 */
11235 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11236   const MagickWand *offset_wand)
11237 {
11238   Image
11239     *stereo_image;
11240
11241   assert(wand != (MagickWand *) NULL);
11242   assert(wand->signature == WandSignature);
11243   if (IfMagickTrue(wand->debug))
11244     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11245   if ((wand->images == (Image *) NULL) ||
11246       (offset_wand->images == (Image *) NULL))
11247     {
11248       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11249         "ContainsNoImages","`%s'",wand->name);
11250       return((MagickWand *) NULL);
11251     }
11252   stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11253   if (stereo_image == (Image *) NULL)
11254     return((MagickWand *) NULL);
11255   return(CloneMagickWandFromImages(wand,stereo_image));
11256 }
11257 \f
11258 /*
11259 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11260 %                                                                             %
11261 %                                                                             %
11262 %                                                                             %
11263 %   M a g i c k S t r i p I m a g e                                           %
11264 %                                                                             %
11265 %                                                                             %
11266 %                                                                             %
11267 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11268 %
11269 %  MagickStripImage() strips an image of all profiles and comments.
11270 %
11271 %  The format of the MagickStripImage method is:
11272 %
11273 %      MagickBooleanType MagickStripImage(MagickWand *wand)
11274 %
11275 %  A description of each parameter follows:
11276 %
11277 %    o wand: the magick wand.
11278 %
11279 */
11280 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11281 {
11282   assert(wand != (MagickWand *) NULL);
11283   assert(wand->signature == WandSignature);
11284   if (IfMagickTrue(wand->debug))
11285     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11286   if (wand->images == (Image *) NULL)
11287     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11288   return(StripImage(wand->images,wand->exception));
11289 }
11290 \f
11291 /*
11292 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11293 %                                                                             %
11294 %                                                                             %
11295 %                                                                             %
11296 %   M a g i c k S w i r l I m a g e                                           %
11297 %                                                                             %
11298 %                                                                             %
11299 %                                                                             %
11300 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11301 %
11302 %  MagickSwirlImage() swirls the pixels about the center of the image, where
11303 %  degrees indicates the sweep of the arc through which each pixel is moved.
11304 %  You get a more dramatic effect as the degrees move from 1 to 360.
11305 %
11306 %  The format of the MagickSwirlImage method is:
11307 %
11308 %      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11309 %        const PixelInterpolateMethod method)
11310 %
11311 %  A description of each parameter follows:
11312 %
11313 %    o wand: the magick wand.
11314 %
11315 %    o degrees: Define the tightness of the swirling effect.
11316 %
11317 %    o method: the pixel interpolation method.
11318 %
11319 */
11320 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11321   const double degrees,const PixelInterpolateMethod method)
11322 {
11323   Image
11324     *swirl_image;
11325
11326   assert(wand != (MagickWand *) NULL);
11327   assert(wand->signature == WandSignature);
11328   if (IfMagickTrue(wand->debug))
11329     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11330   if (wand->images == (Image *) NULL)
11331     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11332   swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
11333   if (swirl_image == (Image *) NULL)
11334     return(MagickFalse);
11335   ReplaceImageInList(&wand->images,swirl_image);
11336   return(MagickTrue);
11337 }
11338 \f
11339 /*
11340 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11341 %                                                                             %
11342 %                                                                             %
11343 %                                                                             %
11344 %   M a g i c k T e x t u r e I m a g e                                       %
11345 %                                                                             %
11346 %                                                                             %
11347 %                                                                             %
11348 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11349 %
11350 %  MagickTextureImage() repeatedly tiles the texture image across and down the
11351 %  image canvas.
11352 %
11353 %  The format of the MagickTextureImage method is:
11354 %
11355 %      MagickWand *MagickTextureImage(MagickWand *wand,
11356 %        const MagickWand *texture_wand)
11357 %
11358 %  A description of each parameter follows:
11359 %
11360 %    o wand: the magick wand.
11361 %
11362 %    o texture_wand: the texture wand
11363 %
11364 */
11365 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11366   const MagickWand *texture_wand)
11367 {
11368   Image
11369     *texture_image;
11370
11371   MagickBooleanType
11372     status;
11373
11374   assert(wand != (MagickWand *) NULL);
11375   assert(wand->signature == WandSignature);
11376   if (IfMagickTrue(wand->debug))
11377     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11378   if ((wand->images == (Image *) NULL) ||
11379       (texture_wand->images == (Image *) NULL))
11380     {
11381       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11382         "ContainsNoImages","`%s'",wand->name);
11383       return((MagickWand *) NULL);
11384     }
11385   texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11386   if (texture_image == (Image *) NULL)
11387     return((MagickWand *) NULL);
11388   status=TextureImage(texture_image,texture_wand->images,wand->exception);
11389   if (IfMagickFalse(status))
11390     {
11391       texture_image=DestroyImage(texture_image);
11392       return((MagickWand *) NULL);
11393     }
11394   return(CloneMagickWandFromImages(wand,texture_image));
11395 }
11396 \f
11397 /*
11398 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11399 %                                                                             %
11400 %                                                                             %
11401 %                                                                             %
11402 %   M a g i c k T h r e s h o l d I m a g e                                   %
11403 %                                                                             %
11404 %                                                                             %
11405 %                                                                             %
11406 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11407 %
11408 %  MagickThresholdImage() changes the value of individual pixels based on
11409 %  the intensity of each pixel compared to threshold.  The result is a
11410 %  high-contrast, two color image.
11411 %
11412 %  The format of the MagickThresholdImage method is:
11413 %
11414 %      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11415 %        const double threshold)
11416 %      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11417 %        const ChannelType channel,const double threshold)
11418 %
11419 %  A description of each parameter follows:
11420 %
11421 %    o wand: the magick wand.
11422 %
11423 %    o channel: the image channel(s).
11424 %
11425 %    o threshold: Define the threshold value.
11426 %
11427 */
11428 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11429   const double threshold)
11430 {
11431   MagickBooleanType
11432     status;
11433
11434   status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11435   return(status);
11436 }
11437
11438 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11439   const ChannelType channel,const double threshold)
11440 {
11441   MagickBooleanType
11442     status;
11443
11444   assert(wand != (MagickWand *) NULL);
11445   assert(wand->signature == WandSignature);
11446   if (IfMagickTrue(wand->debug))
11447     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11448   if (wand->images == (Image *) NULL)
11449     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11450   status=BilevelImage(wand->images,threshold,wand->exception);
11451   return(status);
11452 }
11453 \f
11454 /*
11455 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11456 %                                                                             %
11457 %                                                                             %
11458 %                                                                             %
11459 %   M a g i c k T h u m b n a i l I m a g e                                   %
11460 %                                                                             %
11461 %                                                                             %
11462 %                                                                             %
11463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11464 %
11465 %  MagickThumbnailImage()  changes the size of an image to the given dimensions
11466 %  and removes any associated profiles.  The goal is to produce small low cost
11467 %  thumbnail images suited for display on the Web.
11468 %
11469 %  The format of the MagickThumbnailImage method is:
11470 %
11471 %      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11472 %        const size_t columns,const size_t rows)
11473 %
11474 %  A description of each parameter follows:
11475 %
11476 %    o wand: the magick wand.
11477 %
11478 %    o columns: the number of columns in the scaled image.
11479 %
11480 %    o rows: the number of rows in the scaled image.
11481 %
11482 */
11483 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11484   const size_t columns,const size_t rows)
11485 {
11486   Image
11487     *thumbnail_image;
11488
11489   assert(wand != (MagickWand *) NULL);
11490   assert(wand->signature == WandSignature);
11491   if (IfMagickTrue(wand->debug))
11492     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11493   if (wand->images == (Image *) NULL)
11494     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11495   thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11496   if (thumbnail_image == (Image *) NULL)
11497     return(MagickFalse);
11498   ReplaceImageInList(&wand->images,thumbnail_image);
11499   return(MagickTrue);
11500 }
11501 \f
11502 /*
11503 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11504 %                                                                             %
11505 %                                                                             %
11506 %                                                                             %
11507 %   M a g i c k T i n t I m a g e                                             %
11508 %                                                                             %
11509 %                                                                             %
11510 %                                                                             %
11511 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11512 %
11513 %  MagickTintImage() applies a color vector to each pixel in the image.  The
11514 %  length of the vector is 0 for black and white and at its maximum for the
11515 %  midtones.  The vector weighting function is
11516 %  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11517 %
11518 %  The format of the MagickTintImage method is:
11519 %
11520 %      MagickBooleanType MagickTintImage(MagickWand *wand,
11521 %        const PixelWand *tint,const PixelWand *blend)
11522 %
11523 %  A description of each parameter follows:
11524 %
11525 %    o wand: the magick wand.
11526 %
11527 %    o tint: the tint pixel wand.
11528 %
11529 %    o alpha: the alpha pixel wand.
11530 %
11531 */
11532 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11533   const PixelWand *tint,const PixelWand *blend)
11534 {
11535   char
11536     percent_blend[MaxTextExtent];
11537
11538   Image
11539     *tint_image;
11540
11541   PixelInfo
11542     target;
11543
11544   assert(wand != (MagickWand *) NULL);
11545   assert(wand->signature == WandSignature);
11546   if (IfMagickTrue(wand->debug))
11547     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11548   if (wand->images == (Image *) NULL)
11549     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11550   if (wand->images->colorspace != CMYKColorspace)
11551     (void) FormatLocaleString(percent_blend,MaxTextExtent,
11552       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11553       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11554       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11555       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11556       PixelGetAlphaQuantum(blend)));
11557   else
11558     (void) FormatLocaleString(percent_blend,MaxTextExtent,
11559       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
11560       PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11561       PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11562       PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11563       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11564       PixelGetAlphaQuantum(blend)));
11565   target=PixelGetPixel(tint);
11566   tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
11567   if (tint_image == (Image *) NULL)
11568     return(MagickFalse);
11569   ReplaceImageInList(&wand->images,tint_image);
11570   return(MagickTrue);
11571 }
11572 \f
11573 /*
11574 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11575 %                                                                             %
11576 %                                                                             %
11577 %                                                                             %
11578 %   M a g i c k T r a n s f o r m I m a g e                                   %
11579 %                                                                             %
11580 %                                                                             %
11581 %                                                                             %
11582 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11583 %
11584 %  MagickTransformImage() is a convenience method that behaves like
11585 %  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11586 %  information as a region geometry specification.  If the operation fails,
11587 %  a NULL image handle is returned.
11588 %
11589 %  The format of the MagickTransformImage method is:
11590 %
11591 %      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11592 %        const char *geometry)
11593 %
11594 %  A description of each parameter follows:
11595 %
11596 %    o wand: the magick wand.
11597 %
11598 %    o crop: A crop geometry string.  This geometry defines a subregion of the
11599 %      image to crop.
11600 %
11601 %    o geometry: An image geometry string.  This geometry defines the final
11602 %      size of the image.
11603 %
11604 */
11605 WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11606   const char *crop,const char *geometry)
11607 {
11608   Image
11609     *transform_image;
11610
11611   MagickBooleanType
11612     status;
11613
11614   assert(wand != (MagickWand *) NULL);
11615   assert(wand->signature == WandSignature);
11616   if (IfMagickTrue(wand->debug))
11617     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11618   if (wand->images == (Image *) NULL)
11619     return((MagickWand *) NULL);
11620   transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11621   if (transform_image == (Image *) NULL)
11622     return((MagickWand *) NULL);
11623   status=TransformImage(&transform_image,crop,geometry,wand->exception);
11624   if (IfMagickFalse(status))
11625     {
11626       transform_image=DestroyImage(transform_image);
11627       return((MagickWand *) NULL);
11628     }
11629   return(CloneMagickWandFromImages(wand,transform_image));
11630 }
11631 \f
11632 /*
11633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11634 %                                                                             %
11635 %                                                                             %
11636 %                                                                             %
11637 %   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               %
11638 %                                                                             %
11639 %                                                                             %
11640 %                                                                             %
11641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11642 %
11643 %  MagickTransformImageColorspace() transform the image colorspace, setting
11644 %  the images colorspace while transforming the images data to that
11645 %  colorspace.
11646 %
11647 %  The format of the MagickTransformImageColorspace method is:
11648 %
11649 %      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11650 %        const ColorspaceType colorspace)
11651 %
11652 %  A description of each parameter follows:
11653 %
11654 %    o wand: the magick wand.
11655 %
11656 %    o colorspace: the image colorspace:   UndefinedColorspace,
11657 %      sRGBColorspace, RGBColorspace, GRAYColorspace,
11658 %      OHTAColorspace, XYZColorspace, YCbCrColorspace,
11659 %      YCCColorspace, YIQColorspace, YPbPrColorspace,
11660 %      YPbPrColorspace, YUVColorspace, CMYKColorspace,
11661 %      HSLColorspace, HWBColorspace.
11662 %
11663 */
11664 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11665   const ColorspaceType colorspace)
11666 {
11667   assert(wand != (MagickWand *) NULL);
11668   assert(wand->signature == WandSignature);
11669   if (IfMagickTrue(wand->debug))
11670     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11671   if (wand->images == (Image *) NULL)
11672     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11673   return(TransformImageColorspace(wand->images,colorspace,wand->exception));
11674 }
11675 \f
11676 /*
11677 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11678 %                                                                             %
11679 %                                                                             %
11680 %                                                                             %
11681 %   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                     %
11682 %                                                                             %
11683 %                                                                             %
11684 %                                                                             %
11685 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11686 %
11687 %  MagickTransparentPaintImage() changes any pixel that matches color with the
11688 %  color defined by fill.
11689 %
11690 %  The format of the MagickTransparentPaintImage method is:
11691 %
11692 %      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11693 %        const PixelWand *target,const double alpha,const double fuzz,
11694 %        const MagickBooleanType invert)
11695 %
11696 %  A description of each parameter follows:
11697 %
11698 %    o wand: the magick wand.
11699 %
11700 %    o target: Change this target color to specified alpha value within
11701 %      the image.
11702 %
11703 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11704 %      transparent.
11705 %
11706 %    o fuzz: By default target must match a particular pixel color
11707 %      exactly.  However, in many cases two colors may differ by a small amount.
11708 %      The fuzz member of image defines how much tolerance is acceptable to
11709 %      consider two colors as the same.  For example, set fuzz to 10 and the
11710 %      color red at intensities of 100 and 102 respectively are now interpreted
11711 %      as the same color for the purposes of the floodfill.
11712 %
11713 %    o invert: paint any pixel that does not match the target color.
11714 %
11715 */
11716 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11717   const PixelWand *target,const double alpha,const double fuzz,
11718   const MagickBooleanType invert)
11719 {
11720   MagickBooleanType
11721     status;
11722
11723   PixelInfo
11724     target_pixel;
11725
11726   assert(wand != (MagickWand *) NULL);
11727   assert(wand->signature == WandSignature);
11728   if (IfMagickTrue(wand->debug))
11729     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11730   if (wand->images == (Image *) NULL)
11731     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11732   PixelGetMagickColor(target,&target_pixel);
11733   wand->images->fuzz=fuzz;
11734   status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11735     QuantumRange*alpha),invert,wand->exception);
11736   return(status);
11737 }
11738 \f
11739 /*
11740 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11741 %                                                                             %
11742 %                                                                             %
11743 %                                                                             %
11744 %   M a g i c k T r a n s p o s e I m a g e                                   %
11745 %                                                                             %
11746 %                                                                             %
11747 %                                                                             %
11748 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11749 %
11750 %  MagickTransposeImage() creates a vertical mirror image by reflecting the
11751 %  pixels around the central x-axis while rotating them 90-degrees.
11752 %
11753 %  The format of the MagickTransposeImage method is:
11754 %
11755 %      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11756 %
11757 %  A description of each parameter follows:
11758 %
11759 %    o wand: the magick wand.
11760 %
11761 */
11762 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11763 {
11764   Image
11765     *transpose_image;
11766
11767   assert(wand != (MagickWand *) NULL);
11768   assert(wand->signature == WandSignature);
11769   if (IfMagickTrue(wand->debug))
11770     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11771   if (wand->images == (Image *) NULL)
11772     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11773   transpose_image=TransposeImage(wand->images,wand->exception);
11774   if (transpose_image == (Image *) NULL)
11775     return(MagickFalse);
11776   ReplaceImageInList(&wand->images,transpose_image);
11777   return(MagickTrue);
11778 }
11779 \f
11780 /*
11781 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11782 %                                                                             %
11783 %                                                                             %
11784 %                                                                             %
11785 %   M a g i c k T r a n s v e r s e I m a g e                                 %
11786 %                                                                             %
11787 %                                                                             %
11788 %                                                                             %
11789 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11790 %
11791 %  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11792 %  pixels around the central y-axis while rotating them 270-degrees.
11793 %
11794 %  The format of the MagickTransverseImage method is:
11795 %
11796 %      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11797 %
11798 %  A description of each parameter follows:
11799 %
11800 %    o wand: the magick wand.
11801 %
11802 */
11803 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11804 {
11805   Image
11806     *transverse_image;
11807
11808   assert(wand != (MagickWand *) NULL);
11809   assert(wand->signature == WandSignature);
11810   if (IfMagickTrue(wand->debug))
11811     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11812   if (wand->images == (Image *) NULL)
11813     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11814   transverse_image=TransverseImage(wand->images,wand->exception);
11815   if (transverse_image == (Image *) NULL)
11816     return(MagickFalse);
11817   ReplaceImageInList(&wand->images,transverse_image);
11818   return(MagickTrue);
11819 }
11820 \f
11821 /*
11822 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11823 %                                                                             %
11824 %                                                                             %
11825 %                                                                             %
11826 %   M a g i c k T r i m I m a g e                                             %
11827 %                                                                             %
11828 %                                                                             %
11829 %                                                                             %
11830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11831 %
11832 %  MagickTrimImage() remove edges that are the background color from the image.
11833 %
11834 %  The format of the MagickTrimImage method is:
11835 %
11836 %      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11837 %
11838 %  A description of each parameter follows:
11839 %
11840 %    o wand: the magick wand.
11841 %
11842 %    o fuzz: By default target must match a particular pixel color
11843 %      exactly.  However, in many cases two colors may differ by a small amount.
11844 %      The fuzz member of image defines how much tolerance is acceptable to
11845 %      consider two colors as the same.  For example, set fuzz to 10 and the
11846 %      color red at intensities of 100 and 102 respectively are now interpreted
11847 %      as the same color for the purposes of the floodfill.
11848 %
11849 */
11850 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11851 {
11852   Image
11853     *trim_image;
11854
11855   assert(wand != (MagickWand *) NULL);
11856   assert(wand->signature == WandSignature);
11857   if (IfMagickTrue(wand->debug))
11858     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11859   if (wand->images == (Image *) NULL)
11860     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11861   wand->images->fuzz=fuzz;
11862   trim_image=TrimImage(wand->images,wand->exception);
11863   if (trim_image == (Image *) NULL)
11864     return(MagickFalse);
11865   ReplaceImageInList(&wand->images,trim_image);
11866   return(MagickTrue);
11867 }
11868 \f
11869 /*
11870 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11871 %                                                                             %
11872 %                                                                             %
11873 %                                                                             %
11874 %   M a g i c k U n i q u e I m a g e C o l o r s                             %
11875 %                                                                             %
11876 %                                                                             %
11877 %                                                                             %
11878 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11879 %
11880 %  MagickUniqueImageColors() discards all but one of any pixel color.
11881 %
11882 %  The format of the MagickUniqueImageColors method is:
11883 %
11884 %      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11885 %
11886 %  A description of each parameter follows:
11887 %
11888 %    o wand: the magick wand.
11889 %
11890 */
11891 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11892 {
11893   Image
11894     *unique_image;
11895
11896   assert(wand != (MagickWand *) NULL);
11897   assert(wand->signature == WandSignature);
11898   if (IfMagickTrue(wand->debug))
11899     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11900   if (wand->images == (Image *) NULL)
11901     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11902   unique_image=UniqueImageColors(wand->images,wand->exception);
11903   if (unique_image == (Image *) NULL)
11904     return(MagickFalse);
11905   ReplaceImageInList(&wand->images,unique_image);
11906   return(MagickTrue);
11907 }
11908 \f
11909 /*
11910 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11911 %                                                                             %
11912 %                                                                             %
11913 %                                                                             %
11914 %   M a g i c k U n s h a r p M a s k I m a g e                               %
11915 %                                                                             %
11916 %                                                                             %
11917 %                                                                             %
11918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11919 %
11920 %  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
11921 %  Gaussian operator of the given radius and standard deviation (sigma).
11922 %  For reasonable results, radius should be larger than sigma.  Use a radius
11923 %  of 0 and UnsharpMaskImage() selects a suitable radius for you.
11924 %
11925 %  The format of the MagickUnsharpMaskImage method is:
11926 %
11927 %      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11928 %        const double radius,const double sigma,const double gain,
11929 %        const double threshold)
11930 %
11931 %  A description of each parameter follows:
11932 %
11933 %    o wand: the magick wand.
11934 %
11935 %    o radius: the radius of the Gaussian, in pixels, not counting the center
11936 %      pixel.
11937 %
11938 %    o sigma: the standard deviation of the Gaussian, in pixels.
11939 %
11940 %    o gain: the percentage of the difference between the original and the
11941 %      blur image that is added back into the original.
11942 %
11943 %    o threshold: the threshold in pixels needed to apply the diffence gain.
11944 %
11945 */
11946 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11947   const double radius,const double sigma,const double gain,
11948   const double threshold)
11949 {
11950   Image
11951     *unsharp_image;
11952
11953   assert(wand != (MagickWand *) NULL);
11954   assert(wand->signature == WandSignature);
11955   if (IfMagickTrue(wand->debug))
11956     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11957   if (wand->images == (Image *) NULL)
11958     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11959   unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,gain,threshold,
11960     wand->exception);
11961   if (unsharp_image == (Image *) NULL)
11962     return(MagickFalse);
11963   ReplaceImageInList(&wand->images,unsharp_image);
11964   return(MagickTrue);
11965 }
11966 \f
11967 /*
11968 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11969 %                                                                             %
11970 %                                                                             %
11971 %                                                                             %
11972 %   M a g i c k V i g n e t t e I m a g e                                     %
11973 %                                                                             %
11974 %                                                                             %
11975 %                                                                             %
11976 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11977 %
11978 %  MagickVignetteImage() softens the edges of the image in vignette style.
11979 %
11980 %  The format of the MagickVignetteImage method is:
11981 %
11982 %      MagickBooleanType MagickVignetteImage(MagickWand *wand,
11983 %        const double radius,const double sigma,const ssize_t x,
11984 %        const ssize_t y)
11985 %
11986 %  A description of each parameter follows:
11987 %
11988 %    o wand: the magick wand.
11989 %
11990 %    o radius: the radius.
11991 %
11992 %    o sigma: the sigma.
11993 %
11994 %    o x, y:  Define the x and y ellipse offset.
11995 %
11996 */
11997 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
11998   const double radius,const double sigma,const ssize_t x,const ssize_t y)
11999 {
12000   Image
12001     *vignette_image;
12002
12003   assert(wand != (MagickWand *) NULL);
12004   assert(wand->signature == WandSignature);
12005   if (IfMagickTrue(wand->debug))
12006     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12007   if (wand->images == (Image *) NULL)
12008     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12009   vignette_image=VignetteImage(wand->images,radius,sigma,x,y,wand->exception);
12010   if (vignette_image == (Image *) NULL)
12011     return(MagickFalse);
12012   ReplaceImageInList(&wand->images,vignette_image);
12013   return(MagickTrue);
12014 }
12015 \f
12016 /*
12017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12018 %                                                                             %
12019 %                                                                             %
12020 %                                                                             %
12021 %   M a g i c k W a v e I m a g e                                             %
12022 %                                                                             %
12023 %                                                                             %
12024 %                                                                             %
12025 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12026 %
12027 %  MagickWaveImage()  creates a "ripple" effect in the image by shifting
12028 %  the pixels vertically along a sine wave whose amplitude and wavelength
12029 %  is specified by the given parameters.
12030 %
12031 %  The format of the MagickWaveImage method is:
12032 %
12033 %      MagickBooleanType MagickWaveImage(MagickWand *wand,
12034 %        const double amplitude,const double wave_length,
12035 %        const PixelInterpolateMethod method)
12036 %
12037 %  A description of each parameter follows:
12038 %
12039 %    o wand: the magick wand.
12040 %
12041 %    o amplitude, wave_length:  Define the amplitude and wave length of the
12042 %      sine wave.
12043 %
12044 %    o method: the pixel interpolation method.
12045 %
12046 */
12047 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12048   const double amplitude,const double wave_length,
12049   const PixelInterpolateMethod method)
12050 {
12051   Image
12052     *wave_image;
12053
12054   assert(wand != (MagickWand *) NULL);
12055   assert(wand->signature == WandSignature);
12056   if (IfMagickTrue(wand->debug))
12057     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12058   if (wand->images == (Image *) NULL)
12059     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12060   wave_image=WaveImage(wand->images,amplitude,wave_length,method,
12061     wand->exception);
12062   if (wave_image == (Image *) NULL)
12063     return(MagickFalse);
12064   ReplaceImageInList(&wand->images,wave_image);
12065   return(MagickTrue);
12066 }
12067 \f
12068 /*
12069 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12070 %                                                                             %
12071 %                                                                             %
12072 %                                                                             %
12073 %   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                         %
12074 %                                                                             %
12075 %                                                                             %
12076 %                                                                             %
12077 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12078 %
12079 %  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
12080 %  above the threshold into white while leaving all pixels below the threshold
12081 %  unchanged.
12082 %
12083 %  The format of the MagickWhiteThresholdImage method is:
12084 %
12085 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12086 %        const PixelWand *threshold)
12087 %
12088 %  A description of each parameter follows:
12089 %
12090 %    o wand: the magick wand.
12091 %
12092 %    o threshold: the pixel wand.
12093 %
12094 */
12095 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12096   const PixelWand *threshold)
12097 {
12098   char
12099     thresholds[MaxTextExtent];
12100
12101   assert(wand != (MagickWand *) NULL);
12102   assert(wand->signature == WandSignature);
12103   if (IfMagickTrue(wand->debug))
12104     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12105   if (wand->images == (Image *) NULL)
12106     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12107   (void) FormatLocaleString(thresholds,MaxTextExtent,
12108     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12109     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12110     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
12111   return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
12112 }
12113 \f
12114 /*
12115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12116 %                                                                             %
12117 %                                                                             %
12118 %                                                                             %
12119 %   M a g i c k W r i t e I m a g e                                           %
12120 %                                                                             %
12121 %                                                                             %
12122 %                                                                             %
12123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12124 %
12125 %  MagickWriteImage() writes an image to the specified filename.  If the
12126 %  filename parameter is NULL, the image is written to the filename set
12127 %  by MagickReadImage() or MagickSetImageFilename().
12128 %
12129 %  The format of the MagickWriteImage method is:
12130 %
12131 %      MagickBooleanType MagickWriteImage(MagickWand *wand,
12132 %        const char *filename)
12133 %
12134 %  A description of each parameter follows:
12135 %
12136 %    o wand: the magick wand.
12137 %
12138 %    o filename: the image filename.
12139 %
12140 %
12141 */
12142 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12143   const char *filename)
12144 {
12145   Image
12146     *image;
12147
12148   ImageInfo
12149     *write_info;
12150
12151   MagickBooleanType
12152     status;
12153
12154   assert(wand != (MagickWand *) NULL);
12155   assert(wand->signature == WandSignature);
12156   if (IfMagickTrue(wand->debug))
12157     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12158   if (wand->images == (Image *) NULL)
12159     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12160   if (filename != (const char *) NULL)
12161     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
12162   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12163   if (image == (Image *) NULL)
12164     return(MagickFalse);
12165   write_info=CloneImageInfo(wand->image_info);
12166   write_info->adjoin=MagickTrue;
12167   status=WriteImage(write_info,image,wand->exception);
12168   image=DestroyImage(image);
12169   write_info=DestroyImageInfo(write_info);
12170   return(status);
12171 }
12172 \f
12173 /*
12174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12175 %                                                                             %
12176 %                                                                             %
12177 %                                                                             %
12178 %   M a g i c k W r i t e I m a g e F i l e                                   %
12179 %                                                                             %
12180 %                                                                             %
12181 %                                                                             %
12182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12183 %
12184 %  MagickWriteImageFile() writes an image to an open file descriptor.
12185 %
12186 %  The format of the MagickWriteImageFile method is:
12187 %
12188 %      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12189 %
12190 %  A description of each parameter follows:
12191 %
12192 %    o wand: the magick wand.
12193 %
12194 %    o file: the file descriptor.
12195 %
12196 */
12197 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12198 {
12199   Image
12200     *image;
12201
12202   ImageInfo
12203     *write_info;
12204
12205   MagickBooleanType
12206     status;
12207
12208   assert(wand != (MagickWand *) NULL);
12209   assert(wand->signature == WandSignature);
12210   assert(file != (FILE *) NULL);
12211   if (IfMagickTrue(wand->debug))
12212     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12213   if (wand->images == (Image *) NULL)
12214     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12215   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12216   if (image == (Image *) NULL)
12217     return(MagickFalse);
12218   write_info=CloneImageInfo(wand->image_info);
12219   SetImageInfoFile(write_info,file);
12220   write_info->adjoin=MagickTrue;
12221   status=WriteImage(write_info,image,wand->exception);
12222   write_info=DestroyImageInfo(write_info);
12223   image=DestroyImage(image);
12224   return(status);
12225 }
12226 \f
12227 /*
12228 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12229 %                                                                             %
12230 %                                                                             %
12231 %                                                                             %
12232 %   M a g i c k W r i t e I m a g e s                                         %
12233 %                                                                             %
12234 %                                                                             %
12235 %                                                                             %
12236 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12237 %
12238 %  MagickWriteImages() writes an image or image sequence.
12239 %
12240 %  The format of the MagickWriteImages method is:
12241 %
12242 %      MagickBooleanType MagickWriteImages(MagickWand *wand,
12243 %        const char *filename,const MagickBooleanType adjoin)
12244 %
12245 %  A description of each parameter follows:
12246 %
12247 %    o wand: the magick wand.
12248 %
12249 %    o filename: the image filename.
12250 %
12251 %    o adjoin: join images into a single multi-image file.
12252 %
12253 */
12254 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12255   const char *filename,const MagickBooleanType adjoin)
12256 {
12257   ImageInfo
12258     *write_info;
12259
12260   MagickBooleanType
12261     status;
12262
12263   assert(wand != (MagickWand *) NULL);
12264   assert(wand->signature == WandSignature);
12265   if (IfMagickTrue(wand->debug))
12266     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12267   if (wand->images == (Image *) NULL)
12268     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12269   write_info=CloneImageInfo(wand->image_info);
12270   write_info->adjoin=adjoin;
12271   status=WriteImages(write_info,wand->images,filename,wand->exception);
12272   write_info=DestroyImageInfo(write_info);
12273   return(status);
12274 }
12275 \f
12276 /*
12277 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12278 %                                                                             %
12279 %                                                                             %
12280 %                                                                             %
12281 %   M a g i c k W r i t e I m a g e s F i l e                                 %
12282 %                                                                             %
12283 %                                                                             %
12284 %                                                                             %
12285 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12286 %
12287 %  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12288 %
12289 %  The format of the MagickWriteImagesFile method is:
12290 %
12291 %      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12292 %
12293 %  A description of each parameter follows:
12294 %
12295 %    o wand: the magick wand.
12296 %
12297 %    o file: the file descriptor.
12298 %
12299 */
12300 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12301 {
12302   ImageInfo
12303     *write_info;
12304
12305   MagickBooleanType
12306     status;
12307
12308   assert(wand != (MagickWand *) NULL);
12309   assert(wand->signature == WandSignature);
12310   if (IfMagickTrue(wand->debug))
12311     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12312   if (wand->images == (Image *) NULL)
12313     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12314   write_info=CloneImageInfo(wand->image_info);
12315   SetImageInfoFile(write_info,file);
12316   write_info->adjoin=MagickTrue;
12317   status=WriteImages(write_info,wand->images,(const char *) NULL,
12318     wand->exception);
12319   write_info=DestroyImageInfo(write_info);
12320   return(status);
12321 }