]> granicus.if.org Git - imagemagick/blob - MagickWand/magick-image.c
Added type parameter for Read/Write pixelmask to GetImageMask.
[imagemagick] / MagickWand / magick-image.c
1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %                                                                             %
4 %                                                                             %
5 %                                                                             %
6 %                 M   M   AAA    GGGG  IIIII   CCCC  K   K                    %
7 %                 MM MM  A   A  G        I    C      K  K                     %
8 %                 M M M  AAAAA  G GGG    I    C      KKK                      %
9 %                 M   M  A   A  G   G    I    C      K  K                     %
10 %                 M   M  A   A   GGGG  IIIII   CCCC  K   K                    %
11 %                                                                             %
12 %                     IIIII  M   M   AAA    GGGG  EEEEE                       %
13 %                       I    MM MM  A   A  G      E                           %
14 %                       I    M M M  AAAAA  G  GG  EEE                         %
15 %                       I    M   M  A   A  G   G  E                           %
16 %                     IIIII  M   M  A   A   GGGG  EEEEE                       %
17 %                                                                             %
18 %                                                                             %
19 %                          MagickWand Image Methods                           %
20 %                                                                             %
21 %                               Software Design                               %
22 %                                    Cristy                                   %
23 %                                 August 2003                                 %
24 %                                                                             %
25 %                                                                             %
26 %  Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization      %
27 %  dedicated to making software imaging solutions freely available.           %
28 %                                                                             %
29 %  You may not use this file except in compliance with the License.  You may  %
30 %  obtain a copy of the License at                                            %
31 %                                                                             %
32 %    http://www.imagemagick.org/script/license.php                            %
33 %                                                                             %
34 %  Unless required by applicable law or agreed to in writing, software        %
35 %  distributed under the License is distributed on an "AS IS" BASIS,          %
36 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
37 %  See the License for the specific language governing permissions and        %
38 %  limitations under the License.                                             %
39 %                                                                             %
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 %
42 %
43 %
44 */
45 \f
46 /*
47   Include declarations.
48 */
49 #include "MagickWand/studio.h"
50 #include "MagickWand/MagickWand.h"
51 #include "MagickWand/magick-wand-private.h"
52 #include "MagickWand/wand.h"
53 #include "MagickWand/pixel-wand-private.h"
54 #include "MagickCore/image-private.h"
55 \f
56 /*
57   Define declarations.
58 */
59 #define MagickWandId  "MagickWand"
60 \f
61 /*
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 %                                                                             %
64 %                                                                             %
65 %                                                                             %
66 +   C l o n e M a g i c k W a n d F r o m I m a g e s                         %
67 %                                                                             %
68 %                                                                             %
69 %                                                                             %
70 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71 %
72 %  CloneMagickWandFromImages() clones the magick wand and inserts a new image
73 %  list.
74 %
75 %  The format of the CloneMagickWandFromImages method is:
76 %
77 %      MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
78 %        Image *images)
79 %
80 %  A description of each parameter follows:
81 %
82 %    o wand: the magick wand.
83 %
84 %    o images: replace the image list with these image(s).
85 %
86 */
87 static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
88   Image *images)
89 {
90   MagickWand
91     *clone_wand;
92
93   assert(wand != (MagickWand *) NULL);
94   assert(wand->signature == MagickWandSignature);
95   if (wand->debug != MagickFalse)
96     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
97   clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
98   if (clone_wand == (MagickWand *) NULL)
99     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
100       images->filename);
101   (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
102   clone_wand->id=AcquireWandId();
103   (void) FormatLocaleString(clone_wand->name,MagickPathExtent,"%s-%.20g",
104     MagickWandId,(double) clone_wand->id);
105   clone_wand->exception=AcquireExceptionInfo();
106   InheritException(clone_wand->exception,wand->exception);
107   clone_wand->image_info=CloneImageInfo(wand->image_info);
108   clone_wand->images=images;
109   clone_wand->debug=IsEventLogging();
110   clone_wand->signature=MagickWandSignature;
111   if (clone_wand->debug != MagickFalse)
112     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
113   return(clone_wand);
114 }
115 \f
116 /*
117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
118 %                                                                             %
119 %                                                                             %
120 %                                                                             %
121 %   G e t I m a g e F r o m M a g i c k W a n d                               %
122 %                                                                             %
123 %                                                                             %
124 %                                                                             %
125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
126 %
127 %  GetImageFromMagickWand() returns the current image from the magick wand.
128 %
129 %  The format of the GetImageFromMagickWand method is:
130 %
131 %      Image *GetImageFromMagickWand(const MagickWand *wand)
132 %
133 %  A description of each parameter follows:
134 %
135 %    o wand: the magick wand.
136 %
137 */
138 WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
139 {
140   assert(wand != (MagickWand *) NULL);
141   assert(wand->signature == MagickWandSignature);
142   if (wand->debug != MagickFalse)
143     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
144   if (wand->images == (Image *) NULL)
145     {
146       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
147         "ContainsNoImages","`%s'",wand->name);
148       return((Image *) NULL);
149     }
150   return(wand->images);
151 }
152 \f
153 /*
154 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
155 %                                                                             %
156 %                                                                             %
157 %                                                                             %
158 %   M a g i c k A d a p t i v e S h a r p e n I m a g e                       %
159 %                                                                             %
160 %                                                                             %
161 %                                                                             %
162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
163 %
164 %  MagickAdaptiveBlurImage() adaptively blurs the image by blurring
165 %  less intensely near image edges and more intensely far from edges. We
166 %  blur the image with a Gaussian operator of the given radius and standard
167 %  deviation (sigma).  For reasonable results, radius should be larger than
168 %  sigma.  Use a radius of 0 and MagickAdaptiveBlurImage() selects a
169 %  suitable radius for you.
170 %
171 %  The format of the MagickAdaptiveBlurImage method is:
172 %
173 %      MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
174 %        const double radius,const double sigma)
175 %
176 %  A description of each parameter follows:
177 %
178 %    o wand: the magick wand.
179 %
180 %    o radius: the radius of the Gaussian, in pixels, not counting the center
181 %      pixel.
182 %
183 %    o sigma: the standard deviation of the Gaussian, in pixels.
184 %
185 */
186 WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
187   const double radius,const double sigma)
188 {
189   Image
190     *sharp_image;
191
192   assert(wand != (MagickWand *) NULL);
193   assert(wand->signature == MagickWandSignature);
194   if (wand->debug != MagickFalse)
195     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
196   if (wand->images == (Image *) NULL)
197     ThrowWandException(WandError,"ContainsNoImages",wand->name);
198   sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,wand->exception);
199   if (sharp_image == (Image *) NULL)
200     return(MagickFalse);
201   ReplaceImageInList(&wand->images,sharp_image);
202   return(MagickTrue);
203 }
204 \f
205 /*
206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
207 %                                                                             %
208 %                                                                             %
209 %                                                                             %
210 %   M a g i c k A d a p t i v e R e s i z e I m a g e                         %
211 %                                                                             %
212 %                                                                             %
213 %                                                                             %
214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
215 %
216 %  MagickAdaptiveResizeImage() adaptively resize image with data dependent
217 %  triangulation.
218 %
219 %      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
220 %        const size_t columns,const size_t rows)
221 %
222 %  A description of each parameter follows:
223 %
224 %    o wand: the magick wand.
225 %
226 %    o columns: the number of columns in the scaled image.
227 %
228 %    o rows: the number of rows in the scaled image.
229 %
230 */
231 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
232   const size_t columns,const size_t rows)
233 {
234   Image
235     *resize_image;
236
237   assert(wand != (MagickWand *) NULL);
238   assert(wand->signature == MagickWandSignature);
239   if (wand->debug != MagickFalse)
240     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
241   if (wand->images == (Image *) NULL)
242     ThrowWandException(WandError,"ContainsNoImages",wand->name);
243   resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
244   if (resize_image == (Image *) NULL)
245     return(MagickFalse);
246   ReplaceImageInList(&wand->images,resize_image);
247   return(MagickTrue);
248 }
249 \f
250 /*
251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
252 %                                                                             %
253 %                                                                             %
254 %                                                                             %
255 %   M a g i c k A d a p t i v e S h a r p e n I m a g e                       %
256 %                                                                             %
257 %                                                                             %
258 %                                                                             %
259 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
260 %
261 %  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
262 %  more intensely near image edges and less intensely far from edges. We
263 %  sharpen the image with a Gaussian operator of the given radius and standard
264 %  deviation (sigma).  For reasonable results, radius should be larger than
265 %  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
266 %  suitable radius for you.
267 %
268 %  The format of the MagickAdaptiveSharpenImage method is:
269 %
270 %      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
271 %        const double radius,const double sigma)
272 %
273 %  A description of each parameter follows:
274 %
275 %    o wand: the magick wand.
276 %
277 %    o radius: the radius of the Gaussian, in pixels, not counting the center
278 %      pixel.
279 %
280 %    o sigma: the standard deviation of the Gaussian, in pixels.
281 %
282 */
283 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
284   const double radius,const double sigma)
285 {
286   Image
287     *sharp_image;
288
289   assert(wand != (MagickWand *) NULL);
290   assert(wand->signature == MagickWandSignature);
291   if (wand->debug != MagickFalse)
292     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
293   if (wand->images == (Image *) NULL)
294     ThrowWandException(WandError,"ContainsNoImages",wand->name);
295   sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,wand->exception);
296   if (sharp_image == (Image *) NULL)
297     return(MagickFalse);
298   ReplaceImageInList(&wand->images,sharp_image);
299   return(MagickTrue);
300 }
301 \f
302 /*
303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
304 %                                                                             %
305 %                                                                             %
306 %                                                                             %
307 %   M a g i c k A d a p t i v e T h r e s h o l d I m a g e                   %
308 %                                                                             %
309 %                                                                             %
310 %                                                                             %
311 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
312 %
313 %  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
314 %  based on the range of intensity values in its local neighborhood.  This
315 %  allows for thresholding of an image whose global intensity histogram
316 %  doesn't contain distinctive peaks.
317 %
318 %  The format of the AdaptiveThresholdImage method is:
319 %
320 %      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
321 %        const size_t width,const size_t height,const double bias)
322 %
323 %  A description of each parameter follows:
324 %
325 %    o wand: the magick wand.
326 %
327 %    o width: the width of the local neighborhood.
328 %
329 %    o height: the height of the local neighborhood.
330 %
331 %    o offset: the mean bias.
332 %
333 */
334 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
335   const size_t width,const size_t height,const double bias)
336 {
337   Image
338     *threshold_image;
339
340   assert(wand != (MagickWand *) NULL);
341   assert(wand->signature == MagickWandSignature);
342   if (wand->debug != MagickFalse)
343     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
344   if (wand->images == (Image *) NULL)
345     ThrowWandException(WandError,"ContainsNoImages",wand->name);
346   threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
347     wand->exception);
348   if (threshold_image == (Image *) NULL)
349     return(MagickFalse);
350   ReplaceImageInList(&wand->images,threshold_image);
351   return(MagickTrue);
352 }
353 \f
354 /*
355 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
356 %                                                                             %
357 %                                                                             %
358 %                                                                             %
359 %   M a g i c k A d d I m a g e                                               %
360 %                                                                             %
361 %                                                                             %
362 %                                                                             %
363 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
364 %
365 %  MagickAddImage() adds a clone of the images from the second wand and
366 %  inserts them into the first wand.
367 %
368 %  Use MagickSetLastIterator(), to append new images into an existing wand,
369 %  current image will be set to last image so later adds with also be
370 %  appened to end of wand.
371 %
372 %  Use MagickSetFirstIterator() to prepend new images into wand, any more
373 %  images added will also be prepended before other images in the wand.
374 %  However the order of a list of new images will not change.
375 %
376 %  Otherwise the new images will be inserted just after the current image,
377 %  and any later image will also be added after this current image but
378 %  before the previously added images.  Caution is advised when multiple
379 %  image adds are inserted into the middle of the wand image list.
380 %
381 %  The format of the MagickAddImage method is:
382 %
383 %      MagickBooleanType MagickAddImage(MagickWand *wand,
384 %        const MagickWand *add_wand)
385 %
386 %  A description of each parameter follows:
387 %
388 %    o wand: the magick wand.
389 %
390 %    o add_wand: A wand that contains the image list to be added
391 %
392 */
393 static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
394   Image *images)
395 {
396   if (wand->images == (Image *) NULL)
397     {
398       /*
399         No images in wand, just add them, set current as appropriate.
400       */
401       if (wand->insert_before != MagickFalse)
402         wand->images=GetFirstImageInList(images);
403       else
404         wand->images=GetLastImageInList(images);
405       return(MagickTrue);
406     }
407   /* user jumped to first image, so prepend new images - remain active */
408   if ((wand->insert_before != MagickFalse) &&
409        (wand->images->previous == (Image *) NULL))
410     {
411       PrependImageToList(&wand->images,images);
412       wand->images=GetFirstImageInList(images);
413       return(MagickTrue);
414     }
415   /*
416     Note you should never have 'insert_before' true when current image is not
417     the first image in the wand!  That is no insert before current image, only
418     after current image
419   */
420   if (wand->images->next == (Image *) NULL)
421     {
422       /*
423         At last image, append new images.
424       */
425       InsertImageInList(&wand->images,images);
426       wand->images=GetLastImageInList(images);
427       return(MagickTrue);
428     }
429   /*
430     Insert new images, just after the current image.
431   */
432   InsertImageInList(&wand->images,images);
433   return(MagickTrue);
434 }
435
436 WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
437   const MagickWand *add_wand)
438 {
439   Image
440     *images;
441
442   assert(wand != (MagickWand *) NULL);
443   assert(wand->signature == MagickWandSignature);
444   if (wand->debug != MagickFalse)
445     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
446   assert(add_wand != (MagickWand *) NULL);
447   assert(add_wand->signature == MagickWandSignature);
448   if (add_wand->images == (Image *) NULL)
449     ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
450   /*
451     Clone images in second wand, and insert into first.
452   */
453   images=CloneImageList(add_wand->images,wand->exception);
454   if (images == (Image *) NULL)
455     return(MagickFalse);
456   return(InsertImageInWand(wand,images));
457 }
458 \f
459 /*
460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
461 %                                                                             %
462 %                                                                             %
463 %                                                                             %
464 %     M a g i c k A d d N o i s e I m a g e                                   %
465 %                                                                             %
466 %                                                                             %
467 %                                                                             %
468 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
469 %
470 %  MagickAddNoiseImage() adds random noise to the image.
471 %
472 %  The format of the MagickAddNoiseImage method is:
473 %
474 %      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
475 %        const NoiseType noise_type,const double attenuate)
476 %
477 %  A description of each parameter follows:
478 %
479 %    o wand: the magick wand.
480 %
481 %    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
482 %      Impulse, Laplacian, or Poisson.
483 %
484 %    o attenuate:  attenuate the random distribution.
485 %
486 */
487 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
488   const NoiseType noise_type,const double attenuate)
489 {
490   Image
491     *noise_image;
492
493   assert(wand != (MagickWand *) NULL);
494   assert(wand->signature == MagickWandSignature);
495   if (wand->debug != MagickFalse)
496     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
497   if (wand->images == (Image *) NULL)
498     ThrowWandException(WandError,"ContainsNoImages",wand->name);
499   noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
500   if (noise_image == (Image *) NULL)
501     return(MagickFalse);
502   ReplaceImageInList(&wand->images,noise_image);
503   return(MagickTrue);
504 }
505 \f
506 /*
507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
508 %                                                                             %
509 %                                                                             %
510 %                                                                             %
511 %   M a g i c k A f f i n e T r a n s f o r m I m a g e                       %
512 %                                                                             %
513 %                                                                             %
514 %                                                                             %
515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
516 %
517 %  MagickAffineTransformImage() transforms an image as dictated by the affine
518 %  matrix of the drawing wand.
519 %
520 %  The format of the MagickAffineTransformImage method is:
521 %
522 %      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
523 %        const DrawingWand *drawing_wand)
524 %
525 %  A description of each parameter follows:
526 %
527 %    o wand: the magick wand.
528 %
529 %    o drawing_wand: the draw wand.
530 %
531 */
532 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
533   const DrawingWand *drawing_wand)
534 {
535   DrawInfo
536     *draw_info;
537
538   Image
539     *affine_image;
540
541   assert(wand != (MagickWand *) NULL);
542   assert(wand->signature == MagickWandSignature);
543   if (wand->debug != MagickFalse)
544     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
545   if (wand->images == (Image *) NULL)
546     ThrowWandException(WandError,"ContainsNoImages",wand->name);
547   draw_info=PeekDrawingWand(drawing_wand);
548   if (draw_info == (DrawInfo *) NULL)
549     return(MagickFalse);
550   affine_image=AffineTransformImage(wand->images,&draw_info->affine,
551     wand->exception);
552   draw_info=DestroyDrawInfo(draw_info);
553   if (affine_image == (Image *) NULL)
554     return(MagickFalse);
555   ReplaceImageInList(&wand->images,affine_image);
556   return(MagickTrue);
557 }
558 \f
559 /*
560 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
561 %                                                                             %
562 %                                                                             %
563 %                                                                             %
564 %   M a g i c k A n n o t a t e I m a g e                                     %
565 %                                                                             %
566 %                                                                             %
567 %                                                                             %
568 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
569 %
570 %  MagickAnnotateImage() annotates an image with text.
571 %
572 %  The format of the MagickAnnotateImage method is:
573 %
574 %      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
575 %        const DrawingWand *drawing_wand,const double x,const double y,
576 %        const double angle,const char *text)
577 %
578 %  A description of each parameter follows:
579 %
580 %    o wand: the magick wand.
581 %
582 %    o drawing_wand: the draw wand.
583 %
584 %    o x: x ordinate to left of text
585 %
586 %    o y: y ordinate to text baseline
587 %
588 %    o angle: rotate text relative to this angle.
589 %
590 %    o text: text to draw
591 %
592 */
593 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
594   const DrawingWand *drawing_wand,const double x,const double y,
595   const double angle,const char *text)
596 {
597   char
598     geometry[MagickPathExtent];
599
600   DrawInfo
601     *draw_info;
602
603   MagickBooleanType
604     status;
605
606   assert(wand != (MagickWand *) NULL);
607   assert(wand->signature == MagickWandSignature);
608   if (wand->debug != MagickFalse)
609     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
610   if (wand->images == (Image *) NULL)
611     ThrowWandException(WandError,"ContainsNoImages",wand->name);
612   draw_info=PeekDrawingWand(drawing_wand);
613   if (draw_info == (DrawInfo *) NULL)
614     return(MagickFalse);
615   (void) CloneString(&draw_info->text,text);
616   (void) FormatLocaleString(geometry,MagickPathExtent,"%+g%+g",x,y);
617   draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0)));
618   draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0)));
619   draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0))));
620   draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0)));
621   (void) CloneString(&draw_info->geometry,geometry);
622   status=AnnotateImage(wand->images,draw_info,wand->exception);
623   draw_info=DestroyDrawInfo(draw_info);
624   return(status);
625 }
626 \f
627 /*
628 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
629 %                                                                             %
630 %                                                                             %
631 %                                                                             %
632 %   M a g i c k A n i m a t e I m a g e s                                     %
633 %                                                                             %
634 %                                                                             %
635 %                                                                             %
636 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
637 %
638 %  MagickAnimateImages() animates an image or image sequence.
639 %
640 %  The format of the MagickAnimateImages method is:
641 %
642 %      MagickBooleanType MagickAnimateImages(MagickWand *wand,
643 %        const char *server_name)
644 %
645 %  A description of each parameter follows:
646 %
647 %    o wand: the magick wand.
648 %
649 %    o server_name: the X server name.
650 %
651 */
652 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
653   const char *server_name)
654 {
655   MagickBooleanType
656     status;
657
658   assert(wand != (MagickWand *) NULL);
659   assert(wand->signature == MagickWandSignature);
660   if (wand->debug != MagickFalse)
661     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
662   (void) CloneString(&wand->image_info->server_name,server_name);
663   status=AnimateImages(wand->image_info,wand->images,wand->exception);
664   return(status);
665 }
666 \f
667 /*
668 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
669 %                                                                             %
670 %                                                                             %
671 %                                                                             %
672 %   M a g i c k A p p e n d I m a g e s                                       %
673 %                                                                             %
674 %                                                                             %
675 %                                                                             %
676 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
677 %
678 %  MagickAppendImages() append the images in a wand from the current image
679 %  onwards, creating a new wand with the single image result.  This is
680 %  affected by the gravity and background settings of the first image.
681 %
682 %  Typically you would call either MagickResetIterator() or
683 %  MagickSetFirstImage() before calling this function to ensure that all
684 %  the images in the wand's image list will be appended together.
685 %
686 %  The format of the MagickAppendImages method is:
687 %
688 %      MagickWand *MagickAppendImages(MagickWand *wand,
689 %        const MagickBooleanType stack)
690 %
691 %  A description of each parameter follows:
692 %
693 %    o wand: the magick wand.
694 %
695 %    o stack: By default, images are stacked left-to-right. Set stack to
696 %      MagickTrue to stack them top-to-bottom.
697 %
698 */
699 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
700   const MagickBooleanType stack)
701 {
702   Image
703     *append_image;
704
705   assert(wand != (MagickWand *) NULL);
706   assert(wand->signature == MagickWandSignature);
707   if (wand->debug != MagickFalse)
708     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
709   if (wand->images == (Image *) NULL)
710     return((MagickWand *) NULL);
711   append_image=AppendImages(wand->images,stack,wand->exception);
712   if (append_image == (Image *) NULL)
713     return((MagickWand *) NULL);
714   return(CloneMagickWandFromImages(wand,append_image));
715 }
716 \f
717 /*
718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
719 %                                                                             %
720 %                                                                             %
721 %                                                                             %
722 %   M a g i c k A u t o G a m m a I m a g e                                   %
723 %                                                                             %
724 %                                                                             %
725 %                                                                             %
726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
727 %
728 %  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
729 %  image to try make set its gamma appropriatally.
730 %
731 %  The format of the MagickAutoGammaImage method is:
732 %
733 %      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
734 %
735 %  A description of each parameter follows:
736 %
737 %    o wand: the magick wand.
738 %
739 */
740 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
741 {
742   MagickBooleanType
743     status;
744
745   assert(wand != (MagickWand *) NULL);
746   assert(wand->signature == MagickWandSignature);
747   if (wand->debug != MagickFalse)
748     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
749   if (wand->images == (Image *) NULL)
750     ThrowWandException(WandError,"ContainsNoImages",wand->name);
751   status=AutoGammaImage(wand->images,wand->exception);
752   return(status);
753 }
754 \f
755 /*
756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
757 %                                                                             %
758 %                                                                             %
759 %                                                                             %
760 %   M a g i c k A u t o L e v e l I m a g e                                   %
761 %                                                                             %
762 %                                                                             %
763 %                                                                             %
764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
765 %
766 %  MagickAutoLevelImage() adjusts the levels of a particular image channel by
767 %  scaling the minimum and maximum values to the full quantum range.
768 %
769 %  The format of the MagickAutoLevelImage method is:
770 %
771 %      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
772 %
773 %  A description of each parameter follows:
774 %
775 %    o wand: the magick wand.
776 %
777 */
778 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
779 {
780   MagickBooleanType
781     status;
782
783   assert(wand != (MagickWand *) NULL);
784   assert(wand->signature == MagickWandSignature);
785   if (wand->debug != MagickFalse)
786     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
787   if (wand->images == (Image *) NULL)
788     ThrowWandException(WandError,"ContainsNoImages",wand->name);
789   status=AutoLevelImage(wand->images,wand->exception);
790   return(status);
791 }
792
793 /*
794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
795 %                                                                             %
796 %                                                                             %
797 %                                                                             %
798 %   M a g i c k A u t o O r i e n t I m a g e                                 %
799 %                                                                             %
800 %                                                                             %
801 %                                                                             %
802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
803 %
804 %  MagickAutoOrientImage() adjusts an image so that its orientation is suitable
805 $  for viewing (i.e. top-left orientation).
806 %
807 %  The format of the MagickAutoOrientImage method is:
808 %
809 %      MagickBooleanType MagickAutoOrientImage(MagickWand *image)
810 %
811 %  A description of each parameter follows:
812 %
813 %    o wand: the magick wand.
814 %
815 */
816 WandExport MagickBooleanType MagickAutoOrientImage(MagickWand *wand)
817 {
818
819   Image
820     *orient_image;
821
822   assert(wand != (MagickWand *) NULL);
823   assert(wand->signature == MagickWandSignature);
824   if (wand->debug != MagickFalse)
825     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
826   if (wand->images == (Image *) NULL)
827     ThrowWandException(WandError,"ContainsNoImages",wand->name);
828   orient_image=AutoOrientImage(wand->images,wand->images->orientation,
829     wand->exception);
830   if (orient_image == (Image *) NULL)
831     return(MagickFalse);
832   ReplaceImageInList(&wand->images,orient_image);
833   return(MagickTrue);
834 }
835 \f
836 /*
837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
838 %                                                                             %
839 %                                                                             %
840 %                                                                             %
841 %   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                         %
842 %                                                                             %
843 %                                                                             %
844 %                                                                             %
845 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
846 %
847 %  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
848 %  pixels below the threshold into black while leaving all pixels above the
849 %  threshold unchanged.
850 %
851 %  The format of the MagickBlackThresholdImage method is:
852 %
853 %      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
854 %        const PixelWand *threshold)
855 %
856 %  A description of each parameter follows:
857 %
858 %    o wand: the magick wand.
859 %
860 %    o threshold: the pixel wand.
861 %
862 */
863 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
864   const PixelWand *threshold)
865 {
866   char
867     thresholds[MagickPathExtent];
868
869   MagickBooleanType
870     status;
871
872   assert(wand != (MagickWand *) NULL);
873   assert(wand->signature == MagickWandSignature);
874   if (wand->debug != MagickFalse)
875     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
876   if (wand->images == (Image *) NULL)
877     ThrowWandException(WandError,"ContainsNoImages",wand->name);
878   (void) FormatLocaleString(thresholds,MagickPathExtent,
879     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
880     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
881     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
882   status=BlackThresholdImage(wand->images,thresholds,wand->exception);
883   return(status);
884 }
885 \f
886 /*
887 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
888 %                                                                             %
889 %                                                                             %
890 %                                                                             %
891 %   M a g i c k B l u e S h i f t I m a g e                                   %
892 %                                                                             %
893 %                                                                             %
894 %                                                                             %
895 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
896 %
897 %  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
898 %  nighttime in the moonlight.
899 %
900 %  The format of the MagickBlueShiftImage method is:
901 %
902 %      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
903 %        const double factor)
904 %
905 %  A description of each parameter follows:
906 %
907 %    o wand: the magick wand.
908 %
909 %    o factor: the blue shift factor (default 1.5)
910 %
911 */
912 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
913   const double factor)
914 {
915   Image
916     *shift_image;
917
918   assert(wand != (MagickWand *) NULL);
919   assert(wand->signature == MagickWandSignature);
920   if (wand->debug != MagickFalse)
921     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
922   if (wand->images == (Image *) NULL)
923     ThrowWandException(WandError,"ContainsNoImages",wand->name);
924   shift_image=BlueShiftImage(wand->images,factor,wand->exception);
925   if (shift_image == (Image *) NULL)
926     return(MagickFalse);
927   ReplaceImageInList(&wand->images,shift_image);
928   return(MagickTrue);
929 }
930 \f
931 /*
932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
933 %                                                                             %
934 %                                                                             %
935 %                                                                             %
936 %   M a g i c k B l u r I m a g e                                             %
937 %                                                                             %
938 %                                                                             %
939 %                                                                             %
940 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
941 %
942 %  MagickBlurImage() blurs an image.  We convolve the image with a
943 %  gaussian operator of the given radius and standard deviation (sigma).
944 %  For reasonable results, the radius should be larger than sigma.  Use a
945 %  radius of 0 and BlurImage() selects a suitable radius for you.
946 %
947 %  The format of the MagickBlurImage method is:
948 %
949 %      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
950 %        const double sigma)
951 %
952 %  A description of each parameter follows:
953 %
954 %    o wand: the magick wand.
955 %
956 %    o radius: the radius of the , in pixels, not counting the center
957 %      pixel.
958 %
959 %    o sigma: the standard deviation of the , in pixels.
960 %
961 */
962 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
963   const double radius,const double sigma)
964 {
965   Image
966     *blur_image;
967
968   assert(wand != (MagickWand *) NULL);
969   assert(wand->signature == MagickWandSignature);
970   if (wand->debug != MagickFalse)
971     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
972   if (wand->images == (Image *) NULL)
973     ThrowWandException(WandError,"ContainsNoImages",wand->name);
974   blur_image=BlurImage(wand->images,radius,sigma,wand->exception);
975   if (blur_image == (Image *) NULL)
976     return(MagickFalse);
977   ReplaceImageInList(&wand->images,blur_image);
978   return(MagickTrue);
979 }
980 \f
981 /*
982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
983 %                                                                             %
984 %                                                                             %
985 %                                                                             %
986 %   M a g i c k B o r d e r I m a g e                                         %
987 %                                                                             %
988 %                                                                             %
989 %                                                                             %
990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
991 %
992 %  MagickBorderImage() surrounds the image with a border of the color defined
993 %  by the bordercolor pixel wand.
994 %
995 %  The format of the MagickBorderImage method is:
996 %
997 %      MagickBooleanType MagickBorderImage(MagickWand *wand,
998 %        const PixelWand *bordercolor,const size_t width,
999 %        const size_t height,const CompositeOperator compose)
1000 %
1001 %  A description of each parameter follows:
1002 %
1003 %    o wand: the magick wand.
1004 %
1005 %    o bordercolor: the border color pixel wand.
1006 %
1007 %    o width: the border width.
1008 %
1009 %    o height: the border height.
1010 %
1011 %    o compose: the composite operator.
1012 %
1013 */
1014 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
1015   const PixelWand *bordercolor,const size_t width,const size_t height,
1016   const CompositeOperator compose)
1017 {
1018   Image
1019     *border_image;
1020
1021   RectangleInfo
1022     border_info;
1023
1024   assert(wand != (MagickWand *) NULL);
1025   assert(wand->signature == MagickWandSignature);
1026   if (wand->debug != MagickFalse)
1027     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1028   if (wand->images == (Image *) NULL)
1029     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1030   border_info.width=width;
1031   border_info.height=height;
1032   border_info.x=0;
1033   border_info.y=0;
1034   PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
1035   border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
1036   if (border_image == (Image *) NULL)
1037     return(MagickFalse);
1038   ReplaceImageInList(&wand->images,border_image);
1039   return(MagickTrue);
1040 }
1041 \f
1042 /*
1043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1044 %                                                                             %
1045 %                                                                             %
1046 %                                                                             %
1047 %   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   %
1048 %                                                                             %
1049 %                                                                             %
1050 %                                                                             %
1051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1052 %
1053 %  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1054 %  of an image.  It converts the brightness and contrast parameters into slope
1055 %  and intercept and calls a polynomical function to apply to the image.
1056
1057 %
1058 %  The format of the MagickBrightnessContrastImage method is:
1059 %
1060 %      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1061 %        const double brightness,const double contrast)
1062 %
1063 %  A description of each parameter follows:
1064 %
1065 %    o wand: the magick wand.
1066 %
1067 %    o brightness: the brightness percent (-100 .. 100).
1068 %
1069 %    o contrast: the contrast percent (-100 .. 100).
1070 %
1071 */
1072 WandExport MagickBooleanType MagickBrightnessContrastImage(
1073   MagickWand *wand,const double brightness,const double contrast)
1074 {
1075   MagickBooleanType
1076     status;
1077
1078   assert(wand != (MagickWand *) NULL);
1079   assert(wand->signature == MagickWandSignature);
1080   if (wand->debug != MagickFalse)
1081     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1082   if (wand->images == (Image *) NULL)
1083     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1084   status=BrightnessContrastImage(wand->images,brightness,contrast,
1085     wand->exception);
1086   return(status);
1087 }
1088 \f
1089 /*
1090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1091 %                                                                             %
1092 %                                                                             %
1093 %                                                                             %
1094 %   M a g i c k C h a n n e l F x I m a g e                                   %
1095 %                                                                             %
1096 %                                                                             %
1097 %                                                                             %
1098 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1099 %
1100 %  MagickChannelFxImage() applies a channel expression to the specified image.
1101 %  The expression consists of one or more channels, either mnemonic or numeric
1102 %  (e.g. red, 1), separated by actions as follows:
1103 %
1104 %    <=>     exchange two channels (e.g. red<=>blue)
1105 %    =>      transfer a channel to another (e.g. red=>green)
1106 %    ,       separate channel operations (e.g. red, green)
1107 %    |       read channels from next input image (e.g. red | green)
1108 %    ;       write channels to next output image (e.g. red; green; blue)
1109 %
1110 %  A channel without a operation symbol implies extract. For example, to create
1111 %  3 grayscale images from the red, green, and blue channels of an image, use:
1112 %
1113 %    -channel-fx "red; green; blue"
1114 %
1115 %  The format of the MagickChannelFxImage method is:
1116 %
1117 %      MagickWand *MagickChannelFxImage(MagickWand *wand,const char *expression)
1118 %
1119 %  A description of each parameter follows:
1120 %
1121 %    o wand: the magick wand.
1122 %
1123 %    o expression: the expression.
1124 %
1125 */
1126 WandExport MagickWand *MagickChannelFxImage(MagickWand *wand,
1127   const char *expression)
1128 {
1129   Image
1130     *fx_image;
1131
1132   assert(wand != (MagickWand *) NULL);
1133   assert(wand->signature == MagickWandSignature);
1134   if (wand->debug != MagickFalse)
1135     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1136   if (wand->images == (Image *) NULL)
1137     return((MagickWand *) NULL);
1138   fx_image=ChannelFxImage(wand->images,expression,wand->exception);
1139   if (fx_image == (Image *) NULL)
1140     return((MagickWand *) NULL);
1141   return(CloneMagickWandFromImages(wand,fx_image));
1142 }
1143 \f
1144 /*
1145 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1146 %                                                                             %
1147 %                                                                             %
1148 %                                                                             %
1149 %   M a g i c k C h a r c o a l I m a g e                                     %
1150 %                                                                             %
1151 %                                                                             %
1152 %                                                                             %
1153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1154 %
1155 %  MagickCharcoalImage() simulates a charcoal drawing.
1156 %
1157 %  The format of the MagickCharcoalImage method is:
1158 %
1159 %      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1160 %        const double radius,const double sigma)
1161 %
1162 %  A description of each parameter follows:
1163 %
1164 %    o wand: the magick wand.
1165 %
1166 %    o radius: the radius of the Gaussian, in pixels, not counting the center
1167 %      pixel.
1168 %
1169 %    o sigma: the standard deviation of the Gaussian, in pixels.
1170 %
1171 */
1172 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1173   const double radius,const double sigma)
1174 {
1175   Image
1176     *charcoal_image;
1177
1178   assert(wand != (MagickWand *) NULL);
1179   assert(wand->signature == MagickWandSignature);
1180   if (wand->debug != MagickFalse)
1181     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1182   if (wand->images == (Image *) NULL)
1183     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1184   charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1185   if (charcoal_image == (Image *) NULL)
1186     return(MagickFalse);
1187   ReplaceImageInList(&wand->images,charcoal_image);
1188   return(MagickTrue);
1189 }
1190 \f
1191 /*
1192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1193 %                                                                             %
1194 %                                                                             %
1195 %                                                                             %
1196 %   M a g i c k C h o p I m a g e                                             %
1197 %                                                                             %
1198 %                                                                             %
1199 %                                                                             %
1200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1201 %
1202 %  MagickChopImage() removes a region of an image and collapses the image to
1203 %  occupy the removed portion
1204 %
1205 %  The format of the MagickChopImage method is:
1206 %
1207 %      MagickBooleanType MagickChopImage(MagickWand *wand,
1208 %        const size_t width,const size_t height,const ssize_t x,
1209 %        const ssize_t y)
1210 %
1211 %  A description of each parameter follows:
1212 %
1213 %    o wand: the magick wand.
1214 %
1215 %    o width: the region width.
1216 %
1217 %    o height: the region height.
1218 %
1219 %    o x: the region x offset.
1220 %
1221 %    o y: the region y offset.
1222 %
1223 %
1224 */
1225 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1226   const size_t width,const size_t height,const ssize_t x,
1227   const ssize_t y)
1228 {
1229   Image
1230     *chop_image;
1231
1232   RectangleInfo
1233     chop;
1234
1235   assert(wand != (MagickWand *) NULL);
1236   assert(wand->signature == MagickWandSignature);
1237   if (wand->debug != MagickFalse)
1238     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1239   if (wand->images == (Image *) NULL)
1240     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1241   chop.width=width;
1242   chop.height=height;
1243   chop.x=x;
1244   chop.y=y;
1245   chop_image=ChopImage(wand->images,&chop,wand->exception);
1246   if (chop_image == (Image *) NULL)
1247     return(MagickFalse);
1248   ReplaceImageInList(&wand->images,chop_image);
1249   return(MagickTrue);
1250 }
1251 \f
1252 /*
1253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1254 %                                                                             %
1255 %                                                                             %
1256 %                                                                             %
1257 %   M a g i c k C l a m p I m a g e                                           %
1258 %                                                                             %
1259 %                                                                             %
1260 %                                                                             %
1261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1262 %
1263 %  MagickClampImage() restricts the color range from 0 to the quantum depth.
1264 %
1265 %  The format of the MagickClampImage method is:
1266 %
1267 %      MagickBooleanType MagickClampImage(MagickWand *wand)
1268 %
1269 %  A description of each parameter follows:
1270 %
1271 %    o wand: the magick wand.
1272 %
1273 %    o channel: the channel.
1274 %
1275 */
1276 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1277 {
1278   assert(wand != (MagickWand *) NULL);
1279   assert(wand->signature == MagickWandSignature);
1280   if (wand->debug != MagickFalse)
1281     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1282   if (wand->images == (Image *) NULL)
1283     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1284   return(ClampImage(wand->images,wand->exception));
1285 }
1286 \f
1287 /*
1288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1289 %                                                                             %
1290 %                                                                             %
1291 %                                                                             %
1292 %   M a g i c k C l i p I m a g e                                             %
1293 %                                                                             %
1294 %                                                                             %
1295 %                                                                             %
1296 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1297 %
1298 %  MagickClipImage() clips along the first path from the 8BIM profile, if
1299 %  present.
1300 %
1301 %  The format of the MagickClipImage method is:
1302 %
1303 %      MagickBooleanType MagickClipImage(MagickWand *wand)
1304 %
1305 %  A description of each parameter follows:
1306 %
1307 %    o wand: the magick wand.
1308 %
1309 */
1310 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1311 {
1312   MagickBooleanType
1313     status;
1314
1315   assert(wand != (MagickWand *) NULL);
1316   assert(wand->signature == MagickWandSignature);
1317   if (wand->debug != MagickFalse)
1318     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1319   if (wand->images == (Image *) NULL)
1320     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1321   status=ClipImage(wand->images,wand->exception);
1322   return(status);
1323 }
1324 \f
1325 /*
1326 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1327 %                                                                             %
1328 %                                                                             %
1329 %                                                                             %
1330 %   M a g i c k C l i p I m a g e P a t h                                     %
1331 %                                                                             %
1332 %                                                                             %
1333 %                                                                             %
1334 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1335 %
1336 %  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1337 %  present. Later operations take effect inside the path.  Id may be a number
1338 %  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1339 %  path.
1340 %
1341 %  The format of the MagickClipImagePath method is:
1342 %
1343 %      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1344 %        const char *pathname,const MagickBooleanType inside)
1345 %
1346 %  A description of each parameter follows:
1347 %
1348 %    o wand: the magick wand.
1349 %
1350 %    o pathname: name of clipping path resource. If name is preceded by #, use
1351 %      clipping path numbered by name.
1352 %
1353 %    o inside: if non-zero, later operations take effect inside clipping path.
1354 %      Otherwise later operations take effect outside clipping path.
1355 %
1356 */
1357 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1358   const char *pathname,const MagickBooleanType inside)
1359 {
1360   MagickBooleanType
1361     status;
1362
1363   assert(wand != (MagickWand *) NULL);
1364   assert(wand->signature == MagickWandSignature);
1365   if (wand->debug != MagickFalse)
1366     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1367   if (wand->images == (Image *) NULL)
1368     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1369   status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1370   return(status);
1371 }
1372 \f
1373 /*
1374 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1375 %                                                                             %
1376 %                                                                             %
1377 %                                                                             %
1378 %   M a g i c k C l u t I m a g e                                             %
1379 %                                                                             %
1380 %                                                                             %
1381 %                                                                             %
1382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1383 %
1384 %  MagickClutImage() replaces colors in the image from a color lookup table.
1385 %
1386 %  The format of the MagickClutImage method is:
1387 %
1388 %      MagickBooleanType MagickClutImage(MagickWand *wand,
1389 %        const MagickWand *clut_wand,const PixelInterpolateMethod method)
1390 %
1391 %  A description of each parameter follows:
1392 %
1393 %    o wand: the magick wand.
1394 %
1395 %    o clut_image: the clut image.
1396 %
1397 %    o method: the pixel interpolation method.
1398 %
1399 */
1400 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1401   const MagickWand *clut_wand,const PixelInterpolateMethod method)
1402 {
1403   MagickBooleanType
1404     status;
1405
1406   assert(wand != (MagickWand *) NULL);
1407   assert(wand->signature == MagickWandSignature);
1408   if (wand->debug != MagickFalse)
1409     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1410   if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1411     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1412   status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1413   return(status);
1414 }
1415 \f
1416 /*
1417 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1418 %                                                                             %
1419 %                                                                             %
1420 %                                                                             %
1421 %   M a g i c k C o a l e s c e I m a g e s                                   %
1422 %                                                                             %
1423 %                                                                             %
1424 %                                                                             %
1425 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1426 %
1427 %  MagickCoalesceImages() composites a set of images while respecting any page
1428 %  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1429 %  typically start with an image background and each subsequent image
1430 %  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1431 %  where each image in the sequence is the same size as the first and
1432 %  composited with the next image in the sequence.
1433 %
1434 %  The format of the MagickCoalesceImages method is:
1435 %
1436 %      MagickWand *MagickCoalesceImages(MagickWand *wand)
1437 %
1438 %  A description of each parameter follows:
1439 %
1440 %    o wand: the magick wand.
1441 %
1442 */
1443 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1444 {
1445   Image
1446     *coalesce_image;
1447
1448   assert(wand != (MagickWand *) NULL);
1449   assert(wand->signature == MagickWandSignature);
1450   if (wand->debug != MagickFalse)
1451     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1452   if (wand->images == (Image *) NULL)
1453     return((MagickWand *) NULL);
1454   coalesce_image=CoalesceImages(wand->images,wand->exception);
1455   if (coalesce_image == (Image *) NULL)
1456     return((MagickWand *) NULL);
1457   return(CloneMagickWandFromImages(wand,coalesce_image));
1458 }
1459 \f
1460 /*
1461 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1462 %                                                                             %
1463 %                                                                             %
1464 %                                                                             %
1465 %   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1466 %                                                                             %
1467 %                                                                             %
1468 %                                                                             %
1469 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1470 %
1471 %  MagickColorDecisionListImage() accepts a lightweight Color Correction
1472 %  Collection (CCC) file which solely contains one or more color corrections
1473 %  and applies the color correction to the image.  Here is a sample CCC file:
1474 %
1475 %    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1476 %          <ColorCorrection id="cc03345">
1477 %                <SOPNode>
1478 %                     <Slope> 0.9 1.2 0.5 </Slope>
1479 %                     <Offset> 0.4 -0.5 0.6 </Offset>
1480 %                     <Power> 1.0 0.8 1.5 </Power>
1481 %                </SOPNode>
1482 %                <SATNode>
1483 %                     <Saturation> 0.85 </Saturation>
1484 %                </SATNode>
1485 %          </ColorCorrection>
1486 %    </ColorCorrectionCollection>
1487 %
1488 %  which includes the offset, slope, and power for each of the RGB channels
1489 %  as well as the saturation.
1490 %
1491 %  The format of the MagickColorDecisionListImage method is:
1492 %
1493 %      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1494 %        const char *color_correction_collection)
1495 %
1496 %  A description of each parameter follows:
1497 %
1498 %    o wand: the magick wand.
1499 %
1500 %    o color_correction_collection: the color correction collection in XML.
1501 %
1502 */
1503 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1504   const char *color_correction_collection)
1505 {
1506   MagickBooleanType
1507     status;
1508
1509   assert(wand != (MagickWand *) NULL);
1510   assert(wand->signature == MagickWandSignature);
1511   if (wand->debug != MagickFalse)
1512     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1513   if (wand->images == (Image *) NULL)
1514     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1515   status=ColorDecisionListImage(wand->images,color_correction_collection,
1516     wand->exception);
1517   return(status);
1518 }
1519 \f
1520 /*
1521 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1522 %                                                                             %
1523 %                                                                             %
1524 %                                                                             %
1525 %   M a g i c k C o l o r i z e I m a g e                                     %
1526 %                                                                             %
1527 %                                                                             %
1528 %                                                                             %
1529 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1530 %
1531 %  MagickColorizeImage() blends the fill color with each pixel in the image.
1532 %
1533 %  The format of the MagickColorizeImage method is:
1534 %
1535 %      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1536 %        const PixelWand *colorize,const PixelWand *blend)
1537 %
1538 %  A description of each parameter follows:
1539 %
1540 %    o wand: the magick wand.
1541 %
1542 %    o colorize: the colorize pixel wand.
1543 %
1544 %    o alpha: the alpha pixel wand.
1545 %
1546 */
1547 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1548   const PixelWand *colorize,const PixelWand *blend)
1549 {
1550   char
1551     percent_blend[MagickPathExtent];
1552
1553   Image
1554     *colorize_image;
1555
1556   PixelInfo
1557     target;
1558
1559   assert(wand != (MagickWand *) NULL);
1560   assert(wand->signature == MagickWandSignature);
1561   if (wand->debug != MagickFalse)
1562     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1563   if (wand->images == (Image *) NULL)
1564     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1565   GetPixelInfo(wand->images,&target);
1566   if (target.colorspace != CMYKColorspace)
1567     (void) FormatLocaleString(percent_blend,MagickPathExtent,
1568       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1569       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1570       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1571       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1572       PixelGetAlphaQuantum(blend)));
1573   else
1574     (void) FormatLocaleString(percent_blend,MagickPathExtent,
1575       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1576       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1577       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1578       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1579       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1580       PixelGetAlphaQuantum(blend)));
1581   target=PixelGetPixel(colorize);
1582   colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1583     wand->exception);
1584   if (colorize_image == (Image *) NULL)
1585     return(MagickFalse);
1586   ReplaceImageInList(&wand->images,colorize_image);
1587   return(MagickTrue);
1588 }
1589 \f
1590 /*
1591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1592 %                                                                             %
1593 %                                                                             %
1594 %                                                                             %
1595 %   M a g i c k C o l o r M a t r i x I m a g e                               %
1596 %                                                                             %
1597 %                                                                             %
1598 %                                                                             %
1599 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1600 %
1601 %  MagickColorMatrixImage() apply color transformation to an image. The method
1602 %  permits saturation changes, hue rotation, luminance to alpha, and various
1603 %  other effects.  Although variable-sized transformation matrices can be used,
1604 %  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1605 %  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1606 %  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1607 %  and offsets are normalized (divide Flash offset by 255).
1608 %
1609 %  The format of the MagickColorMatrixImage method is:
1610 %
1611 %      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1612 %        const KernelInfo *color_matrix)
1613 %
1614 %  A description of each parameter follows:
1615 %
1616 %    o wand: the magick wand.
1617 %
1618 %    o color_matrix:  the color matrix.
1619 %
1620 */
1621 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1622   const KernelInfo *color_matrix)
1623 {
1624   Image
1625     *color_image;
1626
1627   assert(wand != (MagickWand *) NULL);
1628   assert(wand->signature == MagickWandSignature);
1629   if (wand->debug != MagickFalse)
1630     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1631   if (color_matrix == (const KernelInfo *) NULL)
1632     return(MagickFalse);
1633   if (wand->images == (Image *) NULL)
1634     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1635   color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1636   if (color_image == (Image *) NULL)
1637     return(MagickFalse);
1638   ReplaceImageInList(&wand->images,color_image);
1639   return(MagickTrue);
1640 }
1641 \f
1642 /*
1643 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1644 %                                                                             %
1645 %                                                                             %
1646 %                                                                             %
1647 %   M a g i c k C o m b i n e I m a g e s                                     %
1648 %                                                                             %
1649 %                                                                             %
1650 %                                                                             %
1651 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1652 %
1653 %  MagickCombineImages() combines one or more images into a single image.  The
1654 %  grayscale value of the pixels of each image in the sequence is assigned in
1655 %  order to the specified  hannels of the combined image.   The typical
1656 %  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1657 %
1658 %  The format of the MagickCombineImages method is:
1659 %
1660 %      MagickWand *MagickCombineImages(MagickWand *wand,
1661 %        const ColorspaceType colorspace)
1662 %
1663 %  A description of each parameter follows:
1664 %
1665 %    o wand: the magick wand.
1666 %
1667 %    o colorspace: the colorspace.
1668 %
1669 */
1670 WandExport MagickWand *MagickCombineImages(MagickWand *wand,
1671   const ColorspaceType colorspace)
1672 {
1673   Image
1674     *combine_image;
1675
1676   assert(wand != (MagickWand *) NULL);
1677   assert(wand->signature == MagickWandSignature);
1678   if (wand->debug != MagickFalse)
1679     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1680   if (wand->images == (Image *) NULL)
1681     return((MagickWand *) NULL);
1682   combine_image=CombineImages(wand->images,colorspace,wand->exception);
1683   if (combine_image == (Image *) NULL)
1684     return((MagickWand *) NULL);
1685   return(CloneMagickWandFromImages(wand,combine_image));
1686 }
1687 \f
1688 /*
1689 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1690 %                                                                             %
1691 %                                                                             %
1692 %                                                                             %
1693 %   M a g i c k C o m m e n t I m a g e                                       %
1694 %                                                                             %
1695 %                                                                             %
1696 %                                                                             %
1697 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1698 %
1699 %  MagickCommentImage() adds a comment to your image.
1700 %
1701 %  The format of the MagickCommentImage method is:
1702 %
1703 %      MagickBooleanType MagickCommentImage(MagickWand *wand,
1704 %        const char *comment)
1705 %
1706 %  A description of each parameter follows:
1707 %
1708 %    o wand: the magick wand.
1709 %
1710 %    o comment: the image comment.
1711 %
1712 */
1713 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1714   const char *comment)
1715 {
1716   MagickBooleanType
1717     status;
1718
1719   assert(wand != (MagickWand *) NULL);
1720   assert(wand->signature == MagickWandSignature);
1721   if (wand->debug != MagickFalse)
1722     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1723   if (wand->images == (Image *) NULL)
1724     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1725   status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1726   return(status);
1727 }
1728 \f
1729 /*
1730 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1731 %                                                                             %
1732 %                                                                             %
1733 %                                                                             %
1734 %   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1735 %                                                                             %
1736 %                                                                             %
1737 %                                                                             %
1738 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1739 %
1740 %  MagickCompareImagesLayers() compares each image with the next in a sequence
1741 %  and returns the maximum bounding region of any pixel differences it
1742 %  discovers.
1743 %
1744 %  The format of the MagickCompareImagesLayers method is:
1745 %
1746 %      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1747 %        const LayerMethod method)
1748 %
1749 %  A description of each parameter follows:
1750 %
1751 %    o wand: the magick wand.
1752 %
1753 %    o method: the compare method.
1754 %
1755 */
1756 WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1757   const LayerMethod method)
1758 {
1759   Image
1760     *layers_image;
1761
1762   assert(wand != (MagickWand *) NULL);
1763   assert(wand->signature == MagickWandSignature);
1764   if (wand->debug != MagickFalse)
1765     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1766   if (wand->images == (Image *) NULL)
1767     return((MagickWand *) NULL);
1768   layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1769   if (layers_image == (Image *) NULL)
1770     return((MagickWand *) NULL);
1771   return(CloneMagickWandFromImages(wand,layers_image));
1772 }
1773 \f
1774 /*
1775 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1776 %                                                                             %
1777 %                                                                             %
1778 %                                                                             %
1779 %   M a g i c k C o m p a r e I m a g e s                                     %
1780 %                                                                             %
1781 %                                                                             %
1782 %                                                                             %
1783 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1784 %
1785 %  MagickCompareImages() compares an image to a reconstructed image and returns
1786 %  the specified difference image.
1787 %
1788 %  The format of the MagickCompareImages method is:
1789 %
1790 %      MagickWand *MagickCompareImages(MagickWand *wand,
1791 %        const MagickWand *reference,const MetricType metric,
1792 %        double *distortion)
1793 %
1794 %  A description of each parameter follows:
1795 %
1796 %    o wand: the magick wand.
1797 %
1798 %    o reference: the reference wand.
1799 %
1800 %    o metric: the metric.
1801 %
1802 %    o distortion: the computed distortion between the images.
1803 %
1804 */
1805 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1806   const MagickWand *reference,const MetricType metric,double *distortion)
1807 {
1808   Image
1809     *compare_image;
1810
1811
1812   assert(wand != (MagickWand *) NULL);
1813   assert(wand->signature == MagickWandSignature);
1814   if (wand->debug != MagickFalse)
1815     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1816   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1817     {
1818       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1819         "ContainsNoImages","`%s'",wand->name);
1820       return((MagickWand *) NULL);
1821     }
1822   compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1823     wand->exception);
1824   if (compare_image == (Image *) NULL)
1825     return((MagickWand *) NULL);
1826   return(CloneMagickWandFromImages(wand,compare_image));
1827 }
1828 \f
1829 /*
1830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1831 %                                                                             %
1832 %                                                                             %
1833 %                                                                             %
1834 %   M a g i c k C o m p o s i t e I m a g e                                   %
1835 %                                                                             %
1836 %                                                                             %
1837 %                                                                             %
1838 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1839 %
1840 %  MagickCompositeImage() composite one image onto another at the specified
1841 %  offset.
1842 %
1843 %  The format of the MagickCompositeImage method is:
1844 %
1845 %      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1846 %        const MagickWand *source_wand,const CompositeOperator compose,
1847 %        const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1848 %
1849 %  A description of each parameter follows:
1850 %
1851 %    o wand: the magick wand holding the destination images
1852 %
1853 %    o source_image: the magick wand holding source image.
1854 %
1855 %    o compose: This operator affects how the composite is applied to the
1856 %      image.  The default is Over.  These are some of the compose methods
1857 %      availble.
1858 %
1859 %        OverCompositeOp       InCompositeOp         OutCompositeOp
1860 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1861 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1862 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1863 %        DisplaceCompositeOp
1864 %
1865 %    o clip_to_self: set to MagickTrue to limit composition to area composed.
1866 %
1867 %    o x: the column offset of the composited image.
1868 %
1869 %    o y: the row offset of the composited image.
1870 %
1871 */
1872 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1873   const MagickWand *source_wand,const CompositeOperator compose,
1874   const MagickBooleanType clip_to_self,const ssize_t x,const ssize_t y)
1875 {
1876   MagickBooleanType
1877     status;
1878
1879   assert(wand != (MagickWand *) NULL);
1880   assert(wand->signature == MagickWandSignature);
1881   if (wand->debug != MagickFalse)
1882     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1883   if ((wand->images == (Image *) NULL) ||
1884       (source_wand->images == (Image *) NULL))
1885     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1886   status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self,
1887     x,y,wand->exception);
1888   return(status);
1889 }
1890 \f
1891 /*
1892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1893 %                                                                             %
1894 %                                                                             %
1895 %                                                                             %
1896 %   M a g i c k C o m p o s i t e I m a g e G r a v i t y                     %
1897 %                                                                             %
1898 %                                                                             %
1899 %                                                                             %
1900 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1901 %
1902 %  MagickCompositeImageGravity() composite one image onto another using the
1903 %  specified gravity.
1904 %
1905 %  The format of the MagickCompositeImageGravity method is:
1906 %
1907 %      MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
1908 %        const MagickWand *source_wand,const CompositeOperator compose,
1909 %        const GravityType gravity)
1910 %
1911 %  A description of each parameter follows:
1912 %
1913 %    o wand: the magick wand holding the destination images
1914 %
1915 %    o source_image: the magick wand holding source image.
1916 %
1917 %    o compose: This operator affects how the composite is applied to the
1918 %      image.  The default is Over.  These are some of the compose methods
1919 %      availble.
1920 %
1921 %        OverCompositeOp       InCompositeOp         OutCompositeOp
1922 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1923 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1924 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1925 %        DisplaceCompositeOp
1926 %
1927 %    o gravity: positioning gravity (NorthWestGravity, NorthGravity,
1928 %               NorthEastGravity, WestGravity, CenterGravity,
1929 %               EastGravity, SouthWestGravity, SouthGravity,
1930 %               SouthEastGravity)
1931 %
1932 */
1933 WandExport MagickBooleanType MagickCompositeImageGravity(MagickWand *wand,
1934   const MagickWand *source_wand,const CompositeOperator compose,
1935   const GravityType gravity)
1936 {
1937   MagickBooleanType
1938     status;
1939
1940   RectangleInfo
1941     geometry;
1942
1943   assert(wand != (MagickWand *) NULL);
1944   assert(wand->signature == MagickWandSignature);
1945   if (wand->debug != MagickFalse)
1946     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1947   if ((wand->images == (Image *) NULL) ||
1948       (source_wand->images == (Image *) NULL))
1949     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1950   SetGeometry(source_wand->images,&geometry);
1951   GravityAdjustGeometry(wand->images->columns,wand->images->rows,gravity,
1952     &geometry);
1953   status=CompositeImage(wand->images,source_wand->images,compose,MagickTrue,
1954     geometry.x,geometry.y,wand->exception);
1955   return(status);
1956 }
1957 \f
1958 /*
1959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1960 %                                                                             %
1961 %                                                                             %
1962 %                                                                             %
1963 %   M a g i c k C o m p o s i t e L a y e r s                                 %
1964 %                                                                             %
1965 %                                                                             %
1966 %                                                                             %
1967 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1968 %
1969 %  MagickCompositeLayers() composite the images in the source wand over the
1970 %  images in the destination wand in sequence, starting with the current
1971 %  image in both lists.
1972 %
1973 %  Each layer from the two image lists are composted together until the end of
1974 %  one of the image lists is reached.  The offset of each composition is also
1975 %  adjusted to match the virtual canvas offsets of each layer. As such the
1976 %  given offset is relative to the virtual canvas, and not the actual image.
1977 %
1978 %  Composition uses given x and y offsets, as the 'origin' location of the
1979 %  source images virtual canvas (not the real image) allowing you to compose a
1980 %  list of 'layer images' into the destiantioni images.  This makes it well
1981 %  sutiable for directly composing 'Clears Frame Animations' or 'Coaleased
1982 %  Animations' onto a static or other 'Coaleased Animation' destination image
1983 %  list.  GIF disposal handling is not looked at.
1984 %
1985 %  Special case:- If one of the image sequences is the last image (just a
1986 %  single image remaining), that image is repeatally composed with all the
1987 %  images in the other image list.  Either the source or destination lists may
1988 %  be the single image, for this situation.
1989 %
1990 %  In the case of a single destination image (or last image given), that image
1991 %  will ve cloned to match the number of images remaining in the source image
1992 %  list.
1993 %
1994 %  This is equivelent to the "-layer Composite" Shell API operator.
1995 %
1996 %  The format of the MagickCompositeLayers method is:
1997 %
1998 %      MagickBooleanType MagickCompositeLayers(MagickWand *wand,
1999 %        const MagickWand *source_wand, const CompositeOperator compose,
2000 %        const ssize_t x,const ssize_t y)
2001 %
2002 %  A description of each parameter follows:
2003 %
2004 %    o wand: the magick wand holding destaintion images
2005 %
2006 %    o source_wand: the wand holding the source images
2007 %
2008 %    o compose, x, y:  composition arguments
2009 %
2010 */
2011 WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand,
2012   const MagickWand *source_wand,const CompositeOperator compose,
2013   const ssize_t x,const ssize_t y)
2014 {
2015   MagickBooleanType
2016     status;
2017
2018   assert(wand != (MagickWand *) NULL);
2019   assert(wand->signature == MagickWandSignature);
2020   if (wand->debug != MagickFalse)
2021     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2022   if ((wand->images == (Image *) NULL) ||
2023       (source_wand->images == (Image *) NULL))
2024     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2025   CompositeLayers(wand->images,compose,source_wand->images,x,y,wand->exception);
2026   status=MagickTrue;  /* FUTURE: determine status from exceptions */
2027   return(status);
2028 }
2029 \f
2030 /*
2031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2032 %                                                                             %
2033 %                                                                             %
2034 %                                                                             %
2035 %   M a g i c k C o n t r a s t I m a g e                                     %
2036 %                                                                             %
2037 %                                                                             %
2038 %                                                                             %
2039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2040 %
2041 %  MagickContrastImage() enhances the intensity differences between the lighter
2042 %  and darker elements of the image.  Set sharpen to a value other than 0 to
2043 %  increase the image contrast otherwise the contrast is reduced.
2044 %
2045 %  The format of the MagickContrastImage method is:
2046 %
2047 %      MagickBooleanType MagickContrastImage(MagickWand *wand,
2048 %        const MagickBooleanType sharpen)
2049 %
2050 %  A description of each parameter follows:
2051 %
2052 %    o wand: the magick wand.
2053 %
2054 %    o sharpen: Increase or decrease image contrast.
2055 %
2056 %
2057 */
2058 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
2059   const MagickBooleanType sharpen)
2060 {
2061   MagickBooleanType
2062     status;
2063
2064   assert(wand != (MagickWand *) NULL);
2065   assert(wand->signature == MagickWandSignature);
2066   if (wand->debug != MagickFalse)
2067     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2068   if (wand->images == (Image *) NULL)
2069     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2070   status=ContrastImage(wand->images,sharpen,wand->exception);
2071   return(status);
2072 }
2073 \f
2074 /*
2075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2076 %                                                                             %
2077 %                                                                             %
2078 %                                                                             %
2079 %   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                       %
2080 %                                                                             %
2081 %                                                                             %
2082 %                                                                             %
2083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2084 %
2085 %  MagickContrastStretchImage() enhances the contrast of a color image by
2086 %  adjusting the pixels color to span the entire range of colors available.
2087 %  You can also reduce the influence of a particular channel with a gamma
2088 %  value of 0.
2089 %
2090 %  The format of the MagickContrastStretchImage method is:
2091 %
2092 %      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2093 %        const double black_point,const double white_point)
2094 %
2095 %  A description of each parameter follows:
2096 %
2097 %    o wand: the magick wand.
2098 %
2099 %    o black_point: the black point.
2100 %
2101 %    o white_point: the white point.
2102 %
2103 */
2104 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2105   const double black_point,const double white_point)
2106 {
2107   MagickBooleanType
2108     status;
2109
2110   assert(wand != (MagickWand *) NULL);
2111   assert(wand->signature == MagickWandSignature);
2112   if (wand->debug != MagickFalse)
2113     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2114   if (wand->images == (Image *) NULL)
2115     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2116   status=ContrastStretchImage(wand->images,black_point,white_point,
2117     wand->exception);
2118   return(status);
2119 }
2120 \f
2121 /*
2122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2123 %                                                                             %
2124 %                                                                             %
2125 %                                                                             %
2126 %   M a g i c k C o n v o l v e I m a g e                                     %
2127 %                                                                             %
2128 %                                                                             %
2129 %                                                                             %
2130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2131 %
2132 %  MagickConvolveImage() applies a custom convolution kernel to the image.
2133 %
2134 %  The format of the MagickConvolveImage method is:
2135 %
2136 %      MagickBooleanType MagickConvolveImage(MagickWand *wand,
2137 %        const KernelInfo *kernel)
2138 %
2139 %  A description of each parameter follows:
2140 %
2141 %    o wand: the magick wand.
2142 %
2143 %    o kernel: An array of doubles representing the convolution kernel.
2144 %
2145 */
2146 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2147   const KernelInfo *kernel)
2148 {
2149   Image
2150     *filter_image;
2151
2152   assert(wand != (MagickWand *) NULL);
2153   assert(wand->signature == MagickWandSignature);
2154   if (wand->debug != MagickFalse)
2155     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2156   if (kernel == (const KernelInfo *) NULL)
2157     return(MagickFalse);
2158   if (wand->images == (Image *) NULL)
2159     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2160   filter_image=ConvolveImage(wand->images,kernel,wand->exception);
2161   if (filter_image == (Image *) NULL)
2162     return(MagickFalse);
2163   ReplaceImageInList(&wand->images,filter_image);
2164   return(MagickTrue);
2165 }
2166 \f
2167 /*
2168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2169 %                                                                             %
2170 %                                                                             %
2171 %                                                                             %
2172 %   M a g i c k C r o p I m a g e                                             %
2173 %                                                                             %
2174 %                                                                             %
2175 %                                                                             %
2176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2177 %
2178 %  MagickCropImage() extracts a region of the image.
2179 %
2180 %  The format of the MagickCropImage method is:
2181 %
2182 %      MagickBooleanType MagickCropImage(MagickWand *wand,
2183 %        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2184 %
2185 %  A description of each parameter follows:
2186 %
2187 %    o wand: the magick wand.
2188 %
2189 %    o width: the region width.
2190 %
2191 %    o height: the region height.
2192 %
2193 %    o x: the region x-offset.
2194 %
2195 %    o y: the region y-offset.
2196 %
2197 */
2198 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2199   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2200 {
2201   Image
2202     *crop_image;
2203
2204   RectangleInfo
2205     crop;
2206
2207   assert(wand != (MagickWand *) NULL);
2208   assert(wand->signature == MagickWandSignature);
2209   if (wand->debug != MagickFalse)
2210     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2211   if (wand->images == (Image *) NULL)
2212     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2213   crop.width=width;
2214   crop.height=height;
2215   crop.x=x;
2216   crop.y=y;
2217   crop_image=CropImage(wand->images,&crop,wand->exception);
2218   if (crop_image == (Image *) NULL)
2219     return(MagickFalse);
2220   ReplaceImageInList(&wand->images,crop_image);
2221   return(MagickTrue);
2222 }
2223 \f
2224 /*
2225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2226 %                                                                             %
2227 %                                                                             %
2228 %                                                                             %
2229 %   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2230 %                                                                             %
2231 %                                                                             %
2232 %                                                                             %
2233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2234 %
2235 %  MagickCycleColormapImage() displaces an image's colormap by a given number
2236 %  of positions.  If you cycle the colormap a number of times you can produce
2237 %  a psychodelic effect.
2238 %
2239 %  The format of the MagickCycleColormapImage method is:
2240 %
2241 %      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2242 %        const ssize_t displace)
2243 %
2244 %  A description of each parameter follows:
2245 %
2246 %    o wand: the magick wand.
2247 %
2248 %    o pixel_wand: the pixel wand.
2249 %
2250 */
2251 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2252   const ssize_t displace)
2253 {
2254   MagickBooleanType
2255     status;
2256
2257   assert(wand != (MagickWand *) NULL);
2258   assert(wand->signature == MagickWandSignature);
2259   if (wand->debug != MagickFalse)
2260     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2261   if (wand->images == (Image *) NULL)
2262     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2263   status=CycleColormapImage(wand->images,displace,wand->exception);
2264   return(status);
2265 }
2266 \f
2267 /*
2268 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2269 %                                                                             %
2270 %                                                                             %
2271 %                                                                             %
2272 %   M a g i c k C o n s t i t u t e I m a g e                                 %
2273 %                                                                             %
2274 %                                                                             %
2275 %                                                                             %
2276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2277 %
2278 %  MagickConstituteImage() adds an image to the wand comprised of the pixel
2279 %  data you supply.  The pixel data must be in scanline order top-to-bottom.
2280 %  The data can be char, short int, int, float, or double.  Float and double
2281 %  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2282 %  is the maximum value the type can accomodate (e.g. 255 for char).  For
2283 %  example, to create a 640x480 image from unsigned red-green-blue character
2284 %  data, use
2285 %
2286 %      MagickConstituteImage(wand,640,480,"RGB",CharPixel,pixels);
2287 %
2288 %  The format of the MagickConstituteImage method is:
2289 %
2290 %      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2291 %        const size_t columns,const size_t rows,const char *map,
2292 %        const StorageType storage,void *pixels)
2293 %
2294 %  A description of each parameter follows:
2295 %
2296 %    o wand: the magick wand.
2297 %
2298 %    o columns: width in pixels of the image.
2299 %
2300 %    o rows: height in pixels of the image.
2301 %
2302 %    o map:  This string reflects the expected ordering of the pixel array.
2303 %      It can be any combination or order of R = red, G = green, B = blue,
2304 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2305 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2306 %      P = pad.
2307 %
2308 %    o storage: Define the data type of the pixels.  Float and double types are
2309 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2310 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2311 %      LongPixel, QuantumPixel, or ShortPixel.
2312 %
2313 %    o pixels: This array of values contain the pixel components as defined by
2314 %      map and type.  You must preallocate this array where the expected
2315 %      length varies depending on the values of width, height, map, and type.
2316 %
2317 %
2318 */
2319 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2320   const size_t columns,const size_t rows,const char *map,
2321   const StorageType storage,const void *pixels)
2322 {
2323   Image
2324     *images;
2325
2326   assert(wand != (MagickWand *) NULL);
2327   assert(wand->signature == MagickWandSignature);
2328   if (wand->debug != MagickFalse)
2329     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2330   images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2331   if (images == (Image *) NULL)
2332     return(MagickFalse);
2333   return(InsertImageInWand(wand,images));
2334 }
2335 \f
2336 /*
2337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2338 %                                                                             %
2339 %                                                                             %
2340 %                                                                             %
2341 %   M a g i c k D e c i p h e r I m a g e                                     %
2342 %                                                                             %
2343 %                                                                             %
2344 %                                                                             %
2345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2346 %
2347 %  MagickDecipherImage() converts cipher pixels to plain pixels.
2348 %
2349 %  The format of the MagickDecipherImage method is:
2350 %
2351 %      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2352 %        const char *passphrase)
2353 %
2354 %  A description of each parameter follows:
2355 %
2356 %    o wand: the magick wand.
2357 %
2358 %    o passphrase: the passphrase.
2359 %
2360 */
2361 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2362   const char *passphrase)
2363 {
2364   assert(wand != (MagickWand *) NULL);
2365   assert(wand->signature == MagickWandSignature);
2366   if (wand->debug != MagickFalse)
2367     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2368   if (wand->images == (Image *) NULL)
2369     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2370   return(DecipherImage(wand->images,passphrase,wand->exception));
2371 }
2372 \f
2373 /*
2374 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2375 %                                                                             %
2376 %                                                                             %
2377 %                                                                             %
2378 %   M a g i c k D e c o n s t r u c t I m a g e s                             %
2379 %                                                                             %
2380 %                                                                             %
2381 %                                                                             %
2382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2383 %
2384 %  MagickDeconstructImages() compares each image with the next in a sequence
2385 %  and returns the maximum bounding region of any pixel differences it
2386 %  discovers.
2387 %
2388 %  The format of the MagickDeconstructImages method is:
2389 %
2390 %      MagickWand *MagickDeconstructImages(MagickWand *wand)
2391 %
2392 %  A description of each parameter follows:
2393 %
2394 %    o wand: the magick wand.
2395 %
2396 */
2397 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2398 {
2399   Image
2400     *deconstruct_image;
2401
2402   assert(wand != (MagickWand *) NULL);
2403   assert(wand->signature == MagickWandSignature);
2404   if (wand->debug != MagickFalse)
2405     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2406   if (wand->images == (Image *) NULL)
2407     return((MagickWand *) NULL);
2408   deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2409     wand->exception);
2410   if (deconstruct_image == (Image *) NULL)
2411     return((MagickWand *) NULL);
2412   return(CloneMagickWandFromImages(wand,deconstruct_image));
2413 }
2414 \f
2415 /*
2416 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2417 %                                                                             %
2418 %                                                                             %
2419 %                                                                             %
2420 %     M a g i c k D e s k e w I m a g e                                       %
2421 %                                                                             %
2422 %                                                                             %
2423 %                                                                             %
2424 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2425 %
2426 %  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2427 %  occurs in scanned images because of the camera being misaligned,
2428 %  imperfections in the scanning or surface, or simply because the paper was
2429 %  not placed completely flat when scanned.
2430 %
2431 %  The format of the MagickDeskewImage method is:
2432 %
2433 %      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2434 %        const double threshold)
2435 %
2436 %  A description of each parameter follows:
2437 %
2438 %    o wand: the magick wand.
2439 %
2440 %    o threshold: separate background from foreground.
2441 %
2442 */
2443 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2444   const double threshold)
2445 {
2446   Image
2447     *sepia_image;
2448
2449   assert(wand != (MagickWand *) NULL);
2450   assert(wand->signature == MagickWandSignature);
2451   if (wand->debug != MagickFalse)
2452     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2453   if (wand->images == (Image *) NULL)
2454     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2455   sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2456   if (sepia_image == (Image *) NULL)
2457     return(MagickFalse);
2458   ReplaceImageInList(&wand->images,sepia_image);
2459   return(MagickTrue);
2460 }
2461 \f
2462 /*
2463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2464 %                                                                             %
2465 %                                                                             %
2466 %                                                                             %
2467 %     M a g i c k D e s p e c k l e I m a g e                                 %
2468 %                                                                             %
2469 %                                                                             %
2470 %                                                                             %
2471 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2472 %
2473 %  MagickDespeckleImage() reduces the speckle noise in an image while
2474 %  perserving the edges of the original image.
2475 %
2476 %  The format of the MagickDespeckleImage method is:
2477 %
2478 %      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2479 %
2480 %  A description of each parameter follows:
2481 %
2482 %    o wand: the magick wand.
2483 %
2484 */
2485 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2486 {
2487   Image
2488     *despeckle_image;
2489
2490   assert(wand != (MagickWand *) NULL);
2491   assert(wand->signature == MagickWandSignature);
2492   if (wand->debug != MagickFalse)
2493     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2494   if (wand->images == (Image *) NULL)
2495     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2496   despeckle_image=DespeckleImage(wand->images,wand->exception);
2497   if (despeckle_image == (Image *) NULL)
2498     return(MagickFalse);
2499   ReplaceImageInList(&wand->images,despeckle_image);
2500   return(MagickTrue);
2501 }
2502 \f
2503 /*
2504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2505 %                                                                             %
2506 %                                                                             %
2507 %                                                                             %
2508 %   M a g i c k D e s t r o y I m a g e                                       %
2509 %                                                                             %
2510 %                                                                             %
2511 %                                                                             %
2512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2513 %
2514 %  MagickDestroyImage() dereferences an image, deallocating memory associated
2515 %  with the image if the reference count becomes zero.
2516 %
2517 %  The format of the MagickDestroyImage method is:
2518 %
2519 %      Image *MagickDestroyImage(Image *image)
2520 %
2521 %  A description of each parameter follows:
2522 %
2523 %    o image: the image.
2524 %
2525 */
2526 WandExport Image *MagickDestroyImage(Image *image)
2527 {
2528   return(DestroyImage(image));
2529 }
2530 \f
2531 /*
2532 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2533 %                                                                             %
2534 %                                                                             %
2535 %                                                                             %
2536 %   M a g i c k D i s p l a y I m a g e                                       %
2537 %                                                                             %
2538 %                                                                             %
2539 %                                                                             %
2540 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2541 %
2542 %  MagickDisplayImage() displays an image.
2543 %
2544 %  The format of the MagickDisplayImage method is:
2545 %
2546 %      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2547 %        const char *server_name)
2548 %
2549 %  A description of each parameter follows:
2550 %
2551 %    o wand: the magick wand.
2552 %
2553 %    o server_name: the X server name.
2554 %
2555 */
2556 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2557   const char *server_name)
2558 {
2559   Image
2560     *image;
2561
2562   MagickBooleanType
2563     status;
2564
2565   assert(wand != (MagickWand *) NULL);
2566   assert(wand->signature == MagickWandSignature);
2567   if (wand->debug != MagickFalse)
2568     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2569   if (wand->images == (Image *) NULL)
2570     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2571   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2572   if (image == (Image *) NULL)
2573     return(MagickFalse);
2574   (void) CloneString(&wand->image_info->server_name,server_name);
2575   status=DisplayImages(wand->image_info,image,wand->exception);
2576   image=DestroyImage(image);
2577   return(status);
2578 }
2579 \f
2580 /*
2581 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2582 %                                                                             %
2583 %                                                                             %
2584 %                                                                             %
2585 %   M a g i c k D i s p l a y I m a g e s                                     %
2586 %                                                                             %
2587 %                                                                             %
2588 %                                                                             %
2589 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2590 %
2591 %  MagickDisplayImages() displays an image or image sequence.
2592 %
2593 %  The format of the MagickDisplayImages method is:
2594 %
2595 %      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2596 %        const char *server_name)
2597 %
2598 %  A description of each parameter follows:
2599 %
2600 %    o wand: the magick wand.
2601 %
2602 %    o server_name: the X server name.
2603 %
2604 */
2605 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2606   const char *server_name)
2607 {
2608   MagickBooleanType
2609     status;
2610
2611   assert(wand != (MagickWand *) NULL);
2612   assert(wand->signature == MagickWandSignature);
2613   if (wand->debug != MagickFalse)
2614     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2615   (void) CloneString(&wand->image_info->server_name,server_name);
2616   status=DisplayImages(wand->image_info,wand->images,wand->exception);
2617   return(status);
2618 }
2619 \f
2620 /*
2621 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2622 %                                                                             %
2623 %                                                                             %
2624 %                                                                             %
2625 %   M a g i c k D i s t o r t I m a g e                                       %
2626 %                                                                             %
2627 %                                                                             %
2628 %                                                                             %
2629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2630 %
2631 %  MagickDistortImage() distorts an image using various distortion methods, by
2632 %  mapping color lookups of the source image to a new destination image
2633 %  usally of the same size as the source image, unless 'bestfit' is set to
2634 %  true.
2635 %
2636 %  If 'bestfit' is enabled, and distortion allows it, the destination image is
2637 %  adjusted to ensure the whole source 'image' will just fit within the final
2638 %  destination image, which will be sized and offset accordingly.  Also in
2639 %  many cases the virtual offset of the source image will be taken into
2640 %  account in the mapping.
2641 %
2642 %  The format of the MagickDistortImage method is:
2643 %
2644 %      MagickBooleanType MagickDistortImage(MagickWand *wand,
2645 %        const DistortImageMethod method,const size_t number_arguments,
2646 %        const double *arguments,const MagickBooleanType bestfit)
2647 %
2648 %  A description of each parameter follows:
2649 %
2650 %    o image: the image to be distorted.
2651 %
2652 %    o method: the method of image distortion.
2653 %
2654 %        ArcDistortion always ignores the source image offset, and always
2655 %        'bestfit' the destination image with the top left corner offset
2656 %        relative to the polar mapping center.
2657 %
2658 %        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2659 %        style of image distortion.
2660 %
2661 %        Affine, Perspective, and Bilinear, do least squares fitting of the
2662 %        distortion when more than the minimum number of control point pairs
2663 %        are provided.
2664 %
2665 %        Perspective, and Bilinear, falls back to a Affine distortion when less
2666 %        that 4 control point pairs are provided. While Affine distortions let
2667 %        you use any number of control point pairs, that is Zero pairs is a
2668 %        no-Op (viewport only) distrotion, one pair is a translation and two
2669 %        pairs of control points do a scale-rotate-translate, without any
2670 %        shearing.
2671 %
2672 %    o number_arguments: the number of arguments given for this distortion
2673 %      method.
2674 %
2675 %    o arguments: the arguments for this distortion method.
2676 %
2677 %    o bestfit: Attempt to resize destination to fit distorted source.
2678 %
2679 */
2680 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2681   const DistortImageMethod method,const size_t number_arguments,
2682   const double *arguments,const MagickBooleanType bestfit)
2683 {
2684   Image
2685     *distort_image;
2686
2687   assert(wand != (MagickWand *) NULL);
2688   assert(wand->signature == MagickWandSignature);
2689   if (wand->debug != MagickFalse)
2690     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2691   if (wand->images == (Image *) NULL)
2692     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2693   distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2694     bestfit,wand->exception);
2695   if (distort_image == (Image *) NULL)
2696     return(MagickFalse);
2697   ReplaceImageInList(&wand->images,distort_image);
2698   return(MagickTrue);
2699 }
2700 \f
2701 /*
2702 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2703 %                                                                             %
2704 %                                                                             %
2705 %                                                                             %
2706 %   M a g i c k D r a w I m a g e                                             %
2707 %                                                                             %
2708 %                                                                             %
2709 %                                                                             %
2710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2711 %
2712 %  MagickDrawImage() renders the drawing wand on the current image.
2713 %
2714 %  The format of the MagickDrawImage method is:
2715 %
2716 %      MagickBooleanType MagickDrawImage(MagickWand *wand,
2717 %        const DrawingWand *drawing_wand)
2718 %
2719 %  A description of each parameter follows:
2720 %
2721 %    o wand: the magick wand.
2722 %
2723 %    o drawing_wand: the draw wand.
2724 %
2725 */
2726 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2727   const DrawingWand *drawing_wand)
2728 {
2729   char
2730     *primitive;
2731
2732   DrawInfo
2733     *draw_info;
2734
2735   MagickBooleanType
2736     status;
2737
2738   assert(wand != (MagickWand *) NULL);
2739   assert(wand->signature == MagickWandSignature);
2740   if (wand->debug != MagickFalse)
2741     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2742   if (wand->images == (Image *) NULL)
2743     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2744   draw_info=PeekDrawingWand(drawing_wand);
2745   if ((draw_info == (DrawInfo *) NULL) ||
2746       (draw_info->primitive == (char *) NULL))
2747     return(MagickFalse);
2748   primitive=AcquireString(draw_info->primitive);
2749   draw_info=DestroyDrawInfo(draw_info);
2750   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2751   draw_info->primitive=primitive;
2752   status=DrawImage(wand->images,draw_info,wand->exception);
2753   draw_info=DestroyDrawInfo(draw_info);
2754   return(status);
2755 }
2756 \f
2757 /*
2758 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2759 %                                                                             %
2760 %                                                                             %
2761 %                                                                             %
2762 %   M a g i c k E d g e I m a g e                                             %
2763 %                                                                             %
2764 %                                                                             %
2765 %                                                                             %
2766 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2767 %
2768 %  MagickEdgeImage() enhance edges within the image with a convolution filter
2769 %  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2770 %  radius for you.
2771 %
2772 %  The format of the MagickEdgeImage method is:
2773 %
2774 %      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2775 %
2776 %  A description of each parameter follows:
2777 %
2778 %    o wand: the magick wand.
2779 %
2780 %    o radius: the radius of the pixel neighborhood.
2781 %
2782 */
2783 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2784   const double radius)
2785 {
2786   Image
2787     *edge_image;
2788
2789   assert(wand != (MagickWand *) NULL);
2790   assert(wand->signature == MagickWandSignature);
2791   if (wand->debug != MagickFalse)
2792     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2793   if (wand->images == (Image *) NULL)
2794     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2795   edge_image=EdgeImage(wand->images,radius,wand->exception);
2796   if (edge_image == (Image *) NULL)
2797     return(MagickFalse);
2798   ReplaceImageInList(&wand->images,edge_image);
2799   return(MagickTrue);
2800 }
2801 \f
2802 /*
2803 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2804 %                                                                             %
2805 %                                                                             %
2806 %                                                                             %
2807 %   M a g i c k E m b o s s I m a g e                                         %
2808 %                                                                             %
2809 %                                                                             %
2810 %                                                                             %
2811 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2812 %
2813 %  MagickEmbossImage() returns a grayscale image with a three-dimensional
2814 %  effect.  We convolve the image with a Gaussian operator of the given radius
2815 %  and standard deviation (sigma).  For reasonable results, radius should be
2816 %  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2817 %  radius for you.
2818 %
2819 %  The format of the MagickEmbossImage method is:
2820 %
2821 %      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2822 %        const double sigma)
2823 %
2824 %  A description of each parameter follows:
2825 %
2826 %    o wand: the magick wand.
2827 %
2828 %    o radius: the radius of the Gaussian, in pixels, not counting the center
2829 %      pixel.
2830 %
2831 %    o sigma: the standard deviation of the Gaussian, in pixels.
2832 %
2833 */
2834 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2835   const double radius,const double sigma)
2836 {
2837   Image
2838     *emboss_image;
2839
2840   assert(wand != (MagickWand *) NULL);
2841   assert(wand->signature == MagickWandSignature);
2842   if (wand->debug != MagickFalse)
2843     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2844   if (wand->images == (Image *) NULL)
2845     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2846   emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2847   if (emboss_image == (Image *) NULL)
2848     return(MagickFalse);
2849   ReplaceImageInList(&wand->images,emboss_image);
2850   return(MagickTrue);
2851 }
2852 \f
2853 /*
2854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2855 %                                                                             %
2856 %                                                                             %
2857 %                                                                             %
2858 %   M a g i c k E n c i p h e r I m a g e                                     %
2859 %                                                                             %
2860 %                                                                             %
2861 %                                                                             %
2862 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2863 %
2864 %  MagickEncipherImage() converts plaint pixels to cipher pixels.
2865 %
2866 %  The format of the MagickEncipherImage method is:
2867 %
2868 %      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2869 %        const char *passphrase)
2870 %
2871 %  A description of each parameter follows:
2872 %
2873 %    o wand: the magick wand.
2874 %
2875 %    o passphrase: the passphrase.
2876 %
2877 */
2878 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2879   const char *passphrase)
2880 {
2881   assert(wand != (MagickWand *) NULL);
2882   assert(wand->signature == MagickWandSignature);
2883   if (wand->debug != MagickFalse)
2884     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2885   if (wand->images == (Image *) NULL)
2886     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2887   return(EncipherImage(wand->images,passphrase,wand->exception));
2888 }
2889 \f
2890 /*
2891 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2892 %                                                                             %
2893 %                                                                             %
2894 %                                                                             %
2895 %   M a g i c k E n h a n c e I m a g e                                       %
2896 %                                                                             %
2897 %                                                                             %
2898 %                                                                             %
2899 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2900 %
2901 %  MagickEnhanceImage() applies a digital filter that improves the quality of a
2902 %  noisy image.
2903 %
2904 %  The format of the MagickEnhanceImage method is:
2905 %
2906 %      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2907 %
2908 %  A description of each parameter follows:
2909 %
2910 %    o wand: the magick wand.
2911 %
2912 */
2913 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2914 {
2915   Image
2916     *enhance_image;
2917
2918   assert(wand != (MagickWand *) NULL);
2919   assert(wand->signature == MagickWandSignature);
2920   if (wand->debug != MagickFalse)
2921     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2922   if (wand->images == (Image *) NULL)
2923     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2924   enhance_image=EnhanceImage(wand->images,wand->exception);
2925   if (enhance_image == (Image *) NULL)
2926     return(MagickFalse);
2927   ReplaceImageInList(&wand->images,enhance_image);
2928   return(MagickTrue);
2929 }
2930 \f
2931 /*
2932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2933 %                                                                             %
2934 %                                                                             %
2935 %                                                                             %
2936 %   M a g i c k E q u a l i z e I m a g e                                     %
2937 %                                                                             %
2938 %                                                                             %
2939 %                                                                             %
2940 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2941 %
2942 %  MagickEqualizeImage() equalizes the image histogram.
2943 %
2944 %  The format of the MagickEqualizeImage method is:
2945 %
2946 %      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2947 %
2948 %  A description of each parameter follows:
2949 %
2950 %    o wand: the magick wand.
2951 %
2952 %    o channel: the image channel(s).
2953 %
2954 */
2955 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2956 {
2957   MagickBooleanType
2958     status;
2959
2960   assert(wand != (MagickWand *) NULL);
2961   assert(wand->signature == MagickWandSignature);
2962   if (wand->debug != MagickFalse)
2963     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2964   if (wand->images == (Image *) NULL)
2965     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2966   status=EqualizeImage(wand->images,wand->exception);
2967   return(status);
2968 }
2969 \f
2970 /*
2971 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2972 %                                                                             %
2973 %                                                                             %
2974 %                                                                             %
2975 %   M a g i c k E v a l u a t e I m a g e                                     %
2976 %                                                                             %
2977 %                                                                             %
2978 %                                                                             %
2979 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2980 %
2981 %  MagickEvaluateImage() applys an arithmetic, relational, or logical
2982 %  expression to an image.  Use these operators to lighten or darken an image,
2983 %  to increase or decrease contrast in an image, or to produce the "negative"
2984 %  of an image.
2985 %
2986 %  The format of the MagickEvaluateImage method is:
2987 %
2988 %      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2989 %        const MagickEvaluateOperator operator,const double value)
2990 %      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2991 %        const MagickEvaluateOperator operator)
2992 %
2993 %  A description of each parameter follows:
2994 %
2995 %    o wand: the magick wand.
2996 %
2997 %    o op: A channel operator.
2998 %
2999 %    o value: A value value.
3000 %
3001 */
3002
3003 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
3004   const MagickEvaluateOperator op)
3005 {
3006   Image
3007     *evaluate_image;
3008
3009   assert(wand != (MagickWand *) NULL);
3010   assert(wand->signature == MagickWandSignature);
3011   if (wand->debug != MagickFalse)
3012     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3013   if (wand->images == (Image *) NULL)
3014     return((MagickWand *) NULL);
3015   evaluate_image=EvaluateImages(wand->images,op,wand->exception);
3016   if (evaluate_image == (Image *) NULL)
3017     return((MagickWand *) NULL);
3018   return(CloneMagickWandFromImages(wand,evaluate_image));
3019 }
3020
3021 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3022   const MagickEvaluateOperator op,const double value)
3023 {
3024   MagickBooleanType
3025     status;
3026
3027   assert(wand != (MagickWand *) NULL);
3028   assert(wand->signature == MagickWandSignature);
3029   if (wand->debug != MagickFalse)
3030     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3031   if (wand->images == (Image *) NULL)
3032     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3033   status=EvaluateImage(wand->images,op,value,wand->exception);
3034   return(status);
3035 }
3036 \f
3037 /*
3038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3039 %                                                                             %
3040 %                                                                             %
3041 %                                                                             %
3042 %   M a g i c k E x p o r t I m a g e P i x e l s                             %
3043 %                                                                             %
3044 %                                                                             %
3045 %                                                                             %
3046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3047 %
3048 %  MagickExportImagePixels() extracts pixel data from an image and returns it
3049 %  to you.  The method returns MagickTrue on success otherwise MagickFalse if
3050 %  an error is encountered.  The data is returned as char, short int, int,
3051 %  ssize_t, float, or double in the order specified by map.
3052 %
3053 %  Suppose you want to extract the first scanline of a 640x480 image as
3054 %  character data in red-green-blue order:
3055 %
3056 %      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3057 %
3058 %  The format of the MagickExportImagePixels method is:
3059 %
3060 %      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3061 %        const ssize_t x,const ssize_t y,const size_t columns,
3062 %        const size_t rows,const char *map,const StorageType storage,
3063 %        void *pixels)
3064 %
3065 %  A description of each parameter follows:
3066 %
3067 %    o wand: the magick wand.
3068 %
3069 %    o x, y, columns, rows:  These values define the perimeter
3070 %      of a region of pixels you want to extract.
3071 %
3072 %    o map:  This string reflects the expected ordering of the pixel array.
3073 %      It can be any combination or order of R = red, G = green, B = blue,
3074 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
3075 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3076 %      P = pad.
3077 %
3078 %    o storage: Define the data type of the pixels.  Float and double types are
3079 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
3080 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3081 %      LongPixel, QuantumPixel, or ShortPixel.
3082 %
3083 %    o pixels: This array of values contain the pixel components as defined by
3084 %      map and type.  You must preallocate this array where the expected
3085 %      length varies depending on the values of width, height, map, and type.
3086 %
3087 */
3088 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3089   const ssize_t x,const ssize_t y,const size_t columns,
3090   const size_t rows,const char *map,const StorageType storage,
3091   void *pixels)
3092 {
3093   MagickBooleanType
3094     status;
3095
3096   assert(wand != (MagickWand *) NULL);
3097   assert(wand->signature == MagickWandSignature);
3098   if (wand->debug != MagickFalse)
3099     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3100   if (wand->images == (Image *) NULL)
3101     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3102   status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3103     storage,pixels,wand->exception);
3104   return(status);
3105 }
3106 \f
3107 /*
3108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3109 %                                                                             %
3110 %                                                                             %
3111 %                                                                             %
3112 %   M a g i c k E x t e n t I m a g e                                         %
3113 %                                                                             %
3114 %                                                                             %
3115 %                                                                             %
3116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3117 %
3118 %  MagickExtentImage() extends the image as defined by the geometry, gravity,
3119 %  and wand background color.  Set the (x,y) offset of the geometry to move
3120 %  the original wand relative to the extended wand.
3121 %
3122 %  The format of the MagickExtentImage method is:
3123 %
3124 %      MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
3125 %        const size_t height,const ssize_t x,const ssize_t y)
3126 %
3127 %  A description of each parameter follows:
3128 %
3129 %    o wand: the magick wand.
3130 %
3131 %    o width: the region width.
3132 %
3133 %    o height: the region height.
3134 %
3135 %    o x: the region x offset.
3136 %
3137 %    o y: the region y offset.
3138 %
3139 */
3140 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3141   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
3142 {
3143   Image
3144     *extent_image;
3145
3146   RectangleInfo
3147     extent;
3148
3149   assert(wand != (MagickWand *) NULL);
3150   assert(wand->signature == MagickWandSignature);
3151   if (wand->debug != MagickFalse)
3152     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3153   if (wand->images == (Image *) NULL)
3154     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3155   extent.width=width;
3156   extent.height=height;
3157   extent.x=x;
3158   extent.y=y;
3159   extent_image=ExtentImage(wand->images,&extent,wand->exception);
3160   if (extent_image == (Image *) NULL)
3161     return(MagickFalse);
3162   ReplaceImageInList(&wand->images,extent_image);
3163   return(MagickTrue);
3164 }
3165 \f
3166 /*
3167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3168 %                                                                             %
3169 %                                                                             %
3170 %                                                                             %
3171 %   M a g i c k F l i p I m a g e                                             %
3172 %                                                                             %
3173 %                                                                             %
3174 %                                                                             %
3175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3176 %
3177 %  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3178 %  around the central x-axis.
3179 %
3180 %  The format of the MagickFlipImage method is:
3181 %
3182 %      MagickBooleanType MagickFlipImage(MagickWand *wand)
3183 %
3184 %  A description of each parameter follows:
3185 %
3186 %    o wand: the magick wand.
3187 %
3188 */
3189 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3190 {
3191   Image
3192     *flip_image;
3193
3194   assert(wand != (MagickWand *) NULL);
3195   assert(wand->signature == MagickWandSignature);
3196   if (wand->debug != MagickFalse)
3197     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3198   if (wand->images == (Image *) NULL)
3199     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3200   flip_image=FlipImage(wand->images,wand->exception);
3201   if (flip_image == (Image *) NULL)
3202     return(MagickFalse);
3203   ReplaceImageInList(&wand->images,flip_image);
3204   return(MagickTrue);
3205 }
3206 \f
3207 /*
3208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3209 %                                                                             %
3210 %                                                                             %
3211 %                                                                             %
3212 %   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                         %
3213 %                                                                             %
3214 %                                                                             %
3215 %                                                                             %
3216 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3217 %
3218 %  MagickFloodfillPaintImage() changes the color value of any pixel that matches
3219 %  target and is an immediate neighbor.  If the method FillToBorderMethod is
3220 %  specified, the color value is changed for any neighbor pixel that does not
3221 %  match the bordercolor member of image.
3222 %
3223 %  The format of the MagickFloodfillPaintImage method is:
3224 %
3225 %      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3226 %        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3227 %        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3228 %
3229 %  A description of each parameter follows:
3230 %
3231 %    o wand: the magick wand.
3232 %
3233 %    o fill: the floodfill color pixel wand.
3234 %
3235 %    o fuzz: By default target must match a particular pixel color
3236 %      exactly.  However, in many cases two colors may differ by a small amount.
3237 %      The fuzz member of image defines how much tolerance is acceptable to
3238 %      consider two colors as the same.  For example, set fuzz to 10 and the
3239 %      color red at intensities of 100 and 102 respectively are now interpreted
3240 %      as the same color for the purposes of the floodfill.
3241 %
3242 %    o bordercolor: the border color pixel wand.
3243 %
3244 %    o x,y: the starting location of the operation.
3245 %
3246 %    o invert: paint any pixel that does not match the target color.
3247 %
3248 */
3249 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3250   const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3251   const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3252 {
3253   DrawInfo
3254     *draw_info;
3255
3256   MagickBooleanType
3257     status;
3258
3259   PixelInfo
3260     target;
3261
3262   assert(wand != (MagickWand *) NULL);
3263   assert(wand->signature == MagickWandSignature);
3264   if (wand->debug != MagickFalse)
3265     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3266   if (wand->images == (Image *) NULL)
3267     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3268   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3269   PixelGetQuantumPacket(fill,&draw_info->fill);
3270   (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
3271     wand->images->columns,y % wand->images->rows,&target,wand->exception);
3272   if (bordercolor != (PixelWand *) NULL)
3273     PixelGetMagickColor(bordercolor,&target);
3274   wand->images->fuzz=fuzz;
3275   status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3276     wand->exception);
3277   draw_info=DestroyDrawInfo(draw_info);
3278   return(status);
3279 }
3280 \f
3281 /*
3282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3283 %                                                                             %
3284 %                                                                             %
3285 %                                                                             %
3286 %   M a g i c k F l o p I m a g e                                             %
3287 %                                                                             %
3288 %                                                                             %
3289 %                                                                             %
3290 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3291 %
3292 %  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3293 %  around the central y-axis.
3294 %
3295 %  The format of the MagickFlopImage method is:
3296 %
3297 %      MagickBooleanType MagickFlopImage(MagickWand *wand)
3298 %
3299 %  A description of each parameter follows:
3300 %
3301 %    o wand: the magick wand.
3302 %
3303 */
3304 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3305 {
3306   Image
3307     *flop_image;
3308
3309   assert(wand != (MagickWand *) NULL);
3310   assert(wand->signature == MagickWandSignature);
3311   if (wand->debug != MagickFalse)
3312     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3313   if (wand->images == (Image *) NULL)
3314     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3315   flop_image=FlopImage(wand->images,wand->exception);
3316   if (flop_image == (Image *) NULL)
3317     return(MagickFalse);
3318   ReplaceImageInList(&wand->images,flop_image);
3319   return(MagickTrue);
3320 }
3321 \f
3322 /*
3323 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3324 %                                                                             %
3325 %                                                                             %
3326 %                                                                             %
3327 %   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                     %
3328 %                                                                             %
3329 %                                                                             %
3330 %                                                                             %
3331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3332 %
3333 %  MagickForwardFourierTransformImage() implements the discrete Fourier
3334 %  transform (DFT) of the image either as a magnitude / phase or real /
3335 %  imaginary image pair.
3336 %
3337 %  The format of the MagickForwardFourierTransformImage method is:
3338 %
3339 %      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3340 %        const MagickBooleanType magnitude)
3341 %
3342 %  A description of each parameter follows:
3343 %
3344 %    o wand: the magick wand.
3345 %
3346 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3347 %      imaginary image pair.
3348 %
3349 */
3350 WandExport MagickBooleanType MagickForwardFourierTransformImage(
3351   MagickWand *wand,const MagickBooleanType magnitude)
3352 {
3353   Image
3354     *forward_image;
3355
3356   assert(wand != (MagickWand *) NULL);
3357   assert(wand->signature == MagickWandSignature);
3358   if (wand->debug != MagickFalse)
3359     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3360   if (wand->images == (Image *) NULL)
3361     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3362   forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3363     wand->exception);
3364   if (forward_image == (Image *) NULL)
3365     return(MagickFalse);
3366   ReplaceImageInList(&wand->images,forward_image);
3367   return(MagickTrue);
3368 }
3369 \f
3370 /*
3371 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3372 %                                                                             %
3373 %                                                                             %
3374 %                                                                             %
3375 %   M a g i c k F r a m e I m a g e                                           %
3376 %                                                                             %
3377 %                                                                             %
3378 %                                                                             %
3379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3380 %
3381 %  MagickFrameImage() adds a simulated three-dimensional border around the
3382 %  image.  The width and height specify the border width of the vertical and
3383 %  horizontal sides of the frame.  The inner and outer bevels indicate the
3384 %  width of the inner and outer shadows of the frame.
3385 %
3386 %  The format of the MagickFrameImage method is:
3387 %
3388 %      MagickBooleanType MagickFrameImage(MagickWand *wand,
3389 %        const PixelWand *matte_color,const size_t width,
3390 %        const size_t height,const ssize_t inner_bevel,
3391 %        const ssize_t outer_bevel,const CompositeOperator compose)
3392 %
3393 %  A description of each parameter follows:
3394 %
3395 %    o wand: the magick wand.
3396 %
3397 %    o matte_color: the frame color pixel wand.
3398 %
3399 %    o width: the border width.
3400 %
3401 %    o height: the border height.
3402 %
3403 %    o inner_bevel: the inner bevel width.
3404 %
3405 %    o outer_bevel: the outer bevel width.
3406 %
3407 %    o compose: the composite operator.
3408 %
3409 */
3410 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3411   const PixelWand *matte_color,const size_t width,const size_t height,
3412   const ssize_t inner_bevel,const ssize_t outer_bevel,
3413   const CompositeOperator compose)
3414 {
3415   Image
3416     *frame_image;
3417
3418   FrameInfo
3419     frame_info;
3420
3421   assert(wand != (MagickWand *) NULL);
3422   assert(wand->signature == MagickWandSignature);
3423   if (wand->debug != MagickFalse)
3424     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3425   if (wand->images == (Image *) NULL)
3426     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3427   (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3428   frame_info.width=wand->images->columns+2*width;
3429   frame_info.height=wand->images->rows+2*height;
3430   frame_info.x=(ssize_t) width;
3431   frame_info.y=(ssize_t) height;
3432   frame_info.inner_bevel=inner_bevel;
3433   frame_info.outer_bevel=outer_bevel;
3434   PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3435   frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3436   if (frame_image == (Image *) NULL)
3437     return(MagickFalse);
3438   ReplaceImageInList(&wand->images,frame_image);
3439   return(MagickTrue);
3440 }
3441 \f
3442 /*
3443 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3444 %                                                                             %
3445 %                                                                             %
3446 %                                                                             %
3447 %   M a g i c k F u n c t i o n I m a g e                                     %
3448 %                                                                             %
3449 %                                                                             %
3450 %                                                                             %
3451 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3452 %
3453 %  MagickFunctionImage() applys an arithmetic, relational, or logical
3454 %  expression to an image.  Use these operators to lighten or darken an image,
3455 %  to increase or decrease contrast in an image, or to produce the "negative"
3456 %  of an image.
3457 %
3458 %  The format of the MagickFunctionImage method is:
3459 %
3460 %      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3461 %        const MagickFunction function,const size_t number_arguments,
3462 %        const double *arguments)
3463 %
3464 %  A description of each parameter follows:
3465 %
3466 %    o wand: the magick wand.
3467 %
3468 %    o function: the image function.
3469 %
3470 %    o number_arguments: the number of function arguments.
3471 %
3472 %    o arguments: the function arguments.
3473 %
3474 */
3475 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3476   const MagickFunction function,const size_t number_arguments,
3477   const double *arguments)
3478 {
3479   MagickBooleanType
3480     status;
3481
3482   assert(wand != (MagickWand *) NULL);
3483   assert(wand->signature == MagickWandSignature);
3484   if (wand->debug != MagickFalse)
3485     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3486   if (wand->images == (Image *) NULL)
3487     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3488   status=FunctionImage(wand->images,function,number_arguments,arguments,
3489     wand->exception);
3490   return(status);
3491 }
3492 \f
3493 /*
3494 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3495 %                                                                             %
3496 %                                                                             %
3497 %                                                                             %
3498 %   M a g i c k F x I m a g e                                                 %
3499 %                                                                             %
3500 %                                                                             %
3501 %                                                                             %
3502 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3503 %
3504 %  MagickFxImage() evaluate expression for each pixel in the image.
3505 %
3506 %  The format of the MagickFxImage method is:
3507 %
3508 %      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3509 %
3510 %  A description of each parameter follows:
3511 %
3512 %    o wand: the magick wand.
3513 %
3514 %    o expression: the expression.
3515 %
3516 */
3517 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3518 {
3519   Image
3520     *fx_image;
3521
3522   assert(wand != (MagickWand *) NULL);
3523   assert(wand->signature == MagickWandSignature);
3524   if (wand->debug != MagickFalse)
3525     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3526   if (wand->images == (Image *) NULL)
3527     return((MagickWand *) NULL);
3528   fx_image=FxImage(wand->images,expression,wand->exception);
3529   if (fx_image == (Image *) NULL)
3530     return((MagickWand *) NULL);
3531   return(CloneMagickWandFromImages(wand,fx_image));
3532 }
3533 \f
3534 /*
3535 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3536 %                                                                             %
3537 %                                                                             %
3538 %                                                                             %
3539 %   M a g i c k G a m m a I m a g e                                           %
3540 %                                                                             %
3541 %                                                                             %
3542 %                                                                             %
3543 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3544 %
3545 %  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3546 %  different devices will have perceptual differences in the way the image's
3547 %  intensities are represented on the screen.  Specify individual gamma levels
3548 %  for the red, green, and blue channels, or adjust all three with the gamma
3549 %  parameter.  Values typically range from 0.8 to 2.3.
3550 %
3551 %  You can also reduce the influence of a particular channel with a gamma
3552 %  value of 0.
3553 %
3554 %  The format of the MagickGammaImage method is:
3555 %
3556 %      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3557 %
3558 %  A description of each parameter follows:
3559 %
3560 %    o wand: the magick wand.
3561 %
3562 %    o level: Define the level of gamma correction.
3563 %
3564 */
3565 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3566   const double gamma)
3567 {
3568   MagickBooleanType
3569     status;
3570
3571   assert(wand != (MagickWand *) NULL);
3572   assert(wand->signature == MagickWandSignature);
3573   if (wand->debug != MagickFalse)
3574     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3575   if (wand->images == (Image *) NULL)
3576     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3577   status=GammaImage(wand->images,gamma,wand->exception);
3578   return(status);
3579 }
3580 \f
3581 /*
3582 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3583 %                                                                             %
3584 %                                                                             %
3585 %                                                                             %
3586 %   M a g i c k G a u s s i a n B l u r I m a g e                             %
3587 %                                                                             %
3588 %                                                                             %
3589 %                                                                             %
3590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3591 %
3592 %  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3593 %  Gaussian operator of the given radius and standard deviation (sigma).
3594 %  For reasonable results, the radius should be larger than sigma.  Use a
3595 %  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3596 %
3597 %  The format of the MagickGaussianBlurImage method is:
3598 %
3599 %      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3600 %        const double radius,const double sigma)
3601 %
3602 %  A description of each parameter follows:
3603 %
3604 %    o wand: the magick wand.
3605 %
3606 %    o radius: the radius of the Gaussian, in pixels, not counting the center
3607 %      pixel.
3608 %
3609 %    o sigma: the standard deviation of the Gaussian, in pixels.
3610 %
3611 */
3612 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3613   const double radius,const double sigma)
3614 {
3615   Image
3616     *blur_image;
3617
3618   assert(wand != (MagickWand *) NULL);
3619   assert(wand->signature == MagickWandSignature);
3620   if (wand->debug != MagickFalse)
3621     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3622   if (wand->images == (Image *) NULL)
3623     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3624   blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3625   if (blur_image == (Image *) NULL)
3626     return(MagickFalse);
3627   ReplaceImageInList(&wand->images,blur_image);
3628   return(MagickTrue);
3629 }
3630 \f
3631 /*
3632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3633 %                                                                             %
3634 %                                                                             %
3635 %                                                                             %
3636 %   M a g i c k G e t I m a g e                                               %
3637 %                                                                             %
3638 %                                                                             %
3639 %                                                                             %
3640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3641 %
3642 %  MagickGetImage() gets the image at the current image index.
3643 %
3644 %  The format of the MagickGetImage method is:
3645 %
3646 %      MagickWand *MagickGetImage(MagickWand *wand)
3647 %
3648 %  A description of each parameter follows:
3649 %
3650 %    o wand: the magick wand.
3651 %
3652 */
3653 WandExport MagickWand *MagickGetImage(MagickWand *wand)
3654 {
3655   Image
3656     *image;
3657
3658   assert(wand != (MagickWand *) NULL);
3659   assert(wand->signature == MagickWandSignature);
3660   if (wand->debug != MagickFalse)
3661     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3662   if (wand->images == (Image *) NULL)
3663     {
3664       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3665         "ContainsNoImages","`%s'",wand->name);
3666       return((MagickWand *) NULL);
3667     }
3668   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3669   if (image == (Image *) NULL)
3670     return((MagickWand *) NULL);
3671   return(CloneMagickWandFromImages(wand,image));
3672 }
3673 \f
3674 /*
3675 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3676 %                                                                             %
3677 %                                                                             %
3678 %                                                                             %
3679 %   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                       %
3680 %                                                                             %
3681 %                                                                             %
3682 %                                                                             %
3683 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3684 %
3685 %  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3686 %  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3687 %  than CMYKA.
3688 %
3689 %  The format of the MagickGetImageAlphaChannel method is:
3690 %
3691 %      MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3692 %
3693 %  A description of each parameter follows:
3694 %
3695 %    o wand: the magick wand.
3696 %
3697 */
3698 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3699 {
3700   assert(wand != (MagickWand *) NULL);
3701   assert(wand->signature == MagickWandSignature);
3702   if (wand->debug != MagickFalse)
3703     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3704   if (wand->images == (Image *) NULL)
3705     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3706   return(GetImageAlphaChannel(wand->images));
3707 }
3708 \f
3709 /*
3710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3711 %                                                                             %
3712 %                                                                             %
3713 %                                                                             %
3714 %   M a g i c k G e t I m a g e C l i p M a s k                               %
3715 %                                                                             %
3716 %                                                                             %
3717 %                                                                             %
3718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3719 %
3720 %  MagickGetImageMask() gets the image clip mask at the current image index.
3721 %
3722 %  The format of the MagickGetImageMask method is:
3723 %
3724 %      MagickWand *MagickGetImageMask(MagickWand *wand)
3725 %
3726 %  A description of each parameter follows:
3727 %
3728 %    o wand: the magick wand.
3729 %
3730 %    o type: type of mask, ReadPixelMask or WritePixelMask.
3731 %
3732 */
3733 WandExport MagickWand *MagickGetImageMask(MagickWand *wand,
3734   const PixelMask type)
3735 {
3736   Image
3737     *image;
3738
3739   assert(wand != (MagickWand *) NULL);
3740   assert(wand->signature == MagickWandSignature);
3741   if (wand->debug != MagickFalse)
3742     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3743   if (wand->images == (Image *) NULL)
3744     {
3745       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3746         "ContainsNoImages","`%s'",wand->name);
3747       return((MagickWand *) NULL);
3748     }
3749   image=GetImageMask(wand->images,type,wand->exception);
3750   if (image == (Image *) NULL)
3751     return((MagickWand *) NULL);
3752   return(CloneMagickWandFromImages(wand,image));
3753 }
3754 \f
3755 /*
3756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3757 %                                                                             %
3758 %                                                                             %
3759 %                                                                             %
3760 %   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                 %
3761 %                                                                             %
3762 %                                                                             %
3763 %                                                                             %
3764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3765 %
3766 %  MagickGetImageBackgroundColor() returns the image background color.
3767 %
3768 %  The format of the MagickGetImageBackgroundColor method is:
3769 %
3770 %      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3771 %        PixelWand *background_color)
3772 %
3773 %  A description of each parameter follows:
3774 %
3775 %    o wand: the magick wand.
3776 %
3777 %    o background_color: Return the background color.
3778 %
3779 */
3780 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3781   PixelWand *background_color)
3782 {
3783   assert(wand != (MagickWand *) NULL);
3784   assert(wand->signature == MagickWandSignature);
3785   if (wand->debug != MagickFalse)
3786     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3787   if (wand->images == (Image *) NULL)
3788     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3789   PixelSetPixelColor(background_color,&wand->images->background_color);
3790   return(MagickTrue);
3791 }
3792 \f
3793 /*
3794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3795 %                                                                             %
3796 %                                                                             %
3797 %                                                                             %
3798 %   M a g i c k G e t I m a g e B l o b                                       %
3799 %                                                                             %
3800 %                                                                             %
3801 %                                                                             %
3802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3803 %
3804 %  MagickGetImageBlob() implements direct to memory image formats.  It returns
3805 %  the image as a blob (a formatted "file" in memory) and its length, starting
3806 %  from the current position in the image sequence.  Use MagickSetImageFormat()
3807 %  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3808 %
3809 %  Utilize MagickResetIterator() to ensure the write is from the beginning of
3810 %  the image sequence.
3811 %
3812 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
3813 %
3814 %  The format of the MagickGetImageBlob method is:
3815 %
3816 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3817 %
3818 %  A description of each parameter follows:
3819 %
3820 %    o wand: the magick wand.
3821 %
3822 %    o length: the length of the blob.
3823 %
3824 */
3825 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3826 {
3827   unsigned char
3828     *blob;
3829
3830   assert(wand != (MagickWand *) NULL);
3831   assert(wand->signature == MagickWandSignature);
3832   if (wand->debug != MagickFalse)
3833     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3834   if (wand->images == (Image *) NULL)
3835     {
3836       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3837         "ContainsNoImages","`%s'",wand->name);
3838       return((unsigned char *) NULL);
3839     }
3840   blob=(unsigned char *) ImageToBlob(wand->image_info,wand->images,length,
3841     wand->exception);
3842   return(blob);
3843 }
3844 \f
3845 /*
3846 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3847 %                                                                             %
3848 %                                                                             %
3849 %                                                                             %
3850 %   M a g i c k G e t I m a g e s B l o b                                     %
3851 %                                                                             %
3852 %                                                                             %
3853 %                                                                             %
3854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3855 %
3856 %  MagickGetImageBlob() implements direct to memory image formats.  It
3857 %  returns the image sequence as a blob and its length.  The format of the image
3858 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3859 %  return a different image format, use MagickSetImageFormat().
3860 %
3861 %  Note, some image formats do not permit multiple images to the same image
3862 %  stream (e.g. JPEG).  in this instance, just the first image of the
3863 %  sequence is returned as a blob.
3864 %
3865 %  The format of the MagickGetImagesBlob method is:
3866 %
3867 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3868 %
3869 %  A description of each parameter follows:
3870 %
3871 %    o wand: the magick wand.
3872 %
3873 %    o length: the length of the blob.
3874 %
3875 */
3876 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3877 {
3878   unsigned char
3879     *blob;
3880
3881   assert(wand != (MagickWand *) NULL);
3882   assert(wand->signature == MagickWandSignature);
3883   if (wand->debug != MagickFalse)
3884     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3885   if (wand->images == (Image *) NULL)
3886     {
3887       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3888         "ContainsNoImages","`%s'",wand->name);
3889       return((unsigned char *) NULL);
3890     }
3891   blob=(unsigned char *) ImagesToBlob(wand->image_info,GetFirstImageInList(
3892     wand->images),length,wand->exception);
3893   return(blob);
3894 }
3895 \f
3896 /*
3897 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3898 %                                                                             %
3899 %                                                                             %
3900 %                                                                             %
3901 %   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                         %
3902 %                                                                             %
3903 %                                                                             %
3904 %                                                                             %
3905 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3906 %
3907 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3908 %  image.
3909 %
3910 %  The format of the MagickGetImageBluePrimary method is:
3911 %
3912 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3913 %        double *y)
3914 %
3915 %  A description of each parameter follows:
3916 %
3917 %    o wand: the magick wand.
3918 %
3919 %    o x: the chromaticity blue primary x-point.
3920 %
3921 %    o y: the chromaticity blue primary y-point.
3922 %
3923 */
3924 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3925   double *x,double *y)
3926 {
3927   assert(wand != (MagickWand *) NULL);
3928   assert(wand->signature == MagickWandSignature);
3929   if (wand->debug != MagickFalse)
3930     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3931   if (wand->images == (Image *) NULL)
3932     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3933   *x=wand->images->chromaticity.blue_primary.x;
3934   *y=wand->images->chromaticity.blue_primary.y;
3935   return(MagickTrue);
3936 }
3937 \f
3938 /*
3939 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3940 %                                                                             %
3941 %                                                                             %
3942 %                                                                             %
3943 %   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                         %
3944 %                                                                             %
3945 %                                                                             %
3946 %                                                                             %
3947 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3948 %
3949 %  MagickGetImageBorderColor() returns the image border color.
3950 %
3951 %  The format of the MagickGetImageBorderColor method is:
3952 %
3953 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3954 %        PixelWand *border_color)
3955 %
3956 %  A description of each parameter follows:
3957 %
3958 %    o wand: the magick wand.
3959 %
3960 %    o border_color: Return the border color.
3961 %
3962 */
3963 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3964   PixelWand *border_color)
3965 {
3966   assert(wand != (MagickWand *) NULL);
3967   assert(wand->signature == MagickWandSignature);
3968   if (wand->debug != MagickFalse)
3969     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3970   if (wand->images == (Image *) NULL)
3971     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3972   PixelSetPixelColor(border_color,&wand->images->border_color);
3973   return(MagickTrue);
3974 }
3975 \f
3976 /*
3977 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3978 %                                                                             %
3979 %                                                                             %
3980 %                                                                             %
3981 %   M a g i c k G e t I m a g e F e a t u r e s                               %
3982 %                                                                             %
3983 %                                                                             %
3984 %                                                                             %
3985 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3986 %
3987 %  MagickGetImageFeatures() returns features for each channel in the
3988 %  image in each of four directions (horizontal, vertical, left and right
3989 %  diagonals) for the specified distance.  The features include the angular
3990 %  second moment, contrast, correlation, sum of squares: variance, inverse
3991 %  difference moment, sum average, sum varience, sum entropy, entropy,
3992 %  difference variance, difference entropy, information measures of
3993 %  correlation 1, information measures of correlation 2, and maximum
3994 %  correlation coefficient.  You can access the red channel contrast, for
3995 %  example, like this:
3996 %
3997 %      channel_features=MagickGetImageFeatures(wand,1);
3998 %      contrast=channel_features[RedPixelChannel].contrast[0];
3999 %
4000 %  Use MagickRelinquishMemory() to free the statistics buffer.
4001 %
4002 %  The format of the MagickGetImageFeatures method is:
4003 %
4004 %      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
4005 %        const size_t distance)
4006 %
4007 %  A description of each parameter follows:
4008 %
4009 %    o wand: the magick wand.
4010 %
4011 %    o distance: the distance.
4012 %
4013 */
4014 WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
4015   const size_t distance)
4016 {
4017   assert(wand != (MagickWand *) NULL);
4018   assert(wand->signature == MagickWandSignature);
4019   if (wand->debug != MagickFalse)
4020     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4021   if (wand->images == (Image *) NULL)
4022     {
4023       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4024         "ContainsNoImages","`%s'",wand->name);
4025       return((ChannelFeatures *) NULL);
4026     }
4027   return(GetImageFeatures(wand->images,distance,wand->exception));
4028 }
4029 \f
4030 /*
4031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4032 %                                                                             %
4033 %                                                                             %
4034 %                                                                             %
4035 %   M a g i c k G e t I m a g e K u r t o s i s                               %
4036 %                                                                             %
4037 %                                                                             %
4038 %                                                                             %
4039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4040 %
4041 %  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
4042 %  more image channels.
4043 %
4044 %  The format of the MagickGetImageKurtosis method is:
4045 %
4046 %      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4047 %        double *kurtosis,double *skewness)
4048 %
4049 %  A description of each parameter follows:
4050 %
4051 %    o wand: the magick wand.
4052 %
4053 %    o kurtosis:  The kurtosis for the specified channel(s).
4054 %
4055 %    o skewness:  The skewness for the specified channel(s).
4056 %
4057 */
4058 WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
4059   double *kurtosis,double *skewness)
4060 {
4061   MagickBooleanType
4062     status;
4063
4064   assert(wand != (MagickWand *) NULL);
4065   assert(wand->signature == MagickWandSignature);
4066   if (wand->debug != MagickFalse)
4067     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4068   if (wand->images == (Image *) NULL)
4069     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4070   status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
4071   return(status);
4072 }
4073 \f
4074 /*
4075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4076 %                                                                             %
4077 %                                                                             %
4078 %                                                                             %
4079 %   M a g i c k G e t I m a g e M e a n                                       %
4080 %                                                                             %
4081 %                                                                             %
4082 %                                                                             %
4083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4084 %
4085 %  MagickGetImageMean() gets the mean and standard deviation of one or more
4086 %  image channels.
4087 %
4088 %  The format of the MagickGetImageMean method is:
4089 %
4090 %      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4091 %        double *standard_deviation)
4092 %
4093 %  A description of each parameter follows:
4094 %
4095 %    o wand: the magick wand.
4096 %
4097 %    o channel: the image channel(s).
4098 %
4099 %    o mean:  The mean pixel value for the specified channel(s).
4100 %
4101 %    o standard_deviation:  The standard deviation for the specified channel(s).
4102 %
4103 */
4104 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
4105   double *standard_deviation)
4106 {
4107   MagickBooleanType
4108     status;
4109
4110   assert(wand != (MagickWand *) NULL);
4111   assert(wand->signature == MagickWandSignature);
4112   if (wand->debug != MagickFalse)
4113     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4114   if (wand->images == (Image *) NULL)
4115     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4116   status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
4117   return(status);
4118 }
4119 \f
4120 /*
4121 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4122 %                                                                             %
4123 %                                                                             %
4124 %                                                                             %
4125 %   M a g i c k G e t I m a g e R a n g e                                     %
4126 %                                                                             %
4127 %                                                                             %
4128 %                                                                             %
4129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4130 %
4131 %  MagickGetImageRange() gets the range for one or more image channels.
4132 %
4133 %  The format of the MagickGetImageRange method is:
4134 %
4135 %      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
4136 %        double *maxima)
4137 %
4138 %  A description of each parameter follows:
4139 %
4140 %    o wand: the magick wand.
4141 %
4142 %    o minima:  The minimum pixel value for the specified channel(s).
4143 %
4144 %    o maxima:  The maximum pixel value for the specified channel(s).
4145 %
4146 */
4147 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
4148   double *minima,double *maxima)
4149 {
4150   MagickBooleanType
4151     status;
4152
4153   assert(wand != (MagickWand *) NULL);
4154   assert(wand->signature == MagickWandSignature);
4155   if (wand->debug != MagickFalse)
4156     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4157   if (wand->images == (Image *) NULL)
4158     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4159   status=GetImageRange(wand->images,minima,maxima,wand->exception);
4160   return(status);
4161 }
4162 \f
4163 /*
4164 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4165 %                                                                             %
4166 %                                                                             %
4167 %                                                                             %
4168 %   M a g i c k G e t I m a g e S t a t i s t i c s                           %
4169 %                                                                             %
4170 %                                                                             %
4171 %                                                                             %
4172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4173 %
4174 %  MagickGetImageStatistics() returns statistics for each channel in the
4175 %  image.  The statistics include the channel depth, its minima and
4176 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
4177 %  You can access the red channel mean, for example, like this:
4178 %
4179 %      channel_statistics=MagickGetImageStatistics(wand);
4180 %      red_mean=channel_statistics[RedPixelChannel].mean;
4181 %
4182 %  Use MagickRelinquishMemory() to free the statistics buffer.
4183 %
4184 %  The format of the MagickGetImageStatistics method is:
4185 %
4186 %      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4187 %
4188 %  A description of each parameter follows:
4189 %
4190 %    o wand: the magick wand.
4191 %
4192 */
4193 WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
4194 {
4195   assert(wand != (MagickWand *) NULL);
4196   assert(wand->signature == MagickWandSignature);
4197   if (wand->debug != MagickFalse)
4198     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4199   if (wand->images == (Image *) NULL)
4200     {
4201       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4202         "ContainsNoImages","`%s'",wand->name);
4203       return((ChannelStatistics *) NULL);
4204     }
4205   return(GetImageStatistics(wand->images,wand->exception));
4206 }
4207 \f
4208 /*
4209 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4210 %                                                                             %
4211 %                                                                             %
4212 %                                                                             %
4213 %   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                     %
4214 %                                                                             %
4215 %                                                                             %
4216 %                                                                             %
4217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4218 %
4219 %  MagickGetImageColormapColor() returns the color of the specified colormap
4220 %  index.
4221 %
4222 %  The format of the MagickGetImageColormapColor method is:
4223 %
4224 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4225 %        const size_t index,PixelWand *color)
4226 %
4227 %  A description of each parameter follows:
4228 %
4229 %    o wand: the magick wand.
4230 %
4231 %    o index: the offset into the image colormap.
4232 %
4233 %    o color: Return the colormap color in this wand.
4234 %
4235 */
4236 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4237   const size_t index,PixelWand *color)
4238 {
4239   assert(wand != (MagickWand *) NULL);
4240   assert(wand->signature == MagickWandSignature);
4241   if (wand->debug != MagickFalse)
4242     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4243   if (wand->images == (Image *) NULL)
4244     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4245   if ((wand->images->colormap == (PixelInfo *) NULL) ||
4246       (index >= wand->images->colors))
4247     {
4248       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4249         "InvalidColormapIndex","`%s'",wand->name);
4250       return(MagickFalse);
4251     }
4252   PixelSetPixelColor(color,wand->images->colormap+index);
4253   return(MagickTrue);
4254 }
4255 \f
4256 /*
4257 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4258 %                                                                             %
4259 %                                                                             %
4260 %                                                                             %
4261 %   M a g i c k G e t I m a g e C o l o r s                                   %
4262 %                                                                             %
4263 %                                                                             %
4264 %                                                                             %
4265 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4266 %
4267 %  MagickGetImageColors() gets the number of unique colors in the image.
4268 %
4269 %  The format of the MagickGetImageColors method is:
4270 %
4271 %      size_t MagickGetImageColors(MagickWand *wand)
4272 %
4273 %  A description of each parameter follows:
4274 %
4275 %    o wand: the magick wand.
4276 %
4277 */
4278 WandExport size_t MagickGetImageColors(MagickWand *wand)
4279 {
4280   assert(wand != (MagickWand *) NULL);
4281   assert(wand->signature == MagickWandSignature);
4282   if (wand->debug != MagickFalse)
4283     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4284   if (wand->images == (Image *) NULL)
4285     {
4286       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4287         "ContainsNoImages","`%s'",wand->name);
4288       return(0);
4289     }
4290   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4291 }
4292 \f
4293 /*
4294 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4295 %                                                                             %
4296 %                                                                             %
4297 %                                                                             %
4298 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4299 %                                                                             %
4300 %                                                                             %
4301 %                                                                             %
4302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4303 %
4304 %  MagickGetImageColorspace() gets the image colorspace.
4305 %
4306 %  The format of the MagickGetImageColorspace method is:
4307 %
4308 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4309 %
4310 %  A description of each parameter follows:
4311 %
4312 %    o wand: the magick wand.
4313 %
4314 */
4315 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4316 {
4317   assert(wand != (MagickWand *) NULL);
4318   assert(wand->signature == MagickWandSignature);
4319   if (wand->debug != MagickFalse)
4320     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4321   if (wand->images == (Image *) NULL)
4322     {
4323       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4324         "ContainsNoImages","`%s'",wand->name);
4325       return(UndefinedColorspace);
4326     }
4327   return(wand->images->colorspace);
4328 }
4329 \f
4330 /*
4331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4332 %                                                                             %
4333 %                                                                             %
4334 %                                                                             %
4335 %   M a g i c k G e t I m a g e C o m p o s e                                 %
4336 %                                                                             %
4337 %                                                                             %
4338 %                                                                             %
4339 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4340 %
4341 %  MagickGetImageCompose() returns the composite operator associated with the
4342 %  image.
4343 %
4344 %  The format of the MagickGetImageCompose method is:
4345 %
4346 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4347 %
4348 %  A description of each parameter follows:
4349 %
4350 %    o wand: the magick wand.
4351 %
4352 */
4353 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4354 {
4355   assert(wand != (MagickWand *) NULL);
4356   assert(wand->signature == MagickWandSignature);
4357   if (wand->debug != MagickFalse)
4358     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4359   if (wand->images == (Image *) NULL)
4360     {
4361       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4362         "ContainsNoImages","`%s'",wand->name);
4363       return(UndefinedCompositeOp);
4364     }
4365   return(wand->images->compose);
4366 }
4367 \f
4368 /*
4369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4370 %                                                                             %
4371 %                                                                             %
4372 %                                                                             %
4373 %   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                         %
4374 %                                                                             %
4375 %                                                                             %
4376 %                                                                             %
4377 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4378 %
4379 %  MagickGetImageCompression() gets the image compression.
4380 %
4381 %  The format of the MagickGetImageCompression method is:
4382 %
4383 %      CompressionType MagickGetImageCompression(MagickWand *wand)
4384 %
4385 %  A description of each parameter follows:
4386 %
4387 %    o wand: the magick wand.
4388 %
4389 */
4390 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4391 {
4392   assert(wand != (MagickWand *) NULL);
4393   assert(wand->signature == MagickWandSignature);
4394   if (wand->debug != MagickFalse)
4395     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4396   if (wand->images == (Image *) NULL)
4397     {
4398       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4399         "ContainsNoImages","`%s'",wand->name);
4400       return(UndefinedCompression);
4401     }
4402   return(wand->images->compression);
4403 }
4404 \f
4405 /*
4406 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4407 %                                                                             %
4408 %                                                                             %
4409 %                                                                             %
4410 %   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           %
4411 %                                                                             %
4412 %                                                                             %
4413 %                                                                             %
4414 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4415 %
4416 %  MagickGetImageCompressionQuality() gets the image compression quality.
4417 %
4418 %  The format of the MagickGetImageCompressionQuality method is:
4419 %
4420 %      size_t MagickGetImageCompressionQuality(MagickWand *wand)
4421 %
4422 %  A description of each parameter follows:
4423 %
4424 %    o wand: the magick wand.
4425 %
4426 */
4427 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4428 {
4429   assert(wand != (MagickWand *) NULL);
4430   assert(wand->signature == MagickWandSignature);
4431   if (wand->debug != MagickFalse)
4432     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4433   if (wand->images == (Image *) NULL)
4434     {
4435       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4436         "ContainsNoImages","`%s'",wand->name);
4437       return(0UL);
4438     }
4439   return(wand->images->quality);
4440 }
4441 \f
4442 /*
4443 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4444 %                                                                             %
4445 %                                                                             %
4446 %                                                                             %
4447 %   M a g i c k G e t I m a g e D e l a y                                     %
4448 %                                                                             %
4449 %                                                                             %
4450 %                                                                             %
4451 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4452 %
4453 %  MagickGetImageDelay() gets the image delay.
4454 %
4455 %  The format of the MagickGetImageDelay method is:
4456 %
4457 %      size_t MagickGetImageDelay(MagickWand *wand)
4458 %
4459 %  A description of each parameter follows:
4460 %
4461 %    o wand: the magick wand.
4462 %
4463 */
4464 WandExport size_t MagickGetImageDelay(MagickWand *wand)
4465 {
4466   assert(wand != (MagickWand *) NULL);
4467   assert(wand->signature == MagickWandSignature);
4468   if (wand->debug != MagickFalse)
4469     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4470   if (wand->images == (Image *) NULL)
4471     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4472   return(wand->images->delay);
4473 }
4474 \f
4475 /*
4476 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4477 %                                                                             %
4478 %                                                                             %
4479 %                                                                             %
4480 %   M a g i c k G e t I m a g e D e p t h                                     %
4481 %                                                                             %
4482 %                                                                             %
4483 %                                                                             %
4484 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4485 %
4486 %  MagickGetImageDepth() gets the image depth.
4487 %
4488 %  The format of the MagickGetImageDepth method is:
4489 %
4490 %      size_t MagickGetImageDepth(MagickWand *wand)
4491 %
4492 %  A description of each parameter follows:
4493 %
4494 %    o wand: the magick wand.
4495 %
4496 */
4497 WandExport size_t MagickGetImageDepth(MagickWand *wand)
4498 {
4499   assert(wand != (MagickWand *) NULL);
4500   assert(wand->signature == MagickWandSignature);
4501   if (wand->debug != MagickFalse)
4502     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4503   if (wand->images == (Image *) NULL)
4504     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4505   return(wand->images->depth);
4506 }
4507 \f
4508 /*
4509 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4510 %                                                                             %
4511 %                                                                             %
4512 %                                                                             %
4513 %   M a g i c k G e t I m a g e D i s p o s e                                 %
4514 %                                                                             %
4515 %                                                                             %
4516 %                                                                             %
4517 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4518 %
4519 %  MagickGetImageDispose() gets the image disposal method.
4520 %
4521 %  The format of the MagickGetImageDispose method is:
4522 %
4523 %      DisposeType MagickGetImageDispose(MagickWand *wand)
4524 %
4525 %  A description of each parameter follows:
4526 %
4527 %    o wand: the magick wand.
4528 %
4529 */
4530 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4531 {
4532   assert(wand != (MagickWand *) NULL);
4533   assert(wand->signature == MagickWandSignature);
4534   if (wand->debug != MagickFalse)
4535     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4536   if (wand->images == (Image *) NULL)
4537     {
4538       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4539         "ContainsNoImages","`%s'",wand->name);
4540       return(UndefinedDispose);
4541     }
4542   return((DisposeType) wand->images->dispose);
4543 }
4544 \f
4545 /*
4546 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4547 %                                                                             %
4548 %                                                                             %
4549 %                                                                             %
4550 %   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4551 %                                                                             %
4552 %                                                                             %
4553 %                                                                             %
4554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4555 %
4556 %  MagickGetImageDistortion() compares an image to a reconstructed image and
4557 %  returns the specified distortion metric.
4558 %
4559 %  The format of the MagickGetImageDistortion method is:
4560 %
4561 %      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4562 %        const MagickWand *reference,const MetricType metric,
4563 %        double *distortion)
4564 %
4565 %  A description of each parameter follows:
4566 %
4567 %    o wand: the magick wand.
4568 %
4569 %    o reference: the reference wand.
4570 %
4571 %    o metric: the metric.
4572 %
4573 %    o distortion: the computed distortion between the images.
4574 %
4575 */
4576 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4577   const MagickWand *reference,const MetricType metric,double *distortion)
4578 {
4579   MagickBooleanType
4580     status;
4581
4582   assert(wand != (MagickWand *) NULL);
4583   assert(wand->signature == MagickWandSignature);
4584   if (wand->debug != MagickFalse)
4585     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4586   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4587     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4588   status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4589     wand->exception);
4590   return(status);
4591 }
4592 \f
4593 /*
4594 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4595 %                                                                             %
4596 %                                                                             %
4597 %                                                                             %
4598 %   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                         %
4599 %                                                                             %
4600 %                                                                             %
4601 %                                                                             %
4602 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4603 %
4604 %  MagickGetImageDistortions() compares one or more pixel channels of an
4605 %  image to a reconstructed image and returns the specified distortion metrics.
4606 %
4607 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4608 %
4609 %  The format of the MagickGetImageDistortion method is:
4610 %
4611 %      double *MagickGetImageDistortion(MagickWand *wand,
4612 %        const MagickWand *reference,const MetricType metric)
4613 %
4614 %  A description of each parameter follows:
4615 %
4616 %    o wand: the magick wand.
4617 %
4618 %    o reference: the reference wand.
4619 %
4620 %    o metric: the metric.
4621 %
4622 */
4623 WandExport double *MagickGetImageDistortions(MagickWand *wand,
4624   const MagickWand *reference,const MetricType metric)
4625 {
4626   double
4627     *channel_distortion;
4628
4629   assert(wand != (MagickWand *) NULL);
4630   assert(wand->signature == MagickWandSignature);
4631   if (wand->debug != MagickFalse)
4632     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4633   assert(reference != (MagickWand *) NULL);
4634   assert(reference->signature == MagickWandSignature);
4635   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4636     {
4637       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4638         "ContainsNoImages","`%s'",wand->name);
4639       return((double *) NULL);
4640     }
4641   channel_distortion=GetImageDistortions(wand->images,reference->images,
4642     metric,wand->exception);
4643   return(channel_distortion);
4644 }
4645 \f
4646 /*
4647 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4648 %                                                                             %
4649 %                                                                             %
4650 %                                                                             %
4651 %   M a g i c k G e t I m a g e E n d i a n                                   %
4652 %                                                                             %
4653 %                                                                             %
4654 %                                                                             %
4655 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4656 %
4657 %  MagickGetImageEndian() gets the image endian.
4658 %
4659 %  The format of the MagickGetImageEndian method is:
4660 %
4661 %      EndianType MagickGetImageEndian(MagickWand *wand)
4662 %
4663 %  A description of each parameter follows:
4664 %
4665 %    o wand: the magick wand.
4666 %
4667 */
4668 WandExport EndianType MagickGetImageEndian(MagickWand *wand)
4669 {
4670   assert(wand != (MagickWand *) NULL);
4671   assert(wand->signature == MagickWandSignature);
4672   if (wand->debug != MagickFalse)
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(UndefinedEndian);
4679     }
4680   return(wand->images->endian);
4681 }
4682 \f
4683 /*
4684 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4685 %                                                                             %
4686 %                                                                             %
4687 %                                                                             %
4688 %   M a g i c k G e t I m a g e F i l e n a m e                               %
4689 %                                                                             %
4690 %                                                                             %
4691 %                                                                             %
4692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4693 %
4694 %  MagickGetImageFilename() returns the filename of a particular image in a
4695 %  sequence.
4696 %
4697 %  The format of the MagickGetImageFilename method is:
4698 %
4699 %      char *MagickGetImageFilename(MagickWand *wand)
4700 %
4701 %  A description of each parameter follows:
4702 %
4703 %    o wand: the magick wand.
4704 %
4705 */
4706 WandExport char *MagickGetImageFilename(MagickWand *wand)
4707 {
4708   assert(wand != (MagickWand *) NULL);
4709   assert(wand->signature == MagickWandSignature);
4710   if (wand->debug != MagickFalse)
4711     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4712   if (wand->images == (Image *) NULL)
4713     {
4714       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4715         "ContainsNoImages","`%s'",wand->name);
4716       return((char *) NULL);
4717     }
4718   return(AcquireString(wand->images->filename));
4719 }
4720 \f
4721 /*
4722 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4723 %                                                                             %
4724 %                                                                             %
4725 %                                                                             %
4726 %   M a g i c k G e t I m a g e F o r m a t                                   %
4727 %                                                                             %
4728 %                                                                             %
4729 %                                                                             %
4730 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4731 %
4732 %  MagickGetImageFormat() returns the format of a particular image in a
4733 %  sequence.
4734 %
4735 %  The format of the MagickGetImageFormat method is:
4736 %
4737 %      char *MagickGetImageFormat(MagickWand *wand)
4738 %
4739 %  A description of each parameter follows:
4740 %
4741 %    o wand: the magick wand.
4742 %
4743 */
4744 WandExport char *MagickGetImageFormat(MagickWand *wand)
4745 {
4746   assert(wand != (MagickWand *) NULL);
4747   assert(wand->signature == MagickWandSignature);
4748   if (wand->debug != MagickFalse)
4749     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4750   if (wand->images == (Image *) NULL)
4751     {
4752       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4753         "ContainsNoImages","`%s'",wand->name);
4754       return((char *) NULL);
4755     }
4756   return(AcquireString(wand->images->magick));
4757 }
4758 \f
4759 /*
4760 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4761 %                                                                             %
4762 %                                                                             %
4763 %                                                                             %
4764 %   M a g i c k G e t I m a g e F u z z                                       %
4765 %                                                                             %
4766 %                                                                             %
4767 %                                                                             %
4768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4769 %
4770 %  MagickGetImageFuzz() gets the image fuzz.
4771 %
4772 %  The format of the MagickGetImageFuzz method is:
4773 %
4774 %      double MagickGetImageFuzz(MagickWand *wand)
4775 %
4776 %  A description of each parameter follows:
4777 %
4778 %    o wand: the magick wand.
4779 %
4780 */
4781 WandExport double MagickGetImageFuzz(MagickWand *wand)
4782 {
4783   assert(wand != (MagickWand *) NULL);
4784   assert(wand->signature == MagickWandSignature);
4785   if (wand->debug != MagickFalse)
4786     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4787   if (wand->images == (Image *) NULL)
4788     {
4789       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4790         "ContainsNoImages","`%s'",wand->name);
4791       return(0.0);
4792     }
4793   return(wand->images->fuzz);
4794 }
4795 \f
4796 /*
4797 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4798 %                                                                             %
4799 %                                                                             %
4800 %                                                                             %
4801 %   M a g i c k G e t I m a g e G a m m a                                     %
4802 %                                                                             %
4803 %                                                                             %
4804 %                                                                             %
4805 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4806 %
4807 %  MagickGetImageGamma() gets the image gamma.
4808 %
4809 %  The format of the MagickGetImageGamma method is:
4810 %
4811 %      double MagickGetImageGamma(MagickWand *wand)
4812 %
4813 %  A description of each parameter follows:
4814 %
4815 %    o wand: the magick wand.
4816 %
4817 */
4818 WandExport double MagickGetImageGamma(MagickWand *wand)
4819 {
4820   assert(wand != (MagickWand *) NULL);
4821   assert(wand->signature == MagickWandSignature);
4822   if (wand->debug != MagickFalse)
4823     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4824   if (wand->images == (Image *) NULL)
4825     {
4826       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4827         "ContainsNoImages","`%s'",wand->name);
4828       return(0.0);
4829     }
4830   return(wand->images->gamma);
4831 }
4832 \f
4833 /*
4834 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4835 %                                                                             %
4836 %                                                                             %
4837 %                                                                             %
4838 %   M a g i c k G e t I m a g e G r a v i t y                                 %
4839 %                                                                             %
4840 %                                                                             %
4841 %                                                                             %
4842 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4843 %
4844 %  MagickGetImageGravity() gets the image gravity.
4845 %
4846 %  The format of the MagickGetImageGravity method is:
4847 %
4848 %      GravityType MagickGetImageGravity(MagickWand *wand)
4849 %
4850 %  A description of each parameter follows:
4851 %
4852 %    o wand: the magick wand.
4853 %
4854 */
4855 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4856 {
4857   assert(wand != (MagickWand *) NULL);
4858   assert(wand->signature == MagickWandSignature);
4859   if (wand->debug != MagickFalse)
4860     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4861   if (wand->images == (Image *) NULL)
4862     {
4863       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4864         "ContainsNoImages","`%s'",wand->name);
4865       return(UndefinedGravity);
4866     }
4867   return(wand->images->gravity);
4868 }
4869 \f
4870 /*
4871 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4872 %                                                                             %
4873 %                                                                             %
4874 %                                                                             %
4875 %   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                       %
4876 %                                                                             %
4877 %                                                                             %
4878 %                                                                             %
4879 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4880 %
4881 %  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4882 %
4883 %  The format of the MagickGetImageGreenPrimary method is:
4884 %
4885 %      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4886 %        double *y)
4887 %
4888 %  A description of each parameter follows:
4889 %
4890 %    o wand: the magick wand.
4891 %
4892 %    o x: the chromaticity green primary x-point.
4893 %
4894 %    o y: the chromaticity green primary y-point.
4895 %
4896 */
4897 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4898   double *x,double *y)
4899 {
4900   assert(wand != (MagickWand *) NULL);
4901   assert(wand->signature == MagickWandSignature);
4902   if (wand->debug != MagickFalse)
4903     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4904   if (wand->images == (Image *) NULL)
4905     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4906   *x=wand->images->chromaticity.green_primary.x;
4907   *y=wand->images->chromaticity.green_primary.y;
4908   return(MagickTrue);
4909 }
4910 \f
4911 /*
4912 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4913 %                                                                             %
4914 %                                                                             %
4915 %                                                                             %
4916 %   M a g i c k G e t I m a g e H e i g h t                                   %
4917 %                                                                             %
4918 %                                                                             %
4919 %                                                                             %
4920 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4921 %
4922 %  MagickGetImageHeight() returns the image height.
4923 %
4924 %  The format of the MagickGetImageHeight method is:
4925 %
4926 %      size_t MagickGetImageHeight(MagickWand *wand)
4927 %
4928 %  A description of each parameter follows:
4929 %
4930 %    o wand: the magick wand.
4931 %
4932 */
4933 WandExport size_t MagickGetImageHeight(MagickWand *wand)
4934 {
4935   assert(wand != (MagickWand *) NULL);
4936   assert(wand->signature == MagickWandSignature);
4937   if (wand->debug != MagickFalse)
4938     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4939   if (wand->images == (Image *) NULL)
4940     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4941   return(wand->images->rows);
4942 }
4943 \f
4944 /*
4945 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4946 %                                                                             %
4947 %                                                                             %
4948 %                                                                             %
4949 %   M a g i c k G e t I m a g e H i s t o g r a m                             %
4950 %                                                                             %
4951 %                                                                             %
4952 %                                                                             %
4953 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4954 %
4955 %  MagickGetImageHistogram() returns the image histogram as an array of
4956 %  PixelWand wands.
4957 %
4958 %  The format of the MagickGetImageHistogram method is:
4959 %
4960 %      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4961 %        size_t *number_colors)
4962 %
4963 %  A description of each parameter follows:
4964 %
4965 %    o wand: the magick wand.
4966 %
4967 %    o number_colors: the number of unique colors in the image and the number
4968 %      of pixel wands returned.
4969 %
4970 */
4971 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4972   size_t *number_colors)
4973 {
4974   PixelInfo
4975     *histogram;
4976
4977   PixelWand
4978     **pixel_wands;
4979
4980   register ssize_t
4981     i;
4982
4983   assert(wand != (MagickWand *) NULL);
4984   assert(wand->signature == MagickWandSignature);
4985   if (wand->debug != MagickFalse)
4986     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4987   if (wand->images == (Image *) NULL)
4988     {
4989       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4990         "ContainsNoImages","`%s'",wand->name);
4991       return((PixelWand **) NULL);
4992     }
4993   histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4994   if (histogram == (PixelInfo *) NULL)
4995     return((PixelWand **) NULL);
4996   pixel_wands=NewPixelWands(*number_colors);
4997   for (i=0; i < (ssize_t) *number_colors; i++)
4998   {
4999     PixelSetPixelColor(pixel_wands[i],&histogram[i]);
5000     PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
5001   }
5002   histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
5003   return(pixel_wands);
5004 }
5005 \f
5006 /*
5007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5008 %                                                                             %
5009 %                                                                             %
5010 %                                                                             %
5011 %   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                 %
5012 %                                                                             %
5013 %                                                                             %
5014 %                                                                             %
5015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5016 %
5017 %  MagickGetImageInterlaceScheme() gets the image interlace scheme.
5018 %
5019 %  The format of the MagickGetImageInterlaceScheme method is:
5020 %
5021 %      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5022 %
5023 %  A description of each parameter follows:
5024 %
5025 %    o wand: the magick wand.
5026 %
5027 */
5028 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5029 {
5030   assert(wand != (MagickWand *) NULL);
5031   assert(wand->signature == MagickWandSignature);
5032   if (wand->debug != MagickFalse)
5033     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5034   if (wand->images == (Image *) NULL)
5035     {
5036       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5037         "ContainsNoImages","`%s'",wand->name);
5038       return(UndefinedInterlace);
5039     }
5040   return(wand->images->interlace);
5041 }
5042 \f
5043 /*
5044 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5045 %                                                                             %
5046 %                                                                             %
5047 %                                                                             %
5048 %   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             %
5049 %                                                                             %
5050 %                                                                             %
5051 %                                                                             %
5052 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5053 %
5054 %  MagickGetImageInterpolateMethod() returns the interpolation method for the
5055 %  sepcified image.
5056 %
5057 %  The format of the MagickGetImageInterpolateMethod method is:
5058 %
5059 %      PixelInterpolateMethod MagickGetImagePixelInterpolateMethod(
5060 %        MagickWand *wand)
5061 %
5062 %  A description of each parameter follows:
5063 %
5064 %    o wand: the magick wand.
5065 %
5066 */
5067 WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
5068   MagickWand *wand)
5069 {
5070   assert(wand != (MagickWand *) NULL);
5071   assert(wand->signature == MagickWandSignature);
5072   if (wand->debug != MagickFalse)
5073     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5074   if (wand->images == (Image *) NULL)
5075     {
5076       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5077         "ContainsNoImages","`%s'",wand->name);
5078       return(UndefinedInterpolatePixel);
5079     }
5080   return(wand->images->interpolate);
5081 }
5082 \f
5083 /*
5084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5085 %                                                                             %
5086 %                                                                             %
5087 %                                                                             %
5088 %   M a g i c k G e t I m a g e I t e r a t i o n s                           %
5089 %                                                                             %
5090 %                                                                             %
5091 %                                                                             %
5092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5093 %
5094 %  MagickGetImageIterations() gets the image iterations.
5095 %
5096 %  The format of the MagickGetImageIterations method is:
5097 %
5098 %      size_t MagickGetImageIterations(MagickWand *wand)
5099 %
5100 %  A description of each parameter follows:
5101 %
5102 %    o wand: the magick wand.
5103 %
5104 */
5105 WandExport size_t MagickGetImageIterations(MagickWand *wand)
5106 {
5107   assert(wand != (MagickWand *) NULL);
5108   assert(wand->signature == MagickWandSignature);
5109   if (wand->debug != MagickFalse)
5110     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5111   if (wand->images == (Image *) NULL)
5112     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5113   return(wand->images->iterations);
5114 }
5115 \f
5116 /*
5117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5118 %                                                                             %
5119 %                                                                             %
5120 %                                                                             %
5121 %   M a g i c k G e t I m a g e L e n g t h                                   %
5122 %                                                                             %
5123 %                                                                             %
5124 %                                                                             %
5125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5126 %
5127 %  MagickGetImageLength() returns the image length in bytes.
5128 %
5129 %  The format of the MagickGetImageLength method is:
5130 %
5131 %      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5132 %        MagickSizeType *length)
5133 %
5134 %  A description of each parameter follows:
5135 %
5136 %    o wand: the magick wand.
5137 %
5138 %    o length: the image length in bytes.
5139 %
5140 */
5141 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5142   MagickSizeType *length)
5143 {
5144   assert(wand != (MagickWand *) NULL);
5145   assert(wand->signature == MagickWandSignature);
5146   if (wand->debug != MagickFalse)
5147     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5148   if (wand->images == (Image *) NULL)
5149     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5150   *length=GetBlobSize(wand->images);
5151   return(MagickTrue);
5152 }
5153 \f
5154 /*
5155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5156 %                                                                             %
5157 %                                                                             %
5158 %                                                                             %
5159 %   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5160 %                                                                             %
5161 %                                                                             %
5162 %                                                                             %
5163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5164 %
5165 %  MagickGetImageMatteColor() returns the image matte color.
5166 %
5167 %  The format of the MagickGetImageMatteColor method is:
5168 %
5169 %      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5170 %        PixelWand *matte_color)
5171 %
5172 %  A description of each parameter follows:
5173 %
5174 %    o wand: the magick wand.
5175 %
5176 %    o matte_color: Return the matte color.
5177 %
5178 */
5179 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5180   PixelWand *matte_color)
5181 {
5182   assert(wand != (MagickWand *) NULL);
5183   assert(wand->signature == MagickWandSignature);
5184   if (wand->debug != MagickFalse)
5185     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5186   if (wand->images == (Image *) NULL)
5187     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5188   PixelSetPixelColor(matte_color,&wand->images->matte_color);
5189   return(MagickTrue);
5190 }
5191 \f
5192 /*
5193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5194 %                                                                             %
5195 %                                                                             %
5196 %                                                                             %
5197 %   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                         %
5198 %                                                                             %
5199 %                                                                             %
5200 %                                                                             %
5201 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5202 %
5203 %  MagickGetImageOrientation() returns the image orientation.
5204 %
5205 %  The format of the MagickGetImageOrientation method is:
5206 %
5207 %      OrientationType MagickGetImageOrientation(MagickWand *wand)
5208 %
5209 %  A description of each parameter follows:
5210 %
5211 %    o wand: the magick wand.
5212 %
5213 */
5214 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5215 {
5216   assert(wand != (MagickWand *) NULL);
5217   assert(wand->signature == MagickWandSignature);
5218   if (wand->debug != MagickFalse)
5219     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5220   if (wand->images == (Image *) NULL)
5221     {
5222       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5223         "ContainsNoImages","`%s'",wand->name);
5224       return(UndefinedOrientation);
5225     }
5226   return(wand->images->orientation);
5227 }
5228 \f
5229 /*
5230 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5231 %                                                                             %
5232 %                                                                             %
5233 %                                                                             %
5234 %   M a g i c k G e t I m a g e P a g e                                       %
5235 %                                                                             %
5236 %                                                                             %
5237 %                                                                             %
5238 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5239 %
5240 %  MagickGetImagePage() returns the page geometry associated with the image.
5241 %
5242 %  The format of the MagickGetImagePage method is:
5243 %
5244 %      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5245 %        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5246 %
5247 %  A description of each parameter follows:
5248 %
5249 %    o wand: the magick wand.
5250 %
5251 %    o width: the page width.
5252 %
5253 %    o height: the page height.
5254 %
5255 %    o x: the page x-offset.
5256 %
5257 %    o y: the page y-offset.
5258 %
5259 */
5260 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5261   size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5262 {
5263   assert(wand != (const MagickWand *) NULL);
5264   assert(wand->signature == MagickWandSignature);
5265   if (wand->debug != MagickFalse)
5266     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5267   if (wand->images == (Image *) NULL)
5268     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5269   *width=wand->images->page.width;
5270   *height=wand->images->page.height;
5271   *x=wand->images->page.x;
5272   *y=wand->images->page.y;
5273   return(MagickTrue);
5274 }
5275 \f
5276 /*
5277 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5278 %                                                                             %
5279 %                                                                             %
5280 %                                                                             %
5281 %   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5282 %                                                                             %
5283 %                                                                             %
5284 %                                                                             %
5285 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5286 %
5287 %  MagickGetImagePixelColor() returns the color of the specified pixel.
5288 %
5289 %  The format of the MagickGetImagePixelColor method is:
5290 %
5291 %      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5292 %        const ssize_t x,const ssize_t y,PixelWand *color)
5293 %
5294 %  A description of each parameter follows:
5295 %
5296 %    o wand: the magick wand.
5297 %
5298 %    o x,y: the pixel offset into the image.
5299 %
5300 %    o color: Return the colormap color in this wand.
5301 %
5302 */
5303 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5304   const ssize_t x,const ssize_t y,PixelWand *color)
5305 {
5306   register const Quantum
5307     *p;
5308
5309   CacheView
5310     *image_view;
5311
5312   assert(wand != (MagickWand *) NULL);
5313   assert(wand->signature == MagickWandSignature);
5314   if (wand->debug != MagickFalse)
5315     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5316   if (wand->images == (Image *) NULL)
5317     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5318   image_view=AcquireVirtualCacheView(wand->images,wand->exception);
5319   p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5320   if (p == (const Quantum *) NULL)
5321     {
5322       image_view=DestroyCacheView(image_view);
5323       return(MagickFalse);
5324     }
5325   PixelSetQuantumPixel(wand->images,p,color);
5326   image_view=DestroyCacheView(image_view);
5327   return(MagickTrue);
5328 }
5329 \f
5330 /*
5331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5332 %                                                                             %
5333 %                                                                             %
5334 %                                                                             %
5335 %   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5336 %                                                                             %
5337 %                                                                             %
5338 %                                                                             %
5339 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5340 %
5341 %  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5342 %
5343 %  The format of the MagickGetImageRedPrimary method is:
5344 %
5345 %      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5346 %        double *y)
5347 %
5348 %  A description of each parameter follows:
5349 %
5350 %    o wand: the magick wand.
5351 %
5352 %    o x: the chromaticity red primary x-point.
5353 %
5354 %    o y: the chromaticity red primary y-point.
5355 %
5356 */
5357 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5358   double *x,double *y)
5359 {
5360   assert(wand != (MagickWand *) NULL);
5361   assert(wand->signature == MagickWandSignature);
5362   if (wand->debug != MagickFalse)
5363     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5364   if (wand->images == (Image *) NULL)
5365     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5366   *x=wand->images->chromaticity.red_primary.x;
5367   *y=wand->images->chromaticity.red_primary.y;
5368   return(MagickTrue);
5369 }
5370 \f
5371 /*
5372 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5373 %                                                                             %
5374 %                                                                             %
5375 %                                                                             %
5376 %   M a g i c k G e t I m a g e R e g i o n                                   %
5377 %                                                                             %
5378 %                                                                             %
5379 %                                                                             %
5380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5381 %
5382 %  MagickGetImageRegion() extracts a region of the image and returns it as a
5383 %  a new wand.
5384 %
5385 %  The format of the MagickGetImageRegion method is:
5386 %
5387 %      MagickWand *MagickGetImageRegion(MagickWand *wand,
5388 %        const size_t width,const size_t height,const ssize_t x,
5389 %        const ssize_t y)
5390 %
5391 %  A description of each parameter follows:
5392 %
5393 %    o wand: the magick wand.
5394 %
5395 %    o width: the region width.
5396 %
5397 %    o height: the region height.
5398 %
5399 %    o x: the region x offset.
5400 %
5401 %    o y: the region y offset.
5402 %
5403 */
5404 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5405   const size_t width,const size_t height,const ssize_t x,
5406   const ssize_t y)
5407 {
5408   Image
5409     *region_image;
5410
5411   RectangleInfo
5412     region;
5413
5414   assert(wand != (MagickWand *) NULL);
5415   assert(wand->signature == MagickWandSignature);
5416   if (wand->debug != MagickFalse)
5417     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5418   if (wand->images == (Image *) NULL)
5419     return((MagickWand *) NULL);
5420   region.width=width;
5421   region.height=height;
5422   region.x=x;
5423   region.y=y;
5424   region_image=CropImage(wand->images,&region,wand->exception);
5425   if (region_image == (Image *) NULL)
5426     return((MagickWand *) NULL);
5427   return(CloneMagickWandFromImages(wand,region_image));
5428 }
5429 \f
5430 /*
5431 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5432 %                                                                             %
5433 %                                                                             %
5434 %                                                                             %
5435 %   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                 %
5436 %                                                                             %
5437 %                                                                             %
5438 %                                                                             %
5439 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5440 %
5441 %  MagickGetImageRenderingIntent() gets the image rendering intent.
5442 %
5443 %  The format of the MagickGetImageRenderingIntent method is:
5444 %
5445 %      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5446 %
5447 %  A description of each parameter follows:
5448 %
5449 %    o wand: the magick wand.
5450 %
5451 */
5452 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5453 {
5454   assert(wand != (MagickWand *) NULL);
5455   assert(wand->signature == MagickWandSignature);
5456   if (wand->debug != MagickFalse)
5457     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5458   if (wand->images == (Image *) NULL)
5459     {
5460       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5461         "ContainsNoImages","`%s'",wand->name);
5462       return(UndefinedIntent);
5463     }
5464   return((RenderingIntent) wand->images->rendering_intent);
5465 }
5466 \f
5467 /*
5468 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5469 %                                                                             %
5470 %                                                                             %
5471 %                                                                             %
5472 %   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5473 %                                                                             %
5474 %                                                                             %
5475 %                                                                             %
5476 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5477 %
5478 %  MagickGetImageResolution() gets the image X and Y resolution.
5479 %
5480 %  The format of the MagickGetImageResolution method is:
5481 %
5482 %      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5483 %        double *y)
5484 %
5485 %  A description of each parameter follows:
5486 %
5487 %    o wand: the magick wand.
5488 %
5489 %    o x: the image x-resolution.
5490 %
5491 %    o y: the image y-resolution.
5492 %
5493 */
5494 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5495   double *x,double *y)
5496 {
5497   assert(wand != (MagickWand *) NULL);
5498   assert(wand->signature == MagickWandSignature);
5499   if (wand->debug != MagickFalse)
5500     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5501   if (wand->images == (Image *) NULL)
5502     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5503   *x=wand->images->resolution.x;
5504   *y=wand->images->resolution.y;
5505   return(MagickTrue);
5506 }
5507 \f
5508 /*
5509 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5510 %                                                                             %
5511 %                                                                             %
5512 %                                                                             %
5513 %   M a g i c k G e t I m a g e S c e n e                                     %
5514 %                                                                             %
5515 %                                                                             %
5516 %                                                                             %
5517 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5518 %
5519 %  MagickGetImageScene() gets the image scene.
5520 %
5521 %  The format of the MagickGetImageScene method is:
5522 %
5523 %      size_t MagickGetImageScene(MagickWand *wand)
5524 %
5525 %  A description of each parameter follows:
5526 %
5527 %    o wand: the magick wand.
5528 %
5529 */
5530 WandExport size_t MagickGetImageScene(MagickWand *wand)
5531 {
5532   assert(wand != (MagickWand *) NULL);
5533   assert(wand->signature == MagickWandSignature);
5534   if (wand->debug != MagickFalse)
5535     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5536   if (wand->images == (Image *) NULL)
5537     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5538   return(wand->images->scene);
5539 }
5540 \f
5541 /*
5542 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5543 %                                                                             %
5544 %                                                                             %
5545 %                                                                             %
5546 %   M a g i c k G e t I m a g e S i g n a t u r e                             %
5547 %                                                                             %
5548 %                                                                             %
5549 %                                                                             %
5550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5551 %
5552 %  MagickGetImageSignature() generates an SHA-256 message digest for the image
5553 %  pixel stream.
5554 %
5555 %  The format of the MagickGetImageSignature method is:
5556 %
5557 %      char *MagickGetImageSignature(MagickWand *wand)
5558 %
5559 %  A description of each parameter follows:
5560 %
5561 %    o wand: the magick wand.
5562 %
5563 */
5564 WandExport char *MagickGetImageSignature(MagickWand *wand)
5565 {
5566   const char
5567     *value;
5568
5569   MagickBooleanType
5570     status;
5571
5572   assert(wand != (MagickWand *) NULL);
5573   assert(wand->signature == MagickWandSignature);
5574   if (wand->debug != MagickFalse)
5575     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5576   if (wand->images == (Image *) NULL)
5577     {
5578       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5579         "ContainsNoImages","`%s'",wand->name);
5580       return((char *) NULL);
5581     }
5582   status=SignatureImage(wand->images,wand->exception);
5583   if (status == MagickFalse)
5584     return((char *) NULL);
5585   value=GetImageProperty(wand->images,"signature",wand->exception);
5586   if (value == (const char *) NULL)
5587     return((char *) NULL);
5588   return(AcquireString(value));
5589 }
5590 \f
5591 /*
5592 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5593 %                                                                             %
5594 %                                                                             %
5595 %                                                                             %
5596 %   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                   %
5597 %                                                                             %
5598 %                                                                             %
5599 %                                                                             %
5600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5601 %
5602 %  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5603 %
5604 %  The format of the MagickGetImageTicksPerSecond method is:
5605 %
5606 %      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5607 %
5608 %  A description of each parameter follows:
5609 %
5610 %    o wand: the magick wand.
5611 %
5612 */
5613 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5614 {
5615   assert(wand != (MagickWand *) NULL);
5616   assert(wand->signature == MagickWandSignature);
5617   if (wand->debug != MagickFalse)
5618     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5619   if (wand->images == (Image *) NULL)
5620     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5621   return((size_t) wand->images->ticks_per_second);
5622 }
5623 \f
5624 /*
5625 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5626 %                                                                             %
5627 %                                                                             %
5628 %                                                                             %
5629 %   M a g i c k G e t I m a g e T y p e                                       %
5630 %                                                                             %
5631 %                                                                             %
5632 %                                                                             %
5633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5634 %
5635 %  MagickGetImageType() gets the potential image type:
5636 %
5637 %        Bilevel        Grayscale       GrayscaleMatte
5638 %        Palette        PaletteMatte    TrueColor
5639 %        TrueColorMatte ColorSeparation ColorSeparationMatte
5640 %
5641 %  The format of the MagickGetImageType method is:
5642 %
5643 %      ImageType MagickGetImageType(MagickWand *wand)
5644 %
5645 %  A description of each parameter follows:
5646 %
5647 %    o wand: the magick wand.
5648 %
5649 */
5650 WandExport ImageType MagickGetImageType(MagickWand *wand)
5651 {
5652   assert(wand != (MagickWand *) NULL);
5653   assert(wand->signature == MagickWandSignature);
5654   if (wand->debug != MagickFalse)
5655     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5656   if (wand->images == (Image *) NULL)
5657     {
5658       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5659         "ContainsNoImages","`%s'",wand->name);
5660       return(UndefinedType);
5661     }
5662   return(GetImageType(wand->images));
5663 }
5664 \f
5665 /*
5666 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5667 %                                                                             %
5668 %                                                                             %
5669 %                                                                             %
5670 %   M a g i c k G e t I m a g e U n i t s                                     %
5671 %                                                                             %
5672 %                                                                             %
5673 %                                                                             %
5674 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5675 %
5676 %  MagickGetImageUnits() gets the image units of resolution.
5677 %
5678 %  The format of the MagickGetImageUnits method is:
5679 %
5680 %      ResolutionType MagickGetImageUnits(MagickWand *wand)
5681 %
5682 %  A description of each parameter follows:
5683 %
5684 %    o wand: the magick wand.
5685 %
5686 */
5687 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5688 {
5689   assert(wand != (MagickWand *) NULL);
5690   assert(wand->signature == MagickWandSignature);
5691   if (wand->debug != MagickFalse)
5692     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5693   if (wand->images == (Image *) NULL)
5694     {
5695       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5696         "ContainsNoImages","`%s'",wand->name);
5697       return(UndefinedResolution);
5698     }
5699   return(wand->images->units);
5700 }
5701 \f
5702 /*
5703 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5704 %                                                                             %
5705 %                                                                             %
5706 %                                                                             %
5707 %   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           %
5708 %                                                                             %
5709 %                                                                             %
5710 %                                                                             %
5711 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5712 %
5713 %  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5714 %  sepcified image.
5715 %
5716 %  The format of the MagickGetImageVirtualPixelMethod method is:
5717 %
5718 %      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5719 %
5720 %  A description of each parameter follows:
5721 %
5722 %    o wand: the magick wand.
5723 %
5724 */
5725 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5726 {
5727   assert(wand != (MagickWand *) NULL);
5728   assert(wand->signature == MagickWandSignature);
5729   if (wand->debug != MagickFalse)
5730     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5731   if (wand->images == (Image *) NULL)
5732     {
5733       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5734         "ContainsNoImages","`%s'",wand->name);
5735       return(UndefinedVirtualPixelMethod);
5736     }
5737   return(GetImageVirtualPixelMethod(wand->images));
5738 }
5739 \f
5740 /*
5741 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5742 %                                                                             %
5743 %                                                                             %
5744 %                                                                             %
5745 %   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5746 %                                                                             %
5747 %                                                                             %
5748 %                                                                             %
5749 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5750 %
5751 %  MagickGetImageWhitePoint() returns the chromaticy white point.
5752 %
5753 %  The format of the MagickGetImageWhitePoint method is:
5754 %
5755 %      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5756 %        double *y)
5757 %
5758 %  A description of each parameter follows:
5759 %
5760 %    o wand: the magick wand.
5761 %
5762 %    o x: the chromaticity white x-point.
5763 %
5764 %    o y: the chromaticity white y-point.
5765 %
5766 */
5767 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5768   double *x,double *y)
5769 {
5770   assert(wand != (MagickWand *) NULL);
5771   assert(wand->signature == MagickWandSignature);
5772   if (wand->debug != MagickFalse)
5773     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5774   if (wand->images == (Image *) NULL)
5775     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5776   *x=wand->images->chromaticity.white_point.x;
5777   *y=wand->images->chromaticity.white_point.y;
5778   return(MagickTrue);
5779 }
5780 \f
5781 /*
5782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5783 %                                                                             %
5784 %                                                                             %
5785 %                                                                             %
5786 %   M a g i c k G e t I m a g e W i d t h                                     %
5787 %                                                                             %
5788 %                                                                             %
5789 %                                                                             %
5790 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5791 %
5792 %  MagickGetImageWidth() returns the image width.
5793 %
5794 %  The format of the MagickGetImageWidth method is:
5795 %
5796 %      size_t MagickGetImageWidth(MagickWand *wand)
5797 %
5798 %  A description of each parameter follows:
5799 %
5800 %    o wand: the magick wand.
5801 %
5802 */
5803 WandExport size_t MagickGetImageWidth(MagickWand *wand)
5804 {
5805   assert(wand != (MagickWand *) NULL);
5806   assert(wand->signature == MagickWandSignature);
5807   if (wand->debug != MagickFalse)
5808     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5809   if (wand->images == (Image *) NULL)
5810     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5811   return(wand->images->columns);
5812 }
5813 \f
5814 /*
5815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5816 %                                                                             %
5817 %                                                                             %
5818 %                                                                             %
5819 %   M a g i c k G e t N u m b e r I m a g e s                                 %
5820 %                                                                             %
5821 %                                                                             %
5822 %                                                                             %
5823 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5824 %
5825 %  MagickGetNumberImages() returns the number of images associated with a
5826 %  magick wand.
5827 %
5828 %  The format of the MagickGetNumberImages method is:
5829 %
5830 %      size_t MagickGetNumberImages(MagickWand *wand)
5831 %
5832 %  A description of each parameter follows:
5833 %
5834 %    o wand: the magick wand.
5835 %
5836 */
5837 WandExport size_t MagickGetNumberImages(MagickWand *wand)
5838 {
5839   assert(wand != (MagickWand *) NULL);
5840   assert(wand->signature == MagickWandSignature);
5841   if (wand->debug != MagickFalse)
5842     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5843   return(GetImageListLength(wand->images));
5844 }
5845 \f
5846 /*
5847 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5848 %                                                                             %
5849 %                                                                             %
5850 %                                                                             %
5851 %   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                 %
5852 %                                                                             %
5853 %                                                                             %
5854 %                                                                             %
5855 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5856 %
5857 %  MagickGetImageTotalInkDensity() gets the image total ink density.
5858 %
5859 %  The format of the MagickGetImageTotalInkDensity method is:
5860 %
5861 %      double MagickGetImageTotalInkDensity(MagickWand *wand)
5862 %
5863 %  A description of each parameter follows:
5864 %
5865 %    o wand: the magick wand.
5866 %
5867 */
5868 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5869 {
5870   assert(wand != (MagickWand *) NULL);
5871   assert(wand->signature == MagickWandSignature);
5872   if (wand->debug != MagickFalse)
5873     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5874   if (wand->images == (Image *) NULL)
5875     {
5876       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5877         "ContainsNoImages","`%s'",wand->name);
5878       return(0.0);
5879     }
5880   return(GetImageTotalInkDensity(wand->images,wand->exception));
5881 }
5882 \f
5883 /*
5884 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5885 %                                                                             %
5886 %                                                                             %
5887 %                                                                             %
5888 %   M a g i c k H a l d C l u t I m a g e                                     %
5889 %                                                                             %
5890 %                                                                             %
5891 %                                                                             %
5892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5893 %
5894 %  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5895 %  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5896 %  dimensions.  Create it with the HALD coder.  You can apply any color
5897 %  transformation to the Hald image and then use this method to apply the
5898 %  transform to the image.
5899 %
5900 %  The format of the MagickHaldClutImage method is:
5901 %
5902 %      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5903 %        const MagickWand *hald_wand)
5904 %
5905 %  A description of each parameter follows:
5906 %
5907 %    o wand: the magick wand.
5908 %
5909 %    o hald_image: the hald CLUT image.
5910 %
5911 */
5912 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5913   const MagickWand *hald_wand)
5914 {
5915   MagickBooleanType
5916     status;
5917
5918   assert(wand != (MagickWand *) NULL);
5919   assert(wand->signature == MagickWandSignature);
5920   if (wand->debug != MagickFalse)
5921     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5922   if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5923     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5924   status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
5925   return(status);
5926 }
5927 \f
5928 /*
5929 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5930 %                                                                             %
5931 %                                                                             %
5932 %                                                                             %
5933 %   M a g i c k H a s N e x t I m a g e                                       %
5934 %                                                                             %
5935 %                                                                             %
5936 %                                                                             %
5937 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5938 %
5939 %  MagickHasNextImage() returns MagickTrue if the wand has more images when
5940 %  traversing the list in the forward direction
5941 %
5942 %  The format of the MagickHasNextImage method is:
5943 %
5944 %      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5945 %
5946 %  A description of each parameter follows:
5947 %
5948 %    o wand: the magick wand.
5949 %
5950 */
5951 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5952 {
5953   assert(wand != (MagickWand *) NULL);
5954   assert(wand->signature == MagickWandSignature);
5955   if (wand->debug != MagickFalse)
5956     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5957   if (wand->images == (Image *) NULL)
5958     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5959   if (GetNextImageInList(wand->images) == (Image *) NULL)
5960     return(MagickFalse);
5961   return(MagickTrue);
5962 }
5963 \f
5964 /*
5965 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5966 %                                                                             %
5967 %                                                                             %
5968 %                                                                             %
5969 %   M a g i c k H a s P r e v i o u s I m a g e                               %
5970 %                                                                             %
5971 %                                                                             %
5972 %                                                                             %
5973 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5974 %
5975 %  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5976 %  traversing the list in the reverse direction
5977 %
5978 %  The format of the MagickHasPreviousImage method is:
5979 %
5980 %      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5981 %
5982 %  A description of each parameter follows:
5983 %
5984 %    o wand: the magick wand.
5985 %
5986 */
5987 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5988 {
5989   assert(wand != (MagickWand *) NULL);
5990   assert(wand->signature == MagickWandSignature);
5991   if (wand->debug != MagickFalse)
5992     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5993   if (wand->images == (Image *) NULL)
5994     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5995   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5996     return(MagickFalse);
5997   return(MagickTrue);
5998 }
5999 \f
6000 /*
6001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6002 %                                                                             %
6003 %                                                                             %
6004 %                                                                             %
6005 %   M a g i c k I d e n t i f y I m a g e                                     %
6006 %                                                                             %
6007 %                                                                             %
6008 %                                                                             %
6009 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6010 %
6011 %  MagickIdentifyImage() identifies an image by printing its attributes to the
6012 %  file.  Attributes include the image width, height, size, and others.
6013 %
6014 %  The format of the MagickIdentifyImage method is:
6015 %
6016 %      const char *MagickIdentifyImage(MagickWand *wand)
6017 %
6018 %  A description of each parameter follows:
6019 %
6020 %    o wand: the magick wand.
6021 %
6022 */
6023 WandExport char *MagickIdentifyImage(MagickWand *wand)
6024 {
6025   char
6026     *description,
6027     filename[MagickPathExtent];
6028
6029   FILE
6030     *file;
6031
6032   int
6033     unique_file;
6034
6035   assert(wand != (MagickWand *) NULL);
6036   assert(wand->signature == MagickWandSignature);
6037   if (wand->debug != MagickFalse)
6038     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6039   if (wand->images == (Image *) NULL)
6040     {
6041       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6042         "ContainsNoImages","`%s'",wand->name);
6043       return((char *) NULL);
6044     }
6045   description=(char *) NULL;
6046   unique_file=AcquireUniqueFileResource(filename);
6047   file=(FILE *) NULL;
6048   if (unique_file != -1)
6049     file=fdopen(unique_file,"wb");
6050   if ((unique_file == -1) || (file == (FILE *) NULL))
6051     {
6052       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6053         "UnableToCreateTemporaryFile","`%s'",wand->name);
6054       return((char *) NULL);
6055     }
6056   (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
6057   (void) fclose(file);
6058   description=FileToString(filename,~0UL,wand->exception);
6059   (void) RelinquishUniqueFileResource(filename);
6060   return(description);
6061 }
6062
6063 /*
6064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6065 %                                                                             %
6066 %                                                                             %
6067 %                                                                             %
6068 %   M a g i c k I d e n t i f y I m a g e T y p e                             %
6069 %                                                                             %
6070 %                                                                             %
6071 %                                                                             %
6072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6073 %
6074 %  MagickIdentifyImageType() gets the potential image type:
6075 %
6076 %        Bilevel        Grayscale       GrayscaleMatte
6077 %        Palette        PaletteMatte    TrueColor
6078 %        TrueColorMatte ColorSeparation ColorSeparationMatte
6079 %
6080 %  To ensure the image type matches its potential, use MagickSetImageType():
6081 %
6082 %    (void) MagickSetImageType(wand,MagickIdentifyImageType(wand));
6083 %
6084 %  The format of the MagickIdentifyImageType method is:
6085 %
6086 %      ImageType MagickIdentifyImageType(MagickWand *wand)
6087 %
6088 %  A description of each parameter follows:
6089 %
6090 %    o wand: the magick wand.
6091 %
6092 */
6093 WandExport ImageType MagickIdentifyImageType(MagickWand *wand)
6094 {
6095   assert(wand != (MagickWand *) NULL);
6096   assert(wand->signature == MagickWandSignature);
6097   if (wand->debug != MagickFalse)
6098     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6099   if (wand->images == (Image *) NULL)
6100     {
6101       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6102         "ContainsNoImages","`%s'",wand->name);
6103       return(UndefinedType);
6104     }
6105   return(IdentifyImageType(wand->images,wand->exception));
6106 }
6107
6108 /*
6109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6110 %                                                                             %
6111 %                                                                             %
6112 %                                                                             %
6113 %   M a g i c k I m p l o d e I m a g e                                       %
6114 %                                                                             %
6115 %                                                                             %
6116 %                                                                             %
6117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6118 %
6119 %  MagickImplodeImage() creates a new image that is a copy of an existing
6120 %  one with the image pixels "implode" by the specified percentage.  It
6121 %  allocates the memory necessary for the new Image structure and returns a
6122 %  pointer to the new image.
6123 %
6124 %  The format of the MagickImplodeImage method is:
6125 %
6126 %      MagickBooleanType MagickImplodeImage(MagickWand *wand,
6127 %        const double radius,const PixelInterpolateMethod method)
6128 %
6129 %  A description of each parameter follows:
6130 %
6131 %    o wand: the magick wand.
6132 %
6133 %    o amount: Define the extent of the implosion.
6134 %
6135 %    o method: the pixel interpolation method.
6136 %
6137 */
6138 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6139   const double amount,const PixelInterpolateMethod method)
6140 {
6141   Image
6142     *implode_image;
6143
6144   assert(wand != (MagickWand *) NULL);
6145   assert(wand->signature == MagickWandSignature);
6146   if (wand->debug != MagickFalse)
6147     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6148   if (wand->images == (Image *) NULL)
6149     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6150   implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
6151   if (implode_image == (Image *) NULL)
6152     return(MagickFalse);
6153   ReplaceImageInList(&wand->images,implode_image);
6154   return(MagickTrue);
6155 }
6156 \f
6157 /*
6158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6159 %                                                                             %
6160 %                                                                             %
6161 %                                                                             %
6162 %   M a g i c k I m p o r t I m a g e P i x e l s                             %
6163 %                                                                             %
6164 %                                                                             %
6165 %                                                                             %
6166 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6167 %
6168 %  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6169 %  location you specify.  The method returns MagickFalse on success otherwise
6170 %  MagickTrue if an error is encountered.  The pixel data can be either char,
6171 %  short int, int, ssize_t, float, or double in the order specified by map.
6172 %
6173 %  Suppose your want to upload the first scanline of a 640x480 image from
6174 %  character data in red-green-blue order:
6175 %
6176 %      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6177 %
6178 %  The format of the MagickImportImagePixels method is:
6179 %
6180 %      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6181 %        const ssize_t x,const ssize_t y,const size_t columns,
6182 %        const size_t rows,const char *map,const StorageType storage,
6183 %        const void *pixels)
6184 %
6185 %  A description of each parameter follows:
6186 %
6187 %    o wand: the magick wand.
6188 %
6189 %    o x, y, columns, rows:  These values define the perimeter of a region
6190 %      of pixels you want to define.
6191 %
6192 %    o map:  This string reflects the expected ordering of the pixel array.
6193 %      It can be any combination or order of R = red, G = green, B = blue,
6194 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
6195 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6196 %      P = pad.
6197 %
6198 %    o storage: Define the data type of the pixels.  Float and double types are
6199 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6200 %      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6201 %      or DoublePixel.
6202 %
6203 %    o pixels: This array of values contain the pixel components as defined by
6204 %      map and type.  You must preallocate this array where the expected
6205 %      length varies depending on the values of width, height, map, and type.
6206 %
6207 */
6208 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6209   const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
6210   const char *map,const StorageType storage,const void *pixels)
6211 {
6212   MagickBooleanType
6213     status;
6214
6215   assert(wand != (MagickWand *) NULL);
6216   assert(wand->signature == MagickWandSignature);
6217   if (wand->debug != MagickFalse)
6218     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6219   if (wand->images == (Image *) NULL)
6220     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6221   status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
6222     wand->exception);
6223   return(status);
6224 }
6225 \f
6226 /*
6227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6228 %                                                                             %
6229 %                                                                             %
6230 %                                                                             %
6231 %   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               %
6232 %                                                                             %
6233 %                                                                             %
6234 %                                                                             %
6235 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6236 %
6237 %  MagickInterpolativeResizeImage() resize image using a interpolative
6238 %  method.
6239 %
6240 %      MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6241 %        const size_t columns,const size_t rows,
6242 %        const PixelInterpolateMethod method)
6243 %
6244 %  A description of each parameter follows:
6245 %
6246 %    o wand: the magick wand.
6247 %
6248 %    o columns: the number of columns in the scaled image.
6249 %
6250 %    o rows: the number of rows in the scaled image.
6251 %
6252 %    o interpolate: the pixel interpolation method.
6253 %
6254 */
6255 WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
6256   const size_t columns,const size_t rows,const PixelInterpolateMethod method)
6257 {
6258   Image
6259     *resize_image;
6260
6261   assert(wand != (MagickWand *) NULL);
6262   assert(wand->signature == MagickWandSignature);
6263   if (wand->debug != MagickFalse)
6264     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6265   if (wand->images == (Image *) NULL)
6266     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6267   resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
6268     wand->exception);
6269   if (resize_image == (Image *) NULL)
6270     return(MagickFalse);
6271   ReplaceImageInList(&wand->images,resize_image);
6272   return(MagickTrue);
6273 }
6274 \f
6275 /*
6276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6277 %                                                                             %
6278 %                                                                             %
6279 %                                                                             %
6280 %   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       %
6281 %                                                                             %
6282 %                                                                             %
6283 %                                                                             %
6284 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6285 %
6286 %  MagickInverseFourierTransformImage() implements the inverse discrete
6287 %  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6288 %  imaginary image pair.
6289 %
6290 %  The format of the MagickInverseFourierTransformImage method is:
6291 %
6292 %      MagickBooleanType MagickInverseFourierTransformImage(
6293 %        MagickWand *magnitude_wand,MagickWand *phase_wand,
6294 %        const MagickBooleanType magnitude)
6295 %
6296 %  A description of each parameter follows:
6297 %
6298 %    o magnitude_wand: the magnitude or real wand.
6299 %
6300 %    o phase_wand: the phase or imaginary wand.
6301 %
6302 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6303 %      imaginary image pair.
6304 %
6305 */
6306 WandExport MagickBooleanType MagickInverseFourierTransformImage(
6307   MagickWand *magnitude_wand,MagickWand *phase_wand,
6308   const MagickBooleanType magnitude)
6309 {
6310   Image
6311     *inverse_image;
6312
6313   MagickWand
6314     *wand;
6315
6316   assert(magnitude_wand != (MagickWand *) NULL);
6317   assert(magnitude_wand->signature == MagickWandSignature);
6318   if (magnitude_wand->debug != MagickFalse)
6319     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6320       magnitude_wand->name);
6321   wand=magnitude_wand;
6322   if (magnitude_wand->images == (Image *) NULL)
6323     ThrowWandException(WandError,"ContainsNoImages",
6324       magnitude_wand->name);
6325   assert(phase_wand != (MagickWand *) NULL);
6326   assert(phase_wand->signature == MagickWandSignature);
6327   inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6328     phase_wand->images,magnitude,wand->exception);
6329   if (inverse_image == (Image *) NULL)
6330     return(MagickFalse);
6331   ReplaceImageInList(&wand->images,inverse_image);
6332   return(MagickTrue);
6333 }
6334 \f
6335 /*
6336 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6337 %                                                                             %
6338 %                                                                             %
6339 %                                                                             %
6340 %   M a g i c k L a b e l I m a g e                                           %
6341 %                                                                             %
6342 %                                                                             %
6343 %                                                                             %
6344 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6345 %
6346 %  MagickLabelImage() adds a label to your image.
6347 %
6348 %  The format of the MagickLabelImage method is:
6349 %
6350 %      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6351 %
6352 %  A description of each parameter follows:
6353 %
6354 %    o wand: the magick wand.
6355 %
6356 %    o label: the image label.
6357 %
6358 */
6359 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6360   const char *label)
6361 {
6362   MagickBooleanType
6363     status;
6364
6365   assert(wand != (MagickWand *) NULL);
6366   assert(wand->signature == MagickWandSignature);
6367   if (wand->debug != MagickFalse)
6368     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6369   if (wand->images == (Image *) NULL)
6370     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6371   status=SetImageProperty(wand->images,"label",label,wand->exception);
6372   return(status);
6373 }
6374 \f
6375 /*
6376 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6377 %                                                                             %
6378 %                                                                             %
6379 %                                                                             %
6380 %   M a g i c k L e v e l I m a g e                                           %
6381 %                                                                             %
6382 %                                                                             %
6383 %                                                                             %
6384 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6385 %
6386 %  MagickLevelImage() adjusts the levels of an image by scaling the colors
6387 %  falling between specified white and black points to the full available
6388 %  quantum range. The parameters provided represent the black, mid, and white
6389 %  points. The black point specifies the darkest color in the image. Colors
6390 %  darker than the black point are set to zero. Mid point specifies a gamma
6391 %  correction to apply to the image.  White point specifies the lightest color
6392 %  in the image. Colors brighter than the white point are set to the maximum
6393 %  quantum value.
6394 %
6395 %  The format of the MagickLevelImage method is:
6396 %
6397 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6398 %        const double black_point,const double gamma,const double white_point)
6399 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6400 %        const ChannelType channel,const double black_point,const double gamma,
6401 %        const double white_point)
6402 %
6403 %  A description of each parameter follows:
6404 %
6405 %    o wand: the magick wand.
6406 %
6407 %    o channel: Identify which channel to level: RedPixelChannel,
6408 %      GreenPixelChannel, etc.
6409 %
6410 %    o black_point: the black point.
6411 %
6412 %    o gamma: the gamma.
6413 %
6414 %    o white_point: the white point.
6415 %
6416 */
6417 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6418   const double black_point,const double gamma,const double white_point)
6419 {
6420   MagickBooleanType
6421     status;
6422
6423   assert(wand != (MagickWand *) NULL);
6424   assert(wand->signature == MagickWandSignature);
6425   if (wand->debug != MagickFalse)
6426     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6427   if (wand->images == (Image *) NULL)
6428     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6429   status=LevelImage(wand->images,black_point,white_point,gamma,
6430     wand->exception);
6431   return(status);
6432 }
6433 \f
6434 /*
6435 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6436 %                                                                             %
6437 %                                                                             %
6438 %                                                                             %
6439 %   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6440 %                                                                             %
6441 %                                                                             %
6442 %                                                                             %
6443 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6444 %
6445 %  MagickLinearStretchImage() stretches with saturation the image intensity.
6446 %
6447 %  You can also reduce the influence of a particular channel with a gamma
6448 %  value of 0.
6449 %
6450 %  The format of the MagickLinearStretchImage method is:
6451 %
6452 %      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6453 %        const double black_point,const double white_point)
6454 %
6455 %  A description of each parameter follows:
6456 %
6457 %    o wand: the magick wand.
6458 %
6459 %    o black_point: the black point.
6460 %
6461 %    o white_point: the white point.
6462 %
6463 */
6464 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6465   const double black_point,const double white_point)
6466 {
6467   MagickBooleanType
6468     status;
6469
6470   assert(wand != (MagickWand *) NULL);
6471   assert(wand->signature == MagickWandSignature);
6472   if (wand->debug != MagickFalse)
6473     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6474   if (wand->images == (Image *) NULL)
6475     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6476   status=LinearStretchImage(wand->images,black_point,white_point,
6477     wand->exception);
6478   return(status);
6479 }
6480 \f
6481 /*
6482 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6483 %                                                                             %
6484 %                                                                             %
6485 %                                                                             %
6486 %   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6487 %                                                                             %
6488 %                                                                             %
6489 %                                                                             %
6490 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6491 %
6492 %  MagickLiquidRescaleImage() rescales image with seam carving.
6493 %
6494 %      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6495 %        const size_t columns,const size_t rows,
6496 %        const double delta_x,const double rigidity)
6497 %
6498 %  A description of each parameter follows:
6499 %
6500 %    o wand: the magick wand.
6501 %
6502 %    o columns: the number of columns in the scaled image.
6503 %
6504 %    o rows: the number of rows in the scaled image.
6505 %
6506 %    o delta_x: maximum seam transversal step (0 means straight seams).
6507 %
6508 %    o rigidity: introduce a bias for non-straight seams (typically 0).
6509 %
6510 */
6511 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6512   const size_t columns,const size_t rows,const double delta_x,
6513   const double rigidity)
6514 {
6515   Image
6516     *rescale_image;
6517
6518   assert(wand != (MagickWand *) NULL);
6519   assert(wand->signature == MagickWandSignature);
6520   if (wand->debug != MagickFalse)
6521     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6522   if (wand->images == (Image *) NULL)
6523     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6524   rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6525     rigidity,wand->exception);
6526   if (rescale_image == (Image *) NULL)
6527     return(MagickFalse);
6528   ReplaceImageInList(&wand->images,rescale_image);
6529   return(MagickTrue);
6530 }
6531
6532 /*
6533 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6534 %                                                                             %
6535 %                                                                             %
6536 %                                                                             %
6537 %     M a g i c k L o c a l C o n t r a s t I m a g e                         %
6538 %                                                                             %
6539 %                                                                             %
6540 %                                                                             %
6541 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6542 %
6543 %  MagickLocalContrastImage() attempts to increase the appearance of
6544 %  large-scale light-dark transitions. Local contrast enhancement works
6545 %  similarly to sharpening with an unsharp mask, however the mask is instead
6546 %  created using an image with a greater blur distance.
6547 %
6548 %      MagickBooleanType MagickLocalContrastImage(MagickWand *wand,
6549 %        const double radius,const double strength)
6550 %
6551 %  A description of each parameter follows:
6552 %
6553 %    o image: the image.
6554 %
6555 %    o radius: the radius of the Gaussian, in pixels, not counting
6556 %      the center pixel.
6557 %
6558 %    o strength: the strength of the blur mask in percentage.
6559 %
6560 */
6561 WandExport MagickBooleanType MagickLocalContrastImage(MagickWand *wand,
6562   const double radius, const double strength)
6563 {
6564   Image
6565     *contrast_image;
6566
6567   assert(wand != (MagickWand *)NULL);
6568   assert(wand->signature == MagickWandSignature);
6569   if (wand->debug != MagickFalse)
6570     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s", wand->name);
6571   if (wand->images == (Image *)NULL)
6572     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6573   contrast_image=LocalContrastImage(wand->images,radius,strength,
6574     wand->exception);
6575   if (contrast_image == (Image *)NULL)
6576     return(MagickFalse);
6577   ReplaceImageInList(&wand->images,contrast_image);
6578   return(MagickTrue);
6579 }
6580 \f
6581 /*
6582 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6583 %                                                                             %
6584 %                                                                             %
6585 %                                                                             %
6586 %   M a g i c k M a g n i f y I m a g e                                       %
6587 %                                                                             %
6588 %                                                                             %
6589 %                                                                             %
6590 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6591 %
6592 %  MagickMagnifyImage() is a convenience method that scales an image
6593 %  proportionally to twice its original size.
6594 %
6595 %  The format of the MagickMagnifyImage method is:
6596 %
6597 %      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6598 %
6599 %  A description of each parameter follows:
6600 %
6601 %    o wand: the magick wand.
6602 %
6603 */
6604 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6605 {
6606   Image
6607     *magnify_image;
6608
6609   assert(wand != (MagickWand *) NULL);
6610   assert(wand->signature == MagickWandSignature);
6611   if (wand->debug != MagickFalse)
6612     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6613   if (wand->images == (Image *) NULL)
6614     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6615   magnify_image=MagnifyImage(wand->images,wand->exception);
6616   if (magnify_image == (Image *) NULL)
6617     return(MagickFalse);
6618   ReplaceImageInList(&wand->images,magnify_image);
6619   return(MagickTrue);
6620 }
6621 \f
6622 /*
6623 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6624 %                                                                             %
6625 %                                                                             %
6626 %                                                                             %
6627 %   M a g i c k M e r g e I m a g e L a y e r s                               %
6628 %                                                                             %
6629 %                                                                             %
6630 %                                                                             %
6631 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6632 %
6633 %  MagickMergeImageLayers() composes all the image layers from the current
6634 %  given image onward to produce a single image of the merged layers.
6635 %
6636 %  The inital canvas's size depends on the given LayerMethod, and is
6637 %  initialized using the first images background color.  The images
6638 %  are then compositied onto that image in sequence using the given
6639 %  composition that has been assigned to each individual image.
6640 %
6641 %  The format of the MagickMergeImageLayers method is:
6642 %
6643 %      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6644 %        const LayerMethod method)
6645 %
6646 %  A description of each parameter follows:
6647 %
6648 %    o wand: the magick wand.
6649 %
6650 %    o method: the method of selecting the size of the initial canvas.
6651 %
6652 %        MergeLayer: Merge all layers onto a canvas just large enough
6653 %           to hold all the actual images. The virtual canvas of the
6654 %           first image is preserved but otherwise ignored.
6655 %
6656 %        FlattenLayer: Use the virtual canvas size of first image.
6657 %           Images which fall outside this canvas is clipped.
6658 %           This can be used to 'fill out' a given virtual canvas.
6659 %
6660 %        MosaicLayer: Start with the virtual canvas of the first image,
6661 %           enlarging left and right edges to contain all images.
6662 %           Images with negative offsets will be clipped.
6663 %
6664 */
6665 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6666   const LayerMethod method)
6667 {
6668   Image
6669     *mosaic_image;
6670
6671   assert(wand != (MagickWand *) NULL);
6672   assert(wand->signature == MagickWandSignature);
6673   if (wand->debug != MagickFalse)
6674     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6675   if (wand->images == (Image *) NULL)
6676     return((MagickWand *) NULL);
6677   mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6678   if (mosaic_image == (Image *) NULL)
6679     return((MagickWand *) NULL);
6680   return(CloneMagickWandFromImages(wand,mosaic_image));
6681 }
6682 \f
6683 /*
6684 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6685 %                                                                             %
6686 %                                                                             %
6687 %                                                                             %
6688 %   M a g i c k M i n i f y I m a g e                                         %
6689 %                                                                             %
6690 %                                                                             %
6691 %                                                                             %
6692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6693 %
6694 %  MagickMinifyImage() is a convenience method that scales an image
6695 %  proportionally to one-half its original size
6696 %
6697 %  The format of the MagickMinifyImage method is:
6698 %
6699 %      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6700 %
6701 %  A description of each parameter follows:
6702 %
6703 %    o wand: the magick wand.
6704 %
6705 */
6706 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6707 {
6708   Image
6709     *minify_image;
6710
6711   assert(wand != (MagickWand *) NULL);
6712   assert(wand->signature == MagickWandSignature);
6713   if (wand->debug != MagickFalse)
6714     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6715   if (wand->images == (Image *) NULL)
6716     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6717   minify_image=MinifyImage(wand->images,wand->exception);
6718   if (minify_image == (Image *) NULL)
6719     return(MagickFalse);
6720   ReplaceImageInList(&wand->images,minify_image);
6721   return(MagickTrue);
6722 }
6723 \f
6724 /*
6725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6726 %                                                                             %
6727 %                                                                             %
6728 %                                                                             %
6729 %   M a g i c k M o d u l a t e I m a g e                                     %
6730 %                                                                             %
6731 %                                                                             %
6732 %                                                                             %
6733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6734 %
6735 %  MagickModulateImage() lets you control the brightness, saturation, and hue
6736 %  of an image.  Hue is the percentage of absolute rotation from the current
6737 %  position.  For example 50 results in a counter-clockwise rotation of 90
6738 %  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6739 %  both resulting in a rotation of 180 degrees.
6740 %
6741 %  To increase the color brightness by 20% and decrease the color saturation by
6742 %  10% and leave the hue unchanged, use: 120,90,100.
6743 %
6744 %  The format of the MagickModulateImage method is:
6745 %
6746 %      MagickBooleanType MagickModulateImage(MagickWand *wand,
6747 %        const double brightness,const double saturation,const double hue)
6748 %
6749 %  A description of each parameter follows:
6750 %
6751 %    o wand: the magick wand.
6752 %
6753 %    o brightness: the percent change in brighness.
6754 %
6755 %    o saturation: the percent change in saturation.
6756 %
6757 %    o hue: the percent change in hue.
6758 %
6759 */
6760 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6761   const double brightness,const double saturation,const double hue)
6762 {
6763   char
6764     modulate[MagickPathExtent];
6765
6766   MagickBooleanType
6767     status;
6768
6769   assert(wand != (MagickWand *) NULL);
6770   assert(wand->signature == MagickWandSignature);
6771   if (wand->debug != MagickFalse)
6772     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6773   if (wand->images == (Image *) NULL)
6774     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6775   (void) FormatLocaleString(modulate,MagickPathExtent,"%g,%g,%g",
6776     brightness,saturation,hue);
6777   status=ModulateImage(wand->images,modulate,wand->exception);
6778   return(status);
6779 }
6780 \f
6781 /*
6782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6783 %                                                                             %
6784 %                                                                             %
6785 %                                                                             %
6786 %   M a g i c k M o n t a g e I m a g e                                       %
6787 %                                                                             %
6788 %                                                                             %
6789 %                                                                             %
6790 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6791 %
6792 %  MagickMontageImage() creates a composite image by combining several
6793 %  separate images. The images are tiled on the composite image with the name
6794 %  of the image optionally appearing just below the individual tile.
6795 %
6796 %  The format of the MagickMontageImage method is:
6797 %
6798 %      MagickWand *MagickMontageImage(MagickWand *wand,
6799 %        const DrawingWand drawing_wand,const char *tile_geometry,
6800 %        const char *thumbnail_geometry,const MontageMode mode,
6801 %        const char *frame)
6802 %
6803 %  A description of each parameter follows:
6804 %
6805 %    o wand: the magick wand.
6806 %
6807 %    o drawing_wand: the drawing wand.  The font name, size, and color are
6808 %      obtained from this wand.
6809 %
6810 %    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6811 %
6812 %    o thumbnail_geometry: Preferred image size and border size of each
6813 %      thumbnail (e.g. 120x120+4+3>).
6814 %
6815 %    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6816 %
6817 %    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6818 %      The frame color is that of the thumbnail's matte color.
6819 %
6820 */
6821 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6822   const DrawingWand *drawing_wand,const char *tile_geometry,
6823   const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6824 {
6825   char
6826     *font;
6827
6828   Image
6829     *montage_image;
6830
6831   MontageInfo
6832     *montage_info;
6833
6834   PixelWand
6835     *pixel_wand;
6836
6837   assert(wand != (MagickWand *) NULL);
6838   assert(wand->signature == MagickWandSignature);
6839   if (wand->debug != MagickFalse)
6840     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6841   if (wand->images == (Image *) NULL)
6842     return((MagickWand *) NULL);
6843   montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6844   switch (mode)
6845   {
6846     case FrameMode:
6847     {
6848       (void) CloneString(&montage_info->frame,"15x15+3+3");
6849       montage_info->shadow=MagickTrue;
6850       break;
6851     }
6852     case UnframeMode:
6853     {
6854       montage_info->frame=(char *) NULL;
6855       montage_info->shadow=MagickFalse;
6856       montage_info->border_width=0;
6857       break;
6858     }
6859     case ConcatenateMode:
6860     {
6861       montage_info->frame=(char *) NULL;
6862       montage_info->shadow=MagickFalse;
6863       (void) CloneString(&montage_info->geometry,"+0+0");
6864       montage_info->border_width=0;
6865       break;
6866     }
6867     default:
6868       break;
6869   }
6870   font=DrawGetFont(drawing_wand);
6871   if (font != (char *) NULL)
6872     (void) CloneString(&montage_info->font,font);
6873   if (frame != (char *) NULL)
6874     (void) CloneString(&montage_info->frame,frame);
6875   montage_info->pointsize=DrawGetFontSize(drawing_wand);
6876   pixel_wand=NewPixelWand();
6877   DrawGetFillColor(drawing_wand,pixel_wand);
6878   PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6879   DrawGetStrokeColor(drawing_wand,pixel_wand);
6880   PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6881   pixel_wand=DestroyPixelWand(pixel_wand);
6882   if (thumbnail_geometry != (char *) NULL)
6883     (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6884   if (tile_geometry != (char *) NULL)
6885     (void) CloneString(&montage_info->tile,tile_geometry);
6886   montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6887     wand->exception);
6888   montage_info=DestroyMontageInfo(montage_info);
6889   if (montage_image == (Image *) NULL)
6890     return((MagickWand *) NULL);
6891   return(CloneMagickWandFromImages(wand,montage_image));
6892 }
6893 \f
6894 /*
6895 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6896 %                                                                             %
6897 %                                                                             %
6898 %                                                                             %
6899 %   M a g i c k M o r p h I m a g e s                                         %
6900 %                                                                             %
6901 %                                                                             %
6902 %                                                                             %
6903 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6904 %
6905 %  MagickMorphImages() method morphs a set of images.  Both the image pixels
6906 %  and size are linearly interpolated to give the appearance of a
6907 %  meta-morphosis from one image to the next.
6908 %
6909 %  The format of the MagickMorphImages method is:
6910 %
6911 %      MagickWand *MagickMorphImages(MagickWand *wand,
6912 %        const size_t number_frames)
6913 %
6914 %  A description of each parameter follows:
6915 %
6916 %    o wand: the magick wand.
6917 %
6918 %    o number_frames: the number of in-between images to generate.
6919 %
6920 */
6921 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6922   const size_t number_frames)
6923 {
6924   Image
6925     *morph_image;
6926
6927   assert(wand != (MagickWand *) NULL);
6928   assert(wand->signature == MagickWandSignature);
6929   if (wand->debug != MagickFalse)
6930     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6931   if (wand->images == (Image *) NULL)
6932     return((MagickWand *) NULL);
6933   morph_image=MorphImages(wand->images,number_frames,wand->exception);
6934   if (morph_image == (Image *) NULL)
6935     return((MagickWand *) NULL);
6936   return(CloneMagickWandFromImages(wand,morph_image));
6937 }
6938 \f
6939 /*
6940 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6941 %                                                                             %
6942 %                                                                             %
6943 %                                                                             %
6944 %   M a g i c k M o r p h o l o g y I m a g e                                 %
6945 %                                                                             %
6946 %                                                                             %
6947 %                                                                             %
6948 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6949 %
6950 %  MagickMorphologyImage() applies a user supplied kernel to the image
6951 %  according to the given mophology method.
6952 %
6953 %  The format of the MagickMorphologyImage method is:
6954 %
6955 %      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6956 %        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6957 %
6958 %  A description of each parameter follows:
6959 %
6960 %    o wand: the magick wand.
6961 %
6962 %    o method: the morphology method to be applied.
6963 %
6964 %    o iterations: apply the operation this many times (or no change).
6965 %      A value of -1 means loop until no change found.  How this is applied
6966 %      may depend on the morphology method.  Typically this is a value of 1.
6967 %
6968 %    o kernel: An array of doubles representing the morphology kernel.
6969 %
6970 */
6971 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6972   MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6973 {
6974   Image
6975     *morphology_image;
6976
6977   assert(wand != (MagickWand *) NULL);
6978   assert(wand->signature == MagickWandSignature);
6979   if (wand->debug != MagickFalse)
6980     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6981   if (kernel == (const KernelInfo *) NULL)
6982     return(MagickFalse);
6983   if (wand->images == (Image *) NULL)
6984     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6985   morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6986     wand->exception);
6987   if (morphology_image == (Image *) NULL)
6988     return(MagickFalse);
6989   ReplaceImageInList(&wand->images,morphology_image);
6990   return(MagickTrue);
6991 }
6992 \f
6993 /*
6994 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6995 %                                                                             %
6996 %                                                                             %
6997 %                                                                             %
6998 %   M a g i c k M o t i o n B l u r I m a g e                                 %
6999 %                                                                             %
7000 %                                                                             %
7001 %                                                                             %
7002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7003 %
7004 %  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
7005 %  Gaussian operator of the given radius and standard deviation (sigma).
7006 %  For reasonable results, radius should be larger than sigma.  Use a
7007 %  radius of 0 and MotionBlurImage() selects a suitable radius for you.
7008 %  Angle gives the angle of the blurring motion.
7009 %
7010 %  The format of the MagickMotionBlurImage method is:
7011 %
7012 %      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7013 %        const double radius,const double sigma,const double angle)
7014 %
7015 %  A description of each parameter follows:
7016 %
7017 %    o wand: the magick wand.
7018 %
7019 %    o radius: the radius of the Gaussian, in pixels, not counting
7020 %      the center pixel.
7021 %
7022 %    o sigma: the standard deviation of the Gaussian, in pixels.
7023 %
7024 %    o angle: Apply the effect along this angle.
7025 %
7026 */
7027 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7028   const double radius,const double sigma,const double angle)
7029 {
7030   Image
7031     *blur_image;
7032
7033   assert(wand != (MagickWand *) NULL);
7034   assert(wand->signature == MagickWandSignature);
7035   if (wand->debug != MagickFalse)
7036     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7037   if (wand->images == (Image *) NULL)
7038     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7039   blur_image=MotionBlurImage(wand->images,radius,sigma,angle,wand->exception);
7040   if (blur_image == (Image *) NULL)
7041     return(MagickFalse);
7042   ReplaceImageInList(&wand->images,blur_image);
7043   return(MagickTrue);
7044 }
7045 \f
7046 /*
7047 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7048 %                                                                             %
7049 %                                                                             %
7050 %                                                                             %
7051 %   M a g i c k N e g a t e I m a g e                                         %
7052 %                                                                             %
7053 %                                                                             %
7054 %                                                                             %
7055 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7056 %
7057 %  MagickNegateImage() negates the colors in the reference image.  The
7058 %  Grayscale option means that only grayscale values within the image are
7059 %  negated.
7060 %
7061 %  You can also reduce the influence of a particular channel with a gamma
7062 %  value of 0.
7063 %
7064 %  The format of the MagickNegateImage method is:
7065 %
7066 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
7067 %        const MagickBooleanType gray)
7068 %
7069 %  A description of each parameter follows:
7070 %
7071 %    o wand: the magick wand.
7072 %
7073 %    o gray: If MagickTrue, only negate grayscale pixels within the image.
7074 %
7075 */
7076 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
7077   const MagickBooleanType gray)
7078 {
7079   MagickBooleanType
7080     status;
7081
7082   assert(wand != (MagickWand *) NULL);
7083   assert(wand->signature == MagickWandSignature);
7084   if (wand->debug != MagickFalse)
7085     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7086   if (wand->images == (Image *) NULL)
7087     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7088   status=NegateImage(wand->images,gray,wand->exception);
7089   return(status);
7090 }
7091 \f
7092 /*
7093 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7094 %                                                                             %
7095 %                                                                             %
7096 %                                                                             %
7097 %   M a g i c k N e w I m a g e                                               %
7098 %                                                                             %
7099 %                                                                             %
7100 %                                                                             %
7101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7102 %
7103 %  MagickNewImage() adds a blank image canvas of the specified size and
7104 %  background color to the wand.
7105 %
7106 %  The format of the MagickNewImage method is:
7107 %
7108 %      MagickBooleanType MagickNewImage(MagickWand *wand,
7109 %        const size_t columns,const size_t rows,
7110 %        const PixelWand *background)
7111 %
7112 %  A description of each parameter follows:
7113 %
7114 %    o wand: the magick wand.
7115 %
7116 %    o width: the image width.
7117 %
7118 %    o height: the image height.
7119 %
7120 %    o background: the image color.
7121 %
7122 */
7123 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
7124   const size_t height,const PixelWand *background)
7125 {
7126   Image
7127     *images;
7128
7129   PixelInfo
7130     pixel;
7131
7132   assert(wand != (MagickWand *) NULL);
7133   assert(wand->signature == MagickWandSignature);
7134   if (wand->debug != MagickFalse)
7135     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7136   PixelGetMagickColor(background,&pixel);
7137   images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
7138   if (images == (Image *) NULL)
7139     return(MagickFalse);
7140   return(InsertImageInWand(wand,images));
7141 }
7142 \f
7143 /*
7144 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7145 %                                                                             %
7146 %                                                                             %
7147 %                                                                             %
7148 %   M a g i c k N e x t I m a g e                                             %
7149 %                                                                             %
7150 %                                                                             %
7151 %                                                                             %
7152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7153 %
7154 %  MagickNextImage() sets the next image in the wand as the current image.
7155 %
7156 %  It is typically used after MagickResetIterator(), after which its first use
7157 %  will set the first image as the current image (unless the wand is empty).
7158 %
7159 %  It will return MagickFalse when no more images are left to be returned
7160 %  which happens when the wand is empty, or the current image is the last
7161 %  image.
7162 %
7163 %  When the above condition (end of image list) is reached, the iterator is
7164 %  automaticall set so that you can start using MagickPreviousImage() to
7165 %  again iterate over the images in the reverse direction, starting with the
7166 %  last image (again).  You can jump to this condition immeditally using
7167 %  MagickSetLastIterator().
7168 %
7169 %  The format of the MagickNextImage method is:
7170 %
7171 %      MagickBooleanType MagickNextImage(MagickWand *wand)
7172 %
7173 %  A description of each parameter follows:
7174 %
7175 %    o wand: the magick wand.
7176 %
7177 */
7178 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7179 {
7180   assert(wand != (MagickWand *) NULL);
7181   assert(wand->signature == MagickWandSignature);
7182   if (wand->debug != MagickFalse)
7183     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7184   if (wand->images == (Image *) NULL)
7185     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7186   wand->insert_before=MagickFalse; /* Inserts is now appended */
7187   if (wand->image_pending != MagickFalse)
7188     {
7189       wand->image_pending=MagickFalse;
7190       return(MagickTrue);
7191     }
7192   if (GetNextImageInList(wand->images) == (Image *) NULL)
7193     {
7194       wand->image_pending=MagickTrue; /* No image, PreviousImage re-gets */
7195       return(MagickFalse);
7196     }
7197   wand->images=GetNextImageInList(wand->images);
7198   return(MagickTrue);
7199 }
7200 \f
7201 /*
7202 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7203 %                                                                             %
7204 %                                                                             %
7205 %                                                                             %
7206 %   M a g i c k N o r m a l i z e I m a g e                                   %
7207 %                                                                             %
7208 %                                                                             %
7209 %                                                                             %
7210 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7211 %
7212 %  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7213 %  the pixels color to span the entire range of colors available
7214 %
7215 %  You can also reduce the influence of a particular channel with a gamma
7216 %  value of 0.
7217 %
7218 %  The format of the MagickNormalizeImage method is:
7219 %
7220 %      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7221 %
7222 %  A description of each parameter follows:
7223 %
7224 %    o wand: the magick wand.
7225 %
7226 */
7227 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7228 {
7229   MagickBooleanType
7230     status;
7231
7232   assert(wand != (MagickWand *) NULL);
7233   assert(wand->signature == MagickWandSignature);
7234   if (wand->debug != MagickFalse)
7235     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7236   if (wand->images == (Image *) NULL)
7237     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7238   status=NormalizeImage(wand->images,wand->exception);
7239   return(status);
7240 }
7241 \f
7242 /*
7243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7244 %                                                                             %
7245 %                                                                             %
7246 %                                                                             %
7247 %   M a g i c k O i l P a i n t I m a g e                                     %
7248 %                                                                             %
7249 %                                                                             %
7250 %                                                                             %
7251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7252 %
7253 %  MagickOilPaintImage() applies a special effect filter that simulates an oil
7254 %  painting.  Each pixel is replaced by the most frequent color occurring
7255 %  in a circular region defined by radius.
7256 %
7257 %  The format of the MagickOilPaintImage method is:
7258 %
7259 %      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7260 %        const double radius,const double sigma)
7261 %
7262 %  A description of each parameter follows:
7263 %
7264 %    o wand: the magick wand.
7265 %
7266 %    o radius: the radius of the circular neighborhood.
7267 %
7268 %    o sigma: the standard deviation of the Gaussian, in pixels.
7269 %
7270 */
7271 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7272   const double radius,const double sigma)
7273 {
7274   Image
7275     *paint_image;
7276
7277   assert(wand != (MagickWand *) NULL);
7278   assert(wand->signature == MagickWandSignature);
7279   if (wand->debug != MagickFalse)
7280     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7281   if (wand->images == (Image *) NULL)
7282     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7283   paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
7284   if (paint_image == (Image *) NULL)
7285     return(MagickFalse);
7286   ReplaceImageInList(&wand->images,paint_image);
7287   return(MagickTrue);
7288 }
7289 \f
7290 /*
7291 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7292 %                                                                             %
7293 %                                                                             %
7294 %                                                                             %
7295 %   M a g i c k O p a q u e P a i n t I m a g e                               %
7296 %                                                                             %
7297 %                                                                             %
7298 %                                                                             %
7299 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7300 %
7301 %  MagickOpaquePaintImage() changes any pixel that matches color with the color
7302 %  defined by fill.
7303 %
7304 %  The format of the MagickOpaquePaintImage method is:
7305 %
7306 %      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7307 %        const PixelWand *target,const PixelWand *fill,const double fuzz,
7308 %        const MagickBooleanType invert)
7309 %
7310 %  A description of each parameter follows:
7311 %
7312 %    o wand: the magick wand.
7313 %
7314 %    o target: Change this target color to the fill color within the image.
7315 %
7316 %    o fill: the fill pixel wand.
7317 %
7318 %    o fuzz: By default target must match a particular pixel color
7319 %      exactly.  However, in many cases two colors may differ by a small amount.
7320 %      The fuzz member of image defines how much tolerance is acceptable to
7321 %      consider two colors as the same.  For example, set fuzz to 10 and the
7322 %      color red at intensities of 100 and 102 respectively are now interpreted
7323 %      as the same color for the purposes of the floodfill.
7324 %
7325 %    o invert: paint any pixel that does not match the target color.
7326 %
7327 */
7328 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7329   const PixelWand *target,const PixelWand *fill,const double fuzz,
7330   const MagickBooleanType invert)
7331 {
7332   MagickBooleanType
7333     status;
7334
7335   PixelInfo
7336     fill_pixel,
7337     target_pixel;
7338
7339   assert(wand != (MagickWand *) NULL);
7340   assert(wand->signature == MagickWandSignature);
7341   if (wand->debug != MagickFalse)
7342     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7343   if (wand->images == (Image *) NULL)
7344     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7345   PixelGetMagickColor(target,&target_pixel);
7346   PixelGetMagickColor(fill,&fill_pixel);
7347   wand->images->fuzz=fuzz;
7348   status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
7349     wand->exception);
7350   return(status);
7351 }
7352 \f
7353 /*
7354 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7355 %                                                                             %
7356 %                                                                             %
7357 %                                                                             %
7358 %   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                         %
7359 %                                                                             %
7360 %                                                                             %
7361 %                                                                             %
7362 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7363 %
7364 %  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7365 %  previous image in the sequence.  From this it attempts to select the
7366 %  smallest cropped image to replace each frame, while preserving the results
7367 %  of the animation.
7368 %
7369 %  The format of the MagickOptimizeImageLayers method is:
7370 %
7371 %      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7372 %
7373 %  A description of each parameter follows:
7374 %
7375 %    o wand: the magick wand.
7376 %
7377 */
7378 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7379 {
7380   Image
7381     *optimize_image;
7382
7383   assert(wand != (MagickWand *) NULL);
7384   assert(wand->signature == MagickWandSignature);
7385   if (wand->debug != MagickFalse)
7386     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7387   if (wand->images == (Image *) NULL)
7388     return((MagickWand *) NULL);
7389   optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7390   if (optimize_image == (Image *) NULL)
7391     return((MagickWand *) NULL);
7392   return(CloneMagickWandFromImages(wand,optimize_image));
7393 }
7394 \f
7395 /*
7396 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7397 %                                                                             %
7398 %                                                                             %
7399 %                                                                             %
7400 %   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             %
7401 %                                                                             %
7402 %                                                                             %
7403 %                                                                             %
7404 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7405 %
7406 %  MagickOptimizeImageTransparency() takes a frame optimized GIF animation, and
7407 %  compares the overlayed pixels against the disposal image resulting from all
7408 %  the previous frames in the animation.  Any pixel that does not change the
7409 %  disposal image (and thus does not effect the outcome of an overlay) is made
7410 %  transparent.
7411 %
7412 %  WARNING: This modifies the current images directly, rather than generate
7413 %  a new image sequence.
7414 %  The format of the MagickOptimizeImageTransparency method is:
7415 %
7416 %      MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7417 %
7418 %  A description of each parameter follows:
7419 %
7420 %    o wand: the magick wand.
7421 %
7422 */
7423 WandExport MagickBooleanType MagickOptimizeImageTransparency(MagickWand *wand)
7424 {
7425   assert(wand != (MagickWand *) NULL);
7426   assert(wand->signature == MagickWandSignature);
7427   if (wand->debug != MagickFalse)
7428     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7429   if (wand->images == (Image *) NULL)
7430     return(MagickFalse);
7431   OptimizeImageTransparency(wand->images,wand->exception);
7432   return(MagickTrue);
7433 }
7434 \f
7435 /*
7436 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7437 %                                                                             %
7438 %                                                                             %
7439 %                                                                             %
7440 %     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                   %
7441 %                                                                             %
7442 %                                                                             %
7443 %                                                                             %
7444 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7445 %
7446 %  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7447 %  of pre-defined dithering threshold maps, but over multiple intensity levels,
7448 %  which can be different for different channels, according to the input
7449 %  arguments.
7450 %
7451 %  The format of the MagickOrderedPosterizeImage method is:
7452 %
7453 %      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7454 %        const char *threshold_map)
7455 %
7456 %  A description of each parameter follows:
7457 %
7458 %    o image: the image.
7459 %
7460 %    o threshold_map: A string containing the name of the threshold dither
7461 %      map to use, followed by zero or more numbers representing the number of
7462 %      color levels tho dither between.
7463 %
7464 %      Any level number less than 2 is equivalent to 2, and means only binary
7465 %      dithering will be applied to each color channel.
7466 %
7467 %      No numbers also means a 2 level (bitmap) dither will be applied to all
7468 %      channels, while a single number is the number of levels applied to each
7469 %      channel in sequence.  More numbers will be applied in turn to each of
7470 %      the color channels.
7471 %
7472 %      For example: "o3x3,6" generates a 6 level posterization of the image
7473 %      with a ordered 3x3 diffused pixel dither being applied between each
7474 %      level. While checker,8,8,4 will produce a 332 colormaped image with
7475 %      only a single checkerboard hash pattern (50% grey) between each color
7476 %      level, to basically double the number of color levels with a bare
7477 %      minimim of dithering.
7478 %
7479 */
7480 WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7481   const char *threshold_map)
7482 {
7483   MagickBooleanType
7484     status;
7485
7486   assert(wand != (MagickWand *) NULL);
7487   assert(wand->signature == MagickWandSignature);
7488   if (wand->debug != MagickFalse)
7489     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7490   if (wand->images == (Image *) NULL)
7491     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7492   status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7493   return(status);
7494 }
7495 \f
7496 /*
7497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7498 %                                                                             %
7499 %                                                                             %
7500 %                                                                             %
7501 %   M a g i c k P i n g I m a g e                                             %
7502 %                                                                             %
7503 %                                                                             %
7504 %                                                                             %
7505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7506 %
7507 %  MagickPingImage() is the same as MagickReadImage() except the only valid
7508 %  information returned is the image width, height, size, and format.  It
7509 %  is designed to efficiently obtain this information from a file without
7510 %  reading the entire image sequence into memory.
7511 %
7512 %  The format of the MagickPingImage method is:
7513 %
7514 %      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7515 %
7516 %  A description of each parameter follows:
7517 %
7518 %    o wand: the magick wand.
7519 %
7520 %    o filename: the image filename.
7521 %
7522 */
7523 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7524   const char *filename)
7525 {
7526   Image
7527     *images;
7528
7529   ImageInfo
7530     *ping_info;
7531
7532   assert(wand != (MagickWand *) NULL);
7533   assert(wand->signature == MagickWandSignature);
7534   if (wand->debug != MagickFalse)
7535     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7536   ping_info=CloneImageInfo(wand->image_info);
7537   if (filename != (const char *) NULL)
7538     (void) CopyMagickString(ping_info->filename,filename,MagickPathExtent);
7539   images=PingImage(ping_info,wand->exception);
7540   ping_info=DestroyImageInfo(ping_info);
7541   if (images == (Image *) NULL)
7542     return(MagickFalse);
7543   return(InsertImageInWand(wand,images));
7544 }
7545 \f
7546 /*
7547 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7548 %                                                                             %
7549 %                                                                             %
7550 %                                                                             %
7551 %   M a g i c k P i n g I m a g e B l o b                                     %
7552 %                                                                             %
7553 %                                                                             %
7554 %                                                                             %
7555 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7556 %
7557 %  MagickPingImageBlob() pings an image or image sequence from a blob.
7558 %
7559 %  The format of the MagickPingImageBlob method is:
7560 %
7561 %      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7562 %        const void *blob,const size_t length)
7563 %
7564 %  A description of each parameter follows:
7565 %
7566 %    o wand: the magick wand.
7567 %
7568 %    o blob: the blob.
7569 %
7570 %    o length: the blob length.
7571 %
7572 */
7573 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7574   const void *blob,const size_t length)
7575 {
7576   Image
7577     *images;
7578
7579   ImageInfo
7580     *read_info;
7581
7582   assert(wand != (MagickWand *) NULL);
7583   assert(wand->signature == MagickWandSignature);
7584   if (wand->debug != MagickFalse)
7585     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7586   read_info=CloneImageInfo(wand->image_info);
7587   SetImageInfoBlob(read_info,blob,length);
7588   images=PingImage(read_info,wand->exception);
7589   read_info=DestroyImageInfo(read_info);
7590   if (images == (Image *) NULL)
7591     return(MagickFalse);
7592   return(InsertImageInWand(wand,images));
7593 }
7594 \f
7595 /*
7596 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7597 %                                                                             %
7598 %                                                                             %
7599 %                                                                             %
7600 %   M a g i c k P i n g I m a g e F i l e                                     %
7601 %                                                                             %
7602 %                                                                             %
7603 %                                                                             %
7604 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7605 %
7606 %  MagickPingImageFile() pings an image or image sequence from an open file
7607 %  descriptor.
7608 %
7609 %  The format of the MagickPingImageFile method is:
7610 %
7611 %      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7612 %
7613 %  A description of each parameter follows:
7614 %
7615 %    o wand: the magick wand.
7616 %
7617 %    o file: the file descriptor.
7618 %
7619 */
7620 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7621 {
7622   Image
7623     *images;
7624
7625   ImageInfo
7626     *read_info;
7627
7628   assert(wand != (MagickWand *) NULL);
7629   assert(wand->signature == MagickWandSignature);
7630   assert(file != (FILE *) NULL);
7631   if (wand->debug != MagickFalse)
7632     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7633   read_info=CloneImageInfo(wand->image_info);
7634   SetImageInfoFile(read_info,file);
7635   images=PingImage(read_info,wand->exception);
7636   read_info=DestroyImageInfo(read_info);
7637   if (images == (Image *) NULL)
7638     return(MagickFalse);
7639   return(InsertImageInWand(wand,images));
7640 }
7641 \f
7642 /*
7643 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7644 %                                                                             %
7645 %                                                                             %
7646 %                                                                             %
7647 %   M a g i c k P o l a r o i d I m a g e                                     %
7648 %                                                                             %
7649 %                                                                             %
7650 %                                                                             %
7651 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7652 %
7653 %  MagickPolaroidImage() simulates a Polaroid picture.
7654 %
7655 %  The format of the MagickPolaroidImage method is:
7656 %
7657 %      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7658 %        const DrawingWand *drawing_wand,const char *caption,const double angle,
7659 %        const PixelInterpolateMethod method)
7660 %
7661 %  A description of each parameter follows:
7662 %
7663 %    o wand: the magick wand.
7664 %
7665 %    o drawing_wand: the draw wand.
7666 %
7667 %    o caption: the Polaroid caption.
7668 %
7669 %    o angle: Apply the effect along this angle.
7670 %
7671 %    o method: the pixel interpolation method.
7672 %
7673 */
7674 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7675   const DrawingWand *drawing_wand,const char *caption,const double angle,
7676   const PixelInterpolateMethod method)
7677 {
7678   DrawInfo
7679     *draw_info;
7680
7681   Image
7682     *polaroid_image;
7683
7684   assert(wand != (MagickWand *) NULL);
7685   assert(wand->signature == MagickWandSignature);
7686   if (wand->debug != MagickFalse)
7687     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7688   if (wand->images == (Image *) NULL)
7689     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7690   draw_info=PeekDrawingWand(drawing_wand);
7691   if (draw_info == (DrawInfo *) NULL)
7692     return(MagickFalse);
7693   polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
7694     wand->exception);
7695   if (polaroid_image == (Image *) NULL)
7696     return(MagickFalse);
7697   ReplaceImageInList(&wand->images,polaroid_image);
7698   return(MagickTrue);
7699 }
7700 \f
7701 /*
7702 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7703 %                                                                             %
7704 %                                                                             %
7705 %                                                                             %
7706 %   M a g i c k P o s t e r i z e I m a g e                                   %
7707 %                                                                             %
7708 %                                                                             %
7709 %                                                                             %
7710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7711 %
7712 %  MagickPosterizeImage() reduces the image to a limited number of color level.
7713 %
7714 %  The format of the MagickPosterizeImage method is:
7715 %
7716 %      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7717 %        const size_t levels,const DitherMethod method)
7718 %
7719 %  A description of each parameter follows:
7720 %
7721 %    o wand: the magick wand.
7722 %
7723 %    o levels: Number of color levels allowed in each channel.  Very low values
7724 %      (2, 3, or 4) have the most visible effect.
7725 %
7726 %    o method: choose the dither method: UndefinedDitherMethod,
7727 %      NoDitherMethod, RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7728 %
7729 */
7730 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7731   const size_t levels,const DitherMethod dither)
7732 {
7733   MagickBooleanType
7734     status;
7735
7736   assert(wand != (MagickWand *) NULL);
7737   assert(wand->signature == MagickWandSignature);
7738   if (wand->debug != MagickFalse)
7739     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7740   if (wand->images == (Image *) NULL)
7741     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7742   status=PosterizeImage(wand->images,levels,dither,wand->exception);
7743   return(status);
7744 }
7745 \f
7746 /*
7747 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7748 %                                                                             %
7749 %                                                                             %
7750 %                                                                             %
7751 %   M a g i c k P r e v i e w I m a g e s                                     %
7752 %                                                                             %
7753 %                                                                             %
7754 %                                                                             %
7755 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7756 %
7757 %  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7758 %  image processing operation applied at varying strengths.  This helpful
7759 %  to quickly pin-point an appropriate parameter for an image processing
7760 %  operation.
7761 %
7762 %  The format of the MagickPreviewImages method is:
7763 %
7764 %      MagickWand *MagickPreviewImages(MagickWand *wand,
7765 %        const PreviewType preview)
7766 %
7767 %  A description of each parameter follows:
7768 %
7769 %    o wand: the magick wand.
7770 %
7771 %    o preview: the preview type.
7772 %
7773 */
7774 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7775   const PreviewType preview)
7776 {
7777   Image
7778     *preview_image;
7779
7780   assert(wand != (MagickWand *) NULL);
7781   assert(wand->signature == MagickWandSignature);
7782   if (wand->debug != MagickFalse)
7783     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7784   if (wand->images == (Image *) NULL)
7785     return((MagickWand *) NULL);
7786   preview_image=PreviewImage(wand->images,preview,wand->exception);
7787   if (preview_image == (Image *) NULL)
7788     return((MagickWand *) NULL);
7789   return(CloneMagickWandFromImages(wand,preview_image));
7790 }
7791 \f
7792 /*
7793 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7794 %                                                                             %
7795 %                                                                             %
7796 %                                                                             %
7797 %   M a g i c k P r e v i o u s I m a g e                                     %
7798 %                                                                             %
7799 %                                                                             %
7800 %                                                                             %
7801 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7802 %
7803 %  MagickPreviousImage() sets the previous image in the wand as the current
7804 %  image.
7805 %
7806 %  It is typically used after MagickSetLastIterator(), after which its first
7807 %  use will set the last image as the current image (unless the wand is empty).
7808 %
7809 %  It will return MagickFalse when no more images are left to be returned
7810 %  which happens when the wand is empty, or the current image is the first
7811 %  image.  At that point the iterator is than reset to again process images in
7812 %  the forward direction, again starting with the first image in list. Images
7813 %  added at this point are prepended.
7814 %
7815 %  Also at that point any images added to the wand using MagickAddImages() or
7816 %  MagickReadImages() will be prepended before the first image. In this sense
7817 %  the condition is not quite exactly the same as MagickResetIterator().
7818 %
7819 %  The format of the MagickPreviousImage method is:
7820 %
7821 %      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7822 %
7823 %  A description of each parameter follows:
7824 %
7825 %    o wand: the magick wand.
7826 %
7827 */
7828 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7829 {
7830   assert(wand != (MagickWand *) NULL);
7831   assert(wand->signature == MagickWandSignature);
7832   if (wand->debug != MagickFalse)
7833     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7834   if (wand->images == (Image *) NULL)
7835     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7836   if (wand->image_pending != MagickFalse)
7837     {
7838       wand->image_pending=MagickFalse;  /* image returned no longer pending */
7839       return(MagickTrue);
7840     }
7841   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7842     {
7843       wand->image_pending=MagickTrue;   /* Next now re-gets first image */
7844       wand->insert_before=MagickTrue;   /* insert/add prepends new images */
7845       return(MagickFalse);
7846     }
7847   wand->images=GetPreviousImageInList(wand->images);
7848   return(MagickTrue);
7849 }
7850 \f
7851 /*
7852 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7853 %                                                                             %
7854 %                                                                             %
7855 %                                                                             %
7856 %   M a g i c k Q u a n t i z e I m a g e                                     %
7857 %                                                                             %
7858 %                                                                             %
7859 %                                                                             %
7860 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7861 %
7862 %  MagickQuantizeImage() analyzes the colors within a reference image and
7863 %  chooses a fixed number of colors to represent the image.  The goal of the
7864 %  algorithm is to minimize the color difference between the input and output
7865 %  image while minimizing the processing time.
7866 %
7867 %  The format of the MagickQuantizeImage method is:
7868 %
7869 %      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7870 %        const size_t number_colors,const ColorspaceType colorspace,
7871 %        const size_t treedepth,const DitherMethod dither_method,
7872 %        const MagickBooleanType measure_error)
7873 %
7874 %  A description of each parameter follows:
7875 %
7876 %    o wand: the magick wand.
7877 %
7878 %    o number_colors: the number of colors.
7879 %
7880 %    o colorspace: Perform color reduction in this colorspace, typically
7881 %      RGBColorspace.
7882 %
7883 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7884 %      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
7885 %      reference image with the least amount of memory and the fastest
7886 %      computational speed.  In some cases, such as an image with low color
7887 %      dispersion (a few number of colors), a value other than
7888 %      Log4(number_colors) is required.  To expand the color tree completely,
7889 %      use a value of 8.
7890 %
7891 %    o dither_method: choose from UndefinedDitherMethod, NoDitherMethod,
7892 %      RiemersmaDitherMethod, FloydSteinbergDitherMethod.
7893 %
7894 %    o measure_error: A value other than zero measures the difference between
7895 %      the original and quantized images.  This difference is the total
7896 %      quantization error.  The error is computed by summing over all pixels
7897 %      in an image the distance squared in RGB space between each reference
7898 %      pixel value and its quantized value.
7899 %
7900 */
7901 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7902   const size_t number_colors,const ColorspaceType colorspace,
7903   const size_t treedepth,const DitherMethod dither_method,
7904   const MagickBooleanType measure_error)
7905 {
7906   MagickBooleanType
7907     status;
7908
7909   QuantizeInfo
7910     *quantize_info;
7911
7912   assert(wand != (MagickWand *) NULL);
7913   assert(wand->signature == MagickWandSignature);
7914   if (wand->debug != MagickFalse)
7915     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7916   if (wand->images == (Image *) NULL)
7917     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7918   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7919   quantize_info->number_colors=number_colors;
7920   quantize_info->dither_method=dither_method;
7921   quantize_info->tree_depth=treedepth;
7922   quantize_info->colorspace=colorspace;
7923   quantize_info->measure_error=measure_error;
7924   status=QuantizeImage(quantize_info,wand->images,wand->exception);
7925   quantize_info=DestroyQuantizeInfo(quantize_info);
7926   return(status);
7927 }
7928 \f
7929 /*
7930 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7931 %                                                                             %
7932 %                                                                             %
7933 %                                                                             %
7934 %   M a g i c k Q u a n t i z e I m a g e s                                   %
7935 %                                                                             %
7936 %                                                                             %
7937 %                                                                             %
7938 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7939 %
7940 %  MagickQuantizeImages() analyzes the colors within a sequence of images and
7941 %  chooses a fixed number of colors to represent the image.  The goal of the
7942 %  algorithm is to minimize the color difference between the input and output
7943 %  image while minimizing the processing time.
7944 %
7945 %  The format of the MagickQuantizeImages method is:
7946 %
7947 %      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7948 %        const size_t number_colors,const ColorspaceType colorspace,
7949 %        const size_t treedepth,const DitherMethod dither_method,
7950 %        const MagickBooleanType measure_error)
7951 %
7952 %  A description of each parameter follows:
7953 %
7954 %    o wand: the magick wand.
7955 %
7956 %    o number_colors: the number of colors.
7957 %
7958 %    o colorspace: Perform color reduction in this colorspace, typically
7959 %      RGBColorspace.
7960 %
7961 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7962 %      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
7963 %      reference image with the least amount of memory and the fastest
7964 %      computational speed.  In some cases, such as an image with low color
7965 %      dispersion (a few number of colors), a value other than
7966 %      Log4(number_colors) is required.  To expand the color tree completely,
7967 %      use a value of 8.
7968 %
7969 %    o dither_method: choose from these dither methods: NoDitherMethod,
7970 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7971 %
7972 %    o measure_error: A value other than zero measures the difference between
7973 %      the original and quantized images.  This difference is the total
7974 %      quantization error.  The error is computed by summing over all pixels
7975 %      in an image the distance squared in RGB space between each reference
7976 %      pixel value and its quantized value.
7977 %
7978 */
7979 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7980   const size_t number_colors,const ColorspaceType colorspace,
7981   const size_t treedepth,const DitherMethod dither_method,
7982   const MagickBooleanType measure_error)
7983 {
7984   MagickBooleanType
7985     status;
7986
7987   QuantizeInfo
7988     *quantize_info;
7989
7990   assert(wand != (MagickWand *) NULL);
7991   assert(wand->signature == MagickWandSignature);
7992   if (wand->debug != MagickFalse)
7993     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7994   if (wand->images == (Image *) NULL)
7995     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7996   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7997   quantize_info->number_colors=number_colors;
7998   quantize_info->dither_method=dither_method;
7999   quantize_info->tree_depth=treedepth;
8000   quantize_info->colorspace=colorspace;
8001   quantize_info->measure_error=measure_error;
8002   status=QuantizeImages(quantize_info,wand->images,wand->exception);
8003   quantize_info=DestroyQuantizeInfo(quantize_info);
8004   return(status);
8005 }
8006 \f
8007 /*
8008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8009 %                                                                             %
8010 %                                                                             %
8011 %                                                                             %
8012 %   M a g i c k R o t a t i o n a l B l u r I m a g e                         %
8013 %                                                                             %
8014 %                                                                             %
8015 %                                                                             %
8016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8017 %
8018 %  MagickRotationalBlurImage() rotational blurs an image.
8019 %
8020 %  The format of the MagickRotationalBlurImage method is:
8021 %
8022 %      MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
8023 %        const double angle)
8024 %
8025 %  A description of each parameter follows:
8026 %
8027 %    o wand: the magick wand.
8028 %
8029 %    o angle: the angle of the blur in degrees.
8030 %
8031 */
8032 WandExport MagickBooleanType MagickRotationalBlurImage(MagickWand *wand,
8033   const double angle)
8034 {
8035   Image
8036     *blur_image;
8037
8038   assert(wand != (MagickWand *) NULL);
8039   assert(wand->signature == MagickWandSignature);
8040   if (wand->debug != MagickFalse)
8041     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8042   if (wand->images == (Image *) NULL)
8043     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8044   blur_image=RotationalBlurImage(wand->images,angle,wand->exception);
8045   if (blur_image == (Image *) NULL)
8046     return(MagickFalse);
8047   ReplaceImageInList(&wand->images,blur_image);
8048   return(MagickTrue);
8049 }
8050 \f
8051 /*
8052 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8053 %                                                                             %
8054 %                                                                             %
8055 %                                                                             %
8056 %   M a g i c k R a i s e I m a g e                                           %
8057 %                                                                             %
8058 %                                                                             %
8059 %                                                                             %
8060 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8061 %
8062 %  MagickRaiseImage() creates a simulated three-dimensional button-like effect
8063 %  by lightening and darkening the edges of the image.  Members width and
8064 %  height of raise_info define the width of the vertical and horizontal
8065 %  edge of the effect.
8066 %
8067 %  The format of the MagickRaiseImage method is:
8068 %
8069 %      MagickBooleanType MagickRaiseImage(MagickWand *wand,
8070 %        const size_t width,const size_t height,const ssize_t x,
8071 %        const ssize_t y,const MagickBooleanType raise)
8072 %
8073 %  A description of each parameter follows:
8074 %
8075 %    o wand: the magick wand.
8076 %
8077 %    o width,height,x,y:  Define the dimensions of the area to raise.
8078 %
8079 %    o raise: A value other than zero creates a 3-D raise effect,
8080 %      otherwise it has a lowered effect.
8081 %
8082 */
8083 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
8084   const size_t width,const size_t height,const ssize_t x,
8085   const ssize_t y,const MagickBooleanType raise)
8086 {
8087   MagickBooleanType
8088     status;
8089
8090   RectangleInfo
8091     raise_info;
8092
8093   assert(wand != (MagickWand *) NULL);
8094   assert(wand->signature == MagickWandSignature);
8095   if (wand->debug != MagickFalse)
8096     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8097   if (wand->images == (Image *) NULL)
8098     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8099   raise_info.width=width;
8100   raise_info.height=height;
8101   raise_info.x=x;
8102   raise_info.y=y;
8103   status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
8104   return(status);
8105 }
8106 \f
8107 /*
8108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8109 %                                                                             %
8110 %                                                                             %
8111 %                                                                             %
8112 %   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                       %
8113 %                                                                             %
8114 %                                                                             %
8115 %                                                                             %
8116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8117 %
8118 %  MagickRandomThresholdImage() changes the value of individual pixels based on
8119 %  the intensity of each pixel compared to threshold.  The result is a
8120 %  high-contrast, two color image.
8121 %
8122 %  The format of the MagickRandomThresholdImage method is:
8123 %
8124 %      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8125 %        const double low,const double high)
8126 %
8127 %  A description of each parameter follows:
8128 %
8129 %    o wand: the magick wand.
8130 %
8131 %    o low,high: Specify the high and low thresholds.  These values range from
8132 %      0 to QuantumRange.
8133 %
8134 */
8135 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8136   const double low,const double high)
8137 {
8138   char
8139     threshold[MagickPathExtent];
8140
8141   assert(wand != (MagickWand *) NULL);
8142   assert(wand->signature == MagickWandSignature);
8143   if (wand->debug != MagickFalse)
8144     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8145   if (wand->images == (Image *) NULL)
8146     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8147   (void) FormatLocaleString(threshold,MagickPathExtent,"%gx%g",low,high);
8148   return(RandomThresholdImage(wand->images,threshold,wand->exception));
8149 }
8150 \f
8151 /*
8152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8153 %                                                                             %
8154 %                                                                             %
8155 %                                                                             %
8156 %   M a g i c k R e a d I m a g e                                             %
8157 %                                                                             %
8158 %                                                                             %
8159 %                                                                             %
8160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8161 %
8162 %  MagickReadImage() reads an image or image sequence.  The images are inserted
8163 %  jjust before the current image pointer position.
8164 %
8165 %  Use MagickSetFirstIterator(), to insert new images before all the current
8166 %  images in the wand, MagickSetLastIterator() to append add to the end,
8167 %  MagickSetIteratorIndex() to place images just after the given index.
8168 %
8169 %  The format of the MagickReadImage method is:
8170 %
8171 %      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8172 %
8173 %  A description of each parameter follows:
8174 %
8175 %    o wand: the magick wand.
8176 %
8177 %    o filename: the image filename.
8178 %
8179 */
8180 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8181   const char *filename)
8182 {
8183   Image
8184     *images;
8185
8186   ImageInfo
8187     *read_info;
8188
8189   assert(wand != (MagickWand *) NULL);
8190   assert(wand->signature == MagickWandSignature);
8191   if (wand->debug != MagickFalse)
8192     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8193   read_info=CloneImageInfo(wand->image_info);
8194   if (filename != (const char *) NULL)
8195     (void) CopyMagickString(read_info->filename,filename,MagickPathExtent);
8196   images=ReadImage(read_info,wand->exception);
8197   read_info=DestroyImageInfo(read_info);
8198   if (images == (Image *) NULL)
8199     return(MagickFalse);
8200   return(InsertImageInWand(wand,images));
8201 }
8202 \f
8203 /*
8204 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8205 %                                                                             %
8206 %                                                                             %
8207 %                                                                             %
8208 %   M a g i c k R e a d I m a g e B l o b                                     %
8209 %                                                                             %
8210 %                                                                             %
8211 %                                                                             %
8212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8213 %
8214 %  MagickReadImageBlob() reads an image or image sequence from a blob.
8215 %  In all other respects it is like MagickReadImage().
8216 %
8217 %  The format of the MagickReadImageBlob method is:
8218 %
8219 %      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8220 %        const void *blob,const size_t length)
8221 %
8222 %  A description of each parameter follows:
8223 %
8224 %    o wand: the magick wand.
8225 %
8226 %    o blob: the blob.
8227 %
8228 %    o length: the blob length.
8229 %
8230 */
8231 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8232   const void *blob,const size_t length)
8233 {
8234   Image
8235     *images;
8236
8237   assert(wand != (MagickWand *) NULL);
8238   assert(wand->signature == MagickWandSignature);
8239   if (wand->debug != MagickFalse)
8240     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8241   images=BlobToImage(wand->image_info,blob,length,wand->exception);
8242   if (images == (Image *) NULL)
8243     return(MagickFalse);
8244   return(InsertImageInWand(wand,images));
8245 }
8246 \f
8247 /*
8248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8249 %                                                                             %
8250 %                                                                             %
8251 %                                                                             %
8252 %   M a g i c k R e a d I m a g e F i l e                                     %
8253 %                                                                             %
8254 %                                                                             %
8255 %                                                                             %
8256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8257 %
8258 %  MagickReadImageFile() reads an image or image sequence from an already
8259 %  opened file descriptor.  Otherwise it is like MagickReadImage().
8260 %
8261 %  The format of the MagickReadImageFile method is:
8262 %
8263 %      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8264 %
8265 %  A description of each parameter follows:
8266 %
8267 %    o wand: the magick wand.
8268 %
8269 %    o file: the file descriptor.
8270 %
8271 */
8272 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8273 {
8274   Image
8275     *images;
8276
8277   ImageInfo
8278     *read_info;
8279
8280   assert(wand != (MagickWand *) NULL);
8281   assert(wand->signature == MagickWandSignature);
8282   assert(file != (FILE *) NULL);
8283   if (wand->debug != MagickFalse)
8284     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8285   read_info=CloneImageInfo(wand->image_info);
8286   SetImageInfoFile(read_info,file);
8287   images=ReadImage(read_info,wand->exception);
8288   read_info=DestroyImageInfo(read_info);
8289   if (images == (Image *) NULL)
8290     return(MagickFalse);
8291   return(InsertImageInWand(wand,images));
8292 }
8293 \f
8294 /*
8295 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8296 %                                                                             %
8297 %                                                                             %
8298 %                                                                             %
8299 %   M a g i c k R e m a p I m a g e                                           %
8300 %                                                                             %
8301 %                                                                             %
8302 %                                                                             %
8303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8304 %
8305 %  MagickRemapImage() replaces the colors of an image with the closest color
8306 %  from a reference image.
8307 %
8308 %  The format of the MagickRemapImage method is:
8309 %
8310 %      MagickBooleanType MagickRemapImage(MagickWand *wand,
8311 %        const MagickWand *remap_wand,const DitherMethod method)
8312 %
8313 %  A description of each parameter follows:
8314 %
8315 %    o wand: the magick wand.
8316 %
8317 %    o affinity: the affinity wand.
8318 %
8319 %    o method: choose from these dither methods: NoDitherMethod,
8320 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8321 %
8322 */
8323 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8324   const MagickWand *remap_wand,const DitherMethod dither_method)
8325 {
8326   MagickBooleanType
8327     status;
8328
8329   QuantizeInfo
8330     *quantize_info;
8331
8332   assert(wand != (MagickWand *) NULL);
8333   assert(wand->signature == MagickWandSignature);
8334   if (wand->debug != MagickFalse)
8335     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8336   if ((wand->images == (Image *) NULL) ||
8337       (remap_wand->images == (Image *) NULL))
8338     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8339   quantize_info=AcquireQuantizeInfo(wand->image_info);
8340   quantize_info->dither_method=dither_method;
8341   status=RemapImage(quantize_info,wand->images,remap_wand->images,
8342     wand->exception);
8343   quantize_info=DestroyQuantizeInfo(quantize_info);
8344   return(status);
8345 }
8346 \f
8347 /*
8348 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8349 %                                                                             %
8350 %                                                                             %
8351 %                                                                             %
8352 %   M a g i c k R e m o v e I m a g e                                         %
8353 %                                                                             %
8354 %                                                                             %
8355 %                                                                             %
8356 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8357 %
8358 %  MagickRemoveImage() removes an image from the image list.
8359 %
8360 %  The format of the MagickRemoveImage method is:
8361 %
8362 %      MagickBooleanType MagickRemoveImage(MagickWand *wand)
8363 %
8364 %  A description of each parameter follows:
8365 %
8366 %    o wand: the magick wand.
8367 %
8368 %    o insert: the splice wand.
8369 %
8370 */
8371 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8372 {
8373   assert(wand != (MagickWand *) NULL);
8374   assert(wand->signature == MagickWandSignature);
8375   if (wand->debug != MagickFalse)
8376     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8377   if (wand->images == (Image *) NULL)
8378     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8379   DeleteImageFromList(&wand->images);
8380   return(MagickTrue);
8381 }
8382 \f
8383 /*
8384 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8385 %                                                                             %
8386 %                                                                             %
8387 %                                                                             %
8388 %   M a g i c k R e s a m p l e I m a g e                                     %
8389 %                                                                             %
8390 %                                                                             %
8391 %                                                                             %
8392 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8393 %
8394 %  MagickResampleImage() resample image to desired resolution.
8395 %
8396 %    Bessel   Blackman   Box
8397 %    Catrom   Cubic      Gaussian
8398 %    Hanning  Hermite    Lanczos
8399 %    Mitchell Point      Quandratic
8400 %    Sinc     Triangle
8401 %
8402 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8403 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8404 %  are windowed (brought down to zero) with the Blackman filter.
8405 %
8406 %  The format of the MagickResampleImage method is:
8407 %
8408 %      MagickBooleanType MagickResampleImage(MagickWand *wand,
8409 %        const double x_resolution,const double y_resolution,
8410 %        const FilterTypes filter)
8411 %
8412 %  A description of each parameter follows:
8413 %
8414 %    o wand: the magick wand.
8415 %
8416 %    o x_resolution: the new image x resolution.
8417 %
8418 %    o y_resolution: the new image y resolution.
8419 %
8420 %    o filter: Image filter to use.
8421 %
8422 */
8423 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8424   const double x_resolution,const double y_resolution,const FilterTypes filter)
8425 {
8426   Image
8427     *resample_image;
8428
8429   assert(wand != (MagickWand *) NULL);
8430   assert(wand->signature == MagickWandSignature);
8431   if (wand->debug != MagickFalse)
8432     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8433   if (wand->images == (Image *) NULL)
8434     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8435   resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8436     wand->exception);
8437   if (resample_image == (Image *) NULL)
8438     return(MagickFalse);
8439   ReplaceImageInList(&wand->images,resample_image);
8440   return(MagickTrue);
8441 }
8442 \f
8443 /*
8444 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8445 %                                                                             %
8446 %                                                                             %
8447 %                                                                             %
8448 %   M a g i c k R e s e t I m a g e P a g e                                   %
8449 %                                                                             %
8450 %                                                                             %
8451 %                                                                             %
8452 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8453 %
8454 %  MagickResetImagePage() resets the Wand page canvas and position.
8455 %
8456 %  The format of the MagickResetImagePage method is:
8457 %
8458 %      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8459 %        const char *page)
8460 %
8461 %  A description of each parameter follows:
8462 %
8463 %    o wand: the magick wand.
8464 %
8465 %    o page: the relative page specification.
8466 %
8467 */
8468 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8469   const char *page)
8470 {
8471   assert(wand != (MagickWand *) NULL);
8472   assert(wand->signature == MagickWandSignature);
8473   if (wand->debug != MagickFalse)
8474     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8475   if (wand->images == (Image *) NULL)
8476     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8477   if ((page == (char *) NULL) || (*page == '\0'))
8478     {
8479       (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8480       return(MagickTrue);
8481     }
8482   return(ResetImagePage(wand->images,page));
8483 }
8484 \f
8485 /*
8486 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8487 %                                                                             %
8488 %                                                                             %
8489 %                                                                             %
8490 %   M a g i c k R e s i z e I m a g e                                         %
8491 %                                                                             %
8492 %                                                                             %
8493 %                                                                             %
8494 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8495 %
8496 %  MagickResizeImage() scales an image to the desired dimensions with one of
8497 %  these filters:
8498 %
8499 %    Bessel   Blackman   Box
8500 %    Catrom   Cubic      Gaussian
8501 %    Hanning  Hermite    Lanczos
8502 %    Mitchell Point      Quandratic
8503 %    Sinc     Triangle
8504 %
8505 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8506 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8507 %  are windowed (brought down to zero) with the Blackman filter.
8508 %
8509 %  The format of the MagickResizeImage method is:
8510 %
8511 %      MagickBooleanType MagickResizeImage(MagickWand *wand,
8512 %        const size_t columns,const size_t rows,const FilterTypes filter)
8513 %
8514 %  A description of each parameter follows:
8515 %
8516 %    o wand: the magick wand.
8517 %
8518 %    o columns: the number of columns in the scaled image.
8519 %
8520 %    o rows: the number of rows in the scaled image.
8521 %
8522 %    o filter: Image filter to use.
8523 %
8524 */
8525 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8526   const size_t columns,const size_t rows,const FilterTypes filter)
8527 {
8528   Image
8529     *resize_image;
8530
8531   assert(wand != (MagickWand *) NULL);
8532   assert(wand->signature == MagickWandSignature);
8533   if (wand->debug != MagickFalse)
8534     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8535   if (wand->images == (Image *) NULL)
8536     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8537   resize_image=ResizeImage(wand->images,columns,rows,filter,wand->exception);
8538   if (resize_image == (Image *) NULL)
8539     return(MagickFalse);
8540   ReplaceImageInList(&wand->images,resize_image);
8541   return(MagickTrue);
8542 }
8543 \f
8544 /*
8545 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8546 %                                                                             %
8547 %                                                                             %
8548 %                                                                             %
8549 %   M a g i c k R o l l I m a g e                                             %
8550 %                                                                             %
8551 %                                                                             %
8552 %                                                                             %
8553 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8554 %
8555 %  MagickRollImage() offsets an image as defined by x and y.
8556 %
8557 %  The format of the MagickRollImage method is:
8558 %
8559 %      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8560 %        const size_t y)
8561 %
8562 %  A description of each parameter follows:
8563 %
8564 %    o wand: the magick wand.
8565 %
8566 %    o x: the x offset.
8567 %
8568 %    o y: the y offset.
8569 %
8570 %
8571 */
8572 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8573   const ssize_t x,const ssize_t y)
8574 {
8575   Image
8576     *roll_image;
8577
8578   assert(wand != (MagickWand *) NULL);
8579   assert(wand->signature == MagickWandSignature);
8580   if (wand->debug != MagickFalse)
8581     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8582   if (wand->images == (Image *) NULL)
8583     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8584   roll_image=RollImage(wand->images,x,y,wand->exception);
8585   if (roll_image == (Image *) NULL)
8586     return(MagickFalse);
8587   ReplaceImageInList(&wand->images,roll_image);
8588   return(MagickTrue);
8589 }
8590 \f
8591 /*
8592 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8593 %                                                                             %
8594 %                                                                             %
8595 %                                                                             %
8596 %   M a g i c k R o t a t e I m a g e                                         %
8597 %                                                                             %
8598 %                                                                             %
8599 %                                                                             %
8600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8601 %
8602 %  MagickRotateImage() rotates an image the specified number of degrees. Empty
8603 %  triangles left over from rotating the image are filled with the
8604 %  background color.
8605 %
8606 %  The format of the MagickRotateImage method is:
8607 %
8608 %      MagickBooleanType MagickRotateImage(MagickWand *wand,
8609 %        const PixelWand *background,const double degrees)
8610 %
8611 %  A description of each parameter follows:
8612 %
8613 %    o wand: the magick wand.
8614 %
8615 %    o background: the background pixel wand.
8616 %
8617 %    o degrees: the number of degrees to rotate the image.
8618 %
8619 %
8620 */
8621 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8622   const PixelWand *background,const double degrees)
8623 {
8624   Image
8625     *rotate_image;
8626
8627   assert(wand != (MagickWand *) NULL);
8628   assert(wand->signature == MagickWandSignature);
8629   if (wand->debug != MagickFalse)
8630     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8631   if (wand->images == (Image *) NULL)
8632     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8633   PixelGetQuantumPacket(background,&wand->images->background_color);
8634   rotate_image=RotateImage(wand->images,degrees,wand->exception);
8635   if (rotate_image == (Image *) NULL)
8636     return(MagickFalse);
8637   ReplaceImageInList(&wand->images,rotate_image);
8638   return(MagickTrue);
8639 }
8640 \f
8641 /*
8642 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8643 %                                                                             %
8644 %                                                                             %
8645 %                                                                             %
8646 %   M a g i c k S a m p l e I m a g e                                         %
8647 %                                                                             %
8648 %                                                                             %
8649 %                                                                             %
8650 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8651 %
8652 %  MagickSampleImage() scales an image to the desired dimensions with pixel
8653 %  sampling.  Unlike other scaling methods, this method does not introduce
8654 %  any additional color into the scaled image.
8655 %
8656 %  The format of the MagickSampleImage method is:
8657 %
8658 %      MagickBooleanType MagickSampleImage(MagickWand *wand,
8659 %        const size_t columns,const size_t rows)
8660 %
8661 %  A description of each parameter follows:
8662 %
8663 %    o wand: the magick wand.
8664 %
8665 %    o columns: the number of columns in the scaled image.
8666 %
8667 %    o rows: the number of rows in the scaled image.
8668 %
8669 %
8670 */
8671 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8672   const size_t columns,const size_t rows)
8673 {
8674   Image
8675     *sample_image;
8676
8677   assert(wand != (MagickWand *) NULL);
8678   assert(wand->signature == MagickWandSignature);
8679   if (wand->debug != MagickFalse)
8680     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8681   if (wand->images == (Image *) NULL)
8682     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8683   sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8684   if (sample_image == (Image *) NULL)
8685     return(MagickFalse);
8686   ReplaceImageInList(&wand->images,sample_image);
8687   return(MagickTrue);
8688 }
8689 \f
8690 /*
8691 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8692 %                                                                             %
8693 %                                                                             %
8694 %                                                                             %
8695 %   M a g i c k S c a l e I m a g e                                           %
8696 %                                                                             %
8697 %                                                                             %
8698 %                                                                             %
8699 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8700 %
8701 %  MagickScaleImage() scales the size of an image to the given dimensions.
8702 %
8703 %  The format of the MagickScaleImage method is:
8704 %
8705 %      MagickBooleanType MagickScaleImage(MagickWand *wand,
8706 %        const size_t columns,const size_t rows)
8707 %
8708 %  A description of each parameter follows:
8709 %
8710 %    o wand: the magick wand.
8711 %
8712 %    o columns: the number of columns in the scaled image.
8713 %
8714 %    o rows: the number of rows in the scaled image.
8715 %
8716 %
8717 */
8718 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8719   const size_t columns,const size_t rows)
8720 {
8721   Image
8722     *scale_image;
8723
8724   assert(wand != (MagickWand *) NULL);
8725   assert(wand->signature == MagickWandSignature);
8726   if (wand->debug != MagickFalse)
8727     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8728   if (wand->images == (Image *) NULL)
8729     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8730   scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8731   if (scale_image == (Image *) NULL)
8732     return(MagickFalse);
8733   ReplaceImageInList(&wand->images,scale_image);
8734   return(MagickTrue);
8735 }
8736 \f
8737 /*
8738 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8739 %                                                                             %
8740 %                                                                             %
8741 %                                                                             %
8742 %   M a g i c k S e g m e n t I m a g e                                       %
8743 %                                                                             %
8744 %                                                                             %
8745 %                                                                             %
8746 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8747 %
8748 %  MagickSegmentImage() segments an image by analyzing the histograms of the
8749 %  color components and identifying units that are homogeneous with the fuzzy
8750 %  C-means technique.
8751 %
8752 %  The format of the SegmentImage method is:
8753 %
8754 %      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8755 %        const ColorspaceType colorspace,const MagickBooleanType verbose,
8756 %        const double cluster_threshold,const double smooth_threshold)
8757 %
8758 %  A description of each parameter follows.
8759 %
8760 %    o wand: the wand.
8761 %
8762 %    o colorspace: the image colorspace.
8763 %
8764 %    o verbose:  Set to MagickTrue to print detailed information about the
8765 %      identified classes.
8766 %
8767 %    o cluster_threshold:  This represents the minimum number of pixels
8768 %      contained in a hexahedra before it can be considered valid (expressed as
8769 %      a percentage).
8770 %
8771 %    o smooth_threshold: the smoothing threshold eliminates noise in the second
8772 %      derivative of the histogram.  As the value is increased, you can expect a
8773 %      smoother second derivative.
8774 %
8775 */
8776 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8777   const ColorspaceType colorspace,const MagickBooleanType verbose,
8778   const double cluster_threshold,const double smooth_threshold)
8779 {
8780   MagickBooleanType
8781     status;
8782
8783   assert(wand != (MagickWand *) NULL);
8784   assert(wand->signature == MagickWandSignature);
8785   if (wand->debug != MagickFalse)
8786     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8787   if (wand->images == (Image *) NULL)
8788     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8789   status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8790     smooth_threshold,wand->exception);
8791   return(status);
8792 }
8793 \f
8794 /*
8795 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8796 %                                                                             %
8797 %                                                                             %
8798 %                                                                             %
8799 %   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8800 %                                                                             %
8801 %                                                                             %
8802 %                                                                             %
8803 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8804 %
8805 %  MagickSelectiveBlurImage() selectively blur an image within a contrast
8806 %  threshold. It is similar to the unsharpen mask that sharpens everything with
8807 %  contrast above a certain threshold.
8808 %
8809 %  The format of the MagickSelectiveBlurImage method is:
8810 %
8811 %      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8812 %        const double radius,const double sigma,const double threshold)
8813 %
8814 %  A description of each parameter follows:
8815 %
8816 %    o wand: the magick wand.
8817 %
8818 %    o radius: the radius of the gaussian, in pixels, not counting the center
8819 %      pixel.
8820 %
8821 %    o sigma: the standard deviation of the gaussian, in pixels.
8822 %
8823 %    o threshold: only pixels within this contrast threshold are included
8824 %      in the blur operation.
8825 %
8826 */
8827 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8828   const double radius,const double sigma,const double threshold)
8829 {
8830   Image
8831     *blur_image;
8832
8833   assert(wand != (MagickWand *) NULL);
8834   assert(wand->signature == MagickWandSignature);
8835   if (wand->debug != MagickFalse)
8836     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8837   if (wand->images == (Image *) NULL)
8838     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8839   blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,
8840     wand->exception);
8841   if (blur_image == (Image *) NULL)
8842     return(MagickFalse);
8843   ReplaceImageInList(&wand->images,blur_image);
8844   return(MagickTrue);
8845 }
8846 \f
8847 /*
8848 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8849 %                                                                             %
8850 %                                                                             %
8851 %                                                                             %
8852 %   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                       %
8853 %                                                                             %
8854 %                                                                             %
8855 %                                                                             %
8856 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8857 %
8858 %  MagickSeparateImage() separates a channel from the image and returns a
8859 %  grayscale image.  A channel is a particular color component of each pixel
8860 %  in the image.
8861 %
8862 %  The format of the MagickSeparateImage method is:
8863 %
8864 %      MagickBooleanType MagickSeparateImage(MagickWand *wand,
8865 %        const ChannelType channel)
8866 %
8867 %  A description of each parameter follows:
8868 %
8869 %    o wand: the magick wand.
8870 %
8871 %    o channel: the channel.
8872 %
8873 */
8874 WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
8875   const ChannelType channel)
8876 {
8877   Image
8878     *separate_image;
8879
8880   assert(wand != (MagickWand *) NULL);
8881   assert(wand->signature == MagickWandSignature);
8882   if (wand->debug != MagickFalse)
8883     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8884   if (wand->images == (Image *) NULL)
8885     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8886   separate_image=SeparateImage(wand->images,channel,wand->exception);
8887   if (separate_image == (Image *) NULL)
8888     return(MagickFalse);
8889   ReplaceImageInList(&wand->images,separate_image);
8890   return(MagickTrue);
8891 }
8892 \f
8893 /*
8894 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8895 %                                                                             %
8896 %                                                                             %
8897 %                                                                             %
8898 %     M a g i c k S e p i a T o n e I m a g e                                 %
8899 %                                                                             %
8900 %                                                                             %
8901 %                                                                             %
8902 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8903 %
8904 %  MagickSepiaToneImage() applies a special effect to the image, similar to the
8905 %  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8906 %  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8907 %  threshold of 80% is a good starting point for a reasonable tone.
8908 %
8909 %  The format of the MagickSepiaToneImage method is:
8910 %
8911 %      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8912 %        const double threshold)
8913 %
8914 %  A description of each parameter follows:
8915 %
8916 %    o wand: the magick wand.
8917 %
8918 %    o threshold:  Define the extent of the sepia toning.
8919 %
8920 */
8921 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8922   const double threshold)
8923 {
8924   Image
8925     *sepia_image;
8926
8927   assert(wand != (MagickWand *) NULL);
8928   assert(wand->signature == MagickWandSignature);
8929   if (wand->debug != MagickFalse)
8930     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8931   if (wand->images == (Image *) NULL)
8932     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8933   sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8934   if (sepia_image == (Image *) NULL)
8935     return(MagickFalse);
8936   ReplaceImageInList(&wand->images,sepia_image);
8937   return(MagickTrue);
8938 }
8939 \f
8940 /*
8941 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8942 %                                                                             %
8943 %                                                                             %
8944 %                                                                             %
8945 %   M a g i c k S e t I m a g e                                               %
8946 %                                                                             %
8947 %                                                                             %
8948 %                                                                             %
8949 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8950 %
8951 %  MagickSetImage() replaces the last image returned by MagickSetIteratorIndex(),
8952 %  MagickNextImage(), MagickPreviousImage() with the images from the specified
8953 %  wand.
8954 %
8955 %  The format of the MagickSetImage method is:
8956 %
8957 %      MagickBooleanType MagickSetImage(MagickWand *wand,
8958 %        const MagickWand *set_wand)
8959 %
8960 %  A description of each parameter follows:
8961 %
8962 %    o wand: the magick wand.
8963 %
8964 %    o set_wand: the set_wand wand.
8965 %
8966 */
8967 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8968   const MagickWand *set_wand)
8969 {
8970   Image
8971     *images;
8972
8973   assert(wand != (MagickWand *) NULL);
8974   assert(wand->signature == MagickWandSignature);
8975   if (wand->debug != MagickFalse)
8976     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8977   assert(set_wand != (MagickWand *) NULL);
8978   assert(set_wand->signature == MagickWandSignature);
8979   if (wand->debug != MagickFalse)
8980     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8981   if (set_wand->images == (Image *) NULL)
8982     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8983   images=CloneImageList(set_wand->images,wand->exception);
8984   if (images == (Image *) NULL)
8985     return(MagickFalse);
8986   ReplaceImageInList(&wand->images,images);
8987   return(MagickTrue);
8988 }
8989 \f
8990 /*
8991 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8992 %                                                                             %
8993 %                                                                             %
8994 %                                                                             %
8995 %   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                       %
8996 %                                                                             %
8997 %                                                                             %
8998 %                                                                             %
8999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9000 %
9001 %  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
9002 %  alpha channel.
9003 %
9004 %  The format of the MagickSetImageAlphaChannel method is:
9005 %
9006 %      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9007 %        const AlphaChannelOption alpha_type)
9008 %
9009 %  A description of each parameter follows:
9010 %
9011 %    o wand: the magick wand.
9012 %
9013 %    o alpha_type: the alpha channel type: ActivateAlphaChannel,
9014 %      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
9015 %
9016 */
9017 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9018   const AlphaChannelOption alpha_type)
9019 {
9020   assert(wand != (MagickWand *) NULL);
9021   assert(wand->signature == MagickWandSignature);
9022   if (wand->debug != MagickFalse)
9023     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9024   if (wand->images == (Image *) NULL)
9025     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9026   return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
9027 }
9028 \f
9029 /*
9030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9031 %                                                                             %
9032 %                                                                             %
9033 %                                                                             %
9034 %   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                 %
9035 %                                                                             %
9036 %                                                                             %
9037 %                                                                             %
9038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9039 %
9040 %  MagickSetImageBackgroundColor() sets the image background color.
9041 %
9042 %  The format of the MagickSetImageBackgroundColor method is:
9043 %
9044 %      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9045 %        const PixelWand *background)
9046 %
9047 %  A description of each parameter follows:
9048 %
9049 %    o wand: the magick wand.
9050 %
9051 %    o background: the background pixel wand.
9052 %
9053 */
9054 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9055   const PixelWand *background)
9056 {
9057   assert(wand != (MagickWand *) NULL);
9058   assert(wand->signature == MagickWandSignature);
9059   if (wand->debug != MagickFalse)
9060     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9061   if (wand->images == (Image *) NULL)
9062     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9063   PixelGetQuantumPacket(background,&wand->images->background_color);
9064   return(MagickTrue);
9065 }
9066 \f
9067 /*
9068 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9069 %                                                                             %
9070 %                                                                             %
9071 %                                                                             %
9072 %   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                         %
9073 %                                                                             %
9074 %                                                                             %
9075 %                                                                             %
9076 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9077 %
9078 %  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
9079 %
9080 %  The format of the MagickSetImageBluePrimary method is:
9081 %
9082 %      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9083 %        const double x,const double y)
9084 %
9085 %  A description of each parameter follows:
9086 %
9087 %    o wand: the magick wand.
9088 %
9089 %    o x: the blue primary x-point.
9090 %
9091 %    o y: the blue primary y-point.
9092 %
9093 */
9094 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9095   const double x,const double y)
9096 {
9097   assert(wand != (MagickWand *) NULL);
9098   assert(wand->signature == MagickWandSignature);
9099   if (wand->debug != MagickFalse)
9100     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9101   if (wand->images == (Image *) NULL)
9102     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9103   wand->images->chromaticity.blue_primary.x=x;
9104   wand->images->chromaticity.blue_primary.y=y;
9105   return(MagickTrue);
9106 }
9107 \f
9108 /*
9109 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9110 %                                                                             %
9111 %                                                                             %
9112 %                                                                             %
9113 %   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                         %
9114 %                                                                             %
9115 %                                                                             %
9116 %                                                                             %
9117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9118 %
9119 %  MagickSetImageBorderColor() sets the image border color.
9120 %
9121 %  The format of the MagickSetImageBorderColor method is:
9122 %
9123 %      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9124 %        const PixelWand *border)
9125 %
9126 %  A description of each parameter follows:
9127 %
9128 %    o wand: the magick wand.
9129 %
9130 %    o border: the border pixel wand.
9131 %
9132 */
9133 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9134   const PixelWand *border)
9135 {
9136   assert(wand != (MagickWand *) NULL);
9137   assert(wand->signature == MagickWandSignature);
9138   if (wand->debug != MagickFalse)
9139     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9140   if (wand->images == (Image *) NULL)
9141     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9142   PixelGetQuantumPacket(border,&wand->images->border_color);
9143   return(MagickTrue);
9144 }
9145 \f
9146 /*
9147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9148 %                                                                             %
9149 %                                                                             %
9150 %                                                                             %
9151 %   M a g i c k S e t I m a g e C h a n n e l M a s k                         %
9152 %                                                                             %
9153 %                                                                             %
9154 %                                                                             %
9155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9156 %
9157 %  MagickSetImageChannelMask() sets image channel mask.
9158 %
9159 %  The format of the MagickSetImageChannelMask method is:
9160 %
9161 %      ChannelType MagickSetImageChannelMask(MagickWand *wand,
9162 %        const ChannelType channel_mask)
9163 %
9164 %  A description of each parameter follows:
9165 %
9166 %    o wand: the magick wand.
9167 %
9168 %    o channel_mask: the channel_mask wand.
9169 %
9170 */
9171 WandExport ChannelType MagickSetImageChannelMask(MagickWand *wand,
9172   const ChannelType channel_mask)
9173 {
9174   assert(wand != (MagickWand *) NULL);
9175   assert(wand->signature == MagickWandSignature);
9176   if (wand->debug != MagickFalse)
9177     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9178   return(SetImageChannelMask(wand->images,channel_mask));
9179 }
9180 \f
9181 /*
9182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9183 %                                                                             %
9184 %                                                                             %
9185 %                                                                             %
9186 %   M a g i c k S e t I m a g e M a s k                                       %
9187 %                                                                             %
9188 %                                                                             %
9189 %                                                                             %
9190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9191 %
9192 %  MagickSetImageMask() sets image clip mask.
9193 %
9194 %  The format of the MagickSetImageMask method is:
9195 %
9196 %      MagickBooleanType MagickSetImageMask(MagickWand *wand,
9197 %        const PixelMask type,const MagickWand *clip_mask)
9198 %
9199 %  A description of each parameter follows:
9200 %
9201 %    o wand: the magick wand.
9202 %
9203 %    o type: type of mask, ReadPixelMask or WritePixelMask.
9204 %
9205 %    o clip_mask: the clip_mask wand.
9206 %
9207 */
9208 WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
9209   const PixelMask type,const MagickWand *clip_mask)
9210 {
9211   assert(wand != (MagickWand *) NULL);
9212   assert(wand->signature == MagickWandSignature);
9213   if (wand->debug != MagickFalse)
9214     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9215   assert(clip_mask != (MagickWand *) NULL);
9216   assert(clip_mask->signature == MagickWandSignature);
9217   if (clip_mask->debug != MagickFalse)
9218     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9219   if (clip_mask->images == (Image *) NULL)
9220     ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
9221   return(SetImageMask(wand->images,type,clip_mask->images,wand->exception));
9222 }
9223 \f
9224 /*
9225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9226 %                                                                             %
9227 %                                                                             %
9228 %                                                                             %
9229 %   M a g i c k S e t I m a g e C o l o r                                     %
9230 %                                                                             %
9231 %                                                                             %
9232 %                                                                             %
9233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9234 %
9235 %  MagickSetImageColor() set the entire wand canvas to the specified color.
9236 %
9237 %  The format of the MagickSetImageColor method is:
9238 %
9239 %      MagickBooleanType MagickSetImageColor(MagickWand *wand,
9240 %        const PixelWand *color)
9241 %
9242 %  A description of each parameter follows:
9243 %
9244 %    o wand: the magick wand.
9245 %
9246 %    o background: the image color.
9247 %
9248 */
9249 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9250   const PixelWand *color)
9251 {
9252   PixelInfo
9253     pixel;
9254
9255   assert(wand != (MagickWand *) NULL);
9256   assert(wand->signature == MagickWandSignature);
9257   if (wand->debug != MagickFalse)
9258     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9259   PixelGetMagickColor(color,&pixel);
9260   return(SetImageColor(wand->images,&pixel,wand->exception));
9261 }
9262 \f
9263 /*
9264 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9265 %                                                                             %
9266 %                                                                             %
9267 %                                                                             %
9268 %   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                     %
9269 %                                                                             %
9270 %                                                                             %
9271 %                                                                             %
9272 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9273 %
9274 %  MagickSetImageColormapColor() sets the color of the specified colormap
9275 %  index.
9276 %
9277 %  The format of the MagickSetImageColormapColor method is:
9278 %
9279 %      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9280 %        const size_t index,const PixelWand *color)
9281 %
9282 %  A description of each parameter follows:
9283 %
9284 %    o wand: the magick wand.
9285 %
9286 %    o index: the offset into the image colormap.
9287 %
9288 %    o color: Return the colormap color in this wand.
9289 %
9290 */
9291 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9292   const size_t index,const PixelWand *color)
9293 {
9294   assert(wand != (MagickWand *) NULL);
9295   assert(wand->signature == MagickWandSignature);
9296   if (wand->debug != MagickFalse)
9297     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9298   if (wand->images == (Image *) NULL)
9299     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9300   if ((wand->images->colormap == (PixelInfo *) NULL) ||
9301       (index >= wand->images->colors))
9302     ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9303   PixelGetQuantumPacket(color,wand->images->colormap+index);
9304   return(SyncImage(wand->images,wand->exception));
9305 }
9306 \f
9307 /*
9308 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9309 %                                                                             %
9310 %                                                                             %
9311 %                                                                             %
9312 %   M a g i c k S e t I m a g e C o l o r s p a c e                           %
9313 %                                                                             %
9314 %                                                                             %
9315 %                                                                             %
9316 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9317 %
9318 %  MagickSetImageColorspace() sets the image colorspace. But does not modify
9319 %  the image data.
9320 %
9321 %  The format of the MagickSetImageColorspace method is:
9322 %
9323 %      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9324 %        const ColorspaceType colorspace)
9325 %
9326 %  A description of each parameter follows:
9327 %
9328 %    o wand: the magick wand.
9329 %
9330 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
9331 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9332 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9333 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9334 %      HSLColorspace, or HWBColorspace.
9335 %
9336 */
9337 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9338   const ColorspaceType colorspace)
9339 {
9340   assert(wand != (MagickWand *) NULL);
9341   assert(wand->signature == MagickWandSignature);
9342   if (wand->debug != MagickFalse)
9343     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9344   if (wand->images == (Image *) NULL)
9345     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9346   return(SetImageColorspace(wand->images,colorspace,wand->exception));
9347 }
9348 \f
9349 /*
9350 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9351 %                                                                             %
9352 %                                                                             %
9353 %                                                                             %
9354 %   M a g i c k S e t I m a g e C o m p o s e                                 %
9355 %                                                                             %
9356 %                                                                             %
9357 %                                                                             %
9358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9359 %
9360 %  MagickSetImageCompose() sets the image composite operator, useful for
9361 %  specifying how to composite the image thumbnail when using the
9362 %  MagickMontageImage() method.
9363 %
9364 %  The format of the MagickSetImageCompose method is:
9365 %
9366 %      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9367 %        const CompositeOperator compose)
9368 %
9369 %  A description of each parameter follows:
9370 %
9371 %    o wand: the magick wand.
9372 %
9373 %    o compose: the image composite operator.
9374 %
9375 */
9376 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9377   const CompositeOperator compose)
9378 {
9379   assert(wand != (MagickWand *) NULL);
9380   assert(wand->signature == MagickWandSignature);
9381   if (wand->debug != MagickFalse)
9382     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9383   if (wand->images == (Image *) NULL)
9384     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9385   wand->images->compose=compose;
9386   return(MagickTrue);
9387 }
9388 \f
9389 /*
9390 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9391 %                                                                             %
9392 %                                                                             %
9393 %                                                                             %
9394 %   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                         %
9395 %                                                                             %
9396 %                                                                             %
9397 %                                                                             %
9398 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9399 %
9400 %  MagickSetImageCompression() sets the image compression.
9401 %
9402 %  The format of the MagickSetImageCompression method is:
9403 %
9404 %      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9405 %        const CompressionType compression)
9406 %
9407 %  A description of each parameter follows:
9408 %
9409 %    o wand: the magick wand.
9410 %
9411 %    o compression: the image compression type.
9412 %
9413 */
9414 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9415   const CompressionType compression)
9416 {
9417   assert(wand != (MagickWand *) NULL);
9418   assert(wand->signature == MagickWandSignature);
9419   if (wand->debug != MagickFalse)
9420     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9421   if (wand->images == (Image *) NULL)
9422     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9423   wand->images->compression=compression;
9424   return(MagickTrue);
9425 }
9426 \f
9427 /*
9428 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9429 %                                                                             %
9430 %                                                                             %
9431 %                                                                             %
9432 %   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           %
9433 %                                                                             %
9434 %                                                                             %
9435 %                                                                             %
9436 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9437 %
9438 %  MagickSetImageCompressionQuality() sets the image compression quality.
9439 %
9440 %  The format of the MagickSetImageCompressionQuality method is:
9441 %
9442 %      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9443 %        const size_t quality)
9444 %
9445 %  A description of each parameter follows:
9446 %
9447 %    o wand: the magick wand.
9448 %
9449 %    o quality: the image compression tlityype.
9450 %
9451 */
9452 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9453   const size_t quality)
9454 {
9455   assert(wand != (MagickWand *) NULL);
9456   assert(wand->signature == MagickWandSignature);
9457   if (wand->debug != MagickFalse)
9458     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9459   if (wand->images == (Image *) NULL)
9460     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9461   wand->images->quality=quality;
9462   return(MagickTrue);
9463 }
9464 \f
9465 /*
9466 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9467 %                                                                             %
9468 %                                                                             %
9469 %                                                                             %
9470 %   M a g i c k S e t I m a g e D e l a y                                     %
9471 %                                                                             %
9472 %                                                                             %
9473 %                                                                             %
9474 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9475 %
9476 %  MagickSetImageDelay() sets the image delay.
9477 %
9478 %  The format of the MagickSetImageDelay method is:
9479 %
9480 %      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9481 %        const size_t delay)
9482 %
9483 %  A description of each parameter follows:
9484 %
9485 %    o wand: the magick wand.
9486 %
9487 %    o delay: the image delay in ticks-per-second units.
9488 %
9489 */
9490 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9491   const size_t delay)
9492 {
9493   assert(wand != (MagickWand *) NULL);
9494   assert(wand->signature == MagickWandSignature);
9495   if (wand->debug != MagickFalse)
9496     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9497   if (wand->images == (Image *) NULL)
9498     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9499   wand->images->delay=delay;
9500   return(MagickTrue);
9501 }
9502 \f
9503 /*
9504 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9505 %                                                                             %
9506 %                                                                             %
9507 %                                                                             %
9508 %   M a g i c k S e t I m a g e D e p t h                                     %
9509 %                                                                             %
9510 %                                                                             %
9511 %                                                                             %
9512 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9513 %
9514 %  MagickSetImageDepth() sets the image depth.
9515 %
9516 %  The format of the MagickSetImageDepth method is:
9517 %
9518 %      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9519 %        const size_t depth)
9520 %
9521 %  A description of each parameter follows:
9522 %
9523 %    o wand: the magick wand.
9524 %
9525 %    o depth: the image depth in bits: 8, 16, or 32.
9526 %
9527 */
9528 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9529   const size_t depth)
9530 {
9531   assert(wand != (MagickWand *) NULL);
9532   assert(wand->signature == MagickWandSignature);
9533   if (wand->debug != MagickFalse)
9534     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9535   if (wand->images == (Image *) NULL)
9536     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9537   return(SetImageDepth(wand->images,depth,wand->exception));
9538 }
9539 \f
9540 /*
9541 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9542 %                                                                             %
9543 %                                                                             %
9544 %                                                                             %
9545 %   M a g i c k S e t I m a g e D i s p o s e                                 %
9546 %                                                                             %
9547 %                                                                             %
9548 %                                                                             %
9549 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9550 %
9551 %  MagickSetImageDispose() sets the image disposal method.
9552 %
9553 %  The format of the MagickSetImageDispose method is:
9554 %
9555 %      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9556 %        const DisposeType dispose)
9557 %
9558 %  A description of each parameter follows:
9559 %
9560 %    o wand: the magick wand.
9561 %
9562 %    o dispose: the image disposeal type.
9563 %
9564 */
9565 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9566   const DisposeType dispose)
9567 {
9568   assert(wand != (MagickWand *) NULL);
9569   assert(wand->signature == MagickWandSignature);
9570   if (wand->debug != MagickFalse)
9571     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9572   if (wand->images == (Image *) NULL)
9573     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9574   wand->images->dispose=dispose;
9575   return(MagickTrue);
9576 }
9577 \f
9578 /*
9579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9580 %                                                                             %
9581 %                                                                             %
9582 %                                                                             %
9583 %   M a g i c k S e t I m a g e E n d i a n                                   %
9584 %                                                                             %
9585 %                                                                             %
9586 %                                                                             %
9587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9588 %
9589 %  MagickSetImageEndian() sets the image endian method.
9590 %
9591 %  The format of the MagickSetImageEndian method is:
9592 %
9593 %      MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9594 %        const EndianType endian)
9595 %
9596 %  A description of each parameter follows:
9597 %
9598 %    o wand: the magick wand.
9599 %
9600 %    o endian: the image endian type.
9601 %
9602 */
9603 WandExport MagickBooleanType MagickSetImageEndian(MagickWand *wand,
9604   const EndianType endian)
9605 {
9606   assert(wand != (MagickWand *) NULL);
9607   assert(wand->signature == MagickWandSignature);
9608   if (wand->debug != MagickFalse)
9609     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9610   if (wand->images == (Image *) NULL)
9611     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9612   wand->images->endian=endian;
9613   return(MagickTrue);
9614 }
9615 \f
9616 /*
9617 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9618 %                                                                             %
9619 %                                                                             %
9620 %                                                                             %
9621 %   M a g i c k S e t I m a g e E x t e n t                                   %
9622 %                                                                             %
9623 %                                                                             %
9624 %                                                                             %
9625 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9626 %
9627 %  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9628 %
9629 %  The format of the MagickSetImageExtent method is:
9630 %
9631 %      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9632 %        const size_t columns,const unsigned rows)
9633 %
9634 %  A description of each parameter follows:
9635 %
9636 %    o wand: the magick wand.
9637 %
9638 %    o columns:  The image width in pixels.
9639 %
9640 %    o rows:  The image height in pixels.
9641 %
9642 */
9643 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9644   const size_t columns,const size_t rows)
9645 {
9646   assert(wand != (MagickWand *) NULL);
9647   assert(wand->signature == MagickWandSignature);
9648   if (wand->debug != MagickFalse)
9649     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9650   if (wand->images == (Image *) NULL)
9651     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9652   return(SetImageExtent(wand->images,columns,rows,wand->exception));
9653 }
9654 \f
9655 /*
9656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9657 %                                                                             %
9658 %                                                                             %
9659 %                                                                             %
9660 %   M a g i c k S e t I m a g e F i l e n a m e                               %
9661 %                                                                             %
9662 %                                                                             %
9663 %                                                                             %
9664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9665 %
9666 %  MagickSetImageFilename() sets the filename of a particular image in a
9667 %  sequence.
9668 %
9669 %  The format of the MagickSetImageFilename method is:
9670 %
9671 %      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9672 %        const char *filename)
9673 %
9674 %  A description of each parameter follows:
9675 %
9676 %    o wand: the magick wand.
9677 %
9678 %    o filename: the image filename.
9679 %
9680 */
9681 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9682   const char *filename)
9683 {
9684   assert(wand != (MagickWand *) NULL);
9685   assert(wand->signature == MagickWandSignature);
9686   if (wand->debug != MagickFalse)
9687     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9688   if (wand->images == (Image *) NULL)
9689     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9690   if (filename != (const char *) NULL)
9691     (void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
9692   return(MagickTrue);
9693 }
9694 \f
9695 /*
9696 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9697 %                                                                             %
9698 %                                                                             %
9699 %                                                                             %
9700 %   M a g i c k S e t I m a g e F o r m a t                                   %
9701 %                                                                             %
9702 %                                                                             %
9703 %                                                                             %
9704 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9705 %
9706 %  MagickSetImageFormat() sets the format of a particular image in a
9707 %  sequence.
9708 %
9709 %  The format of the MagickSetImageFormat method is:
9710 %
9711 %      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9712 %        const char *format)
9713 %
9714 %  A description of each parameter follows:
9715 %
9716 %    o wand: the magick wand.
9717 %
9718 %    o format: the image format.
9719 %
9720 */
9721 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9722   const char *format)
9723 {
9724   const MagickInfo
9725     *magick_info;
9726
9727   assert(wand != (MagickWand *) NULL);
9728   assert(wand->signature == MagickWandSignature);
9729   if (wand->debug != MagickFalse)
9730     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9731   if (wand->images == (Image *) NULL)
9732     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9733   if ((format == (char *) NULL) || (*format == '\0'))
9734     {
9735       *wand->images->magick='\0';
9736       return(MagickTrue);
9737     }
9738   magick_info=GetMagickInfo(format,wand->exception);
9739   if (magick_info == (const MagickInfo *) NULL)
9740     return(MagickFalse);
9741   ClearMagickException(wand->exception);
9742   (void) CopyMagickString(wand->images->magick,format,MagickPathExtent);
9743   return(MagickTrue);
9744 }
9745 \f
9746 /*
9747 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9748 %                                                                             %
9749 %                                                                             %
9750 %                                                                             %
9751 %   M a g i c k S e t I m a g e F u z z                                       %
9752 %                                                                             %
9753 %                                                                             %
9754 %                                                                             %
9755 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9756 %
9757 %  MagickSetImageFuzz() sets the image fuzz.
9758 %
9759 %  The format of the MagickSetImageFuzz method is:
9760 %
9761 %      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9762 %        const double fuzz)
9763 %
9764 %  A description of each parameter follows:
9765 %
9766 %    o wand: the magick wand.
9767 %
9768 %    o fuzz: the image fuzz.
9769 %
9770 */
9771 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9772   const double fuzz)
9773 {
9774   assert(wand != (MagickWand *) NULL);
9775   assert(wand->signature == MagickWandSignature);
9776   if (wand->debug != MagickFalse)
9777     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9778   if (wand->images == (Image *) NULL)
9779     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9780   wand->images->fuzz=fuzz;
9781   return(MagickTrue);
9782 }
9783 \f
9784 /*
9785 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9786 %                                                                             %
9787 %                                                                             %
9788 %                                                                             %
9789 %   M a g i c k S e t I m a g e G a m m a                                     %
9790 %                                                                             %
9791 %                                                                             %
9792 %                                                                             %
9793 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9794 %
9795 %  MagickSetImageGamma() sets the image gamma.
9796 %
9797 %  The format of the MagickSetImageGamma method is:
9798 %
9799 %      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9800 %        const double gamma)
9801 %
9802 %  A description of each parameter follows:
9803 %
9804 %    o wand: the magick wand.
9805 %
9806 %    o gamma: the image gamma.
9807 %
9808 */
9809 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9810   const double gamma)
9811 {
9812   assert(wand != (MagickWand *) NULL);
9813   assert(wand->signature == MagickWandSignature);
9814   if (wand->debug != MagickFalse)
9815     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9816   if (wand->images == (Image *) NULL)
9817     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9818   wand->images->gamma=gamma;
9819   return(MagickTrue);
9820 }
9821 \f
9822 /*
9823 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9824 %                                                                             %
9825 %                                                                             %
9826 %                                                                             %
9827 %   M a g i c k S e t I m a g e G r a v i t y                                 %
9828 %                                                                             %
9829 %                                                                             %
9830 %                                                                             %
9831 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9832 %
9833 %  MagickSetImageGravity() sets the image gravity type.
9834 %
9835 %  The format of the MagickSetImageGravity method is:
9836 %
9837 %      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9838 %        const GravityType gravity)
9839 %
9840 %  A description of each parameter follows:
9841 %
9842 %    o wand: the magick wand.
9843 %
9844 %    o gravity: positioning gravity (NorthWestGravity, NorthGravity,
9845 %               NorthEastGravity, WestGravity, CenterGravity,
9846 %               EastGravity, SouthWestGravity, SouthGravity,
9847 %               SouthEastGravity)
9848 %
9849 */
9850 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9851   const GravityType gravity)
9852 {
9853   assert(wand != (MagickWand *) NULL);
9854   assert(wand->signature == MagickWandSignature);
9855   if (wand->debug != MagickFalse)
9856     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9857   if (wand->images == (Image *) NULL)
9858     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9859   wand->images->gravity=gravity;
9860   return(MagickTrue);
9861 }
9862 \f
9863 /*
9864 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9865 %                                                                             %
9866 %                                                                             %
9867 %                                                                             %
9868 %   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                       %
9869 %                                                                             %
9870 %                                                                             %
9871 %                                                                             %
9872 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9873 %
9874 %  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9875 %  point.
9876 %
9877 %  The format of the MagickSetImageGreenPrimary method is:
9878 %
9879 %      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9880 %        const double x,const double y)
9881 %
9882 %  A description of each parameter follows:
9883 %
9884 %    o wand: the magick wand.
9885 %
9886 %    o x: the green primary x-point.
9887 %
9888 %    o y: the green primary y-point.
9889 %
9890 %
9891 */
9892 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9893   const double x,const double y)
9894 {
9895   assert(wand != (MagickWand *) NULL);
9896   assert(wand->signature == MagickWandSignature);
9897   if (wand->debug != MagickFalse)
9898     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9899   if (wand->images == (Image *) NULL)
9900     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9901   wand->images->chromaticity.green_primary.x=x;
9902   wand->images->chromaticity.green_primary.y=y;
9903   return(MagickTrue);
9904 }
9905 \f
9906 /*
9907 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9908 %                                                                             %
9909 %                                                                             %
9910 %                                                                             %
9911 %   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                 %
9912 %                                                                             %
9913 %                                                                             %
9914 %                                                                             %
9915 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9916 %
9917 %  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9918 %
9919 %  The format of the MagickSetImageInterlaceScheme method is:
9920 %
9921 %      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9922 %        const InterlaceType interlace)
9923 %
9924 %  A description of each parameter follows:
9925 %
9926 %    o wand: the magick wand.
9927 %
9928 %    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9929 %      PlaneInterlace, PartitionInterlace.
9930 %
9931 */
9932 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9933   const InterlaceType interlace)
9934 {
9935   assert(wand != (MagickWand *) NULL);
9936   assert(wand->signature == MagickWandSignature);
9937   if (wand->debug != MagickFalse)
9938     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9939   if (wand->images == (Image *) NULL)
9940     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9941   wand->images->interlace=interlace;
9942   return(MagickTrue);
9943 }
9944 \f
9945 /*
9946 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9947 %                                                                             %
9948 %                                                                             %
9949 %                                                                             %
9950 %   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             %
9951 %                                                                             %
9952 %                                                                             %
9953 %                                                                             %
9954 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9955 %
9956 %  MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel
9957 %  method.
9958 %
9959 %  The format of the MagickSetImagePixelInterpolateMethod method is:
9960 %
9961 %      MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9962 %        const PixelInterpolateMethod method)
9963 %
9964 %  A description of each parameter follows:
9965 %
9966 %    o wand: the magick wand.
9967 %
9968 %    o method: the image interpole pixel methods: choose from Undefined,
9969 %      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9970 %
9971 */
9972 WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(
9973   MagickWand *wand,const PixelInterpolateMethod method)
9974 {
9975   assert(wand != (MagickWand *) NULL);
9976   assert(wand->signature == MagickWandSignature);
9977   if (wand->debug != MagickFalse)
9978     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9979   if (wand->images == (Image *) NULL)
9980     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9981   wand->images->interpolate=method;
9982   return(MagickTrue);
9983 }
9984 \f
9985 /*
9986 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9987 %                                                                             %
9988 %                                                                             %
9989 %                                                                             %
9990 %   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9991 %                                                                             %
9992 %                                                                             %
9993 %                                                                             %
9994 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9995 %
9996 %  MagickSetImageIterations() sets the image iterations.
9997 %
9998 %  The format of the MagickSetImageIterations method is:
9999 %
10000 %      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10001 %        const size_t iterations)
10002 %
10003 %  A description of each parameter follows:
10004 %
10005 %    o wand: the magick wand.
10006 %
10007 %    o delay: the image delay in 1/100th of a second.
10008 %
10009 */
10010 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10011   const size_t iterations)
10012 {
10013   assert(wand != (MagickWand *) NULL);
10014   assert(wand->signature == MagickWandSignature);
10015   if (wand->debug != MagickFalse)
10016     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10017   if (wand->images == (Image *) NULL)
10018     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10019   wand->images->iterations=iterations;
10020   return(MagickTrue);
10021 }
10022 \f
10023 /*
10024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10025 %                                                                             %
10026 %                                                                             %
10027 %                                                                             %
10028 %   M a g i c k S e t I m a g e M a t t e                                     %
10029 %                                                                             %
10030 %                                                                             %
10031 %                                                                             %
10032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10033 %
10034 %  MagickSetImageMatte() sets the image matte channel.
10035 %
10036 %  The format of the MagickSetImageMatteColor method is:
10037 %
10038 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10039 %        const MagickBooleanType *matte)
10040 %
10041 %  A description of each parameter follows:
10042 %
10043 %    o wand: the magick wand.
10044 %
10045 %    o matte: Set to MagickTrue to enable the image matte channel otherwise
10046 %      MagickFalse.
10047 %
10048 */
10049 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10050   const MagickBooleanType matte)
10051 {
10052   assert(wand != (MagickWand *) NULL);
10053   assert(wand->signature == MagickWandSignature);
10054   if (wand->debug != MagickFalse)
10055     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10056   if (wand->images == (Image *) NULL)
10057     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10058   if (matte == MagickFalse)
10059     wand->images->alpha_trait=UndefinedPixelTrait;
10060   else
10061     {
10062       if (wand->images->alpha_trait == UndefinedPixelTrait)
10063         (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
10064       wand->images->alpha_trait=BlendPixelTrait;
10065     }
10066   return(MagickTrue);
10067 }
10068 \f
10069 /*
10070 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10071 %                                                                             %
10072 %                                                                             %
10073 %                                                                             %
10074 %   M a g i c k S e t I m a g e M a t t e C o l o r                           %
10075 %                                                                             %
10076 %                                                                             %
10077 %                                                                             %
10078 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10079 %
10080 %  MagickSetImageMatteColor() sets the image matte color.
10081 %
10082 %  The format of the MagickSetImageMatteColor method is:
10083 %
10084 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10085 %        const PixelWand *matte)
10086 %
10087 %  A description of each parameter follows:
10088 %
10089 %    o wand: the magick wand.
10090 %
10091 %    o matte: the matte pixel wand.
10092 %
10093 */
10094 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10095   const PixelWand *matte)
10096 {
10097   assert(wand != (MagickWand *) NULL);
10098   assert(wand->signature == MagickWandSignature);
10099   if (wand->debug != MagickFalse)
10100     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10101   if (wand->images == (Image *) NULL)
10102     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10103   PixelGetQuantumPacket(matte,&wand->images->matte_color);
10104   return(MagickTrue);
10105 }
10106 \f
10107 /*
10108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10109 %                                                                             %
10110 %                                                                             %
10111 %                                                                             %
10112 %   M a g i c k S e t I m a g e O p a c i t y                                 %
10113 %                                                                             %
10114 %                                                                             %
10115 %                                                                             %
10116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10117 %
10118 %  MagickSetImageAlpha() sets the image to the specified alpha level.
10119 %
10120 %  The format of the MagickSetImageAlpha method is:
10121 %
10122 %      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
10123 %        const double alpha)
10124 %
10125 %  A description of each parameter follows:
10126 %
10127 %    o wand: the magick wand.
10128 %
10129 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10130 %      transparent.
10131 %
10132 */
10133 WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
10134   const double alpha)
10135 {
10136   MagickBooleanType
10137     status;
10138
10139   assert(wand != (MagickWand *) NULL);
10140   assert(wand->signature == MagickWandSignature);
10141   if (wand->debug != MagickFalse)
10142     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10143   if (wand->images == (Image *) NULL)
10144     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10145   status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
10146     wand->exception);
10147   return(status);
10148 }
10149 \f
10150 /*
10151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10152 %                                                                             %
10153 %                                                                             %
10154 %                                                                             %
10155 %   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                         %
10156 %                                                                             %
10157 %                                                                             %
10158 %                                                                             %
10159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10160 %
10161 %  MagickSetImageOrientation() sets the image orientation.
10162 %
10163 %  The format of the MagickSetImageOrientation method is:
10164 %
10165 %      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10166 %        const OrientationType orientation)
10167 %
10168 %  A description of each parameter follows:
10169 %
10170 %    o wand: the magick wand.
10171 %
10172 %    o orientation: the image orientation type.
10173 %
10174 */
10175 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10176   const OrientationType orientation)
10177 {
10178   assert(wand != (MagickWand *) NULL);
10179   assert(wand->signature == MagickWandSignature);
10180   if (wand->debug != MagickFalse)
10181     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10182   if (wand->images == (Image *) NULL)
10183     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10184   wand->images->orientation=orientation;
10185   return(MagickTrue);
10186 }
10187 \f
10188 /*
10189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10190 %                                                                             %
10191 %                                                                             %
10192 %                                                                             %
10193 %   M a g i c k S e t I m a g e P a g e                                       %
10194 %                                                                             %
10195 %                                                                             %
10196 %                                                                             %
10197 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10198 %
10199 %  MagickSetImagePage() sets the page geometry of the image.
10200 %
10201 %  The format of the MagickSetImagePage method is:
10202 %
10203 %      MagickBooleanType MagickSetImagePage(MagickWand *wand,const size_t width,%        const size_t height,const ssize_t x,const ssize_t y)
10204 %
10205 %  A description of each parameter follows:
10206 %
10207 %    o wand: the magick wand.
10208 %
10209 %    o width: the page width.
10210 %
10211 %    o height: the page height.
10212 %
10213 %    o x: the page x-offset.
10214 %
10215 %    o y: the page y-offset.
10216 %
10217 */
10218 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
10219   const size_t width,const size_t height,const ssize_t x,
10220   const ssize_t y)
10221 {
10222   assert(wand != (MagickWand *) NULL);
10223   assert(wand->signature == MagickWandSignature);
10224   if (wand->debug != MagickFalse)
10225     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10226   if (wand->images == (Image *) NULL)
10227     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10228   wand->images->page.width=width;
10229   wand->images->page.height=height;
10230   wand->images->page.x=x;
10231   wand->images->page.y=y;
10232   return(MagickTrue);
10233 }
10234 \f
10235 /*
10236 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10237 %                                                                             %
10238 %                                                                             %
10239 %                                                                             %
10240 %   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                 %
10241 %                                                                             %
10242 %                                                                             %
10243 %                                                                             %
10244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10245 %
10246 %  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10247 %  specified method and returns the previous progress monitor if any.  The
10248 %  progress monitor method looks like this:
10249 %
10250 %    MagickBooleanType MagickProgressMonitor(const char *text,
10251 %      const MagickOffsetType offset,const MagickSizeType span,
10252 %      void *client_data)
10253 %
10254 %  If the progress monitor returns MagickFalse, the current operation is
10255 %  interrupted.
10256 %
10257 %  The format of the MagickSetImageProgressMonitor method is:
10258 %
10259 %      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10260 %        const MagickProgressMonitor progress_monitor,void *client_data)
10261 %
10262 %  A description of each parameter follows:
10263 %
10264 %    o wand: the magick wand.
10265 %
10266 %    o progress_monitor: Specifies a pointer to a method to monitor progress
10267 %      of an image operation.
10268 %
10269 %    o client_data: Specifies a pointer to any client data.
10270 %
10271 */
10272 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10273   const MagickProgressMonitor progress_monitor,void *client_data)
10274 {
10275   MagickProgressMonitor
10276     previous_monitor;
10277
10278   assert(wand != (MagickWand *) NULL);
10279   assert(wand->signature == MagickWandSignature);
10280   if (wand->debug != MagickFalse)
10281     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10282   if (wand->images == (Image *) NULL)
10283     {
10284       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10285         "ContainsNoImages","`%s'",wand->name);
10286       return((MagickProgressMonitor) NULL);
10287     }
10288   previous_monitor=SetImageProgressMonitor(wand->images,
10289     progress_monitor,client_data);
10290   return(previous_monitor);
10291 }
10292 \f
10293 /*
10294 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10295 %                                                                             %
10296 %                                                                             %
10297 %                                                                             %
10298 %   M a g i c k S e t I m a g e R e d P r i m a r y                           %
10299 %                                                                             %
10300 %                                                                             %
10301 %                                                                             %
10302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10303 %
10304 %  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10305 %
10306 %  The format of the MagickSetImageRedPrimary method is:
10307 %
10308 %      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10309 %        const double x,const double y)
10310 %
10311 %  A description of each parameter follows:
10312 %
10313 %    o wand: the magick wand.
10314 %
10315 %    o x: the red primary x-point.
10316 %
10317 %    o y: the red primary y-point.
10318 %
10319 */
10320 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10321   const double x,const double y)
10322 {
10323   assert(wand != (MagickWand *) NULL);
10324   assert(wand->signature == MagickWandSignature);
10325   if (wand->debug != MagickFalse)
10326     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10327   if (wand->images == (Image *) NULL)
10328     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10329   wand->images->chromaticity.red_primary.x=x;
10330   wand->images->chromaticity.red_primary.y=y;
10331   return(MagickTrue);
10332 }
10333 \f
10334 /*
10335 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10336 %                                                                             %
10337 %                                                                             %
10338 %                                                                             %
10339 %   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                 %
10340 %                                                                             %
10341 %                                                                             %
10342 %                                                                             %
10343 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10344 %
10345 %  MagickSetImageRenderingIntent() sets the image rendering intent.
10346 %
10347 %  The format of the MagickSetImageRenderingIntent method is:
10348 %
10349 %      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10350 %        const RenderingIntent rendering_intent)
10351 %
10352 %  A description of each parameter follows:
10353 %
10354 %    o wand: the magick wand.
10355 %
10356 %    o rendering_intent: the image rendering intent: UndefinedIntent,
10357 %      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10358 %
10359 */
10360 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10361   const RenderingIntent rendering_intent)
10362 {
10363   assert(wand != (MagickWand *) NULL);
10364   assert(wand->signature == MagickWandSignature);
10365   if (wand->debug != MagickFalse)
10366     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10367   if (wand->images == (Image *) NULL)
10368     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10369   wand->images->rendering_intent=rendering_intent;
10370   return(MagickTrue);
10371 }
10372 \f
10373 /*
10374 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10375 %                                                                             %
10376 %                                                                             %
10377 %                                                                             %
10378 %   M a g i c k S e t I m a g e R e s o l u t i o n                           %
10379 %                                                                             %
10380 %                                                                             %
10381 %                                                                             %
10382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10383 %
10384 %  MagickSetImageResolution() sets the image resolution.
10385 %
10386 %  The format of the MagickSetImageResolution method is:
10387 %
10388 %      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10389 %        const double x_resolution,const double y_resolution)
10390 %
10391 %  A description of each parameter follows:
10392 %
10393 %    o wand: the magick wand.
10394 %
10395 %    o x_resolution: the image x resolution.
10396 %
10397 %    o y_resolution: the image y resolution.
10398 %
10399 */
10400 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10401   const double x_resolution,const double y_resolution)
10402 {
10403   assert(wand != (MagickWand *) NULL);
10404   assert(wand->signature == MagickWandSignature);
10405   if (wand->debug != MagickFalse)
10406     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10407   if (wand->images == (Image *) NULL)
10408     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10409   wand->images->resolution.x=x_resolution;
10410   wand->images->resolution.y=y_resolution;
10411   return(MagickTrue);
10412 }
10413 \f
10414 /*
10415 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10416 %                                                                             %
10417 %                                                                             %
10418 %                                                                             %
10419 %   M a g i c k S e t I m a g e S c e n e                                     %
10420 %                                                                             %
10421 %                                                                             %
10422 %                                                                             %
10423 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10424 %
10425 %  MagickSetImageScene() sets the image scene.
10426 %
10427 %  The format of the MagickSetImageScene method is:
10428 %
10429 %      MagickBooleanType MagickSetImageScene(MagickWand *wand,
10430 %        const size_t scene)
10431 %
10432 %  A description of each parameter follows:
10433 %
10434 %    o wand: the magick wand.
10435 %
10436 %    o delay: the image scene number.
10437 %
10438 */
10439 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
10440   const size_t scene)
10441 {
10442   assert(wand != (MagickWand *) NULL);
10443   assert(wand->signature == MagickWandSignature);
10444   if (wand->debug != MagickFalse)
10445     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10446   if (wand->images == (Image *) NULL)
10447     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10448   wand->images->scene=scene;
10449   return(MagickTrue);
10450 }
10451 \f
10452 /*
10453 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10454 %                                                                             %
10455 %                                                                             %
10456 %                                                                             %
10457 %   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                   %
10458 %                                                                             %
10459 %                                                                             %
10460 %                                                                             %
10461 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10462 %
10463 %  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10464 %
10465 %  The format of the MagickSetImageTicksPerSecond method is:
10466 %
10467 %      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10468 %        const ssize_t ticks_per-second)
10469 %
10470 %  A description of each parameter follows:
10471 %
10472 %    o wand: the magick wand.
10473 %
10474 %    o ticks_per_second: the units to use for the image delay.
10475 %
10476 */
10477 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10478   const ssize_t ticks_per_second)
10479 {
10480   assert(wand != (MagickWand *) NULL);
10481   assert(wand->signature == MagickWandSignature);
10482   if (wand->debug != MagickFalse)
10483     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10484   if (wand->images == (Image *) NULL)
10485     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10486   wand->images->ticks_per_second=ticks_per_second;
10487   return(MagickTrue);
10488 }
10489 \f
10490 /*
10491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10492 %                                                                             %
10493 %                                                                             %
10494 %                                                                             %
10495 %   M a g i c k S e t I m a g e T y p e                                       %
10496 %                                                                             %
10497 %                                                                             %
10498 %                                                                             %
10499 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10500 %
10501 %  MagickSetImageType() sets the image type.
10502 %
10503 %  The format of the MagickSetImageType method is:
10504 %
10505 %      MagickBooleanType MagickSetImageType(MagickWand *wand,
10506 %        const ImageType image_type)
10507 %
10508 %  A description of each parameter follows:
10509 %
10510 %    o wand: the magick wand.
10511 %
10512 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10513 %      GrayscaleAlphaType, PaletteType, PaletteAlphaType, TrueColorType,
10514 %      TrueColorAlphaType, ColorSeparationType, ColorSeparationAlphaType,
10515 %      or OptimizeType.
10516 %
10517 */
10518 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10519   const ImageType image_type)
10520 {
10521   assert(wand != (MagickWand *) NULL);
10522   assert(wand->signature == MagickWandSignature);
10523   if (wand->debug != MagickFalse)
10524     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10525   if (wand->images == (Image *) NULL)
10526     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10527   return(SetImageType(wand->images,image_type,wand->exception));
10528 }
10529 \f
10530 /*
10531 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10532 %                                                                             %
10533 %                                                                             %
10534 %                                                                             %
10535 %   M a g i c k S e t I m a g e U n i t s                                     %
10536 %                                                                             %
10537 %                                                                             %
10538 %                                                                             %
10539 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10540 %
10541 %  MagickSetImageUnits() sets the image units of resolution.
10542 %
10543 %  The format of the MagickSetImageUnits method is:
10544 %
10545 %      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10546 %        const ResolutionType units)
10547 %
10548 %  A description of each parameter follows:
10549 %
10550 %    o wand: the magick wand.
10551 %
10552 %    o units: the image units of resolution : UndefinedResolution,
10553 %      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10554 %
10555 */
10556 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10557   const ResolutionType units)
10558 {
10559   assert(wand != (MagickWand *) NULL);
10560   assert(wand->signature == MagickWandSignature);
10561   if (wand->debug != MagickFalse)
10562     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10563   if (wand->images == (Image *) NULL)
10564     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10565   wand->images->units=units;
10566   return(MagickTrue);
10567 }
10568 \f
10569 /*
10570 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10571 %                                                                             %
10572 %                                                                             %
10573 %                                                                             %
10574 %   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           %
10575 %                                                                             %
10576 %                                                                             %
10577 %                                                                             %
10578 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10579 %
10580 %  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10581 %
10582 %  The format of the MagickSetImageVirtualPixelMethod method is:
10583 %
10584 %      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10585 %        const VirtualPixelMethod method)
10586 %
10587 %  A description of each parameter follows:
10588 %
10589 %    o wand: the magick wand.
10590 %
10591 %    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10592 %      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10593 %      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10594 %
10595 */
10596 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10597   const VirtualPixelMethod method)
10598 {
10599   assert(wand != (MagickWand *) NULL);
10600   assert(wand->signature == MagickWandSignature);
10601   if (wand->debug != MagickFalse)
10602     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10603   if (wand->images == (Image *) NULL)
10604     return(UndefinedVirtualPixelMethod);
10605   return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
10606 }
10607 \f
10608 /*
10609 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10610 %                                                                             %
10611 %                                                                             %
10612 %                                                                             %
10613 %   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10614 %                                                                             %
10615 %                                                                             %
10616 %                                                                             %
10617 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10618 %
10619 %  MagickSetImageWhitePoint() sets the image chromaticity white point.
10620 %
10621 %  The format of the MagickSetImageWhitePoint method is:
10622 %
10623 %      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10624 %        const double x,const double y)
10625 %
10626 %  A description of each parameter follows:
10627 %
10628 %    o wand: the magick wand.
10629 %
10630 %    o x: the white x-point.
10631 %
10632 %    o y: the white y-point.
10633 %
10634 */
10635 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10636   const double x,const double y)
10637 {
10638   assert(wand != (MagickWand *) NULL);
10639   assert(wand->signature == MagickWandSignature);
10640   if (wand->debug != MagickFalse)
10641     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10642   if (wand->images == (Image *) NULL)
10643     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10644   wand->images->chromaticity.white_point.x=x;
10645   wand->images->chromaticity.white_point.y=y;
10646   return(MagickTrue);
10647 }
10648 \f
10649 /*
10650 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10651 %                                                                             %
10652 %                                                                             %
10653 %                                                                             %
10654 %   M a g i c k S h a d e I m a g e C h a n n e l                             %
10655 %                                                                             %
10656 %                                                                             %
10657 %                                                                             %
10658 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10659 %
10660 %  MagickShadeImage() shines a distant light on an image to create a
10661 %  three-dimensional effect. You control the positioning of the light with
10662 %  azimuth and elevation; azimuth is measured in degrees off the x axis
10663 %  and elevation is measured in pixels above the Z axis.
10664 %
10665 %  The format of the MagickShadeImage method is:
10666 %
10667 %      MagickBooleanType MagickShadeImage(MagickWand *wand,
10668 %        const MagickBooleanType gray,const double azimuth,
10669 %        const double elevation)
10670 %
10671 %  A description of each parameter follows:
10672 %
10673 %    o wand: the magick wand.
10674 %
10675 %    o gray: A value other than zero shades the intensity of each pixel.
10676 %
10677 %    o azimuth, elevation:  Define the light source direction.
10678 %
10679 */
10680 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10681   const MagickBooleanType gray,const double asimuth,const double elevation)
10682 {
10683   Image
10684     *shade_image;
10685
10686   assert(wand != (MagickWand *) NULL);
10687   assert(wand->signature == MagickWandSignature);
10688   if (wand->debug != MagickFalse)
10689     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10690   if (wand->images == (Image *) NULL)
10691     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10692   shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10693   if (shade_image == (Image *) NULL)
10694     return(MagickFalse);
10695   ReplaceImageInList(&wand->images,shade_image);
10696   return(MagickTrue);
10697 }
10698 \f
10699 /*
10700 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10701 %                                                                             %
10702 %                                                                             %
10703 %                                                                             %
10704 %   M a g i c k S h a d o w I m a g e                                         %
10705 %                                                                             %
10706 %                                                                             %
10707 %                                                                             %
10708 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10709 %
10710 %  MagickShadowImage() simulates an image shadow.
10711 %
10712 %  The format of the MagickShadowImage method is:
10713 %
10714 %      MagickBooleanType MagickShadowImage(MagickWand *wand,const double alpha,
10715 %        const double sigma,const ssize_t x,const ssize_t y)
10716 %
10717 %  A description of each parameter follows:
10718 %
10719 %    o wand: the magick wand.
10720 %
10721 %    o alpha: percentage transparency.
10722 %
10723 %    o sigma: the standard deviation of the Gaussian, in pixels.
10724 %
10725 %    o x: the shadow x-offset.
10726 %
10727 %    o y: the shadow y-offset.
10728 %
10729 */
10730 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10731   const double alpha,const double sigma,const ssize_t x,const ssize_t y)
10732 {
10733   Image
10734     *shadow_image;
10735
10736   assert(wand != (MagickWand *) NULL);
10737   assert(wand->signature == MagickWandSignature);
10738   if (wand->debug != MagickFalse)
10739     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10740   if (wand->images == (Image *) NULL)
10741     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10742   shadow_image=ShadowImage(wand->images,alpha,sigma,x,y,wand->exception);
10743   if (shadow_image == (Image *) NULL)
10744     return(MagickFalse);
10745   ReplaceImageInList(&wand->images,shadow_image);
10746   return(MagickTrue);
10747 }
10748 \f
10749 /*
10750 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10751 %                                                                             %
10752 %                                                                             %
10753 %                                                                             %
10754 %   M a g i c k S h a r p e n I m a g e                                       %
10755 %                                                                             %
10756 %                                                                             %
10757 %                                                                             %
10758 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10759 %
10760 %  MagickSharpenImage() sharpens an image.  We convolve the image with a
10761 %  Gaussian operator of the given radius and standard deviation (sigma).
10762 %  For reasonable results, the radius should be larger than sigma.  Use a
10763 %  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10764 %
10765 %  The format of the MagickSharpenImage method is:
10766 %
10767 %      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10768 %        const double radius,const double sigma)
10769 %
10770 %  A description of each parameter follows:
10771 %
10772 %    o wand: the magick wand.
10773 %
10774 %    o radius: the radius of the Gaussian, in pixels, not counting the center
10775 %      pixel.
10776 %
10777 %    o sigma: the standard deviation of the Gaussian, in pixels.
10778 %
10779 */
10780 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10781   const double radius,const double sigma)
10782 {
10783   Image
10784     *sharp_image;
10785
10786   assert(wand != (MagickWand *) NULL);
10787   assert(wand->signature == MagickWandSignature);
10788   if (wand->debug != MagickFalse)
10789     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10790   if (wand->images == (Image *) NULL)
10791     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10792   sharp_image=SharpenImage(wand->images,radius,sigma,wand->exception);
10793   if (sharp_image == (Image *) NULL)
10794     return(MagickFalse);
10795   ReplaceImageInList(&wand->images,sharp_image);
10796   return(MagickTrue);
10797 }
10798 \f
10799 /*
10800 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10801 %                                                                             %
10802 %                                                                             %
10803 %                                                                             %
10804 %   M a g i c k S h a v e I m a g e                                           %
10805 %                                                                             %
10806 %                                                                             %
10807 %                                                                             %
10808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10809 %
10810 %  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10811 %  memory necessary for the new Image structure and returns a pointer to the
10812 %  new image.
10813 %
10814 %  The format of the MagickShaveImage method is:
10815 %
10816 %      MagickBooleanType MagickShaveImage(MagickWand *wand,
10817 %        const size_t columns,const size_t rows)
10818 %
10819 %  A description of each parameter follows:
10820 %
10821 %    o wand: the magick wand.
10822 %
10823 %    o columns: the number of columns in the scaled image.
10824 %
10825 %    o rows: the number of rows in the scaled image.
10826 %
10827 %
10828 */
10829 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10830   const size_t columns,const size_t rows)
10831 {
10832   Image
10833     *shave_image;
10834
10835   RectangleInfo
10836     shave_info;
10837
10838   assert(wand != (MagickWand *) NULL);
10839   assert(wand->signature == MagickWandSignature);
10840   if (wand->debug != MagickFalse)
10841     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10842   if (wand->images == (Image *) NULL)
10843     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10844   shave_info.width=columns;
10845   shave_info.height=rows;
10846   shave_info.x=0;
10847   shave_info.y=0;
10848   shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10849   if (shave_image == (Image *) NULL)
10850     return(MagickFalse);
10851   ReplaceImageInList(&wand->images,shave_image);
10852   return(MagickTrue);
10853 }
10854 \f
10855 /*
10856 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10857 %                                                                             %
10858 %                                                                             %
10859 %                                                                             %
10860 %   M a g i c k S h e a r I m a g e                                           %
10861 %                                                                             %
10862 %                                                                             %
10863 %                                                                             %
10864 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10865 %
10866 %  MagickShearImage() slides one edge of an image along the X or Y axis,
10867 %  creating a parallelogram.  An X direction shear slides an edge along the X
10868 %  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10869 %  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10870 %  is measured relative to the Y axis, and similarly, for Y direction shears
10871 %  y_shear is measured relative to the X axis.  Empty triangles left over from
10872 %  shearing the image are filled with the background color.
10873 %
10874 %  The format of the MagickShearImage method is:
10875 %
10876 %      MagickBooleanType MagickShearImage(MagickWand *wand,
10877 %        const PixelWand *background,const double x_shear,const double y_shear)
10878 %
10879 %  A description of each parameter follows:
10880 %
10881 %    o wand: the magick wand.
10882 %
10883 %    o background: the background pixel wand.
10884 %
10885 %    o x_shear: the number of degrees to shear the image.
10886 %
10887 %    o y_shear: the number of degrees to shear the image.
10888 %
10889 */
10890 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10891   const PixelWand *background,const double x_shear,const double y_shear)
10892 {
10893   Image
10894     *shear_image;
10895
10896   assert(wand != (MagickWand *) NULL);
10897   assert(wand->signature == MagickWandSignature);
10898   if (wand->debug != MagickFalse)
10899     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10900   if (wand->images == (Image *) NULL)
10901     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10902   PixelGetQuantumPacket(background,&wand->images->background_color);
10903   shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10904   if (shear_image == (Image *) NULL)
10905     return(MagickFalse);
10906   ReplaceImageInList(&wand->images,shear_image);
10907   return(MagickTrue);
10908 }
10909 \f
10910 /*
10911 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10912 %                                                                             %
10913 %                                                                             %
10914 %                                                                             %
10915 %   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                   %
10916 %                                                                             %
10917 %                                                                             %
10918 %                                                                             %
10919 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10920 %
10921 %  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10922 %  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10923 %  image using a sigmoidal transfer function without saturating highlights or
10924 %  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10925 %  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10926 %  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10927 %  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10928 %  is reduced.
10929 %
10930 %  The format of the MagickSigmoidalContrastImage method is:
10931 %
10932 %      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10933 %        const MagickBooleanType sharpen,const double alpha,const double beta)
10934 %
10935 %  A description of each parameter follows:
10936 %
10937 %    o wand: the magick wand.
10938 %
10939 %    o sharpen: Increase or decrease image contrast.
10940 %
10941 %    o alpha: strength of the contrast, the larger the number the more
10942 %      'threshold-like' it becomes.
10943 %
10944 %    o beta: midpoint of the function as a color value 0 to QuantumRange.
10945 %
10946 */
10947 WandExport MagickBooleanType MagickSigmoidalContrastImage(
10948   MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10949   const double beta)
10950 {
10951   MagickBooleanType
10952     status;
10953
10954   assert(wand != (MagickWand *) NULL);
10955   assert(wand->signature == MagickWandSignature);
10956   if (wand->debug != MagickFalse)
10957     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10958   if (wand->images == (Image *) NULL)
10959     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10960   status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10961     wand->exception);
10962   return(status);
10963 }
10964 \f
10965 /*
10966 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10967 %                                                                             %
10968 %                                                                             %
10969 %                                                                             %
10970 %   M a g i c k S i m i l a r i t y I m a g e                                 %
10971 %                                                                             %
10972 %                                                                             %
10973 %                                                                             %
10974 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10975 %
10976 %  MagickSimilarityImage() compares the reference image of the image and
10977 %  returns the best match offset.  In addition, it returns a similarity image
10978 %  such that an exact match location is completely white and if none of the
10979 %  pixels match, black, otherwise some gray level in-between.
10980 %
10981 %  The format of the MagickSimilarityImage method is:
10982 %
10983 %      MagickWand *MagickSimilarityImage(MagickWand *wand,
10984 %        const MagickWand *reference,const MetricType metric,
10985 %        const double similarity_threshold,RectangeInfo *offset,
10986 %        double *similarity)
10987 %
10988 %  A description of each parameter follows:
10989 %
10990 %    o wand: the magick wand.
10991 %
10992 %    o reference: the reference wand.
10993 %
10994 %    o metric: the metric.
10995 %
10996 %    o similarity_threshold: minimum distortion for (sub)image match.
10997 %
10998 %    o offset: the best match offset of the reference image within the image.
10999 %
11000 %    o similarity: the computed similarity between the images.
11001 %
11002 */
11003 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
11004   const MagickWand *reference,const MetricType metric,
11005   const double similarity_threshold,RectangleInfo *offset,double *similarity)
11006 {
11007   Image
11008     *similarity_image;
11009
11010   assert(wand != (MagickWand *) NULL);
11011   assert(wand->signature == MagickWandSignature);
11012   if (wand->debug != MagickFalse)
11013     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11014   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
11015     {
11016       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11017         "ContainsNoImages","`%s'",wand->name);
11018       return((MagickWand *) NULL);
11019     }
11020   similarity_image=SimilarityImage(wand->images,reference->images,metric,
11021     similarity_threshold,offset,similarity,wand->exception);
11022   if (similarity_image == (Image *) NULL)
11023     return((MagickWand *) NULL);
11024   return(CloneMagickWandFromImages(wand,similarity_image));
11025 }
11026 \f
11027 /*
11028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11029 %                                                                             %
11030 %                                                                             %
11031 %                                                                             %
11032 %   M a g i c k S k e t c h I m a g e                                         %
11033 %                                                                             %
11034 %                                                                             %
11035 %                                                                             %
11036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11037 %
11038 %  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
11039 %  a Gaussian operator of the given radius and standard deviation (sigma).
11040 %  For reasonable results, radius should be larger than sigma.  Use a
11041 %  radius of 0 and SketchImage() selects a suitable radius for you.
11042 %  Angle gives the angle of the blurring motion.
11043 %
11044 %  The format of the MagickSketchImage method is:
11045 %
11046 %      MagickBooleanType MagickSketchImage(MagickWand *wand,
11047 %        const double radius,const double sigma,const double angle)
11048 %
11049 %  A description of each parameter follows:
11050 %
11051 %    o wand: the magick wand.
11052 %
11053 %    o radius: the radius of the Gaussian, in pixels, not counting
11054 %      the center pixel.
11055 %
11056 %    o sigma: the standard deviation of the Gaussian, in pixels.
11057 %
11058 %    o angle: apply the effect along this angle.
11059 %
11060 */
11061 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
11062   const double radius,const double sigma,const double angle)
11063 {
11064   Image
11065     *sketch_image;
11066
11067   assert(wand != (MagickWand *) NULL);
11068   assert(wand->signature == MagickWandSignature);
11069   if (wand->debug != MagickFalse)
11070     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11071   if (wand->images == (Image *) NULL)
11072     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11073   sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
11074   if (sketch_image == (Image *) NULL)
11075     return(MagickFalse);
11076   ReplaceImageInList(&wand->images,sketch_image);
11077   return(MagickTrue);
11078 }
11079 \f
11080 /*
11081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11082 %                                                                             %
11083 %                                                                             %
11084 %                                                                             %
11085 %   M a g i c k S m u s h I m a g e s                                         %
11086 %                                                                             %
11087 %                                                                             %
11088 %                                                                             %
11089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11090 %
11091 %  MagickSmushImages() takes all images from the current image pointer to the
11092 %  end of the image list and smushs them to each other top-to-bottom if the
11093 %  stack parameter is true, otherwise left-to-right.
11094 %
11095 %  The format of the MagickSmushImages method is:
11096 %
11097 %      MagickWand *MagickSmushImages(MagickWand *wand,
11098 %        const MagickBooleanType stack,const ssize_t offset)
11099 %
11100 %  A description of each parameter follows:
11101 %
11102 %    o wand: the magick wand.
11103 %
11104 %    o stack: By default, images are stacked left-to-right. Set stack to
11105 %      MagickTrue to stack them top-to-bottom.
11106 %
11107 %    o offset: minimum distance in pixels between images.
11108 %
11109 */
11110 WandExport MagickWand *MagickSmushImages(MagickWand *wand,
11111   const MagickBooleanType stack,const ssize_t offset)
11112 {
11113   Image
11114     *smush_image;
11115
11116   assert(wand != (MagickWand *) NULL);
11117   assert(wand->signature == MagickWandSignature);
11118   if (wand->debug != MagickFalse)
11119     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11120   if (wand->images == (Image *) NULL)
11121     return((MagickWand *) NULL);
11122   smush_image=SmushImages(wand->images,stack,offset,wand->exception);
11123   if (smush_image == (Image *) NULL)
11124     return((MagickWand *) NULL);
11125   return(CloneMagickWandFromImages(wand,smush_image));
11126 }
11127 \f
11128 /*
11129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11130 %                                                                             %
11131 %                                                                             %
11132 %                                                                             %
11133 %     M a g i c k S o l a r i z e I m a g e                                   %
11134 %                                                                             %
11135 %                                                                             %
11136 %                                                                             %
11137 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11138 %
11139 %  MagickSolarizeImage() applies a special effect to the image, similar to the
11140 %  effect achieved in a photo darkroom by selectively exposing areas of photo
11141 %  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
11142 %  measure of the extent of the solarization.
11143 %
11144 %  The format of the MagickSolarizeImage method is:
11145 %
11146 %      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11147 %        const double threshold)
11148 %
11149 %  A description of each parameter follows:
11150 %
11151 %    o wand: the magick wand.
11152 %
11153 %    o threshold:  Define the extent of the solarization.
11154 %
11155 */
11156 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11157   const double threshold)
11158 {
11159   MagickBooleanType
11160     status;
11161
11162   assert(wand != (MagickWand *) NULL);
11163   assert(wand->signature == MagickWandSignature);
11164   if (wand->debug != MagickFalse)
11165     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11166   if (wand->images == (Image *) NULL)
11167     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11168   status=SolarizeImage(wand->images,threshold,wand->exception);
11169   return(status);
11170 }
11171 \f
11172 /*
11173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11174 %                                                                             %
11175 %                                                                             %
11176 %                                                                             %
11177 %   M a g i c k S p a r s e C o l o r I m a g e                               %
11178 %                                                                             %
11179 %                                                                             %
11180 %                                                                             %
11181 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11182 %
11183 %  MagickSparseColorImage(), given a set of coordinates, interpolates the
11184 %  colors found at those coordinates, across the whole image, using various
11185 %  methods.
11186 %
11187 %  The format of the MagickSparseColorImage method is:
11188 %
11189 %      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11190 %        const SparseColorMethod method,const size_t number_arguments,
11191 %        const double *arguments)
11192 %
11193 %  A description of each parameter follows:
11194 %
11195 %    o image: the image to be sparseed.
11196 %
11197 %    o method: the method of image sparseion.
11198 %
11199 %        ArcSparseColorion will always ignore source image offset, and always
11200 %        'bestfit' the destination image with the top left corner offset
11201 %        relative to the polar mapping center.
11202 %
11203 %        Bilinear has no simple inverse mapping so will not allow 'bestfit'
11204 %        style of image sparseion.
11205 %
11206 %        Affine, Perspective, and Bilinear, will do least squares fitting of
11207 %        the distrotion when more than the minimum number of control point
11208 %        pairs are provided.
11209 %
11210 %        Perspective, and Bilinear, will fall back to a Affine sparseion when
11211 %        less than 4 control point pairs are provided. While Affine sparseions
11212 %        will let you use any number of control point pairs, that is Zero pairs
11213 %        is a No-Op (viewport only) distrotion, one pair is a translation and
11214 %        two pairs of control points will do a scale-rotate-translate, without
11215 %        any shearing.
11216 %
11217 %    o number_arguments: the number of arguments given for this sparseion
11218 %      method.
11219 %
11220 %    o arguments: the arguments for this sparseion method.
11221 %
11222 */
11223 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11224   const SparseColorMethod method,const size_t number_arguments,
11225   const double *arguments)
11226 {
11227   Image
11228     *sparse_image;
11229
11230   assert(wand != (MagickWand *) NULL);
11231   assert(wand->signature == MagickWandSignature);
11232   if (wand->debug != MagickFalse)
11233     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11234   if (wand->images == (Image *) NULL)
11235     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11236   sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
11237     wand->exception);
11238   if (sparse_image == (Image *) NULL)
11239     return(MagickFalse);
11240   ReplaceImageInList(&wand->images,sparse_image);
11241   return(MagickTrue);
11242 }
11243 \f
11244 /*
11245 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11246 %                                                                             %
11247 %                                                                             %
11248 %                                                                             %
11249 %   M a g i c k S p l i c e I m a g e                                         %
11250 %                                                                             %
11251 %                                                                             %
11252 %                                                                             %
11253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11254 %
11255 %  MagickSpliceImage() splices a solid color into the image.
11256 %
11257 %  The format of the MagickSpliceImage method is:
11258 %
11259 %      MagickBooleanType MagickSpliceImage(MagickWand *wand,
11260 %        const size_t width,const size_t height,const ssize_t x,
11261 %        const ssize_t y)
11262 %
11263 %  A description of each parameter follows:
11264 %
11265 %    o wand: the magick wand.
11266 %
11267 %    o width: the region width.
11268 %
11269 %    o height: the region height.
11270 %
11271 %    o x: the region x offset.
11272 %
11273 %    o y: the region y offset.
11274 %
11275 */
11276 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
11277   const size_t width,const size_t height,const ssize_t x,
11278   const ssize_t y)
11279 {
11280   Image
11281     *splice_image;
11282
11283   RectangleInfo
11284     splice;
11285
11286   assert(wand != (MagickWand *) NULL);
11287   assert(wand->signature == MagickWandSignature);
11288   if (wand->debug != MagickFalse)
11289     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11290   if (wand->images == (Image *) NULL)
11291     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11292   splice.width=width;
11293   splice.height=height;
11294   splice.x=x;
11295   splice.y=y;
11296   splice_image=SpliceImage(wand->images,&splice,wand->exception);
11297   if (splice_image == (Image *) NULL)
11298     return(MagickFalse);
11299   ReplaceImageInList(&wand->images,splice_image);
11300   return(MagickTrue);
11301 }
11302 \f
11303 /*
11304 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11305 %                                                                             %
11306 %                                                                             %
11307 %                                                                             %
11308 %   M a g i c k S p r e a d I m a g e                                         %
11309 %                                                                             %
11310 %                                                                             %
11311 %                                                                             %
11312 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11313 %
11314 %  MagickSpreadImage() is a special effects method that randomly displaces each
11315 %  pixel in a block defined by the radius parameter.
11316 %
11317 %  The format of the MagickSpreadImage method is:
11318 %
11319 %      MagickBooleanType MagickSpreadImage(MagickWand *wand,
11320 %        const PixelInterpolateMethod method,const double radius)
11321 %        
11322 %  A description of each parameter follows:
11323 %
11324 %    o wand: the magick wand.
11325 %
11326 %    o method:  intepolation method.
11327 %
11328 %    o radius:  Choose a random pixel in a neighborhood of this extent.
11329 %
11330 */
11331 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11332   const PixelInterpolateMethod method,const double radius)
11333 {
11334   Image
11335     *spread_image;
11336
11337   assert(wand != (MagickWand *) NULL);
11338   assert(wand->signature == MagickWandSignature);
11339   if (wand->debug != MagickFalse)
11340     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11341   if (wand->images == (Image *) NULL)
11342     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11343   spread_image=SpreadImage(wand->images,method,radius,wand->exception);
11344   if (spread_image == (Image *) NULL)
11345     return(MagickFalse);
11346   ReplaceImageInList(&wand->images,spread_image);
11347   return(MagickTrue);
11348 }
11349 \f
11350 /*
11351 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11352 %                                                                             %
11353 %                                                                             %
11354 %                                                                             %
11355 %   M a g i c k S t a t i s t i c I m a g e                                   %
11356 %                                                                             %
11357 %                                                                             %
11358 %                                                                             %
11359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11360 %
11361 %  MagickStatisticImage() replace each pixel with corresponding statistic from
11362 %  the neighborhood of the specified width and height.
11363 %
11364 %  The format of the MagickStatisticImage method is:
11365 %
11366 %      MagickBooleanType MagickStatisticImage(MagickWand *wand,
11367 %        const StatisticType type,const double width,const size_t height)
11368 %
11369 %  A description of each parameter follows:
11370 %
11371 %    o wand: the magick wand.
11372 %
11373 %    o type: the statistic type (e.g. median, mode, etc.).
11374 %
11375 %    o width: the width of the pixel neighborhood.
11376 %
11377 %    o height: the height of the pixel neighborhood.
11378 %
11379 */
11380 WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
11381   const StatisticType type,const size_t width,const size_t height)
11382 {
11383   Image
11384     *statistic_image;
11385
11386   assert(wand != (MagickWand *) NULL);
11387   assert(wand->signature == MagickWandSignature);
11388   if (wand->debug != MagickFalse)
11389     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11390   if (wand->images == (Image *) NULL)
11391     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11392   statistic_image=StatisticImage(wand->images,type,width,height,
11393     wand->exception);
11394   if (statistic_image == (Image *) NULL)
11395     return(MagickFalse);
11396   ReplaceImageInList(&wand->images,statistic_image);
11397   return(MagickTrue);
11398 }
11399 \f
11400 /*
11401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11402 %                                                                             %
11403 %                                                                             %
11404 %                                                                             %
11405 %   M a g i c k S t e g a n o I m a g e                                       %
11406 %                                                                             %
11407 %                                                                             %
11408 %                                                                             %
11409 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11410 %
11411 %  MagickSteganoImage() hides a digital watermark within the image.
11412 %  Recover the hidden watermark later to prove that the authenticity of
11413 %  an image.  Offset defines the start position within the image to hide
11414 %  the watermark.
11415 %
11416 %  The format of the MagickSteganoImage method is:
11417 %
11418 %      MagickWand *MagickSteganoImage(MagickWand *wand,
11419 %        const MagickWand *watermark_wand,const ssize_t offset)
11420 %
11421 %  A description of each parameter follows:
11422 %
11423 %    o wand: the magick wand.
11424 %
11425 %    o watermark_wand: the watermark wand.
11426 %
11427 %    o offset: Start hiding at this offset into the image.
11428 %
11429 */
11430 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
11431   const MagickWand *watermark_wand,const ssize_t offset)
11432 {
11433   Image
11434     *stegano_image;
11435
11436   assert(wand != (MagickWand *) NULL);
11437   assert(wand->signature == MagickWandSignature);
11438   if (wand->debug != MagickFalse)
11439     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11440   if ((wand->images == (Image *) NULL) ||
11441       (watermark_wand->images == (Image *) NULL))
11442     {
11443       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11444         "ContainsNoImages","`%s'",wand->name);
11445       return((MagickWand *) NULL);
11446     }
11447   wand->images->offset=offset;
11448   stegano_image=SteganoImage(wand->images,watermark_wand->images,
11449     wand->exception);
11450   if (stegano_image == (Image *) NULL)
11451     return((MagickWand *) NULL);
11452   return(CloneMagickWandFromImages(wand,stegano_image));
11453 }
11454 \f
11455 /*
11456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11457 %                                                                             %
11458 %                                                                             %
11459 %                                                                             %
11460 %   M a g i c k S t e r e o I m a g e                                         %
11461 %                                                                             %
11462 %                                                                             %
11463 %                                                                             %
11464 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11465 %
11466 %  MagickStereoImage() composites two images and produces a single image that
11467 %  is the composite of a left and right image of a stereo pair
11468 %
11469 %  The format of the MagickStereoImage method is:
11470 %
11471 %      MagickWand *MagickStereoImage(MagickWand *wand,
11472 %        const MagickWand *offset_wand)
11473 %
11474 %  A description of each parameter follows:
11475 %
11476 %    o wand: the magick wand.
11477 %
11478 %    o offset_wand: Another image wand.
11479 %
11480 */
11481 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11482   const MagickWand *offset_wand)
11483 {
11484   Image
11485     *stereo_image;
11486
11487   assert(wand != (MagickWand *) NULL);
11488   assert(wand->signature == MagickWandSignature);
11489   if (wand->debug != MagickFalse)
11490     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11491   if ((wand->images == (Image *) NULL) ||
11492       (offset_wand->images == (Image *) NULL))
11493     {
11494       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11495         "ContainsNoImages","`%s'",wand->name);
11496       return((MagickWand *) NULL);
11497     }
11498   stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11499   if (stereo_image == (Image *) NULL)
11500     return((MagickWand *) NULL);
11501   return(CloneMagickWandFromImages(wand,stereo_image));
11502 }
11503 \f
11504 /*
11505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11506 %                                                                             %
11507 %                                                                             %
11508 %                                                                             %
11509 %   M a g i c k S t r i p I m a g e                                           %
11510 %                                                                             %
11511 %                                                                             %
11512 %                                                                             %
11513 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11514 %
11515 %  MagickStripImage() strips an image of all profiles and comments.
11516 %
11517 %  The format of the MagickStripImage method is:
11518 %
11519 %      MagickBooleanType MagickStripImage(MagickWand *wand)
11520 %
11521 %  A description of each parameter follows:
11522 %
11523 %    o wand: the magick wand.
11524 %
11525 */
11526 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11527 {
11528   assert(wand != (MagickWand *) NULL);
11529   assert(wand->signature == MagickWandSignature);
11530   if (wand->debug != MagickFalse)
11531     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11532   if (wand->images == (Image *) NULL)
11533     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11534   return(StripImage(wand->images,wand->exception));
11535 }
11536 \f
11537 /*
11538 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11539 %                                                                             %
11540 %                                                                             %
11541 %                                                                             %
11542 %   M a g i c k S w i r l I m a g e                                           %
11543 %                                                                             %
11544 %                                                                             %
11545 %                                                                             %
11546 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11547 %
11548 %  MagickSwirlImage() swirls the pixels about the center of the image, where
11549 %  degrees indicates the sweep of the arc through which each pixel is moved.
11550 %  You get a more dramatic effect as the degrees move from 1 to 360.
11551 %
11552 %  The format of the MagickSwirlImage method is:
11553 %
11554 %      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11555 %        const PixelInterpolateMethod method)
11556 %
11557 %  A description of each parameter follows:
11558 %
11559 %    o wand: the magick wand.
11560 %
11561 %    o degrees: Define the tightness of the swirling effect.
11562 %
11563 %    o method: the pixel interpolation method.
11564 %
11565 */
11566 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11567   const double degrees,const PixelInterpolateMethod method)
11568 {
11569   Image
11570     *swirl_image;
11571
11572   assert(wand != (MagickWand *) NULL);
11573   assert(wand->signature == MagickWandSignature);
11574   if (wand->debug != MagickFalse)
11575     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11576   if (wand->images == (Image *) NULL)
11577     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11578   swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
11579   if (swirl_image == (Image *) NULL)
11580     return(MagickFalse);
11581   ReplaceImageInList(&wand->images,swirl_image);
11582   return(MagickTrue);
11583 }
11584 \f
11585 /*
11586 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11587 %                                                                             %
11588 %                                                                             %
11589 %                                                                             %
11590 %   M a g i c k T e x t u r e I m a g e                                       %
11591 %                                                                             %
11592 %                                                                             %
11593 %                                                                             %
11594 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11595 %
11596 %  MagickTextureImage() repeatedly tiles the texture image across and down the
11597 %  image canvas.
11598 %
11599 %  The format of the MagickTextureImage method is:
11600 %
11601 %      MagickWand *MagickTextureImage(MagickWand *wand,
11602 %        const MagickWand *texture_wand)
11603 %
11604 %  A description of each parameter follows:
11605 %
11606 %    o wand: the magick wand.
11607 %
11608 %    o texture_wand: the texture wand
11609 %
11610 */
11611 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11612   const MagickWand *texture_wand)
11613 {
11614   Image
11615     *texture_image;
11616
11617   MagickBooleanType
11618     status;
11619
11620   assert(wand != (MagickWand *) NULL);
11621   assert(wand->signature == MagickWandSignature);
11622   if (wand->debug != MagickFalse)
11623     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11624   if ((wand->images == (Image *) NULL) ||
11625       (texture_wand->images == (Image *) NULL))
11626     {
11627       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11628         "ContainsNoImages","`%s'",wand->name);
11629       return((MagickWand *) NULL);
11630     }
11631   texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11632   if (texture_image == (Image *) NULL)
11633     return((MagickWand *) NULL);
11634   status=TextureImage(texture_image,texture_wand->images,wand->exception);
11635   if (status == MagickFalse)
11636     {
11637       texture_image=DestroyImage(texture_image);
11638       return((MagickWand *) NULL);
11639     }
11640   return(CloneMagickWandFromImages(wand,texture_image));
11641 }
11642 \f
11643 /*
11644 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11645 %                                                                             %
11646 %                                                                             %
11647 %                                                                             %
11648 %   M a g i c k T h r e s h o l d I m a g e                                   %
11649 %                                                                             %
11650 %                                                                             %
11651 %                                                                             %
11652 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11653 %
11654 %  MagickThresholdImage() changes the value of individual pixels based on
11655 %  the intensity of each pixel compared to threshold.  The result is a
11656 %  high-contrast, two color image.
11657 %
11658 %  The format of the MagickThresholdImage method is:
11659 %
11660 %      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11661 %        const double threshold)
11662 %      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11663 %        const ChannelType channel,const double threshold)
11664 %
11665 %  A description of each parameter follows:
11666 %
11667 %    o wand: the magick wand.
11668 %
11669 %    o channel: the image channel(s).
11670 %
11671 %    o threshold: Define the threshold value.
11672 %
11673 */
11674 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11675   const double threshold)
11676 {
11677   MagickBooleanType
11678     status;
11679
11680   status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11681   return(status);
11682 }
11683
11684 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11685   const ChannelType channel,const double threshold)
11686 {
11687   MagickBooleanType
11688     status;
11689
11690   assert(wand != (MagickWand *) NULL);
11691   assert(wand->signature == MagickWandSignature);
11692   if (wand->debug != MagickFalse)
11693     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11694   if (wand->images == (Image *) NULL)
11695     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11696   status=BilevelImage(wand->images,threshold,wand->exception);
11697   return(status);
11698 }
11699 \f
11700 /*
11701 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11702 %                                                                             %
11703 %                                                                             %
11704 %                                                                             %
11705 %   M a g i c k T h u m b n a i l I m a g e                                   %
11706 %                                                                             %
11707 %                                                                             %
11708 %                                                                             %
11709 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11710 %
11711 %  MagickThumbnailImage()  changes the size of an image to the given dimensions
11712 %  and removes any associated profiles.  The goal is to produce small low cost
11713 %  thumbnail images suited for display on the Web.
11714 %
11715 %  The format of the MagickThumbnailImage method is:
11716 %
11717 %      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11718 %        const size_t columns,const size_t rows)
11719 %
11720 %  A description of each parameter follows:
11721 %
11722 %    o wand: the magick wand.
11723 %
11724 %    o columns: the number of columns in the scaled image.
11725 %
11726 %    o rows: the number of rows in the scaled image.
11727 %
11728 */
11729 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11730   const size_t columns,const size_t rows)
11731 {
11732   Image
11733     *thumbnail_image;
11734
11735   assert(wand != (MagickWand *) NULL);
11736   assert(wand->signature == MagickWandSignature);
11737   if (wand->debug != MagickFalse)
11738     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11739   if (wand->images == (Image *) NULL)
11740     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11741   thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11742   if (thumbnail_image == (Image *) NULL)
11743     return(MagickFalse);
11744   ReplaceImageInList(&wand->images,thumbnail_image);
11745   return(MagickTrue);
11746 }
11747 \f
11748 /*
11749 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11750 %                                                                             %
11751 %                                                                             %
11752 %                                                                             %
11753 %   M a g i c k T i n t I m a g e                                             %
11754 %                                                                             %
11755 %                                                                             %
11756 %                                                                             %
11757 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11758 %
11759 %  MagickTintImage() applies a color vector to each pixel in the image.  The
11760 %  length of the vector is 0 for black and white and at its maximum for the
11761 %  midtones.  The vector weighting function is
11762 %  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11763 %
11764 %  The format of the MagickTintImage method is:
11765 %
11766 %      MagickBooleanType MagickTintImage(MagickWand *wand,
11767 %        const PixelWand *tint,const PixelWand *blend)
11768 %
11769 %  A description of each parameter follows:
11770 %
11771 %    o wand: the magick wand.
11772 %
11773 %    o tint: the tint pixel wand.
11774 %
11775 %    o alpha: the alpha pixel wand.
11776 %
11777 */
11778 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11779   const PixelWand *tint,const PixelWand *blend)
11780 {
11781   char
11782     percent_blend[MagickPathExtent];
11783
11784   Image
11785     *tint_image;
11786
11787   PixelInfo
11788     target;
11789
11790   assert(wand != (MagickWand *) NULL);
11791   assert(wand->signature == MagickWandSignature);
11792   if (wand->debug != MagickFalse)
11793     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11794   if (wand->images == (Image *) NULL)
11795     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11796   if (wand->images->colorspace != CMYKColorspace)
11797     (void) FormatLocaleString(percent_blend,MagickPathExtent,
11798       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11799       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11800       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11801       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11802       PixelGetAlphaQuantum(blend)));
11803   else
11804     (void) FormatLocaleString(percent_blend,MagickPathExtent,
11805       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
11806       PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11807       PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11808       PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11809       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11810       PixelGetAlphaQuantum(blend)));
11811   target=PixelGetPixel(tint);
11812   tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
11813   if (tint_image == (Image *) NULL)
11814     return(MagickFalse);
11815   ReplaceImageInList(&wand->images,tint_image);
11816   return(MagickTrue);
11817 }
11818 \f
11819 /*
11820 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11821 %                                                                             %
11822 %                                                                             %
11823 %                                                                             %
11824 %   M a g i c k T r a n s f o r m I m a g e                                   %
11825 %                                                                             %
11826 %                                                                             %
11827 %                                                                             %
11828 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11829 %
11830 %  MagickTransformImage() is a convenience method that behaves like
11831 %  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11832 %  information as a region geometry specification.  If the operation fails,
11833 %  a NULL image handle is returned.
11834 %
11835 %  The format of the MagickTransformImage method is:
11836 %
11837 %      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11838 %        const char *geometry)
11839 %
11840 %  A description of each parameter follows:
11841 %
11842 %    o wand: the magick wand.
11843 %
11844 %    o crop: A crop geometry string.  This geometry defines a subregion of the
11845 %      image to crop.
11846 %
11847 %    o geometry: An image geometry string.  This geometry defines the final
11848 %      size of the image.
11849 %
11850 */
11851 WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11852   const char *crop,const char *geometry)
11853 {
11854   Image
11855     *transform_image;
11856
11857   MagickBooleanType
11858     status;
11859
11860   assert(wand != (MagickWand *) NULL);
11861   assert(wand->signature == MagickWandSignature);
11862   if (wand->debug != MagickFalse)
11863     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11864   if (wand->images == (Image *) NULL)
11865     return((MagickWand *) NULL);
11866   transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11867   if (transform_image == (Image *) NULL)
11868     return((MagickWand *) NULL);
11869   status=TransformImage(&transform_image,crop,geometry,wand->exception);
11870   if (status == MagickFalse)
11871     {
11872       transform_image=DestroyImage(transform_image);
11873       return((MagickWand *) NULL);
11874     }
11875   return(CloneMagickWandFromImages(wand,transform_image));
11876 }
11877 \f
11878 /*
11879 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11880 %                                                                             %
11881 %                                                                             %
11882 %                                                                             %
11883 %   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               %
11884 %                                                                             %
11885 %                                                                             %
11886 %                                                                             %
11887 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11888 %
11889 %  MagickTransformImageColorspace() transform the image colorspace, setting
11890 %  the images colorspace while transforming the images data to that
11891 %  colorspace.
11892 %
11893 %  The format of the MagickTransformImageColorspace method is:
11894 %
11895 %      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11896 %        const ColorspaceType colorspace)
11897 %
11898 %  A description of each parameter follows:
11899 %
11900 %    o wand: the magick wand.
11901 %
11902 %    o colorspace: the image colorspace:   UndefinedColorspace,
11903 %      sRGBColorspace, RGBColorspace, GRAYColorspace,
11904 %      OHTAColorspace, XYZColorspace, YCbCrColorspace,
11905 %      YCCColorspace, YIQColorspace, YPbPrColorspace,
11906 %      YPbPrColorspace, YUVColorspace, CMYKColorspace,
11907 %      HSLColorspace, HWBColorspace.
11908 %
11909 */
11910 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11911   const ColorspaceType colorspace)
11912 {
11913   assert(wand != (MagickWand *) NULL);
11914   assert(wand->signature == MagickWandSignature);
11915   if (wand->debug != MagickFalse)
11916     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11917   if (wand->images == (Image *) NULL)
11918     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11919   return(TransformImageColorspace(wand->images,colorspace,wand->exception));
11920 }
11921 \f
11922 /*
11923 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11924 %                                                                             %
11925 %                                                                             %
11926 %                                                                             %
11927 %   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                     %
11928 %                                                                             %
11929 %                                                                             %
11930 %                                                                             %
11931 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11932 %
11933 %  MagickTransparentPaintImage() changes any pixel that matches color with the
11934 %  color defined by fill.
11935 %
11936 %  The format of the MagickTransparentPaintImage method is:
11937 %
11938 %      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11939 %        const PixelWand *target,const double alpha,const double fuzz,
11940 %        const MagickBooleanType invert)
11941 %
11942 %  A description of each parameter follows:
11943 %
11944 %    o wand: the magick wand.
11945 %
11946 %    o target: Change this target color to specified alpha value within
11947 %      the image.
11948 %
11949 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11950 %      transparent.
11951 %
11952 %    o fuzz: By default target must match a particular pixel color
11953 %      exactly.  However, in many cases two colors may differ by a small amount.
11954 %      The fuzz member of image defines how much tolerance is acceptable to
11955 %      consider two colors as the same.  For example, set fuzz to 10 and the
11956 %      color red at intensities of 100 and 102 respectively are now interpreted
11957 %      as the same color for the purposes of the floodfill.
11958 %
11959 %    o invert: paint any pixel that does not match the target color.
11960 %
11961 */
11962 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11963   const PixelWand *target,const double alpha,const double fuzz,
11964   const MagickBooleanType invert)
11965 {
11966   MagickBooleanType
11967     status;
11968
11969   PixelInfo
11970     target_pixel;
11971
11972   assert(wand != (MagickWand *) NULL);
11973   assert(wand->signature == MagickWandSignature);
11974   if (wand->debug != MagickFalse)
11975     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11976   if (wand->images == (Image *) NULL)
11977     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11978   PixelGetMagickColor(target,&target_pixel);
11979   wand->images->fuzz=fuzz;
11980   status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11981     QuantumRange*alpha),invert,wand->exception);
11982   return(status);
11983 }
11984 \f
11985 /*
11986 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11987 %                                                                             %
11988 %                                                                             %
11989 %                                                                             %
11990 %   M a g i c k T r a n s p o s e I m a g e                                   %
11991 %                                                                             %
11992 %                                                                             %
11993 %                                                                             %
11994 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11995 %
11996 %  MagickTransposeImage() creates a vertical mirror image by reflecting the
11997 %  pixels around the central x-axis while rotating them 90-degrees.
11998 %
11999 %  The format of the MagickTransposeImage method is:
12000 %
12001 %      MagickBooleanType MagickTransposeImage(MagickWand *wand)
12002 %
12003 %  A description of each parameter follows:
12004 %
12005 %    o wand: the magick wand.
12006 %
12007 */
12008 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
12009 {
12010   Image
12011     *transpose_image;
12012
12013   assert(wand != (MagickWand *) NULL);
12014   assert(wand->signature == MagickWandSignature);
12015   if (wand->debug != MagickFalse)
12016     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12017   if (wand->images == (Image *) NULL)
12018     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12019   transpose_image=TransposeImage(wand->images,wand->exception);
12020   if (transpose_image == (Image *) NULL)
12021     return(MagickFalse);
12022   ReplaceImageInList(&wand->images,transpose_image);
12023   return(MagickTrue);
12024 }
12025 \f
12026 /*
12027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12028 %                                                                             %
12029 %                                                                             %
12030 %                                                                             %
12031 %   M a g i c k T r a n s v e r s e I m a g e                                 %
12032 %                                                                             %
12033 %                                                                             %
12034 %                                                                             %
12035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12036 %
12037 %  MagickTransverseImage() creates a horizontal mirror image by reflecting the
12038 %  pixels around the central y-axis while rotating them 270-degrees.
12039 %
12040 %  The format of the MagickTransverseImage method is:
12041 %
12042 %      MagickBooleanType MagickTransverseImage(MagickWand *wand)
12043 %
12044 %  A description of each parameter follows:
12045 %
12046 %    o wand: the magick wand.
12047 %
12048 */
12049 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
12050 {
12051   Image
12052     *transverse_image;
12053
12054   assert(wand != (MagickWand *) NULL);
12055   assert(wand->signature == MagickWandSignature);
12056   if (wand->debug != MagickFalse)
12057     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12058   if (wand->images == (Image *) NULL)
12059     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12060   transverse_image=TransverseImage(wand->images,wand->exception);
12061   if (transverse_image == (Image *) NULL)
12062     return(MagickFalse);
12063   ReplaceImageInList(&wand->images,transverse_image);
12064   return(MagickTrue);
12065 }
12066 \f
12067 /*
12068 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12069 %                                                                             %
12070 %                                                                             %
12071 %                                                                             %
12072 %   M a g i c k T r i m I m a g e                                             %
12073 %                                                                             %
12074 %                                                                             %
12075 %                                                                             %
12076 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12077 %
12078 %  MagickTrimImage() remove edges that are the background color from the image.
12079 %
12080 %  The format of the MagickTrimImage method is:
12081 %
12082 %      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12083 %
12084 %  A description of each parameter follows:
12085 %
12086 %    o wand: the magick wand.
12087 %
12088 %    o fuzz: By default target must match a particular pixel color
12089 %      exactly.  However, in many cases two colors may differ by a small amount.
12090 %      The fuzz member of image defines how much tolerance is acceptable to
12091 %      consider two colors as the same.  For example, set fuzz to 10 and the
12092 %      color red at intensities of 100 and 102 respectively are now interpreted
12093 %      as the same color for the purposes of the floodfill.
12094 %
12095 */
12096 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12097 {
12098   Image
12099     *trim_image;
12100
12101   assert(wand != (MagickWand *) NULL);
12102   assert(wand->signature == MagickWandSignature);
12103   if (wand->debug != MagickFalse)
12104     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12105   if (wand->images == (Image *) NULL)
12106     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12107   wand->images->fuzz=fuzz;
12108   trim_image=TrimImage(wand->images,wand->exception);
12109   if (trim_image == (Image *) NULL)
12110     return(MagickFalse);
12111   ReplaceImageInList(&wand->images,trim_image);
12112   return(MagickTrue);
12113 }
12114 \f
12115 /*
12116 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12117 %                                                                             %
12118 %                                                                             %
12119 %                                                                             %
12120 %   M a g i c k U n i q u e I m a g e C o l o r s                             %
12121 %                                                                             %
12122 %                                                                             %
12123 %                                                                             %
12124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12125 %
12126 %  MagickUniqueImageColors() discards all but one of any pixel color.
12127 %
12128 %  The format of the MagickUniqueImageColors method is:
12129 %
12130 %      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12131 %
12132 %  A description of each parameter follows:
12133 %
12134 %    o wand: the magick wand.
12135 %
12136 */
12137 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12138 {
12139   Image
12140     *unique_image;
12141
12142   assert(wand != (MagickWand *) NULL);
12143   assert(wand->signature == MagickWandSignature);
12144   if (wand->debug != MagickFalse)
12145     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12146   if (wand->images == (Image *) NULL)
12147     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12148   unique_image=UniqueImageColors(wand->images,wand->exception);
12149   if (unique_image == (Image *) NULL)
12150     return(MagickFalse);
12151   ReplaceImageInList(&wand->images,unique_image);
12152   return(MagickTrue);
12153 }
12154 \f
12155 /*
12156 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12157 %                                                                             %
12158 %                                                                             %
12159 %                                                                             %
12160 %   M a g i c k U n s h a r p M a s k I m a g e                               %
12161 %                                                                             %
12162 %                                                                             %
12163 %                                                                             %
12164 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12165 %
12166 %  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
12167 %  Gaussian operator of the given radius and standard deviation (sigma).
12168 %  For reasonable results, radius should be larger than sigma.  Use a radius
12169 %  of 0 and UnsharpMaskImage() selects a suitable radius for you.
12170 %
12171 %  The format of the MagickUnsharpMaskImage method is:
12172 %
12173 %      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12174 %        const double radius,const double sigma,const double gain,
12175 %        const double threshold)
12176 %
12177 %  A description of each parameter follows:
12178 %
12179 %    o wand: the magick wand.
12180 %
12181 %    o radius: the radius of the Gaussian, in pixels, not counting the center
12182 %      pixel.
12183 %
12184 %    o sigma: the standard deviation of the Gaussian, in pixels.
12185 %
12186 %    o gain: the percentage of the difference between the original and the
12187 %      blur image that is added back into the original.
12188 %
12189 %    o threshold: the threshold in pixels needed to apply the diffence gain.
12190 %
12191 */
12192 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12193   const double radius,const double sigma,const double gain,
12194   const double threshold)
12195 {
12196   Image
12197     *unsharp_image;
12198
12199   assert(wand != (MagickWand *) NULL);
12200   assert(wand->signature == MagickWandSignature);
12201   if (wand->debug != MagickFalse)
12202     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12203   if (wand->images == (Image *) NULL)
12204     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12205   unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,gain,threshold,
12206     wand->exception);
12207   if (unsharp_image == (Image *) NULL)
12208     return(MagickFalse);
12209   ReplaceImageInList(&wand->images,unsharp_image);
12210   return(MagickTrue);
12211 }
12212 \f
12213 /*
12214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12215 %                                                                             %
12216 %                                                                             %
12217 %                                                                             %
12218 %   M a g i c k V i g n e t t e I m a g e                                     %
12219 %                                                                             %
12220 %                                                                             %
12221 %                                                                             %
12222 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12223 %
12224 %  MagickVignetteImage() softens the edges of the image in vignette style.
12225 %
12226 %  The format of the MagickVignetteImage method is:
12227 %
12228 %      MagickBooleanType MagickVignetteImage(MagickWand *wand,
12229 %        const double radius,const double sigma,const ssize_t x,
12230 %        const ssize_t y)
12231 %
12232 %  A description of each parameter follows:
12233 %
12234 %    o wand: the magick wand.
12235 %
12236 %    o radius: the radius.
12237 %
12238 %    o sigma: the sigma.
12239 %
12240 %    o x, y:  Define the x and y ellipse offset.
12241 %
12242 */
12243 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
12244   const double radius,const double sigma,const ssize_t x,const ssize_t y)
12245 {
12246   Image
12247     *vignette_image;
12248
12249   assert(wand != (MagickWand *) NULL);
12250   assert(wand->signature == MagickWandSignature);
12251   if (wand->debug != MagickFalse)
12252     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12253   if (wand->images == (Image *) NULL)
12254     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12255   vignette_image=VignetteImage(wand->images,radius,sigma,x,y,wand->exception);
12256   if (vignette_image == (Image *) NULL)
12257     return(MagickFalse);
12258   ReplaceImageInList(&wand->images,vignette_image);
12259   return(MagickTrue);
12260 }
12261 \f
12262 /*
12263 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12264 %                                                                             %
12265 %                                                                             %
12266 %                                                                             %
12267 %   M a g i c k W a v e I m a g e                                             %
12268 %                                                                             %
12269 %                                                                             %
12270 %                                                                             %
12271 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12272 %
12273 %  MagickWaveImage()  creates a "ripple" effect in the image by shifting
12274 %  the pixels vertically along a sine wave whose amplitude and wavelength
12275 %  is specified by the given parameters.
12276 %
12277 %  The format of the MagickWaveImage method is:
12278 %
12279 %      MagickBooleanType MagickWaveImage(MagickWand *wand,
12280 %        const double amplitude,const double wave_length,
12281 %        const PixelInterpolateMethod method)
12282 %
12283 %  A description of each parameter follows:
12284 %
12285 %    o wand: the magick wand.
12286 %
12287 %    o amplitude, wave_length:  Define the amplitude and wave length of the
12288 %      sine wave.
12289 %
12290 %    o method: the pixel interpolation method.
12291 %
12292 */
12293 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12294   const double amplitude,const double wave_length,
12295   const PixelInterpolateMethod method)
12296 {
12297   Image
12298     *wave_image;
12299
12300   assert(wand != (MagickWand *) NULL);
12301   assert(wand->signature == MagickWandSignature);
12302   if (wand->debug != MagickFalse)
12303     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12304   if (wand->images == (Image *) NULL)
12305     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12306   wave_image=WaveImage(wand->images,amplitude,wave_length,method,
12307     wand->exception);
12308   if (wave_image == (Image *) NULL)
12309     return(MagickFalse);
12310   ReplaceImageInList(&wand->images,wave_image);
12311   return(MagickTrue);
12312 }
12313 \f
12314 /*
12315 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12316 %                                                                             %
12317 %                                                                             %
12318 %                                                                             %
12319 %   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                         %
12320 %                                                                             %
12321 %                                                                             %
12322 %                                                                             %
12323 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12324 %
12325 %  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
12326 %  above the threshold into white while leaving all pixels below the threshold
12327 %  unchanged.
12328 %
12329 %  The format of the MagickWhiteThresholdImage method is:
12330 %
12331 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12332 %        const PixelWand *threshold)
12333 %
12334 %  A description of each parameter follows:
12335 %
12336 %    o wand: the magick wand.
12337 %
12338 %    o threshold: the pixel wand.
12339 %
12340 */
12341 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12342   const PixelWand *threshold)
12343 {
12344   char
12345     thresholds[MagickPathExtent];
12346
12347   assert(wand != (MagickWand *) NULL);
12348   assert(wand->signature == MagickWandSignature);
12349   if (wand->debug != MagickFalse)
12350     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12351   if (wand->images == (Image *) NULL)
12352     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12353   (void) FormatLocaleString(thresholds,MagickPathExtent,
12354     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12355     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12356     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
12357   return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
12358 }
12359 \f
12360 /*
12361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12362 %                                                                             %
12363 %                                                                             %
12364 %                                                                             %
12365 %   M a g i c k W r i t e I m a g e                                           %
12366 %                                                                             %
12367 %                                                                             %
12368 %                                                                             %
12369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12370 %
12371 %  MagickWriteImage() writes an image to the specified filename.  If the
12372 %  filename parameter is NULL, the image is written to the filename set
12373 %  by MagickReadImage() or MagickSetImageFilename().
12374 %
12375 %  The format of the MagickWriteImage method is:
12376 %
12377 %      MagickBooleanType MagickWriteImage(MagickWand *wand,
12378 %        const char *filename)
12379 %
12380 %  A description of each parameter follows:
12381 %
12382 %    o wand: the magick wand.
12383 %
12384 %    o filename: the image filename.
12385 %
12386 %
12387 */
12388 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12389   const char *filename)
12390 {
12391   Image
12392     *image;
12393
12394   ImageInfo
12395     *write_info;
12396
12397   MagickBooleanType
12398     status;
12399
12400   assert(wand != (MagickWand *) NULL);
12401   assert(wand->signature == MagickWandSignature);
12402   if (wand->debug != MagickFalse)
12403     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12404   if (wand->images == (Image *) NULL)
12405     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12406   if (filename != (const char *) NULL)
12407     (void) CopyMagickString(wand->images->filename,filename,MagickPathExtent);
12408   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12409   if (image == (Image *) NULL)
12410     return(MagickFalse);
12411   write_info=CloneImageInfo(wand->image_info);
12412   write_info->adjoin=MagickTrue;
12413   status=WriteImage(write_info,image,wand->exception);
12414   image=DestroyImage(image);
12415   write_info=DestroyImageInfo(write_info);
12416   return(status);
12417 }
12418 \f
12419 /*
12420 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12421 %                                                                             %
12422 %                                                                             %
12423 %                                                                             %
12424 %   M a g i c k W r i t e I m a g e F i l e                                   %
12425 %                                                                             %
12426 %                                                                             %
12427 %                                                                             %
12428 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12429 %
12430 %  MagickWriteImageFile() writes an image to an open file descriptor.
12431 %
12432 %  The format of the MagickWriteImageFile method is:
12433 %
12434 %      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12435 %
12436 %  A description of each parameter follows:
12437 %
12438 %    o wand: the magick wand.
12439 %
12440 %    o file: the file descriptor.
12441 %
12442 */
12443 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12444 {
12445   Image
12446     *image;
12447
12448   ImageInfo
12449     *write_info;
12450
12451   MagickBooleanType
12452     status;
12453
12454   assert(wand != (MagickWand *) NULL);
12455   assert(wand->signature == MagickWandSignature);
12456   assert(file != (FILE *) NULL);
12457   if (wand->debug != MagickFalse)
12458     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12459   if (wand->images == (Image *) NULL)
12460     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12461   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12462   if (image == (Image *) NULL)
12463     return(MagickFalse);
12464   write_info=CloneImageInfo(wand->image_info);
12465   SetImageInfoFile(write_info,file);
12466   write_info->adjoin=MagickTrue;
12467   status=WriteImage(write_info,image,wand->exception);
12468   write_info=DestroyImageInfo(write_info);
12469   image=DestroyImage(image);
12470   return(status);
12471 }
12472 \f
12473 /*
12474 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12475 %                                                                             %
12476 %                                                                             %
12477 %                                                                             %
12478 %   M a g i c k W r i t e I m a g e s                                         %
12479 %                                                                             %
12480 %                                                                             %
12481 %                                                                             %
12482 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12483 %
12484 %  MagickWriteImages() writes an image or image sequence.
12485 %
12486 %  The format of the MagickWriteImages method is:
12487 %
12488 %      MagickBooleanType MagickWriteImages(MagickWand *wand,
12489 %        const char *filename,const MagickBooleanType adjoin)
12490 %
12491 %  A description of each parameter follows:
12492 %
12493 %    o wand: the magick wand.
12494 %
12495 %    o filename: the image filename.
12496 %
12497 %    o adjoin: join images into a single multi-image file.
12498 %
12499 */
12500 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12501   const char *filename,const MagickBooleanType adjoin)
12502 {
12503   ImageInfo
12504     *write_info;
12505
12506   MagickBooleanType
12507     status;
12508
12509   assert(wand != (MagickWand *) NULL);
12510   assert(wand->signature == MagickWandSignature);
12511   if (wand->debug != MagickFalse)
12512     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12513   if (wand->images == (Image *) NULL)
12514     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12515   write_info=CloneImageInfo(wand->image_info);
12516   write_info->adjoin=adjoin;
12517   status=WriteImages(write_info,wand->images,filename,wand->exception);
12518   write_info=DestroyImageInfo(write_info);
12519   return(status);
12520 }
12521 \f
12522 /*
12523 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12524 %                                                                             %
12525 %                                                                             %
12526 %                                                                             %
12527 %   M a g i c k W r i t e I m a g e s F i l e                                 %
12528 %                                                                             %
12529 %                                                                             %
12530 %                                                                             %
12531 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12532 %
12533 %  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12534 %
12535 %  The format of the MagickWriteImagesFile method is:
12536 %
12537 %      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12538 %
12539 %  A description of each parameter follows:
12540 %
12541 %    o wand: the magick wand.
12542 %
12543 %    o file: the file descriptor.
12544 %
12545 */
12546 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12547 {
12548   ImageInfo
12549     *write_info;
12550
12551   MagickBooleanType
12552     status;
12553
12554   assert(wand != (MagickWand *) NULL);
12555   assert(wand->signature == MagickWandSignature);
12556   if (wand->debug != MagickFalse)
12557     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12558   if (wand->images == (Image *) NULL)
12559     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12560   write_info=CloneImageInfo(wand->image_info);
12561   SetImageInfoFile(write_info,file);
12562   write_info->adjoin=MagickTrue;
12563   status=WriteImages(write_info,wand->images,(const char *) NULL,
12564     wand->exception);
12565   write_info=DestroyImageInfo(write_info);
12566   return(status);
12567 }