]> granicus.if.org Git - imagemagick/blob - MagickWand/magick-image.c
(no commit message)
[imagemagick] / MagickWand / magick-image.c
1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %                                                                             %
4 %                                                                             %
5 %                                                                             %
6 %                 M   M   AAA    GGGG  IIIII   CCCC  K   K                    %
7 %                 MM MM  A   A  G        I    C      K  K                     %
8 %                 M M M  AAAAA  G GGG    I    C      KKK                      %
9 %                 M   M  A   A  G   G    I    C      K  K                     %
10 %                 M   M  A   A   GGGG  IIIII   CCCC  K   K                    %
11 %                                                                             %
12 %                     IIIII  M   M   AAA    GGGG  EEEEE                       %
13 %                       I    MM MM  A   A  G      E                           %
14 %                       I    M M M  AAAAA  G  GG  EEE                         %
15 %                       I    M   M  A   A  G   G  E                           %
16 %                     IIIII  M   M  A   A   GGGG  EEEEE                       %
17 %                                                                             %
18 %                                                                             %
19 %                          MagickWand Image Methods                           %
20 %                                                                             %
21 %                               Software Design                               %
22 %                                 John Cristy                                 %
23 %                                 August 2003                                 %
24 %                                                                             %
25 %                                                                             %
26 %  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization      %
27 %  dedicated to making software imaging solutions freely available.           %
28 %                                                                             %
29 %  You may not use this file except in compliance with the License.  You may  %
30 %  obtain a copy of the License at                                            %
31 %                                                                             %
32 %    http://www.imagemagick.org/script/license.php                            %
33 %                                                                             %
34 %  Unless required by applicable law or agreed to in writing, software        %
35 %  distributed under the License is distributed on an "AS IS" BASIS,          %
36 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
37 %  See the License for the specific language governing permissions and        %
38 %  limitations under the License.                                             %
39 %                                                                             %
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 %
42 %
43 %
44 */
45 \f
46 /*
47   Include declarations.
48 */
49 #include "MagickWand/studio.h"
50 #include "MagickWand/MagickWand.h"
51 #include "MagickWand/magick-wand-private.h"
52 #include "MagickWand/wand.h"
53 #include "MagickWand/pixel-wand-private.h"
54 \f
55 /*
56   Define declarations.
57 */
58 #define ThrowWandException(severity,tag,context) \
59 { \
60   (void) ThrowMagickException(wand->exception,GetMagickModule(),severity, \
61     tag,"`%s'",context); \
62   return(MagickFalse); \
63 }
64 #define MagickWandId  "MagickWand"
65 \f
66 /*
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68 %                                                                             %
69 %                                                                             %
70 %                                                                             %
71 +   C l o n e M a g i c k W a n d F r o m I m a g e s                         %
72 %                                                                             %
73 %                                                                             %
74 %                                                                             %
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76 %
77 %  CloneMagickWandFromImages() clones the magick wand and inserts a new image
78 %  list.
79 %
80 %  The format of the CloneMagickWandFromImages method is:
81 %
82 %      MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
83 %        Image *images)
84 %
85 %  A description of each parameter follows:
86 %
87 %    o wand: the magick wand.
88 %
89 %    o images: replace the image list with these image(s).
90 %
91 */
92 static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
93   Image *images)
94 {
95   MagickWand
96     *clone_wand;
97
98   assert(wand != (MagickWand *) NULL);
99   assert(wand->signature == WandSignature);
100   if (wand->debug != MagickFalse)
101     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
102   clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
103   if (clone_wand == (MagickWand *) NULL)
104     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
105       images->filename);
106   (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
107   clone_wand->id=AcquireWandId();
108   (void) FormatLocaleString(clone_wand->name,MaxTextExtent,"%s-%.20g",
109     MagickWandId,(double) clone_wand->id);
110   clone_wand->exception=AcquireExceptionInfo();
111   InheritException(clone_wand->exception,wand->exception);
112   clone_wand->image_info=CloneImageInfo(wand->image_info);
113   clone_wand->images=images;
114   clone_wand->debug=IsEventLogging();
115   if (clone_wand->debug != MagickFalse)
116     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
117   clone_wand->signature=WandSignature;
118   return(clone_wand);
119 }
120 \f
121 /*
122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
123 %                                                                             %
124 %                                                                             %
125 %                                                                             %
126 %   G e t I m a g e F r o m M a g i c k W a n d                               %
127 %                                                                             %
128 %                                                                             %
129 %                                                                             %
130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
131 %
132 %  GetImageFromMagickWand() returns the current image from the magick wand.
133 %
134 %  The format of the GetImageFromMagickWand method is:
135 %
136 %      Image *GetImageFromMagickWand(const MagickWand *wand)
137 %
138 %  A description of each parameter follows:
139 %
140 %    o wand: the magick wand.
141 %
142 */
143 WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
144 {
145   assert(wand != (MagickWand *) NULL);
146   assert(wand->signature == WandSignature);
147   if (wand->debug != MagickFalse)
148     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
149   if (wand->images == (Image *) NULL)
150     {
151       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
152         "ContainsNoImages","`%s'",wand->name);
153       return((Image *) NULL);
154     }
155   return(wand->images);
156 }
157 \f
158 /*
159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
160 %                                                                             %
161 %                                                                             %
162 %                                                                             %
163 %   M a g i c k A d a p t i v e S h a r p e n I m a g e                       %
164 %                                                                             %
165 %                                                                             %
166 %                                                                             %
167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
168 %
169 %  MagickAdaptiveBlurImage() adaptively blurs the image by blurring
170 %  less intensely near image edges and more intensely far from edges. We
171 %  blur the image with a Gaussian operator of the given radius and standard
172 %  deviation (sigma).  For reasonable results, radius should be larger than
173 %  sigma.  Use a radius of 0 and MagickAdaptiveBlurImage() selects a
174 %  suitable radius for you.
175 %
176 %  The format of the MagickAdaptiveBlurImage method is:
177 %
178 %      MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
179 %        const double radius,const double sigma,const double bias)
180 %
181 %  A description of each parameter follows:
182 %
183 %    o wand: the magick wand.
184 %
185 %    o radius: the radius of the Gaussian, in pixels, not counting the center
186 %      pixel.
187 %
188 %    o sigma: the standard deviation of the Gaussian, in pixels.
189 %
190 %    o bias: the bias.
191 %
192 */
193 WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
194   const double radius,const double sigma,const double bias)
195 {
196   Image
197     *sharp_image;
198
199   assert(wand != (MagickWand *) NULL);
200   assert(wand->signature == WandSignature);
201   if (wand->debug != MagickFalse)
202     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
203   if (wand->images == (Image *) NULL)
204     ThrowWandException(WandError,"ContainsNoImages",wand->name);
205   sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,bias,wand->exception);
206   if (sharp_image == (Image *) NULL)
207     return(MagickFalse);
208   ReplaceImageInList(&wand->images,sharp_image);
209   return(MagickTrue);
210 }
211 \f
212 /*
213 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
214 %                                                                             %
215 %                                                                             %
216 %                                                                             %
217 %   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                         %
218 %                                                                             %
219 %                                                                             %
220 %                                                                             %
221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
222 %
223 %  MagickAdaptiveResizeImage() adaptively resize image with data dependent
224 %  triangulation.
225 %
226 %      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
227 %        const size_t columns,const size_t rows)
228 %
229 %  A description of each parameter follows:
230 %
231 %    o wand: the magick wand.
232 %
233 %    o columns: the number of columns in the scaled image.
234 %
235 %    o rows: the number of rows in the scaled image.
236 %
237 */
238 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
239   const size_t columns,const size_t rows)
240 {
241   Image
242     *resize_image;
243
244   assert(wand != (MagickWand *) NULL);
245   assert(wand->signature == WandSignature);
246   if (wand->debug != MagickFalse)
247     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
248   if (wand->images == (Image *) NULL)
249     ThrowWandException(WandError,"ContainsNoImages",wand->name);
250   resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
251   if (resize_image == (Image *) NULL)
252     return(MagickFalse);
253   ReplaceImageInList(&wand->images,resize_image);
254   return(MagickTrue);
255 }
256 \f
257 /*
258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
259 %                                                                             %
260 %                                                                             %
261 %                                                                             %
262 %   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                       %
263 %                                                                             %
264 %                                                                             %
265 %                                                                             %
266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
267 %
268 %  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
269 %  more intensely near image edges and less intensely far from edges. We
270 %  sharpen the image with a Gaussian operator of the given radius and standard
271 %  deviation (sigma).  For reasonable results, radius should be larger than
272 %  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
273 %  suitable radius for you.
274 %
275 %  The format of the MagickAdaptiveSharpenImage method is:
276 %
277 %      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
278 %        const double radius,const double sigma,const double bias)
279 %
280 %  A description of each parameter follows:
281 %
282 %    o wand: the magick wand.
283 %
284 %    o radius: the radius of the Gaussian, in pixels, not counting the center
285 %      pixel.
286 %
287 %    o sigma: the standard deviation of the Gaussian, in pixels.
288 %
289 %    o bias: the bias.
290 %
291 */
292 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
293   const double radius,const double sigma,const double bias)
294 {
295   Image
296     *sharp_image;
297
298   assert(wand != (MagickWand *) NULL);
299   assert(wand->signature == WandSignature);
300   if (wand->debug != MagickFalse)
301     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
302   if (wand->images == (Image *) NULL)
303     ThrowWandException(WandError,"ContainsNoImages",wand->name);
304   sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,bias,
305     wand->exception);
306   if (sharp_image == (Image *) NULL)
307     return(MagickFalse);
308   ReplaceImageInList(&wand->images,sharp_image);
309   return(MagickTrue);
310 }
311 \f
312 /*
313 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
314 %                                                                             %
315 %                                                                             %
316 %                                                                             %
317 %   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                   %
318 %                                                                             %
319 %                                                                             %
320 %                                                                             %
321 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
322 %
323 %  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
324 %  based on the range of intensity values in its local neighborhood.  This
325 %  allows for thresholding of an image whose global intensity histogram
326 %  doesn't contain distinctive peaks.
327 %
328 %  The format of the AdaptiveThresholdImage method is:
329 %
330 %      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
331 %        const size_t width,const size_t height,const double bias)
332 %
333 %  A description of each parameter follows:
334 %
335 %    o wand: the magick wand.
336 %
337 %    o width: the width of the local neighborhood.
338 %
339 %    o height: the height of the local neighborhood.
340 %
341 %    o offset: the mean bias.
342 %
343 */
344 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
345   const size_t width,const size_t height,const double bias)
346 {
347   Image
348     *threshold_image;
349
350   assert(wand != (MagickWand *) NULL);
351   assert(wand->signature == WandSignature);
352   if (wand->debug != MagickFalse)
353     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
354   if (wand->images == (Image *) NULL)
355     ThrowWandException(WandError,"ContainsNoImages",wand->name);
356   threshold_image=AdaptiveThresholdImage(wand->images,width,height,bias,
357     wand->exception);
358   if (threshold_image == (Image *) NULL)
359     return(MagickFalse);
360   ReplaceImageInList(&wand->images,threshold_image);
361   return(MagickTrue);
362 }
363 \f
364 /*
365 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
366 %                                                                             %
367 %                                                                             %
368 %                                                                             %
369 %   M a g i c k A d d I m a g e                                               %
370 %                                                                             %
371 %                                                                             %
372 %                                                                             %
373 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
374 %
375 %  MagickAddImage() adds a clone of the images in the second wand and
376 %  inserts them into the first wand, at the current image location.
377 %
378 %  Use MagickSetFirstIterator(), to insert new images before all the current
379 %  images in the wand, otherwise image is placed after the current image.
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 images to add at the current image
391 %      location.
392 %
393 */
394
395 static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
396   Image *images)
397 {
398   Image
399     *current;
400
401   current=wand->images;  /* note the current image */
402
403   /* if no images in wand, just add them and set first image as current */
404   if (current == (Image *) NULL)
405     {
406       wand->images=GetFirstImageInList(images);
407       return(MagickTrue);
408     }
409
410   /* user jumped to first image, so prepend new images - remain active */
411   if ((wand->set_first != MagickFalse) &&
412        (current->previous == (Image *) NULL) )
413     {
414       PrependImageToList(&current,images);
415       wand->images=GetFirstImageInList(images);
416       return(MagickTrue);
417     }
418   wand->set_first = MagickFalse; /* flag no longer valid */
419
420   /* Current image was flagged as 'pending' iterative processing. */
421   if (wand->image_pending != MagickFalse)
422     {
423       /* current pending image is the last, append new images */
424       if (current->next == (Image *) NULL)
425         {
426           AppendImageToList(&current,images);
427           wand->images=GetLastImageInList(images);
428           return(MagickTrue);
429         }
430       /* current pending image is the first image, prepend it */
431       if (current->previous == (Image *) NULL)
432         {
433           PrependImageToList(&current,images);
434           wand->images=GetFirstImageInList(images);
435           return(MagickTrue);
436         }
437     }
438
439   /* if at last image append new images */
440   if (current->next == (Image *) NULL)
441     {
442       InsertImageInList(&current,images);
443       wand->images=GetLastImageInList(images);
444       return(MagickTrue);
445     }
446   /* otherwise just insert image, just after the current image */
447   InsertImageInList(&current,images);
448   wand->images=GetFirstImageInList(images);
449   return(MagickTrue);
450 }
451
452 WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
453   const MagickWand *add_wand)
454 {
455   Image
456     *images;
457
458   assert(wand != (MagickWand *) NULL);
459   assert(wand->signature == WandSignature);
460   if (wand->debug != MagickFalse)
461     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
462   assert(add_wand != (MagickWand *) NULL);
463   assert(add_wand->signature == WandSignature);
464   if (add_wand->images == (Image *) NULL)
465     ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
466
467   /* clone images in second wand, and insert into first */
468   images=CloneImageList(add_wand->images,wand->exception);
469   if (images == (Image *) NULL)
470     return(MagickFalse);
471   return(InsertImageInWand(wand,images));
472 }
473 \f
474 /*
475 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
476 %                                                                             %
477 %                                                                             %
478 %                                                                             %
479 %     M a g i c k A d d N o i s e I m a g e                                   %
480 %                                                                             %
481 %                                                                             %
482 %                                                                             %
483 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
484 %
485 %  MagickAddNoiseImage() adds random noise to the image.
486 %
487 %  The format of the MagickAddNoiseImage method is:
488 %
489 %      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
490 %        const NoiseType noise_type,const double attenuate)
491 %
492 %  A description of each parameter follows:
493 %
494 %    o wand: the magick wand.
495 %
496 %    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
497 %      Impulse, Laplacian, or Poisson.
498 %
499 %    o attenuate:  attenuate the random distribution.
500 %
501 */
502 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
503   const NoiseType noise_type,const double attenuate)
504 {
505   Image
506     *noise_image;
507
508   assert(wand != (MagickWand *) NULL);
509   assert(wand->signature == WandSignature);
510   if (wand->debug != MagickFalse)
511     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
512   if (wand->images == (Image *) NULL)
513     ThrowWandException(WandError,"ContainsNoImages",wand->name);
514   noise_image=AddNoiseImage(wand->images,noise_type,attenuate,wand->exception);
515   if (noise_image == (Image *) NULL)
516     return(MagickFalse);
517   ReplaceImageInList(&wand->images,noise_image);
518   return(MagickTrue);
519 }
520 \f
521 /*
522 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
523 %                                                                             %
524 %                                                                             %
525 %                                                                             %
526 %   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                       %
527 %                                                                             %
528 %                                                                             %
529 %                                                                             %
530 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
531 %
532 %  MagickAffineTransformImage() transforms an image as dictated by the affine
533 %  matrix of the drawing wand.
534 %
535 %  The format of the MagickAffineTransformImage method is:
536 %
537 %      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
538 %        const DrawingWand *drawing_wand)
539 %
540 %  A description of each parameter follows:
541 %
542 %    o wand: the magick wand.
543 %
544 %    o drawing_wand: the draw wand.
545 %
546 */
547 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
548   const DrawingWand *drawing_wand)
549 {
550   DrawInfo
551     *draw_info;
552
553   Image
554     *affine_image;
555
556   assert(wand != (MagickWand *) NULL);
557   assert(wand->signature == WandSignature);
558   if (wand->debug != MagickFalse)
559     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
560   if (wand->images == (Image *) NULL)
561     ThrowWandException(WandError,"ContainsNoImages",wand->name);
562   draw_info=PeekDrawingWand(drawing_wand);
563   if (draw_info == (DrawInfo *) NULL)
564     return(MagickFalse);
565   affine_image=AffineTransformImage(wand->images,&draw_info->affine,
566     wand->exception);
567   draw_info=DestroyDrawInfo(draw_info);
568   if (affine_image == (Image *) NULL)
569     return(MagickFalse);
570   ReplaceImageInList(&wand->images,affine_image);
571   return(MagickTrue);
572 }
573 \f
574 /*
575 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
576 %                                                                             %
577 %                                                                             %
578 %                                                                             %
579 %   M a g i c k A n n o t a t e I m a g e                                     %
580 %                                                                             %
581 %                                                                             %
582 %                                                                             %
583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
584 %
585 %  MagickAnnotateImage() annotates an image with text.
586 %
587 %  The format of the MagickAnnotateImage method is:
588 %
589 %      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
590 %        const DrawingWand *drawing_wand,const double x,const double y,
591 %        const double angle,const char *text)
592 %
593 %  A description of each parameter follows:
594 %
595 %    o wand: the magick wand.
596 %
597 %    o drawing_wand: the draw wand.
598 %
599 %    o x: x ordinate to left of text
600 %
601 %    o y: y ordinate to text baseline
602 %
603 %    o angle: rotate text relative to this angle.
604 %
605 %    o text: text to draw
606 %
607 */
608 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
609   const DrawingWand *drawing_wand,const double x,const double y,
610   const double angle,const char *text)
611 {
612   char
613     geometry[MaxTextExtent];
614
615   DrawInfo
616     *draw_info;
617
618   MagickBooleanType
619     status;
620
621   assert(wand != (MagickWand *) NULL);
622   assert(wand->signature == WandSignature);
623   if (wand->debug != MagickFalse)
624     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
625   if (wand->images == (Image *) NULL)
626     ThrowWandException(WandError,"ContainsNoImages",wand->name);
627   draw_info=PeekDrawingWand(drawing_wand);
628   if (draw_info == (DrawInfo *) NULL)
629     return(MagickFalse);
630   (void) CloneString(&draw_info->text,text);
631   (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",x,y);
632   draw_info->affine.sx=cos((double) DegreesToRadians(fmod(angle,360.0)));
633   draw_info->affine.rx=sin((double) DegreesToRadians(fmod(angle,360.0)));
634   draw_info->affine.ry=(-sin((double) DegreesToRadians(fmod(angle,360.0))));
635   draw_info->affine.sy=cos((double) DegreesToRadians(fmod(angle,360.0)));
636   (void) CloneString(&draw_info->geometry,geometry);
637   status=AnnotateImage(wand->images,draw_info,wand->exception);
638   draw_info=DestroyDrawInfo(draw_info);
639   return(status);
640 }
641 \f
642 /*
643 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
644 %                                                                             %
645 %                                                                             %
646 %                                                                             %
647 %   M a g i c k A n i m a t e I m a g e s                                     %
648 %                                                                             %
649 %                                                                             %
650 %                                                                             %
651 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
652 %
653 %  MagickAnimateImages() animates an image or image sequence.
654 %
655 %  The format of the MagickAnimateImages method is:
656 %
657 %      MagickBooleanType MagickAnimateImages(MagickWand *wand,
658 %        const char *server_name)
659 %
660 %  A description of each parameter follows:
661 %
662 %    o wand: the magick wand.
663 %
664 %    o server_name: the X server name.
665 %
666 */
667 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
668   const char *server_name)
669 {
670   MagickBooleanType
671     status;
672
673   assert(wand != (MagickWand *) NULL);
674   assert(wand->signature == WandSignature);
675   if (wand->debug != MagickFalse)
676     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
677   (void) CloneString(&wand->image_info->server_name,server_name);
678   status=AnimateImages(wand->image_info,wand->images,wand->exception);
679   return(status);
680 }
681 \f
682 /*
683 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
684 %                                                                             %
685 %                                                                             %
686 %                                                                             %
687 %   M a g i c k A p p e n d I m a g e s                                       %
688 %                                                                             %
689 %                                                                             %
690 %                                                                             %
691 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
692 %
693 %  MagickAppendImages() append a set of images.
694 %
695 %  The format of the MagickAppendImages method is:
696 %
697 %      MagickWand *MagickAppendImages(MagickWand *wand,
698 %        const MagickBooleanType stack)
699 %
700 %  A description of each parameter follows:
701 %
702 %    o wand: the magick wand.
703 %
704 %    o stack: By default, images are stacked left-to-right. Set stack to
705 %      MagickTrue to stack them top-to-bottom.
706 %
707 */
708 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
709   const MagickBooleanType stack)
710 {
711   Image
712     *append_image;
713
714   assert(wand != (MagickWand *) NULL);
715   assert(wand->signature == WandSignature);
716   if (wand->debug != MagickFalse)
717     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
718   if (wand->images == (Image *) NULL)
719     return((MagickWand *) NULL);
720   append_image=AppendImages(wand->images,stack,wand->exception);
721   if (append_image == (Image *) NULL)
722     return((MagickWand *) NULL);
723   return(CloneMagickWandFromImages(wand,append_image));
724 }
725 \f
726 /*
727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
728 %                                                                             %
729 %                                                                             %
730 %                                                                             %
731 %   M a g i c k A u t o G a m m a I m a g e                                   %
732 %                                                                             %
733 %                                                                             %
734 %                                                                             %
735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
736 %
737 %  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
738 %  image to try make set its gamma appropriatally.
739 %
740 %  The format of the MagickAutoGammaImage method is:
741 %
742 %      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
743 %
744 %  A description of each parameter follows:
745 %
746 %    o wand: the magick wand.
747 %
748 */
749 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
750 {
751   MagickBooleanType
752     status;
753
754   assert(wand != (MagickWand *) NULL);
755   assert(wand->signature == WandSignature);
756   if (wand->debug != MagickFalse)
757     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
758   if (wand->images == (Image *) NULL)
759     ThrowWandException(WandError,"ContainsNoImages",wand->name);
760   status=AutoGammaImage(wand->images,wand->exception);
761   return(status);
762 }
763 \f
764 /*
765 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
766 %                                                                             %
767 %                                                                             %
768 %                                                                             %
769 %   M a g i c k A u t o L e v e l I m a g e                                   %
770 %                                                                             %
771 %                                                                             %
772 %                                                                             %
773 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
774 %
775 %  MagickAutoLevelImage() adjusts the levels of a particular image channel by
776 %  scaling the minimum and maximum values to the full quantum range.
777 %
778 %  The format of the MagickAutoLevelImage method is:
779 %
780 %      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
781 %
782 %  A description of each parameter follows:
783 %
784 %    o wand: the magick wand.
785 %
786 */
787 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
788 {
789   MagickBooleanType
790     status;
791
792   assert(wand != (MagickWand *) NULL);
793   assert(wand->signature == WandSignature);
794   if (wand->debug != MagickFalse)
795     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
796   if (wand->images == (Image *) NULL)
797     ThrowWandException(WandError,"ContainsNoImages",wand->name);
798   status=AutoLevelImage(wand->images,wand->exception);
799   return(status);
800 }
801 \f
802 /*
803 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
804 %                                                                             %
805 %                                                                             %
806 %                                                                             %
807 %   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                         %
808 %                                                                             %
809 %                                                                             %
810 %                                                                             %
811 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
812 %
813 %  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
814 %  pixels below the threshold into black while leaving all pixels above the
815 %  threshold unchanged.
816 %
817 %  The format of the MagickBlackThresholdImage method is:
818 %
819 %      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
820 %        const PixelWand *threshold)
821 %
822 %  A description of each parameter follows:
823 %
824 %    o wand: the magick wand.
825 %
826 %    o threshold: the pixel wand.
827 %
828 */
829 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
830   const PixelWand *threshold)
831 {
832   char
833     thresholds[MaxTextExtent];
834
835   MagickBooleanType
836     status;
837
838   assert(wand != (MagickWand *) NULL);
839   assert(wand->signature == WandSignature);
840   if (wand->debug != MagickFalse)
841     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
842   if (wand->images == (Image *) NULL)
843     ThrowWandException(WandError,"ContainsNoImages",wand->name);
844   (void) FormatLocaleString(thresholds,MaxTextExtent,
845     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
846     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
847     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
848   status=BlackThresholdImage(wand->images,thresholds,wand->exception);
849   return(status);
850 }
851 \f
852 /*
853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
854 %                                                                             %
855 %                                                                             %
856 %                                                                             %
857 %   M a g i c k B l u e S h i f t I m a g e                                   %
858 %                                                                             %
859 %                                                                             %
860 %                                                                             %
861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
862 %
863 %  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
864 %  nighttime in the moonlight.
865 %
866 %  The format of the MagickBlueShiftImage method is:
867 %
868 %      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
869 %        const double factor)
870 %
871 %  A description of each parameter follows:
872 %
873 %    o wand: the magick wand.
874 %
875 %    o factor: the blue shift factor (default 1.5)
876 %
877 */
878 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
879   const double factor)
880 {
881   Image
882     *shift_image;
883
884   assert(wand != (MagickWand *) NULL);
885   assert(wand->signature == WandSignature);
886   if (wand->debug != MagickFalse)
887     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
888   if (wand->images == (Image *) NULL)
889     ThrowWandException(WandError,"ContainsNoImages",wand->name);
890   shift_image=BlueShiftImage(wand->images,factor,wand->exception);
891   if (shift_image == (Image *) NULL)
892     return(MagickFalse);
893   ReplaceImageInList(&wand->images,shift_image);
894   return(MagickTrue);
895 }
896 \f
897 /*
898 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
899 %                                                                             %
900 %                                                                             %
901 %                                                                             %
902 %   M a g i c k B l u r I m a g e                                             %
903 %                                                                             %
904 %                                                                             %
905 %                                                                             %
906 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
907 %
908 %  MagickBlurImage() blurs an image.  We convolve the image with a
909 %  gaussian operator of the given radius and standard deviation (sigma).
910 %  For reasonable results, the radius should be larger than sigma.  Use a
911 %  radius of 0 and BlurImage() selects a suitable radius for you.
912 %
913 %  The format of the MagickBlurImage method is:
914 %
915 %      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
916 %        const double sigmaconst double bias)
917 %
918 %  A description of each parameter follows:
919 %
920 %    o wand: the magick wand.
921 %
922 %    o radius: the radius of the , in pixels, not counting the center
923 %      pixel.
924 %
925 %    o sigma: the standard deviation of the , in pixels.
926 %
927 %    o bias: the bias.
928 %
929 */
930 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
931   const double radius,const double sigma,const double bias)
932 {
933   Image
934     *blur_image;
935
936   assert(wand != (MagickWand *) NULL);
937   assert(wand->signature == WandSignature);
938   if (wand->debug != MagickFalse)
939     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
940   if (wand->images == (Image *) NULL)
941     ThrowWandException(WandError,"ContainsNoImages",wand->name);
942   blur_image=BlurImage(wand->images,radius,sigma,bias,wand->exception);
943   if (blur_image == (Image *) NULL)
944     return(MagickFalse);
945   ReplaceImageInList(&wand->images,blur_image);
946   return(MagickTrue);
947 }
948 \f
949 /*
950 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
951 %                                                                             %
952 %                                                                             %
953 %                                                                             %
954 %   M a g i c k B o r d e r I m a g e                                         %
955 %                                                                             %
956 %                                                                             %
957 %                                                                             %
958 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
959 %
960 %  MagickBorderImage() surrounds the image with a border of the color defined
961 %  by the bordercolor pixel wand.
962 %
963 %  The format of the MagickBorderImage method is:
964 %
965 %      MagickBooleanType MagickBorderImage(MagickWand *wand,
966 %        const PixelWand *bordercolor,const size_t width,
967 %        const size_t height,const CompositeOperator compose)
968 %
969 %  A description of each parameter follows:
970 %
971 %    o wand: the magick wand.
972 %
973 %    o bordercolor: the border color pixel wand.
974 %
975 %    o width: the border width.
976 %
977 %    o height: the border height.
978 %
979 %    o compose: the composite operator.
980 %
981 */
982 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
983   const PixelWand *bordercolor,const size_t width,const size_t height,
984   const CompositeOperator compose)
985 {
986   Image
987     *border_image;
988
989   RectangleInfo
990     border_info;
991
992   assert(wand != (MagickWand *) NULL);
993   assert(wand->signature == WandSignature);
994   if (wand->debug != MagickFalse)
995     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
996   if (wand->images == (Image *) NULL)
997     ThrowWandException(WandError,"ContainsNoImages",wand->name);
998   border_info.width=width;
999   border_info.height=height;
1000   border_info.x=0;
1001   border_info.y=0;
1002   PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
1003   border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
1004   if (border_image == (Image *) NULL)
1005     return(MagickFalse);
1006   ReplaceImageInList(&wand->images,border_image);
1007   return(MagickTrue);
1008 }
1009 \f
1010 /*
1011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1012 %                                                                             %
1013 %                                                                             %
1014 %                                                                             %
1015 %   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   %
1016 %                                                                             %
1017 %                                                                             %
1018 %                                                                             %
1019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1020 %
1021 %  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1022 %  of an image.  It converts the brightness and contrast parameters into slope
1023 %  and intercept and calls a polynomical function to apply to the image.
1024
1025 %
1026 %  The format of the MagickBrightnessContrastImage method is:
1027 %
1028 %      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1029 %        const double brightness,const double contrast)
1030 %
1031 %  A description of each parameter follows:
1032 %
1033 %    o wand: the magick wand.
1034 %
1035 %    o brightness: the brightness percent (-100 .. 100).
1036 %
1037 %    o contrast: the contrast percent (-100 .. 100).
1038 %
1039 */
1040 WandExport MagickBooleanType MagickBrightnessContrastImage(
1041   MagickWand *wand,const double brightness,const double contrast)
1042 {
1043   MagickBooleanType
1044     status;
1045
1046   assert(wand != (MagickWand *) NULL);
1047   assert(wand->signature == WandSignature);
1048   if (wand->debug != MagickFalse)
1049     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1050   if (wand->images == (Image *) NULL)
1051     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1052   status=BrightnessContrastImage(wand->images,brightness,contrast,
1053     wand->exception);
1054   return(status);
1055 }
1056 \f
1057 /*
1058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1059 %                                                                             %
1060 %                                                                             %
1061 %                                                                             %
1062 %   M a g i c k C h a r c o a l I m a g e                                     %
1063 %                                                                             %
1064 %                                                                             %
1065 %                                                                             %
1066 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1067 %
1068 %  MagickCharcoalImage() simulates a charcoal drawing.
1069 %
1070 %  The format of the MagickCharcoalImage method is:
1071 %
1072 %      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1073 %        const double radius,const double sigma,const double bias)
1074 %
1075 %  A description of each parameter follows:
1076 %
1077 %    o wand: the magick wand.
1078 %
1079 %    o radius: the radius of the Gaussian, in pixels, not counting the center
1080 %      pixel.
1081 %
1082 %    o sigma: the standard deviation of the Gaussian, in pixels.
1083 %
1084 %    o bias: the bias.
1085 %
1086 */
1087 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1088   const double radius,const double sigma,const double bias)
1089 {
1090   Image
1091     *charcoal_image;
1092
1093   assert(wand != (MagickWand *) NULL);
1094   assert(wand->signature == WandSignature);
1095   if (wand->debug != MagickFalse)
1096     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1097   if (wand->images == (Image *) NULL)
1098     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1099   charcoal_image=CharcoalImage(wand->images,radius,sigma,bias,wand->exception);
1100   if (charcoal_image == (Image *) NULL)
1101     return(MagickFalse);
1102   ReplaceImageInList(&wand->images,charcoal_image);
1103   return(MagickTrue);
1104 }
1105 \f
1106 /*
1107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1108 %                                                                             %
1109 %                                                                             %
1110 %                                                                             %
1111 %   M a g i c k C h o p I m a g e                                             %
1112 %                                                                             %
1113 %                                                                             %
1114 %                                                                             %
1115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1116 %
1117 %  MagickChopImage() removes a region of an image and collapses the image to
1118 %  occupy the removed portion
1119 %
1120 %  The format of the MagickChopImage method is:
1121 %
1122 %      MagickBooleanType MagickChopImage(MagickWand *wand,
1123 %        const size_t width,const size_t height,const ssize_t x,
1124 %        const ssize_t y)
1125 %
1126 %  A description of each parameter follows:
1127 %
1128 %    o wand: the magick wand.
1129 %
1130 %    o width: the region width.
1131 %
1132 %    o height: the region height.
1133 %
1134 %    o x: the region x offset.
1135 %
1136 %    o y: the region y offset.
1137 %
1138 %
1139 */
1140 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1141   const size_t width,const size_t height,const ssize_t x,
1142   const ssize_t y)
1143 {
1144   Image
1145     *chop_image;
1146
1147   RectangleInfo
1148     chop;
1149
1150   assert(wand != (MagickWand *) NULL);
1151   assert(wand->signature == WandSignature);
1152   if (wand->debug != MagickFalse)
1153     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1154   if (wand->images == (Image *) NULL)
1155     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1156   chop.width=width;
1157   chop.height=height;
1158   chop.x=x;
1159   chop.y=y;
1160   chop_image=ChopImage(wand->images,&chop,wand->exception);
1161   if (chop_image == (Image *) NULL)
1162     return(MagickFalse);
1163   ReplaceImageInList(&wand->images,chop_image);
1164   return(MagickTrue);
1165 }
1166 \f
1167 /*
1168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1169 %                                                                             %
1170 %                                                                             %
1171 %                                                                             %
1172 %   M a g i c k C l a m p I m a g e                                           %
1173 %                                                                             %
1174 %                                                                             %
1175 %                                                                             %
1176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1177 %
1178 %  MagickClampImage() restricts the color range from 0 to the quantum depth.
1179 %
1180 %  The format of the MagickClampImage method is:
1181 %
1182 %      MagickBooleanType MagickClampImage(MagickWand *wand)
1183 %
1184 %  A description of each parameter follows:
1185 %
1186 %    o wand: the magick wand.
1187 %
1188 %    o channel: the channel.
1189 %
1190 */
1191 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1192 {
1193   assert(wand != (MagickWand *) NULL);
1194   assert(wand->signature == WandSignature);
1195   if (wand->debug != MagickFalse)
1196     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1197   if (wand->images == (Image *) NULL)
1198     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1199   return(ClampImage(wand->images,wand->exception));
1200 }
1201 \f
1202 /*
1203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1204 %                                                                             %
1205 %                                                                             %
1206 %                                                                             %
1207 %   M a g i c k C l i p I m a g e                                             %
1208 %                                                                             %
1209 %                                                                             %
1210 %                                                                             %
1211 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1212 %
1213 %  MagickClipImage() clips along the first path from the 8BIM profile, if
1214 %  present.
1215 %
1216 %  The format of the MagickClipImage method is:
1217 %
1218 %      MagickBooleanType MagickClipImage(MagickWand *wand)
1219 %
1220 %  A description of each parameter follows:
1221 %
1222 %    o wand: the magick wand.
1223 %
1224 */
1225 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1226 {
1227   MagickBooleanType
1228     status;
1229
1230   assert(wand != (MagickWand *) NULL);
1231   assert(wand->signature == WandSignature);
1232   if (wand->debug != MagickFalse)
1233     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1234   if (wand->images == (Image *) NULL)
1235     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1236   status=ClipImage(wand->images,wand->exception);
1237   return(status);
1238 }
1239 \f
1240 /*
1241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1242 %                                                                             %
1243 %                                                                             %
1244 %                                                                             %
1245 %   M a g i c k C l i p I m a g e P a t h                                     %
1246 %                                                                             %
1247 %                                                                             %
1248 %                                                                             %
1249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1250 %
1251 %  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1252 %  present. Later operations take effect inside the path.  Id may be a number
1253 %  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1254 %  path.
1255 %
1256 %  The format of the MagickClipImagePath method is:
1257 %
1258 %      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1259 %        const char *pathname,const MagickBooleanType inside)
1260 %
1261 %  A description of each parameter follows:
1262 %
1263 %    o wand: the magick wand.
1264 %
1265 %    o pathname: name of clipping path resource. If name is preceded by #, use
1266 %      clipping path numbered by name.
1267 %
1268 %    o inside: if non-zero, later operations take effect inside clipping path.
1269 %      Otherwise later operations take effect outside clipping path.
1270 %
1271 */
1272 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1273   const char *pathname,const MagickBooleanType inside)
1274 {
1275   MagickBooleanType
1276     status;
1277
1278   assert(wand != (MagickWand *) NULL);
1279   assert(wand->signature == WandSignature);
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   status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1285   return(status);
1286 }
1287 \f
1288 /*
1289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1290 %                                                                             %
1291 %                                                                             %
1292 %                                                                             %
1293 %   M a g i c k C l u t I m a g e                                             %
1294 %                                                                             %
1295 %                                                                             %
1296 %                                                                             %
1297 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1298 %
1299 %  MagickClutImage() replaces colors in the image from a color lookup table.
1300 %
1301 %  The format of the MagickClutImage method is:
1302 %
1303 %      MagickBooleanType MagickClutImage(MagickWand *wand,
1304 %        const MagickWand *clut_wand,const PixelInterpolateMethod method)
1305 %
1306 %  A description of each parameter follows:
1307 %
1308 %    o wand: the magick wand.
1309 %
1310 %    o clut_image: the clut image.
1311 %
1312 %    o method: the pixel interpolation method.
1313 %
1314 */
1315 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1316   const MagickWand *clut_wand,const PixelInterpolateMethod method)
1317 {
1318   MagickBooleanType
1319     status;
1320
1321   assert(wand != (MagickWand *) NULL);
1322   assert(wand->signature == WandSignature);
1323   if (wand->debug != MagickFalse)
1324     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1325   if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1326     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1327   status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1328   return(status);
1329 }
1330 \f
1331 /*
1332 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1333 %                                                                             %
1334 %                                                                             %
1335 %                                                                             %
1336 %   M a g i c k C o a l e s c e I m a g e s                                   %
1337 %                                                                             %
1338 %                                                                             %
1339 %                                                                             %
1340 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1341 %
1342 %  MagickCoalesceImages() composites a set of images while respecting any page
1343 %  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1344 %  typically start with an image background and each subsequent image
1345 %  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1346 %  where each image in the sequence is the same size as the first and
1347 %  composited with the next image in the sequence.
1348 %
1349 %  The format of the MagickCoalesceImages method is:
1350 %
1351 %      MagickWand *MagickCoalesceImages(MagickWand *wand)
1352 %
1353 %  A description of each parameter follows:
1354 %
1355 %    o wand: the magick wand.
1356 %
1357 */
1358 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1359 {
1360   Image
1361     *coalesce_image;
1362
1363   assert(wand != (MagickWand *) NULL);
1364   assert(wand->signature == WandSignature);
1365   if (wand->debug != MagickFalse)
1366     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1367   if (wand->images == (Image *) NULL)
1368     return((MagickWand *) NULL);
1369   coalesce_image=CoalesceImages(wand->images,wand->exception);
1370   if (coalesce_image == (Image *) NULL)
1371     return((MagickWand *) NULL);
1372   return(CloneMagickWandFromImages(wand,coalesce_image));
1373 }
1374 \f
1375 /*
1376 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1377 %                                                                             %
1378 %                                                                             %
1379 %                                                                             %
1380 %   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1381 %                                                                             %
1382 %                                                                             %
1383 %                                                                             %
1384 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1385 %
1386 %  MagickColorDecisionListImage() accepts a lightweight Color Correction
1387 %  Collection (CCC) file which solely contains one or more color corrections
1388 %  and applies the color correction to the image.  Here is a sample CCC file:
1389 %
1390 %    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1391 %          <ColorCorrection id="cc03345">
1392 %                <SOPNode>
1393 %                     <Slope> 0.9 1.2 0.5 </Slope>
1394 %                     <Offset> 0.4 -0.5 0.6 </Offset>
1395 %                     <Power> 1.0 0.8 1.5 </Power>
1396 %                </SOPNode>
1397 %                <SATNode>
1398 %                     <Saturation> 0.85 </Saturation>
1399 %                </SATNode>
1400 %          </ColorCorrection>
1401 %    </ColorCorrectionCollection>
1402 %
1403 %  which includes the offset, slope, and power for each of the RGB channels
1404 %  as well as the saturation.
1405 %
1406 %  The format of the MagickColorDecisionListImage method is:
1407 %
1408 %      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1409 %        const double gamma)
1410 %
1411 %  A description of each parameter follows:
1412 %
1413 %    o wand: the magick wand.
1414 %
1415 %    o color_correction_collection: the color correction collection in XML.
1416 %
1417 */
1418 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1419   const char *color_correction_collection)
1420 {
1421   MagickBooleanType
1422     status;
1423
1424   assert(wand != (MagickWand *) NULL);
1425   assert(wand->signature == WandSignature);
1426   if (wand->debug != MagickFalse)
1427     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1428   if (wand->images == (Image *) NULL)
1429     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1430   status=ColorDecisionListImage(wand->images,color_correction_collection,
1431     wand->exception);
1432   return(status);
1433 }
1434 \f
1435 /*
1436 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1437 %                                                                             %
1438 %                                                                             %
1439 %                                                                             %
1440 %   M a g i c k C o l o r i z e I m a g e                                     %
1441 %                                                                             %
1442 %                                                                             %
1443 %                                                                             %
1444 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1445 %
1446 %  MagickColorizeImage() blends the fill color with each pixel in the image.
1447 %
1448 %  The format of the MagickColorizeImage method is:
1449 %
1450 %      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1451 %        const PixelWand *colorize,const PixelWand *blend)
1452 %
1453 %  A description of each parameter follows:
1454 %
1455 %    o wand: the magick wand.
1456 %
1457 %    o colorize: the colorize pixel wand.
1458 %
1459 %    o alpha: the alpha pixel wand.
1460 %
1461 */
1462 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1463   const PixelWand *colorize,const PixelWand *blend)
1464 {
1465   char
1466     percent_blend[MaxTextExtent];
1467
1468   Image
1469     *colorize_image;
1470
1471   PixelInfo
1472     target;
1473
1474   assert(wand != (MagickWand *) NULL);
1475   assert(wand->signature == WandSignature);
1476   if (wand->debug != MagickFalse)
1477     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1478   if (wand->images == (Image *) NULL)
1479     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1480   GetPixelInfo(wand->images,&target);
1481   if (target.colorspace != CMYKColorspace)
1482     (void) FormatLocaleString(percent_blend,MaxTextExtent,
1483       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1484       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1485       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1486       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1487       PixelGetAlphaQuantum(blend)));
1488   else
1489     (void) FormatLocaleString(percent_blend,MaxTextExtent,
1490       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
1491       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
1492       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
1493       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
1494       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
1495       PixelGetAlphaQuantum(blend)));
1496   target=PixelGetPixel(colorize);
1497   colorize_image=ColorizeImage(wand->images,percent_blend,&target,
1498     wand->exception);
1499   if (colorize_image == (Image *) NULL)
1500     return(MagickFalse);
1501   ReplaceImageInList(&wand->images,colorize_image);
1502   return(MagickTrue);
1503 }
1504 \f
1505 /*
1506 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1507 %                                                                             %
1508 %                                                                             %
1509 %                                                                             %
1510 %   M a g i c k C o l o r M a t r i x I m a g e                               %
1511 %                                                                             %
1512 %                                                                             %
1513 %                                                                             %
1514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1515 %
1516 %  MagickColorMatrixImage() apply color transformation to an image. The method
1517 %  permits saturation changes, hue rotation, luminance to alpha, and various
1518 %  other effects.  Although variable-sized transformation matrices can be used,
1519 %  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1520 %  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1521 %  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1522 %  and offsets are normalized (divide Flash offset by 255).
1523 %
1524 %  The format of the MagickColorMatrixImage method is:
1525 %
1526 %      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1527 %        const KernelInfo *color_matrix)
1528 %
1529 %  A description of each parameter follows:
1530 %
1531 %    o wand: the magick wand.
1532 %
1533 %    o color_matrix:  the color matrix.
1534 %
1535 */
1536 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1537   const KernelInfo *color_matrix)
1538 {
1539   Image
1540     *color_image;
1541
1542   assert(wand != (MagickWand *) NULL);
1543   assert(wand->signature == WandSignature);
1544   if (wand->debug != MagickFalse)
1545     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1546   if (color_matrix == (const KernelInfo *) NULL)
1547     return(MagickFalse);
1548   if (wand->images == (Image *) NULL)
1549     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1550   color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1551   if (color_image == (Image *) NULL)
1552     return(MagickFalse);
1553   ReplaceImageInList(&wand->images,color_image);
1554   return(MagickTrue);
1555 }
1556 \f
1557 /*
1558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1559 %                                                                             %
1560 %                                                                             %
1561 %                                                                             %
1562 %   M a g i c k C o m b i n e I m a g e s                                     %
1563 %                                                                             %
1564 %                                                                             %
1565 %                                                                             %
1566 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1567 %
1568 %  MagickCombineImages() combines one or more images into a single image.  The
1569 %  grayscale value of the pixels of each image in the sequence is assigned in
1570 %  order to the specified  hannels of the combined image.   The typical
1571 %  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1572 %
1573 %  The format of the MagickCombineImages method is:
1574 %
1575 %      MagickWand *MagickCombineImages(MagickWand *wand)
1576 %
1577 %  A description of each parameter follows:
1578 %
1579 %    o wand: the magick wand.
1580 %
1581 */
1582 WandExport MagickWand *MagickCombineImages(MagickWand *wand)
1583 {
1584   Image
1585     *combine_image;
1586
1587   assert(wand != (MagickWand *) NULL);
1588   assert(wand->signature == WandSignature);
1589   if (wand->debug != MagickFalse)
1590     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1591   if (wand->images == (Image *) NULL)
1592     return((MagickWand *) NULL);
1593   combine_image=CombineImages(wand->images,wand->exception);
1594   if (combine_image == (Image *) NULL)
1595     return((MagickWand *) NULL);
1596   return(CloneMagickWandFromImages(wand,combine_image));
1597 }
1598 \f
1599 /*
1600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1601 %                                                                             %
1602 %                                                                             %
1603 %                                                                             %
1604 %   M a g i c k C o m m e n t I m a g e                                       %
1605 %                                                                             %
1606 %                                                                             %
1607 %                                                                             %
1608 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1609 %
1610 %  MagickCommentImage() adds a comment to your image.
1611 %
1612 %  The format of the MagickCommentImage method is:
1613 %
1614 %      MagickBooleanType MagickCommentImage(MagickWand *wand,
1615 %        const char *comment)
1616 %
1617 %  A description of each parameter follows:
1618 %
1619 %    o wand: the magick wand.
1620 %
1621 %    o comment: the image comment.
1622 %
1623 */
1624 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1625   const char *comment)
1626 {
1627   MagickBooleanType
1628     status;
1629
1630   assert(wand != (MagickWand *) NULL);
1631   assert(wand->signature == WandSignature);
1632   if (wand->debug != MagickFalse)
1633     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1634   if (wand->images == (Image *) NULL)
1635     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1636   status=SetImageProperty(wand->images,"comment",comment,wand->exception);
1637   return(status);
1638 }
1639 \f
1640 /*
1641 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1642 %                                                                             %
1643 %                                                                             %
1644 %                                                                             %
1645 %   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1646 %                                                                             %
1647 %                                                                             %
1648 %                                                                             %
1649 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1650 %
1651 %  MagickCompareImagesLayers() compares each image with the next in a sequence
1652 %  and returns the maximum bounding region of any pixel differences it
1653 %  discovers.
1654 %
1655 %  The format of the MagickCompareImagesLayers method is:
1656 %
1657 %      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1658 %        const ImageLayerMethod method)
1659 %
1660 %  A description of each parameter follows:
1661 %
1662 %    o wand: the magick wand.
1663 %
1664 %    o method: the compare method.
1665 %
1666 */
1667 WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1668   const ImageLayerMethod method)
1669 {
1670   Image
1671     *layers_image;
1672
1673   assert(wand != (MagickWand *) NULL);
1674   assert(wand->signature == WandSignature);
1675   if (wand->debug != MagickFalse)
1676     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1677   if (wand->images == (Image *) NULL)
1678     return((MagickWand *) NULL);
1679   layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1680   if (layers_image == (Image *) NULL)
1681     return((MagickWand *) NULL);
1682   return(CloneMagickWandFromImages(wand,layers_image));
1683 }
1684 \f
1685 /*
1686 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1687 %                                                                             %
1688 %                                                                             %
1689 %                                                                             %
1690 %   M a g i c k C o m p a r e I m a g e s                                     %
1691 %                                                                             %
1692 %                                                                             %
1693 %                                                                             %
1694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1695 %
1696 %  MagickCompareImages() compares an image to a reconstructed image and returns
1697 %  the specified difference image.
1698 %
1699 %  The format of the MagickCompareImages method is:
1700 %
1701 %      MagickWand *MagickCompareImages(MagickWand *wand,
1702 %        const MagickWand *reference,const MetricType metric,
1703 %        double *distortion)
1704 %
1705 %  A description of each parameter follows:
1706 %
1707 %    o wand: the magick wand.
1708 %
1709 %    o reference: the reference wand.
1710 %
1711 %    o metric: the metric.
1712 %
1713 %    o distortion: the computed distortion between the images.
1714 %
1715 */
1716 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1717   const MagickWand *reference,const MetricType metric,double *distortion)
1718 {
1719   Image
1720     *compare_image;
1721
1722
1723   assert(wand != (MagickWand *) NULL);
1724   assert(wand->signature == WandSignature);
1725   if (wand->debug != MagickFalse)
1726     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1727   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1728     {
1729       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1730         "ContainsNoImages","`%s'",wand->name);
1731       return((MagickWand *) NULL);
1732     }
1733   compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1734     wand->exception);
1735   if (compare_image == (Image *) NULL)
1736     return((MagickWand *) NULL);
1737   return(CloneMagickWandFromImages(wand,compare_image));
1738 }
1739 \f
1740 /*
1741 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1742 %                                                                             %
1743 %                                                                             %
1744 %                                                                             %
1745 %   M a g i c k C o m p o s i t e I m a g e                                   %
1746 %                                                                             %
1747 %                                                                             %
1748 %                                                                             %
1749 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1750 %
1751 %  MagickCompositeImage() composite one image onto another at the specified
1752 %  offset.
1753 %
1754 %  The format of the MagickCompositeImage method is:
1755 %
1756 %      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1757 %        const MagickWand *composite_wand,const CompositeOperator compose,
1758 %        const ssize_t x,const ssize_t y)
1759 %
1760 %  A description of each parameter follows:
1761 %
1762 %    o wand: the magick wand.
1763 %
1764 %    o composite_image: the composite image.
1765 %
1766 %    o compose: This operator affects how the composite is applied to the
1767 %      image.  The default is Over.  Choose from these operators:
1768 %
1769 %        OverCompositeOp       InCompositeOp         OutCompositeOp
1770 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1771 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1772 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1773 %        DisplaceCompositeOp
1774 %
1775 %    o x: the column offset of the composited image.
1776 %
1777 %    o y: the row offset of the composited image.
1778 %
1779 */
1780 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1781   const MagickWand *composite_wand,const CompositeOperator compose,
1782   const ssize_t x,const ssize_t y)
1783 {
1784   MagickBooleanType
1785     status;
1786
1787   assert(wand != (MagickWand *) NULL);
1788   assert(wand->signature == WandSignature);
1789   if (wand->debug != MagickFalse)
1790     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1791   if ((wand->images == (Image *) NULL) ||
1792       (composite_wand->images == (Image *) NULL))
1793     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1794   status=CompositeImage(wand->images,compose,composite_wand->images,x,y,
1795     wand->exception);
1796   return(status);
1797 }
1798 \f
1799 /*
1800 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1801 %                                                                             %
1802 %                                                                             %
1803 %                                                                             %
1804 %   M a g i c k C o n t r a s t I m a g e                                     %
1805 %                                                                             %
1806 %                                                                             %
1807 %                                                                             %
1808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1809 %
1810 %  MagickContrastImage() enhances the intensity differences between the lighter
1811 %  and darker elements of the image.  Set sharpen to a value other than 0 to
1812 %  increase the image contrast otherwise the contrast is reduced.
1813 %
1814 %  The format of the MagickContrastImage method is:
1815 %
1816 %      MagickBooleanType MagickContrastImage(MagickWand *wand,
1817 %        const MagickBooleanType sharpen)
1818 %
1819 %  A description of each parameter follows:
1820 %
1821 %    o wand: the magick wand.
1822 %
1823 %    o sharpen: Increase or decrease image contrast.
1824 %
1825 %
1826 */
1827 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1828   const MagickBooleanType sharpen)
1829 {
1830   MagickBooleanType
1831     status;
1832
1833   assert(wand != (MagickWand *) NULL);
1834   assert(wand->signature == WandSignature);
1835   if (wand->debug != MagickFalse)
1836     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1837   if (wand->images == (Image *) NULL)
1838     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1839   status=ContrastImage(wand->images,sharpen,wand->exception);
1840   return(status);
1841 }
1842 \f
1843 /*
1844 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1845 %                                                                             %
1846 %                                                                             %
1847 %                                                                             %
1848 %   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                       %
1849 %                                                                             %
1850 %                                                                             %
1851 %                                                                             %
1852 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1853 %
1854 %  MagickContrastStretchImage() enhances the contrast of a color image by
1855 %  adjusting the pixels color to span the entire range of colors available.
1856 %  You can also reduce the influence of a particular channel with a gamma
1857 %  value of 0.
1858 %
1859 %  The format of the MagickContrastStretchImage method is:
1860 %
1861 %      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1862 %        const double black_point,const double white_point)
1863 %
1864 %  A description of each parameter follows:
1865 %
1866 %    o wand: the magick wand.
1867 %
1868 %    o black_point: the black point.
1869 %
1870 %    o white_point: the white point.
1871 %
1872 */
1873 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1874   const double black_point,const double white_point)
1875 {
1876   MagickBooleanType
1877     status;
1878
1879   assert(wand != (MagickWand *) NULL);
1880   assert(wand->signature == WandSignature);
1881   if (wand->debug != MagickFalse)
1882     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1883   if (wand->images == (Image *) NULL)
1884     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1885   status=ContrastStretchImage(wand->images,black_point,white_point,
1886     wand->exception);
1887   return(status);
1888 }
1889 \f
1890 /*
1891 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1892 %                                                                             %
1893 %                                                                             %
1894 %                                                                             %
1895 %   M a g i c k C o n v o l v e I m a g e                                     %
1896 %                                                                             %
1897 %                                                                             %
1898 %                                                                             %
1899 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1900 %
1901 %  MagickConvolveImage() applies a custom convolution kernel to the image.
1902 %
1903 %  The format of the MagickConvolveImage method is:
1904 %
1905 %      MagickBooleanType MagickConvolveImage(MagickWand *wand,
1906 %        const KernelInfo *kernel)
1907 %
1908 %  A description of each parameter follows:
1909 %
1910 %    o wand: the magick wand.
1911 %
1912 %    o kernel: An array of doubles representing the convolution kernel.
1913 %
1914 */
1915 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
1916   const KernelInfo *kernel)
1917 {
1918   Image
1919     *filter_image;
1920
1921   assert(wand != (MagickWand *) NULL);
1922   assert(wand->signature == WandSignature);
1923   if (wand->debug != MagickFalse)
1924     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1925   if (kernel == (const KernelInfo *) NULL)
1926     return(MagickFalse);
1927   if (wand->images == (Image *) NULL)
1928     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1929   filter_image=ConvolveImage(wand->images,kernel,wand->exception);
1930   if (filter_image == (Image *) NULL)
1931     return(MagickFalse);
1932   ReplaceImageInList(&wand->images,filter_image);
1933   return(MagickTrue);
1934 }
1935 \f
1936 /*
1937 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1938 %                                                                             %
1939 %                                                                             %
1940 %                                                                             %
1941 %   M a g i c k C r o p I m a g e                                             %
1942 %                                                                             %
1943 %                                                                             %
1944 %                                                                             %
1945 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1946 %
1947 %  MagickCropImage() extracts a region of the image.
1948 %
1949 %  The format of the MagickCropImage method is:
1950 %
1951 %      MagickBooleanType MagickCropImage(MagickWand *wand,
1952 %        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1953 %
1954 %  A description of each parameter follows:
1955 %
1956 %    o wand: the magick wand.
1957 %
1958 %    o width: the region width.
1959 %
1960 %    o height: the region height.
1961 %
1962 %    o x: the region x-offset.
1963 %
1964 %    o y: the region y-offset.
1965 %
1966 */
1967 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
1968   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1969 {
1970   Image
1971     *crop_image;
1972
1973   RectangleInfo
1974     crop;
1975
1976   assert(wand != (MagickWand *) NULL);
1977   assert(wand->signature == WandSignature);
1978   if (wand->debug != MagickFalse)
1979     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1980   if (wand->images == (Image *) NULL)
1981     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1982   crop.width=width;
1983   crop.height=height;
1984   crop.x=x;
1985   crop.y=y;
1986   crop_image=CropImage(wand->images,&crop,wand->exception);
1987   if (crop_image == (Image *) NULL)
1988     return(MagickFalse);
1989   ReplaceImageInList(&wand->images,crop_image);
1990   return(MagickTrue);
1991 }
1992 \f
1993 /*
1994 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1995 %                                                                             %
1996 %                                                                             %
1997 %                                                                             %
1998 %   M a g i c k C y c l e C o l o r m a p I m a g e                           %
1999 %                                                                             %
2000 %                                                                             %
2001 %                                                                             %
2002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2003 %
2004 %  MagickCycleColormapImage() displaces an image's colormap by a given number
2005 %  of positions.  If you cycle the colormap a number of times you can produce
2006 %  a psychodelic effect.
2007 %
2008 %  The format of the MagickCycleColormapImage method is:
2009 %
2010 %      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2011 %        const ssize_t displace)
2012 %
2013 %  A description of each parameter follows:
2014 %
2015 %    o wand: the magick wand.
2016 %
2017 %    o pixel_wand: the pixel wand.
2018 %
2019 */
2020 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2021   const ssize_t displace)
2022 {
2023   MagickBooleanType
2024     status;
2025
2026   assert(wand != (MagickWand *) NULL);
2027   assert(wand->signature == WandSignature);
2028   if (wand->debug != MagickFalse)
2029     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2030   if (wand->images == (Image *) NULL)
2031     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2032   status=CycleColormapImage(wand->images,displace,wand->exception);
2033   return(status);
2034 }
2035 \f
2036 /*
2037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2038 %                                                                             %
2039 %                                                                             %
2040 %                                                                             %
2041 %   M a g i c k C o n s t i t u t e I m a g e                                 %
2042 %                                                                             %
2043 %                                                                             %
2044 %                                                                             %
2045 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2046 %
2047 %  MagickConstituteImage() adds an image to the wand comprised of the pixel
2048 %  data you supply.  The pixel data must be in scanline order top-to-bottom.
2049 %  The data can be char, short int, int, float, or double.  Float and double
2050 %  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2051 %  is the maximum value the type can accomodate (e.g. 255 for char).  For
2052 %  example, to create a 640x480 image from unsigned red-green-blue character
2053 %  data, use
2054 %
2055 %      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2056 %
2057 %  The format of the MagickConstituteImage method is:
2058 %
2059 %      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2060 %        const size_t columns,const size_t rows,const char *map,
2061 %        const StorageType storage,void *pixels)
2062 %
2063 %  A description of each parameter follows:
2064 %
2065 %    o wand: the magick wand.
2066 %
2067 %    o columns: width in pixels of the image.
2068 %
2069 %    o rows: height in pixels of the image.
2070 %
2071 %    o map:  This string reflects the expected ordering of the pixel array.
2072 %      It can be any combination or order of R = red, G = green, B = blue,
2073 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2074 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2075 %      P = pad.
2076 %
2077 %    o storage: Define the data type of the pixels.  Float and double types are
2078 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2079 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2080 %      LongPixel, QuantumPixel, or ShortPixel.
2081 %
2082 %    o pixels: This array of values contain the pixel components as defined by
2083 %      map and type.  You must preallocate this array where the expected
2084 %      length varies depending on the values of width, height, map, and type.
2085 %
2086 %
2087 */
2088 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2089   const size_t columns,const size_t rows,const char *map,
2090   const StorageType storage,const void *pixels)
2091 {
2092   Image
2093     *images;
2094
2095   assert(wand != (MagickWand *) NULL);
2096   assert(wand->signature == WandSignature);
2097   if (wand->debug != MagickFalse)
2098     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2099   images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2100   if (images == (Image *) NULL)
2101     return(MagickFalse);
2102   return(InsertImageInWand(wand,images));
2103 }
2104 \f
2105 /*
2106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2107 %                                                                             %
2108 %                                                                             %
2109 %                                                                             %
2110 %   M a g i c k D e c i p h e r I m a g e                                     %
2111 %                                                                             %
2112 %                                                                             %
2113 %                                                                             %
2114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2115 %
2116 %  MagickDecipherImage() converts cipher pixels to plain pixels.
2117 %
2118 %  The format of the MagickDecipherImage method is:
2119 %
2120 %      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2121 %        const char *passphrase)
2122 %
2123 %  A description of each parameter follows:
2124 %
2125 %    o wand: the magick wand.
2126 %
2127 %    o passphrase: the passphrase.
2128 %
2129 */
2130 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2131   const char *passphrase)
2132 {
2133   assert(wand != (MagickWand *) NULL);
2134   assert(wand->signature == WandSignature);
2135   if (wand->debug != MagickFalse)
2136     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2137   if (wand->images == (Image *) NULL)
2138     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2139   return(DecipherImage(wand->images,passphrase,wand->exception));
2140 }
2141 \f
2142 /*
2143 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2144 %                                                                             %
2145 %                                                                             %
2146 %                                                                             %
2147 %   M a g i c k D e c o n s t r u c t I m a g e s                             %
2148 %                                                                             %
2149 %                                                                             %
2150 %                                                                             %
2151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2152 %
2153 %  MagickDeconstructImages() compares each image with the next in a sequence
2154 %  and returns the maximum bounding region of any pixel differences it
2155 %  discovers.
2156 %
2157 %  The format of the MagickDeconstructImages method is:
2158 %
2159 %      MagickWand *MagickDeconstructImages(MagickWand *wand)
2160 %
2161 %  A description of each parameter follows:
2162 %
2163 %    o wand: the magick wand.
2164 %
2165 */
2166 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2167 {
2168   Image
2169     *deconstruct_image;
2170
2171   assert(wand != (MagickWand *) NULL);
2172   assert(wand->signature == WandSignature);
2173   if (wand->debug != MagickFalse)
2174     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2175   if (wand->images == (Image *) NULL)
2176     return((MagickWand *) NULL);
2177   deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2178     wand->exception);
2179   if (deconstruct_image == (Image *) NULL)
2180     return((MagickWand *) NULL);
2181   return(CloneMagickWandFromImages(wand,deconstruct_image));
2182 }
2183 \f
2184 /*
2185 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2186 %                                                                             %
2187 %                                                                             %
2188 %                                                                             %
2189 %     M a g i c k D e s k e w I m a g e                                       %
2190 %                                                                             %
2191 %                                                                             %
2192 %                                                                             %
2193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2194 %
2195 %  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2196 %  occurs in scanned images because of the camera being misaligned,
2197 %  imperfections in the scanning or surface, or simply because the paper was
2198 %  not placed completely flat when scanned.
2199 %
2200 %  The format of the MagickDeskewImage method is:
2201 %
2202 %      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2203 %        const double threshold)
2204 %
2205 %  A description of each parameter follows:
2206 %
2207 %    o wand: the magick wand.
2208 %
2209 %    o threshold: separate background from foreground.
2210 %
2211 */
2212 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2213   const double threshold)
2214 {
2215   Image
2216     *sepia_image;
2217
2218   assert(wand != (MagickWand *) NULL);
2219   assert(wand->signature == WandSignature);
2220   if (wand->debug != MagickFalse)
2221     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2222   if (wand->images == (Image *) NULL)
2223     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2224   sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2225   if (sepia_image == (Image *) NULL)
2226     return(MagickFalse);
2227   ReplaceImageInList(&wand->images,sepia_image);
2228   return(MagickTrue);
2229 }
2230 \f
2231 /*
2232 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2233 %                                                                             %
2234 %                                                                             %
2235 %                                                                             %
2236 %     M a g i c k D e s p e c k l e I m a g e                                 %
2237 %                                                                             %
2238 %                                                                             %
2239 %                                                                             %
2240 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2241 %
2242 %  MagickDespeckleImage() reduces the speckle noise in an image while
2243 %  perserving the edges of the original image.
2244 %
2245 %  The format of the MagickDespeckleImage method is:
2246 %
2247 %      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2248 %
2249 %  A description of each parameter follows:
2250 %
2251 %    o wand: the magick wand.
2252 %
2253 */
2254 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2255 {
2256   Image
2257     *despeckle_image;
2258
2259   assert(wand != (MagickWand *) NULL);
2260   assert(wand->signature == WandSignature);
2261   if (wand->debug != MagickFalse)
2262     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2263   if (wand->images == (Image *) NULL)
2264     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2265   despeckle_image=DespeckleImage(wand->images,wand->exception);
2266   if (despeckle_image == (Image *) NULL)
2267     return(MagickFalse);
2268   ReplaceImageInList(&wand->images,despeckle_image);
2269   return(MagickTrue);
2270 }
2271 \f
2272 /*
2273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2274 %                                                                             %
2275 %                                                                             %
2276 %                                                                             %
2277 %   M a g i c k D e s t r o y I m a g e                                       %
2278 %                                                                             %
2279 %                                                                             %
2280 %                                                                             %
2281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2282 %
2283 %  MagickDestroyImage() dereferences an image, deallocating memory associated
2284 %  with the image if the reference count becomes zero.
2285 %
2286 %  The format of the MagickDestroyImage method is:
2287 %
2288 %      Image *MagickDestroyImage(Image *image)
2289 %
2290 %  A description of each parameter follows:
2291 %
2292 %    o image: the image.
2293 %
2294 */
2295 WandExport Image *MagickDestroyImage(Image *image)
2296 {
2297   return(DestroyImage(image));
2298 }
2299 \f
2300 /*
2301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2302 %                                                                             %
2303 %                                                                             %
2304 %                                                                             %
2305 %   M a g i c k D i s p l a y I m a g e                                       %
2306 %                                                                             %
2307 %                                                                             %
2308 %                                                                             %
2309 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2310 %
2311 %  MagickDisplayImage() displays an image.
2312 %
2313 %  The format of the MagickDisplayImage method is:
2314 %
2315 %      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2316 %        const char *server_name)
2317 %
2318 %  A description of each parameter follows:
2319 %
2320 %    o wand: the magick wand.
2321 %
2322 %    o server_name: the X server name.
2323 %
2324 */
2325 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2326   const char *server_name)
2327 {
2328   Image
2329     *image;
2330
2331   MagickBooleanType
2332     status;
2333
2334   assert(wand != (MagickWand *) NULL);
2335   assert(wand->signature == WandSignature);
2336   if (wand->debug != MagickFalse)
2337     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2338   if (wand->images == (Image *) NULL)
2339     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2340   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2341   if (image == (Image *) NULL)
2342     return(MagickFalse);
2343   (void) CloneString(&wand->image_info->server_name,server_name);
2344   status=DisplayImages(wand->image_info,image,wand->exception);
2345   image=DestroyImage(image);
2346   return(status);
2347 }
2348 \f
2349 /*
2350 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2351 %                                                                             %
2352 %                                                                             %
2353 %                                                                             %
2354 %   M a g i c k D i s p l a y I m a g e s                                     %
2355 %                                                                             %
2356 %                                                                             %
2357 %                                                                             %
2358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2359 %
2360 %  MagickDisplayImages() displays an image or image sequence.
2361 %
2362 %  The format of the MagickDisplayImages method is:
2363 %
2364 %      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2365 %        const char *server_name)
2366 %
2367 %  A description of each parameter follows:
2368 %
2369 %    o wand: the magick wand.
2370 %
2371 %    o server_name: the X server name.
2372 %
2373 */
2374 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2375   const char *server_name)
2376 {
2377   MagickBooleanType
2378     status;
2379
2380   assert(wand != (MagickWand *) NULL);
2381   assert(wand->signature == WandSignature);
2382   if (wand->debug != MagickFalse)
2383     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2384   (void) CloneString(&wand->image_info->server_name,server_name);
2385   status=DisplayImages(wand->image_info,wand->images,wand->exception);
2386   return(status);
2387 }
2388 \f
2389 /*
2390 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2391 %                                                                             %
2392 %                                                                             %
2393 %                                                                             %
2394 %   M a g i c k D i s t o r t I m a g e                                       %
2395 %                                                                             %
2396 %                                                                             %
2397 %                                                                             %
2398 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2399 %
2400 %  MagickDistortImage() distorts an image using various distortion methods, by
2401 %  mapping color lookups of the source image to a new destination image
2402 %  usally of the same size as the source image, unless 'bestfit' is set to
2403 %  true.
2404 %
2405 %  If 'bestfit' is enabled, and distortion allows it, the destination image is
2406 %  adjusted to ensure the whole source 'image' will just fit within the final
2407 %  destination image, which will be sized and offset accordingly.  Also in
2408 %  many cases the virtual offset of the source image will be taken into
2409 %  account in the mapping.
2410 %
2411 %  The format of the MagickDistortImage method is:
2412 %
2413 %      MagickBooleanType MagickDistortImage(MagickWand *wand,
2414 %        const DistortImageMethod method,const size_t number_arguments,
2415 %        const double *arguments,const MagickBooleanType bestfit)
2416 %
2417 %  A description of each parameter follows:
2418 %
2419 %    o image: the image to be distorted.
2420 %
2421 %    o method: the method of image distortion.
2422 %
2423 %        ArcDistortion always ignores the source image offset, and always
2424 %        'bestfit' the destination image with the top left corner offset
2425 %        relative to the polar mapping center.
2426 %
2427 %        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2428 %        style of image distortion.
2429 %
2430 %        Affine, Perspective, and Bilinear, do least squares fitting of the
2431 %        distortion when more than the minimum number of control point pairs
2432 %        are provided.
2433 %
2434 %        Perspective, and Bilinear, falls back to a Affine distortion when less
2435 %        that 4 control point pairs are provided. While Affine distortions let
2436 %        you use any number of control point pairs, that is Zero pairs is a
2437 %        no-Op (viewport only) distrotion, one pair is a translation and two
2438 %        pairs of control points do a scale-rotate-translate, without any
2439 %        shearing.
2440 %
2441 %    o number_arguments: the number of arguments given for this distortion
2442 %      method.
2443 %
2444 %    o arguments: the arguments for this distortion method.
2445 %
2446 %    o bestfit: Attempt to resize destination to fit distorted source.
2447 %
2448 */
2449 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2450   const DistortImageMethod method,const size_t number_arguments,
2451   const double *arguments,const MagickBooleanType bestfit)
2452 {
2453   Image
2454     *distort_image;
2455
2456   assert(wand != (MagickWand *) NULL);
2457   assert(wand->signature == WandSignature);
2458   if (wand->debug != MagickFalse)
2459     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2460   if (wand->images == (Image *) NULL)
2461     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2462   distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2463     bestfit,wand->exception);
2464   if (distort_image == (Image *) NULL)
2465     return(MagickFalse);
2466   ReplaceImageInList(&wand->images,distort_image);
2467   return(MagickTrue);
2468 }
2469 \f
2470 /*
2471 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2472 %                                                                             %
2473 %                                                                             %
2474 %                                                                             %
2475 %   M a g i c k D r a w I m a g e                                             %
2476 %                                                                             %
2477 %                                                                             %
2478 %                                                                             %
2479 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2480 %
2481 %  MagickDrawImage() renders the drawing wand on the current image.
2482 %
2483 %  The format of the MagickDrawImage method is:
2484 %
2485 %      MagickBooleanType MagickDrawImage(MagickWand *wand,
2486 %        const DrawingWand *drawing_wand)
2487 %
2488 %  A description of each parameter follows:
2489 %
2490 %    o wand: the magick wand.
2491 %
2492 %    o drawing_wand: the draw wand.
2493 %
2494 */
2495 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2496   const DrawingWand *drawing_wand)
2497 {
2498   char
2499     *primitive;
2500
2501   DrawInfo
2502     *draw_info;
2503
2504   MagickBooleanType
2505     status;
2506
2507   assert(wand != (MagickWand *) NULL);
2508   assert(wand->signature == WandSignature);
2509   if (wand->debug != MagickFalse)
2510     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2511   if (wand->images == (Image *) NULL)
2512     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2513   draw_info=PeekDrawingWand(drawing_wand);
2514   if ((draw_info == (DrawInfo *) NULL) ||
2515       (draw_info->primitive == (char *) NULL))
2516     return(MagickFalse);
2517   primitive=AcquireString(draw_info->primitive);
2518   draw_info=DestroyDrawInfo(draw_info);
2519   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2520   draw_info->primitive=primitive;
2521   status=DrawImage(wand->images,draw_info,wand->exception);
2522   draw_info=DestroyDrawInfo(draw_info);
2523   return(status);
2524 }
2525 \f
2526 /*
2527 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2528 %                                                                             %
2529 %                                                                             %
2530 %                                                                             %
2531 %   M a g i c k E d g e I m a g e                                             %
2532 %                                                                             %
2533 %                                                                             %
2534 %                                                                             %
2535 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2536 %
2537 %  MagickEdgeImage() enhance edges within the image with a convolution filter
2538 %  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2539 %  radius for you.
2540 %
2541 %  The format of the MagickEdgeImage method is:
2542 %
2543 %      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius,
2544 %        const double sigma)
2545 %
2546 %  A description of each parameter follows:
2547 %
2548 %    o wand: the magick wand.
2549 %
2550 %    o radius: the radius of the pixel neighborhood.
2551 %
2552 %    o sigma: the standard deviation of the Gaussian, in pixels.
2553 %
2554 */
2555 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2556   const double radius,const double sigma)
2557 {
2558   Image
2559     *edge_image;
2560
2561   assert(wand != (MagickWand *) NULL);
2562   assert(wand->signature == WandSignature);
2563   if (wand->debug != MagickFalse)
2564     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2565   if (wand->images == (Image *) NULL)
2566     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2567   edge_image=EdgeImage(wand->images,radius,sigma,wand->exception);
2568   if (edge_image == (Image *) NULL)
2569     return(MagickFalse);
2570   ReplaceImageInList(&wand->images,edge_image);
2571   return(MagickTrue);
2572 }
2573 \f
2574 /*
2575 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2576 %                                                                             %
2577 %                                                                             %
2578 %                                                                             %
2579 %   M a g i c k E m b o s s I m a g e                                         %
2580 %                                                                             %
2581 %                                                                             %
2582 %                                                                             %
2583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2584 %
2585 %  MagickEmbossImage() returns a grayscale image with a three-dimensional
2586 %  effect.  We convolve the image with a Gaussian operator of the given radius
2587 %  and standard deviation (sigma).  For reasonable results, radius should be
2588 %  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2589 %  radius for you.
2590 %
2591 %  The format of the MagickEmbossImage method is:
2592 %
2593 %      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2594 %        const double sigma)
2595 %
2596 %  A description of each parameter follows:
2597 %
2598 %    o wand: the magick wand.
2599 %
2600 %    o radius: the radius of the Gaussian, in pixels, not counting the center
2601 %      pixel.
2602 %
2603 %    o sigma: the standard deviation of the Gaussian, in pixels.
2604 %
2605 */
2606 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2607   const double radius,const double sigma)
2608 {
2609   Image
2610     *emboss_image;
2611
2612   assert(wand != (MagickWand *) NULL);
2613   assert(wand->signature == WandSignature);
2614   if (wand->debug != MagickFalse)
2615     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2616   if (wand->images == (Image *) NULL)
2617     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2618   emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2619   if (emboss_image == (Image *) NULL)
2620     return(MagickFalse);
2621   ReplaceImageInList(&wand->images,emboss_image);
2622   return(MagickTrue);
2623 }
2624 \f
2625 /*
2626 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2627 %                                                                             %
2628 %                                                                             %
2629 %                                                                             %
2630 %   M a g i c k E n c i p h e r I m a g e                                     %
2631 %                                                                             %
2632 %                                                                             %
2633 %                                                                             %
2634 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2635 %
2636 %  MagickEncipherImage() converts plaint pixels to cipher pixels.
2637 %
2638 %  The format of the MagickEncipherImage method is:
2639 %
2640 %      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2641 %        const char *passphrase)
2642 %
2643 %  A description of each parameter follows:
2644 %
2645 %    o wand: the magick wand.
2646 %
2647 %    o passphrase: the passphrase.
2648 %
2649 */
2650 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2651   const char *passphrase)
2652 {
2653   assert(wand != (MagickWand *) NULL);
2654   assert(wand->signature == WandSignature);
2655   if (wand->debug != MagickFalse)
2656     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2657   if (wand->images == (Image *) NULL)
2658     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2659   return(EncipherImage(wand->images,passphrase,wand->exception));
2660 }
2661 \f
2662 /*
2663 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2664 %                                                                             %
2665 %                                                                             %
2666 %                                                                             %
2667 %   M a g i c k E n h a n c e I m a g e                                       %
2668 %                                                                             %
2669 %                                                                             %
2670 %                                                                             %
2671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2672 %
2673 %  MagickEnhanceImage() applies a digital filter that improves the quality of a
2674 %  noisy image.
2675 %
2676 %  The format of the MagickEnhanceImage method is:
2677 %
2678 %      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2679 %
2680 %  A description of each parameter follows:
2681 %
2682 %    o wand: the magick wand.
2683 %
2684 */
2685 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2686 {
2687   Image
2688     *enhance_image;
2689
2690   assert(wand != (MagickWand *) NULL);
2691   assert(wand->signature == WandSignature);
2692   if (wand->debug != MagickFalse)
2693     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2694   if (wand->images == (Image *) NULL)
2695     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2696   enhance_image=EnhanceImage(wand->images,wand->exception);
2697   if (enhance_image == (Image *) NULL)
2698     return(MagickFalse);
2699   ReplaceImageInList(&wand->images,enhance_image);
2700   return(MagickTrue);
2701 }
2702 \f
2703 /*
2704 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2705 %                                                                             %
2706 %                                                                             %
2707 %                                                                             %
2708 %   M a g i c k E q u a l i z e I m a g e                                     %
2709 %                                                                             %
2710 %                                                                             %
2711 %                                                                             %
2712 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2713 %
2714 %  MagickEqualizeImage() equalizes the image histogram.
2715 %
2716 %  The format of the MagickEqualizeImage method is:
2717 %
2718 %      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2719 %
2720 %  A description of each parameter follows:
2721 %
2722 %    o wand: the magick wand.
2723 %
2724 %    o channel: the image channel(s).
2725 %
2726 */
2727 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2728 {
2729   MagickBooleanType
2730     status;
2731
2732   assert(wand != (MagickWand *) NULL);
2733   assert(wand->signature == WandSignature);
2734   if (wand->debug != MagickFalse)
2735     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2736   if (wand->images == (Image *) NULL)
2737     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2738   status=EqualizeImage(wand->images,wand->exception);
2739   return(status);
2740 }
2741 \f
2742 /*
2743 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2744 %                                                                             %
2745 %                                                                             %
2746 %                                                                             %
2747 %   M a g i c k E v a l u a t e I m a g e                                     %
2748 %                                                                             %
2749 %                                                                             %
2750 %                                                                             %
2751 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2752 %
2753 %  MagickEvaluateImage() applys an arithmetic, relational, or logical
2754 %  expression to an image.  Use these operators to lighten or darken an image,
2755 %  to increase or decrease contrast in an image, or to produce the "negative"
2756 %  of an image.
2757 %
2758 %  The format of the MagickEvaluateImage method is:
2759 %
2760 %      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2761 %        const MagickEvaluateOperator operator,const double value)
2762 %      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2763 %        const MagickEvaluateOperator operator)
2764 %
2765 %  A description of each parameter follows:
2766 %
2767 %    o wand: the magick wand.
2768 %
2769 %    o op: A channel operator.
2770 %
2771 %    o value: A value value.
2772 %
2773 */
2774
2775 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2776   const MagickEvaluateOperator op)
2777 {
2778   Image
2779     *evaluate_image;
2780
2781   assert(wand != (MagickWand *) NULL);
2782   assert(wand->signature == WandSignature);
2783   if (wand->debug != MagickFalse)
2784     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2785   if (wand->images == (Image *) NULL)
2786     return((MagickWand *) NULL);
2787   evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2788   if (evaluate_image == (Image *) NULL)
2789     return((MagickWand *) NULL);
2790   return(CloneMagickWandFromImages(wand,evaluate_image));
2791 }
2792
2793 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2794   const MagickEvaluateOperator op,const double value)
2795 {
2796   MagickBooleanType
2797     status;
2798
2799   assert(wand != (MagickWand *) NULL);
2800   assert(wand->signature == WandSignature);
2801   if (wand->debug != MagickFalse)
2802     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2803   if (wand->images == (Image *) NULL)
2804     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2805   status=EvaluateImage(wand->images,op,value,wand->exception);
2806   return(status);
2807 }
2808 \f
2809 /*
2810 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2811 %                                                                             %
2812 %                                                                             %
2813 %                                                                             %
2814 %   M a g i c k E x p o r t I m a g e P i x e l s                             %
2815 %                                                                             %
2816 %                                                                             %
2817 %                                                                             %
2818 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2819 %
2820 %  MagickExportImagePixels() extracts pixel data from an image and returns it
2821 %  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2822 %  an error is encountered.  The data is returned as char, short int, int,
2823 %  ssize_t, float, or double in the order specified by map.
2824 %
2825 %  Suppose you want to extract the first scanline of a 640x480 image as
2826 %  character data in red-green-blue order:
2827 %
2828 %      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
2829 %
2830 %  The format of the MagickExportImagePixels method is:
2831 %
2832 %      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2833 %        const ssize_t x,const ssize_t y,const size_t columns,
2834 %        const size_t rows,const char *map,const StorageType storage,
2835 %        void *pixels)
2836 %
2837 %  A description of each parameter follows:
2838 %
2839 %    o wand: the magick wand.
2840 %
2841 %    o x, y, columns, rows:  These values define the perimeter
2842 %      of a region of pixels you want to extract.
2843 %
2844 %    o map:  This string reflects the expected ordering of the pixel array.
2845 %      It can be any combination or order of R = red, G = green, B = blue,
2846 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
2847 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2848 %      P = pad.
2849 %
2850 %    o storage: Define the data type of the pixels.  Float and double types are
2851 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2852 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2853 %      LongPixel, QuantumPixel, or ShortPixel.
2854 %
2855 %    o pixels: This array of values contain the pixel components as defined by
2856 %      map and type.  You must preallocate this array where the expected
2857 %      length varies depending on the values of width, height, map, and type.
2858 %
2859 */
2860 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2861   const ssize_t x,const ssize_t y,const size_t columns,
2862   const size_t rows,const char *map,const StorageType storage,
2863   void *pixels)
2864 {
2865   MagickBooleanType
2866     status;
2867
2868   assert(wand != (MagickWand *) NULL);
2869   assert(wand->signature == WandSignature);
2870   if (wand->debug != MagickFalse)
2871     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2872   if (wand->images == (Image *) NULL)
2873     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2874   status=ExportImagePixels(wand->images,x,y,columns,rows,map,
2875     storage,pixels,wand->exception);
2876   return(status);
2877 }
2878 \f
2879 /*
2880 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2881 %                                                                             %
2882 %                                                                             %
2883 %                                                                             %
2884 %   M a g i c k E x t e n t I m a g e                                         %
2885 %                                                                             %
2886 %                                                                             %
2887 %                                                                             %
2888 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2889 %
2890 %  MagickExtentImage() extends the image as defined by the geometry, gravity,
2891 %  and wand background color.  Set the (x,y) offset of the geometry to move
2892 %  the original wand relative to the extended wand.
2893 %
2894 %  The format of the MagickExtentImage method is:
2895 %
2896 %      MagickBooleanType MagickExtentImage(MagickWand *wand,const size_t width,
2897 %        const size_t height,const ssize_t x,const ssize_t y)
2898 %
2899 %  A description of each parameter follows:
2900 %
2901 %    o wand: the magick wand.
2902 %
2903 %    o width: the region width.
2904 %
2905 %    o height: the region height.
2906 %
2907 %    o x: the region x offset.
2908 %
2909 %    o y: the region y offset.
2910 %
2911 */
2912 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
2913   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2914 {
2915   Image
2916     *extent_image;
2917
2918   RectangleInfo
2919     extent;
2920
2921   assert(wand != (MagickWand *) NULL);
2922   assert(wand->signature == WandSignature);
2923   if (wand->debug != MagickFalse)
2924     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2925   if (wand->images == (Image *) NULL)
2926     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2927   extent.width=width;
2928   extent.height=height;
2929   extent.x=x;
2930   extent.y=y;
2931   extent_image=ExtentImage(wand->images,&extent,wand->exception);
2932   if (extent_image == (Image *) NULL)
2933     return(MagickFalse);
2934   ReplaceImageInList(&wand->images,extent_image);
2935   return(MagickTrue);
2936 }
2937 \f
2938 /*
2939 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2940 %                                                                             %
2941 %                                                                             %
2942 %                                                                             %
2943 %   M a g i c k F l i p I m a g e                                             %
2944 %                                                                             %
2945 %                                                                             %
2946 %                                                                             %
2947 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2948 %
2949 %  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
2950 %  around the central x-axis.
2951 %
2952 %  The format of the MagickFlipImage method is:
2953 %
2954 %      MagickBooleanType MagickFlipImage(MagickWand *wand)
2955 %
2956 %  A description of each parameter follows:
2957 %
2958 %    o wand: the magick wand.
2959 %
2960 */
2961 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
2962 {
2963   Image
2964     *flip_image;
2965
2966   assert(wand != (MagickWand *) NULL);
2967   assert(wand->signature == WandSignature);
2968   if (wand->debug != MagickFalse)
2969     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2970   if (wand->images == (Image *) NULL)
2971     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2972   flip_image=FlipImage(wand->images,wand->exception);
2973   if (flip_image == (Image *) NULL)
2974     return(MagickFalse);
2975   ReplaceImageInList(&wand->images,flip_image);
2976   return(MagickTrue);
2977 }
2978 \f
2979 /*
2980 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2981 %                                                                             %
2982 %                                                                             %
2983 %                                                                             %
2984 %   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                         %
2985 %                                                                             %
2986 %                                                                             %
2987 %                                                                             %
2988 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2989 %
2990 %  MagickFloodfillPaintImage() changes the color value of any pixel that matches
2991 %  target and is an immediate neighbor.  If the method FillToBorderMethod is
2992 %  specified, the color value is changed for any neighbor pixel that does not
2993 %  match the bordercolor member of image.
2994 %
2995 %  The format of the MagickFloodfillPaintImage method is:
2996 %
2997 %      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
2998 %        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
2999 %        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3000 %
3001 %  A description of each parameter follows:
3002 %
3003 %    o wand: the magick wand.
3004 %
3005 %    o fill: the floodfill color pixel wand.
3006 %
3007 %    o fuzz: By default target must match a particular pixel color
3008 %      exactly.  However, in many cases two colors may differ by a small amount.
3009 %      The fuzz member of image defines how much tolerance is acceptable to
3010 %      consider two colors as the same.  For example, set fuzz to 10 and the
3011 %      color red at intensities of 100 and 102 respectively are now interpreted
3012 %      as the same color for the purposes of the floodfill.
3013 %
3014 %    o bordercolor: the border color pixel wand.
3015 %
3016 %    o x,y: the starting location of the operation.
3017 %
3018 %    o invert: paint any pixel that does not match the target color.
3019 %
3020 */
3021 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3022   const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3023   const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3024 {
3025   DrawInfo
3026     *draw_info;
3027
3028   MagickBooleanType
3029     status;
3030
3031   PixelInfo
3032     target;
3033
3034   assert(wand != (MagickWand *) NULL);
3035   assert(wand->signature == WandSignature);
3036   if (wand->debug != MagickFalse)
3037     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3038   if (wand->images == (Image *) NULL)
3039     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3040   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3041   PixelGetQuantumPacket(fill,&draw_info->fill);
3042   (void) GetOneVirtualPixelInfo(wand->images,TileVirtualPixelMethod,x %
3043     wand->images->columns,y % wand->images->rows,&target,wand->exception);
3044   if (bordercolor != (PixelWand *) NULL)
3045     PixelGetMagickColor(bordercolor,&target);
3046   wand->images->fuzz=fuzz;
3047   status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3048     wand->exception);
3049   draw_info=DestroyDrawInfo(draw_info);
3050   return(status);
3051 }
3052 \f
3053 /*
3054 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3055 %                                                                             %
3056 %                                                                             %
3057 %                                                                             %
3058 %   M a g i c k F l o p I m a g e                                             %
3059 %                                                                             %
3060 %                                                                             %
3061 %                                                                             %
3062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3063 %
3064 %  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3065 %  around the central y-axis.
3066 %
3067 %  The format of the MagickFlopImage method is:
3068 %
3069 %      MagickBooleanType MagickFlopImage(MagickWand *wand)
3070 %
3071 %  A description of each parameter follows:
3072 %
3073 %    o wand: the magick wand.
3074 %
3075 */
3076 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3077 {
3078   Image
3079     *flop_image;
3080
3081   assert(wand != (MagickWand *) NULL);
3082   assert(wand->signature == WandSignature);
3083   if (wand->debug != MagickFalse)
3084     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3085   if (wand->images == (Image *) NULL)
3086     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3087   flop_image=FlopImage(wand->images,wand->exception);
3088   if (flop_image == (Image *) NULL)
3089     return(MagickFalse);
3090   ReplaceImageInList(&wand->images,flop_image);
3091   return(MagickTrue);
3092 }
3093 \f
3094 /*
3095 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3096 %                                                                             %
3097 %                                                                             %
3098 %                                                                             %
3099 %   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                     %
3100 %                                                                             %
3101 %                                                                             %
3102 %                                                                             %
3103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3104 %
3105 %  MagickForwardFourierTransformImage() implements the discrete Fourier
3106 %  transform (DFT) of the image either as a magnitude / phase or real /
3107 %  imaginary image pair.
3108 %
3109 %  The format of the MagickForwardFourierTransformImage method is:
3110 %
3111 %      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3112 %        const MagickBooleanType magnitude)
3113 %
3114 %  A description of each parameter follows:
3115 %
3116 %    o wand: the magick wand.
3117 %
3118 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3119 %      imaginary image pair.
3120 %
3121 */
3122 WandExport MagickBooleanType MagickForwardFourierTransformImage(
3123   MagickWand *wand,const MagickBooleanType magnitude)
3124 {
3125   Image
3126     *forward_image;
3127
3128   assert(wand != (MagickWand *) NULL);
3129   assert(wand->signature == WandSignature);
3130   if (wand->debug != MagickFalse)
3131     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3132   if (wand->images == (Image *) NULL)
3133     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3134   forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3135     wand->exception);
3136   if (forward_image == (Image *) NULL)
3137     return(MagickFalse);
3138   ReplaceImageInList(&wand->images,forward_image);
3139   return(MagickTrue);
3140 }
3141 \f
3142 /*
3143 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3144 %                                                                             %
3145 %                                                                             %
3146 %                                                                             %
3147 %   M a g i c k F r a m e I m a g e                                           %
3148 %                                                                             %
3149 %                                                                             %
3150 %                                                                             %
3151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3152 %
3153 %  MagickFrameImage() adds a simulated three-dimensional border around the
3154 %  image.  The width and height specify the border width of the vertical and
3155 %  horizontal sides of the frame.  The inner and outer bevels indicate the
3156 %  width of the inner and outer shadows of the frame.
3157 %
3158 %  The format of the MagickFrameImage method is:
3159 %
3160 %      MagickBooleanType MagickFrameImage(MagickWand *wand,
3161 %        const PixelWand *matte_color,const size_t width,
3162 %        const size_t height,const ssize_t inner_bevel,
3163 %        const ssize_t outer_bevel,const CompositeOperator compose)
3164 %
3165 %  A description of each parameter follows:
3166 %
3167 %    o wand: the magick wand.
3168 %
3169 %    o matte_color: the frame color pixel wand.
3170 %
3171 %    o width: the border width.
3172 %
3173 %    o height: the border height.
3174 %
3175 %    o inner_bevel: the inner bevel width.
3176 %
3177 %    o outer_bevel: the outer bevel width.
3178 %
3179 %    o compose: the composite operator.
3180 %
3181 */
3182 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3183   const PixelWand *matte_color,const size_t width,const size_t height,
3184   const ssize_t inner_bevel,const ssize_t outer_bevel,
3185   const CompositeOperator compose)
3186 {
3187   Image
3188     *frame_image;
3189
3190   FrameInfo
3191     frame_info;
3192
3193   assert(wand != (MagickWand *) NULL);
3194   assert(wand->signature == WandSignature);
3195   if (wand->debug != MagickFalse)
3196     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3197   if (wand->images == (Image *) NULL)
3198     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3199   (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3200   frame_info.width=wand->images->columns+2*width;
3201   frame_info.height=wand->images->rows+2*height;
3202   frame_info.x=(ssize_t) width;
3203   frame_info.y=(ssize_t) height;
3204   frame_info.inner_bevel=inner_bevel;
3205   frame_info.outer_bevel=outer_bevel;
3206   PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3207   frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3208   if (frame_image == (Image *) NULL)
3209     return(MagickFalse);
3210   ReplaceImageInList(&wand->images,frame_image);
3211   return(MagickTrue);
3212 }
3213 \f
3214 /*
3215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3216 %                                                                             %
3217 %                                                                             %
3218 %                                                                             %
3219 %   M a g i c k F u n c t i o n I m a g e                                     %
3220 %                                                                             %
3221 %                                                                             %
3222 %                                                                             %
3223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3224 %
3225 %  MagickFunctionImage() applys an arithmetic, relational, or logical
3226 %  expression to an image.  Use these operators to lighten or darken an image,
3227 %  to increase or decrease contrast in an image, or to produce the "negative"
3228 %  of an image.
3229 %
3230 %  The format of the MagickFunctionImage method is:
3231 %
3232 %      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3233 %        const MagickFunction function,const size_t number_arguments,
3234 %        const double *arguments)
3235 %
3236 %  A description of each parameter follows:
3237 %
3238 %    o wand: the magick wand.
3239 %
3240 %    o function: the image function.
3241 %
3242 %    o number_arguments: the number of function arguments.
3243 %
3244 %    o arguments: the function arguments.
3245 %
3246 */
3247 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3248   const MagickFunction function,const size_t number_arguments,
3249   const double *arguments)
3250 {
3251   MagickBooleanType
3252     status;
3253
3254   assert(wand != (MagickWand *) NULL);
3255   assert(wand->signature == WandSignature);
3256   if (wand->debug != MagickFalse)
3257     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3258   if (wand->images == (Image *) NULL)
3259     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3260   status=FunctionImage(wand->images,function,number_arguments,arguments,
3261     wand->exception);
3262   return(status);
3263 }
3264 \f
3265 /*
3266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3267 %                                                                             %
3268 %                                                                             %
3269 %                                                                             %
3270 %   M a g i c k F x I m a g e                                                 %
3271 %                                                                             %
3272 %                                                                             %
3273 %                                                                             %
3274 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3275 %
3276 %  MagickFxImage() evaluate expression for each pixel in the image.
3277 %
3278 %  The format of the MagickFxImage method is:
3279 %
3280 %      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3281 %
3282 %  A description of each parameter follows:
3283 %
3284 %    o wand: the magick wand.
3285 %
3286 %    o expression: the expression.
3287 %
3288 */
3289 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3290 {
3291   Image
3292     *fx_image;
3293
3294   assert(wand != (MagickWand *) NULL);
3295   assert(wand->signature == WandSignature);
3296   if (wand->debug != MagickFalse)
3297     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3298   if (wand->images == (Image *) NULL)
3299     return((MagickWand *) NULL);
3300   fx_image=FxImage(wand->images,expression,wand->exception);
3301   if (fx_image == (Image *) NULL)
3302     return((MagickWand *) NULL);
3303   return(CloneMagickWandFromImages(wand,fx_image));
3304 }
3305 \f
3306 /*
3307 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3308 %                                                                             %
3309 %                                                                             %
3310 %                                                                             %
3311 %   M a g i c k G a m m a I m a g e                                           %
3312 %                                                                             %
3313 %                                                                             %
3314 %                                                                             %
3315 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3316 %
3317 %  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3318 %  different devices will have perceptual differences in the way the image's
3319 %  intensities are represented on the screen.  Specify individual gamma levels
3320 %  for the red, green, and blue channels, or adjust all three with the gamma
3321 %  parameter.  Values typically range from 0.8 to 2.3.
3322 %
3323 %  You can also reduce the influence of a particular channel with a gamma
3324 %  value of 0.
3325 %
3326 %  The format of the MagickGammaImage method is:
3327 %
3328 %      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3329 %
3330 %  A description of each parameter follows:
3331 %
3332 %    o wand: the magick wand.
3333 %
3334 %    o level: Define the level of gamma correction.
3335 %
3336 */
3337 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3338   const double gamma)
3339 {
3340   MagickBooleanType
3341     status;
3342
3343   assert(wand != (MagickWand *) NULL);
3344   assert(wand->signature == WandSignature);
3345   if (wand->debug != MagickFalse)
3346     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3347   if (wand->images == (Image *) NULL)
3348     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3349   status=GammaImage(wand->images,gamma,wand->exception);
3350   return(status);
3351 }
3352 \f
3353 /*
3354 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3355 %                                                                             %
3356 %                                                                             %
3357 %                                                                             %
3358 %   M a g i c k G a u s s i a n B l u r I m a g e                             %
3359 %                                                                             %
3360 %                                                                             %
3361 %                                                                             %
3362 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3363 %
3364 %  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3365 %  Gaussian operator of the given radius and standard deviation (sigma).
3366 %  For reasonable results, the radius should be larger than sigma.  Use a
3367 %  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3368 %
3369 %  The format of the MagickGaussianBlurImage method is:
3370 %
3371 %      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3372 %        const double radius,const double sigma)
3373 %
3374 %  A description of each parameter follows:
3375 %
3376 %    o wand: the magick wand.
3377 %
3378 %    o radius: the radius of the Gaussian, in pixels, not counting the center
3379 %      pixel.
3380 %
3381 %    o sigma: the standard deviation of the Gaussian, in pixels.
3382 %
3383 */
3384 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3385   const double radius,const double sigma)
3386 {
3387   Image
3388     *blur_image;
3389
3390   assert(wand != (MagickWand *) NULL);
3391   assert(wand->signature == WandSignature);
3392   if (wand->debug != MagickFalse)
3393     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3394   if (wand->images == (Image *) NULL)
3395     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3396   blur_image=GaussianBlurImage(wand->images,radius,sigma,wand->exception);
3397   if (blur_image == (Image *) NULL)
3398     return(MagickFalse);
3399   ReplaceImageInList(&wand->images,blur_image);
3400   return(MagickTrue);
3401 }
3402 \f
3403 /*
3404 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3405 %                                                                             %
3406 %                                                                             %
3407 %                                                                             %
3408 %   M a g i c k G e t I m a g e                                               %
3409 %                                                                             %
3410 %                                                                             %
3411 %                                                                             %
3412 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3413 %
3414 %  MagickGetImage() gets the image at the current image index.
3415 %
3416 %  The format of the MagickGetImage method is:
3417 %
3418 %      MagickWand *MagickGetImage(MagickWand *wand)
3419 %
3420 %  A description of each parameter follows:
3421 %
3422 %    o wand: the magick wand.
3423 %
3424 */
3425 WandExport MagickWand *MagickGetImage(MagickWand *wand)
3426 {
3427   Image
3428     *image;
3429
3430   assert(wand != (MagickWand *) NULL);
3431   assert(wand->signature == WandSignature);
3432   if (wand->debug != MagickFalse)
3433     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3434   if (wand->images == (Image *) NULL)
3435     {
3436       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3437         "ContainsNoImages","`%s'",wand->name);
3438       return((MagickWand *) NULL);
3439     }
3440   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3441   if (image == (Image *) NULL)
3442     return((MagickWand *) NULL);
3443   return(CloneMagickWandFromImages(wand,image));
3444 }
3445 \f
3446 /*
3447 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3448 %                                                                             %
3449 %                                                                             %
3450 %                                                                             %
3451 %   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                       %
3452 %                                                                             %
3453 %                                                                             %
3454 %                                                                             %
3455 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3456 %
3457 %  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3458 %  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3459 %  than CMYKA.
3460 %
3461 %  The format of the MagickGetImageAlphaChannel method is:
3462 %
3463 %      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3464 %
3465 %  A description of each parameter follows:
3466 %
3467 %    o wand: the magick wand.
3468 %
3469 */
3470 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3471 {
3472   assert(wand != (MagickWand *) NULL);
3473   assert(wand->signature == WandSignature);
3474   if (wand->debug != MagickFalse)
3475     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3476   if (wand->images == (Image *) NULL)
3477     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3478   return(GetImageAlphaChannel(wand->images));
3479 }
3480 \f
3481 /*
3482 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3483 %                                                                             %
3484 %                                                                             %
3485 %                                                                             %
3486 %   M a g i c k G e t I m a g e C l i p M a s k                               %
3487 %                                                                             %
3488 %                                                                             %
3489 %                                                                             %
3490 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3491 %
3492 %  MagickGetImageMask() gets the image clip mask at the current image index.
3493 %
3494 %  The format of the MagickGetImageMask method is:
3495 %
3496 %      MagickWand *MagickGetImageMask(MagickWand *wand)
3497 %
3498 %  A description of each parameter follows:
3499 %
3500 %    o wand: the magick wand.
3501 %
3502 */
3503 WandExport MagickWand *MagickGetImageMask(MagickWand *wand)
3504 {
3505   Image
3506     *image;
3507
3508   assert(wand != (MagickWand *) NULL);
3509   assert(wand->signature == WandSignature);
3510   if (wand->debug != MagickFalse)
3511     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3512   if (wand->images == (Image *) NULL)
3513     {
3514       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3515         "ContainsNoImages","`%s'",wand->name);
3516       return((MagickWand *) NULL);
3517     }
3518   image=GetImageMask(wand->images,wand->exception);
3519   if (image == (Image *) NULL)
3520     return((MagickWand *) NULL);
3521   return(CloneMagickWandFromImages(wand,image));
3522 }
3523 \f
3524 /*
3525 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3526 %                                                                             %
3527 %                                                                             %
3528 %                                                                             %
3529 %   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                 %
3530 %                                                                             %
3531 %                                                                             %
3532 %                                                                             %
3533 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3534 %
3535 %  MagickGetImageBackgroundColor() returns the image background color.
3536 %
3537 %  The format of the MagickGetImageBackgroundColor method is:
3538 %
3539 %      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3540 %        PixelWand *background_color)
3541 %
3542 %  A description of each parameter follows:
3543 %
3544 %    o wand: the magick wand.
3545 %
3546 %    o background_color: Return the background color.
3547 %
3548 */
3549 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3550   PixelWand *background_color)
3551 {
3552   assert(wand != (MagickWand *) NULL);
3553   assert(wand->signature == WandSignature);
3554   if (wand->debug != MagickFalse)
3555     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3556   if (wand->images == (Image *) NULL)
3557     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3558   PixelSetPixelColor(background_color,&wand->images->background_color);
3559   return(MagickTrue);
3560 }
3561 \f
3562 /*
3563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3564 %                                                                             %
3565 %                                                                             %
3566 %                                                                             %
3567 %   M a g i c k G e t I m a g e B l o b                                       %
3568 %                                                                             %
3569 %                                                                             %
3570 %                                                                             %
3571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3572 %
3573 %  MagickGetImageBlob() implements direct to memory image formats.  It returns
3574 %  the image as a blob (a formatted "file" in memory) and its length, starting
3575 %  from the current position in the image sequence.  Use MagickSetImageFormat()
3576 %  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3577 %
3578 %  Utilize MagickResetIterator() to ensure the write is from the beginning of
3579 %  the image sequence.
3580 %
3581 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
3582 %
3583 %  The format of the MagickGetImageBlob method is:
3584 %
3585 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3586 %
3587 %  A description of each parameter follows:
3588 %
3589 %    o wand: the magick wand.
3590 %
3591 %    o length: the length of the blob.
3592 %
3593 */
3594 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3595 {
3596   assert(wand != (MagickWand *) NULL);
3597   assert(wand->signature == WandSignature);
3598   if (wand->debug != MagickFalse)
3599     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3600   if (wand->images == (Image *) NULL)
3601     {
3602       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3603         "ContainsNoImages","`%s'",wand->name);
3604       return((unsigned char *) NULL);
3605     }
3606   return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3607 }
3608 \f
3609 /*
3610 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3611 %                                                                             %
3612 %                                                                             %
3613 %                                                                             %
3614 %   M a g i c k G e t I m a g e s B l o b                                     %
3615 %                                                                             %
3616 %                                                                             %
3617 %                                                                             %
3618 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3619 %
3620 %  MagickGetImageBlob() implements direct to memory image formats.  It
3621 %  returns the image sequence as a blob and its length.  The format of the image
3622 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3623 %  return a different image format, use MagickSetImageFormat().
3624 %
3625 %  Note, some image formats do not permit multiple images to the same image
3626 %  stream (e.g. JPEG).  in this instance, just the first image of the
3627 %  sequence is returned as a blob.
3628 %
3629 %  The format of the MagickGetImagesBlob method is:
3630 %
3631 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3632 %
3633 %  A description of each parameter follows:
3634 %
3635 %    o wand: the magick wand.
3636 %
3637 %    o length: the length of the blob.
3638 %
3639 */
3640 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3641 {
3642   unsigned char
3643     *blob;
3644
3645   assert(wand != (MagickWand *) NULL);
3646   assert(wand->signature == WandSignature);
3647   if (wand->debug != MagickFalse)
3648     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3649   if (wand->images == (Image *) NULL)
3650     {
3651       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3652         "ContainsNoImages","`%s'",wand->name);
3653       return((unsigned char *) NULL);
3654     }
3655   blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3656     wand->exception);
3657   return(blob);
3658 }
3659 \f
3660 /*
3661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3662 %                                                                             %
3663 %                                                                             %
3664 %                                                                             %
3665 %   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                         %
3666 %                                                                             %
3667 %                                                                             %
3668 %                                                                             %
3669 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3670 %
3671 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3672 %  image.
3673 %
3674 %  The format of the MagickGetImageBluePrimary method is:
3675 %
3676 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3677 %        double *y)
3678 %
3679 %  A description of each parameter follows:
3680 %
3681 %    o wand: the magick wand.
3682 %
3683 %    o x: the chromaticity blue primary x-point.
3684 %
3685 %    o y: the chromaticity blue primary y-point.
3686 %
3687 */
3688 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3689   double *x,double *y)
3690 {
3691   assert(wand != (MagickWand *) NULL);
3692   assert(wand->signature == WandSignature);
3693   if (wand->debug != MagickFalse)
3694     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3695   if (wand->images == (Image *) NULL)
3696     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3697   *x=wand->images->chromaticity.blue_primary.x;
3698   *y=wand->images->chromaticity.blue_primary.y;
3699   return(MagickTrue);
3700 }
3701 \f
3702 /*
3703 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3704 %                                                                             %
3705 %                                                                             %
3706 %                                                                             %
3707 %   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                         %
3708 %                                                                             %
3709 %                                                                             %
3710 %                                                                             %
3711 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3712 %
3713 %  MagickGetImageBorderColor() returns the image border color.
3714 %
3715 %  The format of the MagickGetImageBorderColor method is:
3716 %
3717 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3718 %        PixelWand *border_color)
3719 %
3720 %  A description of each parameter follows:
3721 %
3722 %    o wand: the magick wand.
3723 %
3724 %    o border_color: Return the border color.
3725 %
3726 */
3727 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3728   PixelWand *border_color)
3729 {
3730   assert(wand != (MagickWand *) NULL);
3731   assert(wand->signature == WandSignature);
3732   if (wand->debug != MagickFalse)
3733     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3734   if (wand->images == (Image *) NULL)
3735     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3736   PixelSetPixelColor(border_color,&wand->images->border_color);
3737   return(MagickTrue);
3738 }
3739 \f
3740 /*
3741 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3742 %                                                                             %
3743 %                                                                             %
3744 %                                                                             %
3745 %   M a g i c k G e t I m a g e F e a t u r e s                               %
3746 %                                                                             %
3747 %                                                                             %
3748 %                                                                             %
3749 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3750 %
3751 %  MagickGetImageFeatures() returns features for each channel in the
3752 %  image in each of four directions (horizontal, vertical, left and right
3753 %  diagonals) for the specified distance.  The features include the angular
3754 %  second moment, contrast, correlation, sum of squares: variance, inverse
3755 %  difference moment, sum average, sum varience, sum entropy, entropy,
3756 %  difference variance, difference entropy, information measures of
3757 %  correlation 1, information measures of correlation 2, and maximum
3758 %  correlation coefficient.  You can access the red channel contrast, for
3759 %  example, like this:
3760 %
3761 %      channel_features=MagickGetImageFeatures(wand,1);
3762 %      contrast=channel_features[RedPixelChannel].contrast[0];
3763 %
3764 %  Use MagickRelinquishMemory() to free the statistics buffer.
3765 %
3766 %  The format of the MagickGetImageFeatures method is:
3767 %
3768 %      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3769 %        const size_t distance)
3770 %
3771 %  A description of each parameter follows:
3772 %
3773 %    o wand: the magick wand.
3774 %
3775 %    o distance: the distance.
3776 %
3777 */
3778 WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3779   const size_t distance)
3780 {
3781   assert(wand != (MagickWand *) NULL);
3782   assert(wand->signature == WandSignature);
3783   if (wand->debug != MagickFalse)
3784     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3785   if (wand->images == (Image *) NULL)
3786     {
3787       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3788         "ContainsNoImages","`%s'",wand->name);
3789       return((ChannelFeatures *) NULL);
3790     }
3791   return(GetImageFeatures(wand->images,distance,wand->exception));
3792 }
3793 \f
3794 /*
3795 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3796 %                                                                             %
3797 %                                                                             %
3798 %                                                                             %
3799 %   M a g i c k G e t I m a g e K u r t o s i s                               %
3800 %                                                                             %
3801 %                                                                             %
3802 %                                                                             %
3803 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3804 %
3805 %  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
3806 %  more image channels.
3807 %
3808 %  The format of the MagickGetImageKurtosis method is:
3809 %
3810 %      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3811 %        double *kurtosis,double *skewness)
3812 %
3813 %  A description of each parameter follows:
3814 %
3815 %    o wand: the magick wand.
3816 %
3817 %    o kurtosis:  The kurtosis for the specified channel(s).
3818 %
3819 %    o skewness:  The skewness for the specified channel(s).
3820 %
3821 */
3822 WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3823   double *kurtosis,double *skewness)
3824 {
3825   MagickBooleanType
3826     status;
3827
3828   assert(wand != (MagickWand *) NULL);
3829   assert(wand->signature == WandSignature);
3830   if (wand->debug != MagickFalse)
3831     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3832   if (wand->images == (Image *) NULL)
3833     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3834   status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
3835   return(status);
3836 }
3837 \f
3838 /*
3839 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3840 %                                                                             %
3841 %                                                                             %
3842 %                                                                             %
3843 %   M a g i c k G e t I m a g e M e a n                                       %
3844 %                                                                             %
3845 %                                                                             %
3846 %                                                                             %
3847 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3848 %
3849 %  MagickGetImageMean() gets the mean and standard deviation of one or more
3850 %  image channels.
3851 %
3852 %  The format of the MagickGetImageMean method is:
3853 %
3854 %      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3855 %        double *standard_deviation)
3856 %
3857 %  A description of each parameter follows:
3858 %
3859 %    o wand: the magick wand.
3860 %
3861 %    o channel: the image channel(s).
3862 %
3863 %    o mean:  The mean pixel value for the specified channel(s).
3864 %
3865 %    o standard_deviation:  The standard deviation for the specified channel(s).
3866 %
3867 */
3868 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3869   double *standard_deviation)
3870 {
3871   MagickBooleanType
3872     status;
3873
3874   assert(wand != (MagickWand *) NULL);
3875   assert(wand->signature == WandSignature);
3876   if (wand->debug != MagickFalse)
3877     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3878   if (wand->images == (Image *) NULL)
3879     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3880   status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
3881   return(status);
3882 }
3883 \f
3884 /*
3885 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3886 %                                                                             %
3887 %                                                                             %
3888 %                                                                             %
3889 %   M a g i c k G e t I m a g e R a n g e                                     %
3890 %                                                                             %
3891 %                                                                             %
3892 %                                                                             %
3893 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3894 %
3895 %  MagickGetImageRange() gets the range for one or more image channels.
3896 %
3897 %  The format of the MagickGetImageRange method is:
3898 %
3899 %      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
3900 %        double *maxima)
3901 %
3902 %  A description of each parameter follows:
3903 %
3904 %    o wand: the magick wand.
3905 %
3906 %    o minima:  The minimum pixel value for the specified channel(s).
3907 %
3908 %    o maxima:  The maximum pixel value for the specified channel(s).
3909 %
3910 */
3911 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
3912   double *minima,double *maxima)
3913 {
3914   MagickBooleanType
3915     status;
3916
3917   assert(wand != (MagickWand *) NULL);
3918   assert(wand->signature == WandSignature);
3919   if (wand->debug != MagickFalse)
3920     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3921   if (wand->images == (Image *) NULL)
3922     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3923   status=GetImageRange(wand->images,minima,maxima,wand->exception);
3924   return(status);
3925 }
3926 \f
3927 /*
3928 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3929 %                                                                             %
3930 %                                                                             %
3931 %                                                                             %
3932 %   M a g i c k G e t I m a g e S t a t i s t i c s                           %
3933 %                                                                             %
3934 %                                                                             %
3935 %                                                                             %
3936 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3937 %
3938 %  MagickGetImageStatistics() returns statistics for each channel in the
3939 %  image.  The statistics include the channel depth, its minima and
3940 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
3941 %  You can access the red channel mean, for example, like this:
3942 %
3943 %      channel_statistics=MagickGetImageStatistics(wand);
3944 %      red_mean=channel_statistics[RedPixelChannel].mean;
3945 %
3946 %  Use MagickRelinquishMemory() to free the statistics buffer.
3947 %
3948 %  The format of the MagickGetImageStatistics method is:
3949 %
3950 %      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3951 %
3952 %  A description of each parameter follows:
3953 %
3954 %    o wand: the magick wand.
3955 %
3956 */
3957 WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3958 {
3959   assert(wand != (MagickWand *) NULL);
3960   assert(wand->signature == WandSignature);
3961   if (wand->debug != MagickFalse)
3962     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3963   if (wand->images == (Image *) NULL)
3964     {
3965       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3966         "ContainsNoImages","`%s'",wand->name);
3967       return((ChannelStatistics *) NULL);
3968     }
3969   return(GetImageStatistics(wand->images,wand->exception));
3970 }
3971 \f
3972 /*
3973 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3974 %                                                                             %
3975 %                                                                             %
3976 %                                                                             %
3977 %   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                     %
3978 %                                                                             %
3979 %                                                                             %
3980 %                                                                             %
3981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3982 %
3983 %  MagickGetImageColormapColor() returns the color of the specified colormap
3984 %  index.
3985 %
3986 %  The format of the MagickGetImageColormapColor method is:
3987 %
3988 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
3989 %        const size_t index,PixelWand *color)
3990 %
3991 %  A description of each parameter follows:
3992 %
3993 %    o wand: the magick wand.
3994 %
3995 %    o index: the offset into the image colormap.
3996 %
3997 %    o color: Return the colormap color in this wand.
3998 %
3999 */
4000 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4001   const size_t index,PixelWand *color)
4002 {
4003   assert(wand != (MagickWand *) NULL);
4004   assert(wand->signature == WandSignature);
4005   if (wand->debug != MagickFalse)
4006     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4007   if (wand->images == (Image *) NULL)
4008     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4009   if ((wand->images->colormap == (PixelInfo *) NULL) ||
4010       (index >= wand->images->colors))
4011     {
4012       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4013         "InvalidColormapIndex","`%s'",wand->name);
4014       return(MagickFalse);
4015     }
4016   PixelSetPixelColor(color,wand->images->colormap+index);
4017   return(MagickTrue);
4018 }
4019 \f
4020 /*
4021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4022 %                                                                             %
4023 %                                                                             %
4024 %                                                                             %
4025 %   M a g i c k G e t I m a g e C o l o r s                                   %
4026 %                                                                             %
4027 %                                                                             %
4028 %                                                                             %
4029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4030 %
4031 %  MagickGetImageColors() gets the number of unique colors in the image.
4032 %
4033 %  The format of the MagickGetImageColors method is:
4034 %
4035 %      size_t MagickGetImageColors(MagickWand *wand)
4036 %
4037 %  A description of each parameter follows:
4038 %
4039 %    o wand: the magick wand.
4040 %
4041 */
4042 WandExport size_t MagickGetImageColors(MagickWand *wand)
4043 {
4044   assert(wand != (MagickWand *) NULL);
4045   assert(wand->signature == WandSignature);
4046   if (wand->debug != MagickFalse)
4047     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4048   if (wand->images == (Image *) NULL)
4049     {
4050       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4051         "ContainsNoImages","`%s'",wand->name);
4052       return(0);
4053     }
4054   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4055 }
4056 \f
4057 /*
4058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4059 %                                                                             %
4060 %                                                                             %
4061 %                                                                             %
4062 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4063 %                                                                             %
4064 %                                                                             %
4065 %                                                                             %
4066 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4067 %
4068 %  MagickGetImageColorspace() gets the image colorspace.
4069 %
4070 %  The format of the MagickGetImageColorspace method is:
4071 %
4072 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4073 %
4074 %  A description of each parameter follows:
4075 %
4076 %    o wand: the magick wand.
4077 %
4078 */
4079 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4080 {
4081   assert(wand != (MagickWand *) NULL);
4082   assert(wand->signature == WandSignature);
4083   if (wand->debug != MagickFalse)
4084     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4085   if (wand->images == (Image *) NULL)
4086     {
4087       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4088         "ContainsNoImages","`%s'",wand->name);
4089       return(UndefinedColorspace);
4090     }
4091   return(wand->images->colorspace);
4092 }
4093 \f
4094 /*
4095 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4096 %                                                                             %
4097 %                                                                             %
4098 %                                                                             %
4099 %   M a g i c k G e t I m a g e C o m p o s e                                 %
4100 %                                                                             %
4101 %                                                                             %
4102 %                                                                             %
4103 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4104 %
4105 %  MagickGetImageCompose() returns the composite operator associated with the
4106 %  image.
4107 %
4108 %  The format of the MagickGetImageCompose method is:
4109 %
4110 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4111 %
4112 %  A description of each parameter follows:
4113 %
4114 %    o wand: the magick wand.
4115 %
4116 */
4117 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4118 {
4119   assert(wand != (MagickWand *) NULL);
4120   assert(wand->signature == WandSignature);
4121   if (wand->debug != MagickFalse)
4122     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4123   if (wand->images == (Image *) NULL)
4124     {
4125       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4126         "ContainsNoImages","`%s'",wand->name);
4127       return(UndefinedCompositeOp);
4128     }
4129   return(wand->images->compose);
4130 }
4131 \f
4132 /*
4133 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4134 %                                                                             %
4135 %                                                                             %
4136 %                                                                             %
4137 %   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                         %
4138 %                                                                             %
4139 %                                                                             %
4140 %                                                                             %
4141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4142 %
4143 %  MagickGetImageCompression() gets the image compression.
4144 %
4145 %  The format of the MagickGetImageCompression method is:
4146 %
4147 %      CompressionType MagickGetImageCompression(MagickWand *wand)
4148 %
4149 %  A description of each parameter follows:
4150 %
4151 %    o wand: the magick wand.
4152 %
4153 */
4154 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4155 {
4156   assert(wand != (MagickWand *) NULL);
4157   assert(wand->signature == WandSignature);
4158   if (wand->debug != MagickFalse)
4159     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4160   if (wand->images == (Image *) NULL)
4161     {
4162       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4163         "ContainsNoImages","`%s'",wand->name);
4164       return(UndefinedCompression);
4165     }
4166   return(wand->images->compression);
4167 }
4168 \f
4169 /*
4170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4171 %                                                                             %
4172 %                                                                             %
4173 %                                                                             %
4174 %   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           %
4175 %                                                                             %
4176 %                                                                             %
4177 %                                                                             %
4178 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4179 %
4180 %  MagickGetImageCompression() gets the image compression quality.
4181 %
4182 %  The format of the MagickGetImageCompression method is:
4183 %
4184 %      size_t MagickGetImageCompression(MagickWand *wand)
4185 %
4186 %  A description of each parameter follows:
4187 %
4188 %    o wand: the magick wand.
4189 %
4190 */
4191 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4192 {
4193   assert(wand != (MagickWand *) NULL);
4194   assert(wand->signature == WandSignature);
4195   if (wand->debug != MagickFalse)
4196     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4197   if (wand->images == (Image *) NULL)
4198     {
4199       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4200         "ContainsNoImages","`%s'",wand->name);
4201       return(0UL);
4202     }
4203   return(wand->images->quality);
4204 }
4205 \f
4206 /*
4207 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4208 %                                                                             %
4209 %                                                                             %
4210 %                                                                             %
4211 %   M a g i c k G e t I m a g e D e l a y                                     %
4212 %                                                                             %
4213 %                                                                             %
4214 %                                                                             %
4215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4216 %
4217 %  MagickGetImageDelay() gets the image delay.
4218 %
4219 %  The format of the MagickGetImageDelay method is:
4220 %
4221 %      size_t MagickGetImageDelay(MagickWand *wand)
4222 %
4223 %  A description of each parameter follows:
4224 %
4225 %    o wand: the magick wand.
4226 %
4227 */
4228 WandExport size_t MagickGetImageDelay(MagickWand *wand)
4229 {
4230   assert(wand != (MagickWand *) NULL);
4231   assert(wand->signature == WandSignature);
4232   if (wand->debug != MagickFalse)
4233     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4234   if (wand->images == (Image *) NULL)
4235     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4236   return(wand->images->delay);
4237 }
4238 \f
4239 /*
4240 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4241 %                                                                             %
4242 %                                                                             %
4243 %                                                                             %
4244 %   M a g i c k G e t I m a g e D e p t h                                     %
4245 %                                                                             %
4246 %                                                                             %
4247 %                                                                             %
4248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4249 %
4250 %  MagickGetImageDepth() gets the image depth.
4251 %
4252 %  The format of the MagickGetImageDepth method is:
4253 %
4254 %      size_t MagickGetImageDepth(MagickWand *wand)
4255 %
4256 %  A description of each parameter follows:
4257 %
4258 %    o wand: the magick wand.
4259 %
4260 */
4261 WandExport size_t MagickGetImageDepth(MagickWand *wand)
4262 {
4263   assert(wand != (MagickWand *) NULL);
4264   assert(wand->signature == WandSignature);
4265   if (wand->debug != MagickFalse)
4266     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4267   if (wand->images == (Image *) NULL)
4268     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4269   return(wand->images->depth);
4270 }
4271 \f
4272 /*
4273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4274 %                                                                             %
4275 %                                                                             %
4276 %                                                                             %
4277 %   M a g i c k G e t I m a g e D i s p o s e                                 %
4278 %                                                                             %
4279 %                                                                             %
4280 %                                                                             %
4281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4282 %
4283 %  MagickGetImageDispose() gets the image disposal method.
4284 %
4285 %  The format of the MagickGetImageDispose method is:
4286 %
4287 %      DisposeType MagickGetImageDispose(MagickWand *wand)
4288 %
4289 %  A description of each parameter follows:
4290 %
4291 %    o wand: the magick wand.
4292 %
4293 */
4294 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4295 {
4296   assert(wand != (MagickWand *) NULL);
4297   assert(wand->signature == WandSignature);
4298   if (wand->debug != MagickFalse)
4299     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4300   if (wand->images == (Image *) NULL)
4301     {
4302       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4303         "ContainsNoImages","`%s'",wand->name);
4304       return(UndefinedDispose);
4305     }
4306   return((DisposeType) wand->images->dispose);
4307 }
4308 \f
4309 /*
4310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4311 %                                                                             %
4312 %                                                                             %
4313 %                                                                             %
4314 %   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4315 %                                                                             %
4316 %                                                                             %
4317 %                                                                             %
4318 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4319 %
4320 %  MagickGetImageDistortion() compares an image to a reconstructed image and
4321 %  returns the specified distortion metric.
4322 %
4323 %  The format of the MagickGetImageDistortion method is:
4324 %
4325 %      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4326 %        const MagickWand *reference,const MetricType metric,
4327 %        double *distortion)
4328 %
4329 %  A description of each parameter follows:
4330 %
4331 %    o wand: the magick wand.
4332 %
4333 %    o reference: the reference wand.
4334 %
4335 %    o metric: the metric.
4336 %
4337 %    o distortion: the computed distortion between the images.
4338 %
4339 */
4340 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4341   const MagickWand *reference,const MetricType metric,double *distortion)
4342 {
4343   MagickBooleanType
4344     status;
4345
4346   assert(wand != (MagickWand *) NULL);
4347   assert(wand->signature == WandSignature);
4348   if (wand->debug != MagickFalse)
4349     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4350   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4351     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4352   status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4353     wand->exception);
4354   return(status);
4355 }
4356 \f
4357 /*
4358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4359 %                                                                             %
4360 %                                                                             %
4361 %                                                                             %
4362 %   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                         %
4363 %                                                                             %
4364 %                                                                             %
4365 %                                                                             %
4366 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4367 %
4368 %  MagickGetImageDistortions() compares one or more pixel channels of an
4369 %  image to a reconstructed image and returns the specified distortion metrics.
4370 %
4371 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4372 %
4373 %  The format of the MagickGetImageDistortion method is:
4374 %
4375 %      double *MagickGetImageDistortion(MagickWand *wand,
4376 %        const MagickWand *reference,const MetricType metric)
4377 %
4378 %  A description of each parameter follows:
4379 %
4380 %    o wand: the magick wand.
4381 %
4382 %    o reference: the reference wand.
4383 %
4384 %    o metric: the metric.
4385 %
4386 */
4387 WandExport double *MagickGetImageDistortions(MagickWand *wand,
4388   const MagickWand *reference,const MetricType metric)
4389 {
4390   double
4391     *channel_distortion;
4392
4393   assert(wand != (MagickWand *) NULL);
4394   assert(wand->signature == WandSignature);
4395   if (wand->debug != MagickFalse)
4396     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4397   assert(reference != (MagickWand *) NULL);
4398   assert(reference->signature == WandSignature);
4399   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4400     {
4401       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4402         "ContainsNoImages","`%s'",wand->name);
4403       return((double *) NULL);
4404     }
4405   channel_distortion=GetImageDistortions(wand->images,reference->images,
4406     metric,wand->exception);
4407   return(channel_distortion);
4408 }
4409 \f
4410 /*
4411 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4412 %                                                                             %
4413 %                                                                             %
4414 %                                                                             %
4415 %   M a g i c k G e t I m a g e F i l e n a m e                               %
4416 %                                                                             %
4417 %                                                                             %
4418 %                                                                             %
4419 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4420 %
4421 %  MagickGetImageFilename() returns the filename of a particular image in a
4422 %  sequence.
4423 %
4424 %  The format of the MagickGetImageFilename method is:
4425 %
4426 %      char *MagickGetImageFilename(MagickWand *wand)
4427 %
4428 %  A description of each parameter follows:
4429 %
4430 %    o wand: the magick wand.
4431 %
4432 */
4433 WandExport char *MagickGetImageFilename(MagickWand *wand)
4434 {
4435   assert(wand != (MagickWand *) NULL);
4436   assert(wand->signature == WandSignature);
4437   if (wand->debug != MagickFalse)
4438     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4439   if (wand->images == (Image *) NULL)
4440     {
4441       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4442         "ContainsNoImages","`%s'",wand->name);
4443       return((char *) NULL);
4444     }
4445   return(AcquireString(wand->images->filename));
4446 }
4447 \f
4448 /*
4449 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4450 %                                                                             %
4451 %                                                                             %
4452 %                                                                             %
4453 %   M a g i c k G e t I m a g e F o r m a t                                   %
4454 %                                                                             %
4455 %                                                                             %
4456 %                                                                             %
4457 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4458 %
4459 %  MagickGetImageFormat() returns the format of a particular image in a
4460 %  sequence.
4461 %
4462 %  The format of the MagickGetImageFormat method is:
4463 %
4464 %      const char *MagickGetImageFormat(MagickWand *wand)
4465 %
4466 %  A description of each parameter follows:
4467 %
4468 %    o wand: the magick wand.
4469 %
4470 */
4471 WandExport char *MagickGetImageFormat(MagickWand *wand)
4472 {
4473   assert(wand != (MagickWand *) NULL);
4474   assert(wand->signature == WandSignature);
4475   if (wand->debug != MagickFalse)
4476     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4477   if (wand->images == (Image *) NULL)
4478     {
4479       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4480         "ContainsNoImages","`%s'",wand->name);
4481       return((char *) NULL);
4482     }
4483   return(AcquireString(wand->images->magick));
4484 }
4485 \f
4486 /*
4487 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4488 %                                                                             %
4489 %                                                                             %
4490 %                                                                             %
4491 %   M a g i c k G e t I m a g e F u z z                                       %
4492 %                                                                             %
4493 %                                                                             %
4494 %                                                                             %
4495 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4496 %
4497 %  MagickGetImageFuzz() gets the image fuzz.
4498 %
4499 %  The format of the MagickGetImageFuzz method is:
4500 %
4501 %      double MagickGetImageFuzz(MagickWand *wand)
4502 %
4503 %  A description of each parameter follows:
4504 %
4505 %    o wand: the magick wand.
4506 %
4507 */
4508 WandExport double MagickGetImageFuzz(MagickWand *wand)
4509 {
4510   assert(wand != (MagickWand *) NULL);
4511   assert(wand->signature == WandSignature);
4512   if (wand->debug != MagickFalse)
4513     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4514   if (wand->images == (Image *) NULL)
4515     {
4516       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4517         "ContainsNoImages","`%s'",wand->name);
4518       return(0.0);
4519     }
4520   return(wand->images->fuzz);
4521 }
4522 \f
4523 /*
4524 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4525 %                                                                             %
4526 %                                                                             %
4527 %                                                                             %
4528 %   M a g i c k G e t I m a g e G a m m a                                     %
4529 %                                                                             %
4530 %                                                                             %
4531 %                                                                             %
4532 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4533 %
4534 %  MagickGetImageGamma() gets the image gamma.
4535 %
4536 %  The format of the MagickGetImageGamma method is:
4537 %
4538 %      double MagickGetImageGamma(MagickWand *wand)
4539 %
4540 %  A description of each parameter follows:
4541 %
4542 %    o wand: the magick wand.
4543 %
4544 */
4545 WandExport double MagickGetImageGamma(MagickWand *wand)
4546 {
4547   assert(wand != (MagickWand *) NULL);
4548   assert(wand->signature == WandSignature);
4549   if (wand->debug != MagickFalse)
4550     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4551   if (wand->images == (Image *) NULL)
4552     {
4553       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4554         "ContainsNoImages","`%s'",wand->name);
4555       return(0.0);
4556     }
4557   return(wand->images->gamma);
4558 }
4559 \f
4560 /*
4561 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4562 %                                                                             %
4563 %                                                                             %
4564 %                                                                             %
4565 %   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                 %
4566 %                                                                             %
4567 %                                                                             %
4568 %                                                                             %
4569 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4570 %
4571 %  MagickGetImageGravity() gets the image gravity.
4572 %
4573 %  The format of the MagickGetImageGravity method is:
4574 %
4575 %      GravityType MagickGetImageGravity(MagickWand *wand)
4576 %
4577 %  A description of each parameter follows:
4578 %
4579 %    o wand: the magick wand.
4580 %
4581 */
4582 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4583 {
4584   assert(wand != (MagickWand *) NULL);
4585   assert(wand->signature == WandSignature);
4586   if (wand->debug != MagickFalse)
4587     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4588   if (wand->images == (Image *) NULL)
4589     {
4590       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4591         "ContainsNoImages","`%s'",wand->name);
4592       return(UndefinedGravity);
4593     }
4594   return(wand->images->gravity);
4595 }
4596 \f
4597 /*
4598 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4599 %                                                                             %
4600 %                                                                             %
4601 %                                                                             %
4602 %   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                       %
4603 %                                                                             %
4604 %                                                                             %
4605 %                                                                             %
4606 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4607 %
4608 %  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4609 %
4610 %  The format of the MagickGetImageGreenPrimary method is:
4611 %
4612 %      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4613 %        double *y)
4614 %
4615 %  A description of each parameter follows:
4616 %
4617 %    o wand: the magick wand.
4618 %
4619 %    o x: the chromaticity green primary x-point.
4620 %
4621 %    o y: the chromaticity green primary y-point.
4622 %
4623 */
4624 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4625   double *x,double *y)
4626 {
4627   assert(wand != (MagickWand *) NULL);
4628   assert(wand->signature == WandSignature);
4629   if (wand->debug != MagickFalse)
4630     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4631   if (wand->images == (Image *) NULL)
4632     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4633   *x=wand->images->chromaticity.green_primary.x;
4634   *y=wand->images->chromaticity.green_primary.y;
4635   return(MagickTrue);
4636 }
4637 \f
4638 /*
4639 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4640 %                                                                             %
4641 %                                                                             %
4642 %                                                                             %
4643 %   M a g i c k G e t I m a g e H e i g h t                                   %
4644 %                                                                             %
4645 %                                                                             %
4646 %                                                                             %
4647 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4648 %
4649 %  MagickGetImageHeight() returns the image height.
4650 %
4651 %  The format of the MagickGetImageHeight method is:
4652 %
4653 %      size_t MagickGetImageHeight(MagickWand *wand)
4654 %
4655 %  A description of each parameter follows:
4656 %
4657 %    o wand: the magick wand.
4658 %
4659 */
4660 WandExport size_t MagickGetImageHeight(MagickWand *wand)
4661 {
4662   assert(wand != (MagickWand *) NULL);
4663   assert(wand->signature == WandSignature);
4664   if (wand->debug != MagickFalse)
4665     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4666   if (wand->images == (Image *) NULL)
4667     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4668   return(wand->images->rows);
4669 }
4670 \f
4671 /*
4672 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4673 %                                                                             %
4674 %                                                                             %
4675 %                                                                             %
4676 %   M a g i c k G e t I m a g e H i s t o g r a m                             %
4677 %                                                                             %
4678 %                                                                             %
4679 %                                                                             %
4680 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4681 %
4682 %  MagickGetImageHistogram() returns the image histogram as an array of
4683 %  PixelWand wands.
4684 %
4685 %  The format of the MagickGetImageHistogram method is:
4686 %
4687 %      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4688 %        size_t *number_colors)
4689 %
4690 %  A description of each parameter follows:
4691 %
4692 %    o wand: the magick wand.
4693 %
4694 %    o number_colors: the number of unique colors in the image and the number
4695 %      of pixel wands returned.
4696 %
4697 */
4698 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4699   size_t *number_colors)
4700 {
4701   PixelInfo
4702     *histogram;
4703
4704   PixelWand
4705     **pixel_wands;
4706
4707   register ssize_t
4708     i;
4709
4710   assert(wand != (MagickWand *) NULL);
4711   assert(wand->signature == WandSignature);
4712   if (wand->debug != MagickFalse)
4713     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4714   if (wand->images == (Image *) NULL)
4715     {
4716       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4717         "ContainsNoImages","`%s'",wand->name);
4718       return((PixelWand **) NULL);
4719     }
4720   histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4721   if (histogram == (PixelInfo *) NULL)
4722     return((PixelWand **) NULL);
4723   pixel_wands=NewPixelWands(*number_colors);
4724   for (i=0; i < (ssize_t) *number_colors; i++)
4725   {
4726     PixelSetPixelColor(pixel_wands[i],&histogram[i]);
4727     PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4728   }
4729   histogram=(PixelInfo *) RelinquishMagickMemory(histogram);
4730   return(pixel_wands);
4731 }
4732 \f
4733 /*
4734 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4735 %                                                                             %
4736 %                                                                             %
4737 %                                                                             %
4738 %   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                 %
4739 %                                                                             %
4740 %                                                                             %
4741 %                                                                             %
4742 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4743 %
4744 %  MagickGetImageInterlaceScheme() gets the image interlace scheme.
4745 %
4746 %  The format of the MagickGetImageInterlaceScheme method is:
4747 %
4748 %      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4749 %
4750 %  A description of each parameter follows:
4751 %
4752 %    o wand: the magick wand.
4753 %
4754 */
4755 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4756 {
4757   assert(wand != (MagickWand *) NULL);
4758   assert(wand->signature == WandSignature);
4759   if (wand->debug != MagickFalse)
4760     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4761   if (wand->images == (Image *) NULL)
4762     {
4763       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4764         "ContainsNoImages","`%s'",wand->name);
4765       return(UndefinedInterlace);
4766     }
4767   return(wand->images->interlace);
4768 }
4769 \f
4770 /*
4771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4772 %                                                                             %
4773 %                                                                             %
4774 %                                                                             %
4775 %   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             %
4776 %                                                                             %
4777 %                                                                             %
4778 %                                                                             %
4779 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4780 %
4781 %  MagickGetImageInterpolateMethod() returns the interpolation method for the
4782 %  sepcified image.
4783 %
4784 %  The format of the MagickGetImageInterpolateMethod method is:
4785 %
4786 %      PixelInterpolateMethod MagickGetImagePixelInterpolateMethod(
4787 %        MagickWand *wand)
4788 %
4789 %  A description of each parameter follows:
4790 %
4791 %    o wand: the magick wand.
4792 %
4793 */
4794 WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
4795   MagickWand *wand)
4796 {
4797   assert(wand != (MagickWand *) NULL);
4798   assert(wand->signature == WandSignature);
4799   if (wand->debug != MagickFalse)
4800     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4801   if (wand->images == (Image *) NULL)
4802     {
4803       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4804         "ContainsNoImages","`%s'",wand->name);
4805       return(UndefinedInterpolatePixel);
4806     }
4807   return(wand->images->interpolate);
4808 }
4809 \f
4810 /*
4811 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4812 %                                                                             %
4813 %                                                                             %
4814 %                                                                             %
4815 %   M a g i c k G e t I m a g e I t e r a t i o n s                           %
4816 %                                                                             %
4817 %                                                                             %
4818 %                                                                             %
4819 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4820 %
4821 %  MagickGetImageIterations() gets the image iterations.
4822 %
4823 %  The format of the MagickGetImageIterations method is:
4824 %
4825 %      size_t MagickGetImageIterations(MagickWand *wand)
4826 %
4827 %  A description of each parameter follows:
4828 %
4829 %    o wand: the magick wand.
4830 %
4831 */
4832 WandExport size_t MagickGetImageIterations(MagickWand *wand)
4833 {
4834   assert(wand != (MagickWand *) NULL);
4835   assert(wand->signature == WandSignature);
4836   if (wand->debug != MagickFalse)
4837     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4838   if (wand->images == (Image *) NULL)
4839     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4840   return(wand->images->iterations);
4841 }
4842 \f
4843 /*
4844 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4845 %                                                                             %
4846 %                                                                             %
4847 %                                                                             %
4848 %   M a g i c k G e t I m a g e L e n g t h                                   %
4849 %                                                                             %
4850 %                                                                             %
4851 %                                                                             %
4852 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4853 %
4854 %  MagickGetImageLength() returns the image length in bytes.
4855 %
4856 %  The format of the MagickGetImageLength method is:
4857 %
4858 %      MagickBooleanType MagickGetImageLength(MagickWand *wand,
4859 %        MagickSizeType *length)
4860 %
4861 %  A description of each parameter follows:
4862 %
4863 %    o wand: the magick wand.
4864 %
4865 %    o length: the image length in bytes.
4866 %
4867 */
4868 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
4869   MagickSizeType *length)
4870 {
4871   assert(wand != (MagickWand *) NULL);
4872   assert(wand->signature == WandSignature);
4873   if (wand->debug != MagickFalse)
4874     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4875   if (wand->images == (Image *) NULL)
4876     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4877   *length=GetBlobSize(wand->images);
4878   return(MagickTrue);
4879 }
4880 \f
4881 /*
4882 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4883 %                                                                             %
4884 %                                                                             %
4885 %                                                                             %
4886 %   M a g i c k G e t I m a g e M a t t e C o l o r                           %
4887 %                                                                             %
4888 %                                                                             %
4889 %                                                                             %
4890 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4891 %
4892 %  MagickGetImageMatteColor() returns the image matte color.
4893 %
4894 %  The format of the MagickGetImageMatteColor method is:
4895 %
4896 %      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
4897 %        PixelWand *matte_color)
4898 %
4899 %  A description of each parameter follows:
4900 %
4901 %    o wand: the magick wand.
4902 %
4903 %    o matte_color: Return the matte color.
4904 %
4905 */
4906 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
4907   PixelWand *matte_color)
4908 {
4909   assert(wand != (MagickWand *) NULL);
4910   assert(wand->signature == WandSignature);
4911   if (wand->debug != MagickFalse)
4912     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4913   if (wand->images == (Image *) NULL)
4914     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4915   PixelSetPixelColor(matte_color,&wand->images->matte_color);
4916   return(MagickTrue);
4917 }
4918 \f
4919 /*
4920 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4921 %                                                                             %
4922 %                                                                             %
4923 %                                                                             %
4924 %   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                         %
4925 %                                                                             %
4926 %                                                                             %
4927 %                                                                             %
4928 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4929 %
4930 %  MagickGetImageOrientation() returns the image orientation.
4931 %
4932 %  The format of the MagickGetImageOrientation method is:
4933 %
4934 %      OrientationType MagickGetImageOrientation(MagickWand *wand)
4935 %
4936 %  A description of each parameter follows:
4937 %
4938 %    o wand: the magick wand.
4939 %
4940 */
4941 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
4942 {
4943   assert(wand != (MagickWand *) NULL);
4944   assert(wand->signature == WandSignature);
4945   if (wand->debug != MagickFalse)
4946     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4947   if (wand->images == (Image *) NULL)
4948     {
4949       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4950         "ContainsNoImages","`%s'",wand->name);
4951       return(UndefinedOrientation);
4952     }
4953   return(wand->images->orientation);
4954 }
4955 \f
4956 /*
4957 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4958 %                                                                             %
4959 %                                                                             %
4960 %                                                                             %
4961 %   M a g i c k G e t I m a g e P a g e                                       %
4962 %                                                                             %
4963 %                                                                             %
4964 %                                                                             %
4965 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4966 %
4967 %  MagickGetImagePage() returns the page geometry associated with the image.
4968 %
4969 %  The format of the MagickGetImagePage method is:
4970 %
4971 %      MagickBooleanType MagickGetImagePage(MagickWand *wand,
4972 %        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4973 %
4974 %  A description of each parameter follows:
4975 %
4976 %    o wand: the magick wand.
4977 %
4978 %    o width: the page width.
4979 %
4980 %    o height: the page height.
4981 %
4982 %    o x: the page x-offset.
4983 %
4984 %    o y: the page y-offset.
4985 %
4986 */
4987 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
4988   size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4989 {
4990   assert(wand != (const MagickWand *) NULL);
4991   assert(wand->signature == WandSignature);
4992   if (wand->debug != MagickFalse)
4993     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4994   if (wand->images == (Image *) NULL)
4995     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4996   *width=wand->images->page.width;
4997   *height=wand->images->page.height;
4998   *x=wand->images->page.x;
4999   *y=wand->images->page.y;
5000   return(MagickTrue);
5001 }
5002 \f
5003 /*
5004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5005 %                                                                             %
5006 %                                                                             %
5007 %                                                                             %
5008 %   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5009 %                                                                             %
5010 %                                                                             %
5011 %                                                                             %
5012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5013 %
5014 %  MagickGetImagePixelColor() returns the color of the specified pixel.
5015 %
5016 %  The format of the MagickGetImagePixelColor method is:
5017 %
5018 %      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5019 %        const ssize_t x,const ssize_t y,PixelWand *color)
5020 %
5021 %  A description of each parameter follows:
5022 %
5023 %    o wand: the magick wand.
5024 %
5025 %    o x,y: the pixel offset into the image.
5026 %
5027 %    o color: Return the colormap color in this wand.
5028 %
5029 */
5030 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5031   const ssize_t x,const ssize_t y,PixelWand *color)
5032 {
5033   register const Quantum
5034     *p;
5035
5036   CacheView
5037     *image_view;
5038
5039   assert(wand != (MagickWand *) NULL);
5040   assert(wand->signature == WandSignature);
5041   if (wand->debug != MagickFalse)
5042     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5043   if (wand->images == (Image *) NULL)
5044     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5045   image_view=AcquireCacheView(wand->images);
5046   p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5047   if (p == (const Quantum *) NULL)
5048     {
5049       image_view=DestroyCacheView(image_view);
5050       return(MagickFalse);
5051     }
5052   PixelSetQuantumPixel(wand->images,p,color);
5053   image_view=DestroyCacheView(image_view);
5054   return(MagickTrue);
5055 }
5056 \f
5057 /*
5058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5059 %                                                                             %
5060 %                                                                             %
5061 %                                                                             %
5062 %   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5063 %                                                                             %
5064 %                                                                             %
5065 %                                                                             %
5066 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5067 %
5068 %  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5069 %
5070 %  The format of the MagickGetImageRedPrimary method is:
5071 %
5072 %      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5073 %        double *y)
5074 %
5075 %  A description of each parameter follows:
5076 %
5077 %    o wand: the magick wand.
5078 %
5079 %    o x: the chromaticity red primary x-point.
5080 %
5081 %    o y: the chromaticity red primary y-point.
5082 %
5083 */
5084 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5085   double *x,double *y)
5086 {
5087   assert(wand != (MagickWand *) NULL);
5088   assert(wand->signature == WandSignature);
5089   if (wand->debug != MagickFalse)
5090     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5091   if (wand->images == (Image *) NULL)
5092     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5093   *x=wand->images->chromaticity.red_primary.x;
5094   *y=wand->images->chromaticity.red_primary.y;
5095   return(MagickTrue);
5096 }
5097 \f
5098 /*
5099 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5100 %                                                                             %
5101 %                                                                             %
5102 %                                                                             %
5103 %   M a g i c k G e t I m a g e R e g i o n                                   %
5104 %                                                                             %
5105 %                                                                             %
5106 %                                                                             %
5107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5108 %
5109 %  MagickGetImageRegion() extracts a region of the image and returns it as a
5110 %  a new wand.
5111 %
5112 %  The format of the MagickGetImageRegion method is:
5113 %
5114 %      MagickWand *MagickGetImageRegion(MagickWand *wand,
5115 %        const size_t width,const size_t height,const ssize_t x,
5116 %        const ssize_t y)
5117 %
5118 %  A description of each parameter follows:
5119 %
5120 %    o wand: the magick wand.
5121 %
5122 %    o width: the region width.
5123 %
5124 %    o height: the region height.
5125 %
5126 %    o x: the region x offset.
5127 %
5128 %    o y: the region y offset.
5129 %
5130 */
5131 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5132   const size_t width,const size_t height,const ssize_t x,
5133   const ssize_t y)
5134 {
5135   Image
5136     *region_image;
5137
5138   RectangleInfo
5139     region;
5140
5141   assert(wand != (MagickWand *) NULL);
5142   assert(wand->signature == WandSignature);
5143   if (wand->debug != MagickFalse)
5144     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5145   if (wand->images == (Image *) NULL)
5146     return((MagickWand *) NULL);
5147   region.width=width;
5148   region.height=height;
5149   region.x=x;
5150   region.y=y;
5151   region_image=CropImage(wand->images,&region,wand->exception);
5152   if (region_image == (Image *) NULL)
5153     return((MagickWand *) NULL);
5154   return(CloneMagickWandFromImages(wand,region_image));
5155 }
5156 \f
5157 /*
5158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5159 %                                                                             %
5160 %                                                                             %
5161 %                                                                             %
5162 %   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                 %
5163 %                                                                             %
5164 %                                                                             %
5165 %                                                                             %
5166 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5167 %
5168 %  MagickGetImageRenderingIntent() gets the image rendering intent.
5169 %
5170 %  The format of the MagickGetImageRenderingIntent method is:
5171 %
5172 %      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5173 %
5174 %  A description of each parameter follows:
5175 %
5176 %    o wand: the magick wand.
5177 %
5178 */
5179 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5180 {
5181   assert(wand != (MagickWand *) NULL);
5182   assert(wand->signature == WandSignature);
5183   if (wand->debug != MagickFalse)
5184     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5185   if (wand->images == (Image *) NULL)
5186     {
5187       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5188         "ContainsNoImages","`%s'",wand->name);
5189       return(UndefinedIntent);
5190     }
5191   return((RenderingIntent) wand->images->rendering_intent);
5192 }
5193 \f
5194 /*
5195 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5196 %                                                                             %
5197 %                                                                             %
5198 %                                                                             %
5199 %   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5200 %                                                                             %
5201 %                                                                             %
5202 %                                                                             %
5203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5204 %
5205 %  MagickGetImageResolution() gets the image X and Y resolution.
5206 %
5207 %  The format of the MagickGetImageResolution method is:
5208 %
5209 %      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5210 %        double *y)
5211 %
5212 %  A description of each parameter follows:
5213 %
5214 %    o wand: the magick wand.
5215 %
5216 %    o x: the image x-resolution.
5217 %
5218 %    o y: the image y-resolution.
5219 %
5220 */
5221 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5222   double *x,double *y)
5223 {
5224   assert(wand != (MagickWand *) NULL);
5225   assert(wand->signature == WandSignature);
5226   if (wand->debug != MagickFalse)
5227     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5228   if (wand->images == (Image *) NULL)
5229     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5230   *x=wand->images->resolution.x;
5231   *y=wand->images->resolution.y;
5232   return(MagickTrue);
5233 }
5234 \f
5235 /*
5236 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5237 %                                                                             %
5238 %                                                                             %
5239 %                                                                             %
5240 %   M a g i c k G e t I m a g e S c e n e                                     %
5241 %                                                                             %
5242 %                                                                             %
5243 %                                                                             %
5244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5245 %
5246 %  MagickGetImageScene() gets the image scene.
5247 %
5248 %  The format of the MagickGetImageScene method is:
5249 %
5250 %      size_t MagickGetImageScene(MagickWand *wand)
5251 %
5252 %  A description of each parameter follows:
5253 %
5254 %    o wand: the magick wand.
5255 %
5256 */
5257 WandExport size_t MagickGetImageScene(MagickWand *wand)
5258 {
5259   assert(wand != (MagickWand *) NULL);
5260   assert(wand->signature == WandSignature);
5261   if (wand->debug != MagickFalse)
5262     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5263   if (wand->images == (Image *) NULL)
5264     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5265   return(wand->images->scene);
5266 }
5267 \f
5268 /*
5269 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5270 %                                                                             %
5271 %                                                                             %
5272 %                                                                             %
5273 %   M a g i c k G e t I m a g e S i g n a t u r e                             %
5274 %                                                                             %
5275 %                                                                             %
5276 %                                                                             %
5277 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5278 %
5279 %  MagickGetImageSignature() generates an SHA-256 message digest for the image
5280 %  pixel stream.
5281 %
5282 %  The format of the MagickGetImageSignature method is:
5283 %
5284 %      const char MagickGetImageSignature(MagickWand *wand)
5285 %
5286 %  A description of each parameter follows:
5287 %
5288 %    o wand: the magick wand.
5289 %
5290 */
5291 WandExport char *MagickGetImageSignature(MagickWand *wand)
5292 {
5293   const char
5294     *value;
5295
5296   MagickBooleanType
5297     status;
5298
5299   assert(wand != (MagickWand *) NULL);
5300   assert(wand->signature == WandSignature);
5301   if (wand->debug != MagickFalse)
5302     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5303   if (wand->images == (Image *) NULL)
5304     {
5305       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5306         "ContainsNoImages","`%s'",wand->name);
5307       return((char *) NULL);
5308     }
5309   status=SignatureImage(wand->images,wand->exception);
5310   if (status == MagickFalse)
5311     return((char *) NULL);
5312   value=GetImageProperty(wand->images,"signature",wand->exception);
5313   if (value == (const char *) NULL)
5314     return((char *) NULL);
5315   return(AcquireString(value));
5316 }
5317 \f
5318 /*
5319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5320 %                                                                             %
5321 %                                                                             %
5322 %                                                                             %
5323 %   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                   %
5324 %                                                                             %
5325 %                                                                             %
5326 %                                                                             %
5327 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5328 %
5329 %  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5330 %
5331 %  The format of the MagickGetImageTicksPerSecond method is:
5332 %
5333 %      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5334 %
5335 %  A description of each parameter follows:
5336 %
5337 %    o wand: the magick wand.
5338 %
5339 */
5340 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5341 {
5342   assert(wand != (MagickWand *) NULL);
5343   assert(wand->signature == WandSignature);
5344   if (wand->debug != MagickFalse)
5345     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5346   if (wand->images == (Image *) NULL)
5347     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5348   return((size_t) wand->images->ticks_per_second);
5349 }
5350 \f
5351 /*
5352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5353 %                                                                             %
5354 %                                                                             %
5355 %                                                                             %
5356 %   M a g i c k G e t I m a g e T y p e                                       %
5357 %                                                                             %
5358 %                                                                             %
5359 %                                                                             %
5360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5361 %
5362 %  MagickGetImageType() gets the potential image type:
5363 %
5364 %        Bilevel        Grayscale       GrayscaleMatte
5365 %        Palette        PaletteMatte    TrueColor
5366 %        TrueColorMatte ColorSeparation ColorSeparationMatte
5367 %
5368 %  To ensure the image type matches its potential, use MagickSetImageType():
5369 %
5370 %    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5371 %
5372 %  The format of the MagickGetImageType method is:
5373 %
5374 %      ImageType MagickGetImageType(MagickWand *wand)
5375 %
5376 %  A description of each parameter follows:
5377 %
5378 %    o wand: the magick wand.
5379 %
5380 */
5381 WandExport ImageType MagickGetImageType(MagickWand *wand)
5382 {
5383   assert(wand != (MagickWand *) NULL);
5384   assert(wand->signature == WandSignature);
5385   if (wand->debug != MagickFalse)
5386     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5387   if (wand->images == (Image *) NULL)
5388     {
5389       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5390         "ContainsNoImages","`%s'",wand->name);
5391       return(UndefinedType);
5392     }
5393   return(GetImageType(wand->images,wand->exception));
5394 }
5395 \f
5396 /*
5397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5398 %                                                                             %
5399 %                                                                             %
5400 %                                                                             %
5401 %   M a g i c k G e t I m a g e U n i t s                                     %
5402 %                                                                             %
5403 %                                                                             %
5404 %                                                                             %
5405 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5406 %
5407 %  MagickGetImageUnits() gets the image units of resolution.
5408 %
5409 %  The format of the MagickGetImageUnits method is:
5410 %
5411 %      ResolutionType MagickGetImageUnits(MagickWand *wand)
5412 %
5413 %  A description of each parameter follows:
5414 %
5415 %    o wand: the magick wand.
5416 %
5417 */
5418 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5419 {
5420   assert(wand != (MagickWand *) NULL);
5421   assert(wand->signature == WandSignature);
5422   if (wand->debug != MagickFalse)
5423     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5424   if (wand->images == (Image *) NULL)
5425     {
5426       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5427         "ContainsNoImages","`%s'",wand->name);
5428       return(UndefinedResolution);
5429     }
5430   return(wand->images->units);
5431 }
5432 \f
5433 /*
5434 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5435 %                                                                             %
5436 %                                                                             %
5437 %                                                                             %
5438 %   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           %
5439 %                                                                             %
5440 %                                                                             %
5441 %                                                                             %
5442 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5443 %
5444 %  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5445 %  sepcified image.
5446 %
5447 %  The format of the MagickGetImageVirtualPixelMethod method is:
5448 %
5449 %      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5450 %
5451 %  A description of each parameter follows:
5452 %
5453 %    o wand: the magick wand.
5454 %
5455 */
5456 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5457 {
5458   assert(wand != (MagickWand *) NULL);
5459   assert(wand->signature == WandSignature);
5460   if (wand->debug != MagickFalse)
5461     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5462   if (wand->images == (Image *) NULL)
5463     {
5464       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5465         "ContainsNoImages","`%s'",wand->name);
5466       return(UndefinedVirtualPixelMethod);
5467     }
5468   return(GetImageVirtualPixelMethod(wand->images));
5469 }
5470 \f
5471 /*
5472 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5473 %                                                                             %
5474 %                                                                             %
5475 %                                                                             %
5476 %   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5477 %                                                                             %
5478 %                                                                             %
5479 %                                                                             %
5480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5481 %
5482 %  MagickGetImageWhitePoint() returns the chromaticy white point.
5483 %
5484 %  The format of the MagickGetImageWhitePoint method is:
5485 %
5486 %      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5487 %        double *y)
5488 %
5489 %  A description of each parameter follows:
5490 %
5491 %    o wand: the magick wand.
5492 %
5493 %    o x: the chromaticity white x-point.
5494 %
5495 %    o y: the chromaticity white y-point.
5496 %
5497 */
5498 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5499   double *x,double *y)
5500 {
5501   assert(wand != (MagickWand *) NULL);
5502   assert(wand->signature == WandSignature);
5503   if (wand->debug != MagickFalse)
5504     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5505   if (wand->images == (Image *) NULL)
5506     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5507   *x=wand->images->chromaticity.white_point.x;
5508   *y=wand->images->chromaticity.white_point.y;
5509   return(MagickTrue);
5510 }
5511 \f
5512 /*
5513 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5514 %                                                                             %
5515 %                                                                             %
5516 %                                                                             %
5517 %   M a g i c k G e t I m a g e W i d t h                                     %
5518 %                                                                             %
5519 %                                                                             %
5520 %                                                                             %
5521 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5522 %
5523 %  MagickGetImageWidth() returns the image width.
5524 %
5525 %  The format of the MagickGetImageWidth method is:
5526 %
5527 %      size_t MagickGetImageWidth(MagickWand *wand)
5528 %
5529 %  A description of each parameter follows:
5530 %
5531 %    o wand: the magick wand.
5532 %
5533 */
5534 WandExport size_t MagickGetImageWidth(MagickWand *wand)
5535 {
5536   assert(wand != (MagickWand *) NULL);
5537   assert(wand->signature == WandSignature);
5538   if (wand->debug != MagickFalse)
5539     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5540   if (wand->images == (Image *) NULL)
5541     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5542   return(wand->images->columns);
5543 }
5544 \f
5545 /*
5546 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5547 %                                                                             %
5548 %                                                                             %
5549 %                                                                             %
5550 %   M a g i c k G e t N u m b e r I m a g e s                                 %
5551 %                                                                             %
5552 %                                                                             %
5553 %                                                                             %
5554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5555 %
5556 %  MagickGetNumberImages() returns the number of images associated with a
5557 %  magick wand.
5558 %
5559 %  The format of the MagickGetNumberImages method is:
5560 %
5561 %      size_t MagickGetNumberImages(MagickWand *wand)
5562 %
5563 %  A description of each parameter follows:
5564 %
5565 %    o wand: the magick wand.
5566 %
5567 */
5568 WandExport size_t MagickGetNumberImages(MagickWand *wand)
5569 {
5570   assert(wand != (MagickWand *) NULL);
5571   assert(wand->signature == WandSignature);
5572   if (wand->debug != MagickFalse)
5573     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5574   return(GetImageListLength(wand->images));
5575 }
5576 \f
5577 /*
5578 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5579 %                                                                             %
5580 %                                                                             %
5581 %                                                                             %
5582 %   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                 %
5583 %                                                                             %
5584 %                                                                             %
5585 %                                                                             %
5586 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5587 %
5588 %  MagickGetImageTotalInkDensity() gets the image total ink density.
5589 %
5590 %  The format of the MagickGetImageTotalInkDensity method is:
5591 %
5592 %      double MagickGetImageTotalInkDensity(MagickWand *wand)
5593 %
5594 %  A description of each parameter follows:
5595 %
5596 %    o wand: the magick wand.
5597 %
5598 */
5599 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5600 {
5601   assert(wand != (MagickWand *) NULL);
5602   assert(wand->signature == WandSignature);
5603   if (wand->debug != MagickFalse)
5604     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5605   if (wand->images == (Image *) NULL)
5606     {
5607       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5608         "ContainsNoImages","`%s'",wand->name);
5609       return(0.0);
5610     }
5611   return(GetImageTotalInkDensity(wand->images,wand->exception));
5612 }
5613 \f
5614 /*
5615 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5616 %                                                                             %
5617 %                                                                             %
5618 %                                                                             %
5619 %   M a g i c k H a l d C l u t I m a g e                                     %
5620 %                                                                             %
5621 %                                                                             %
5622 %                                                                             %
5623 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5624 %
5625 %  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5626 %  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5627 %  dimensions.  Create it with the HALD coder.  You can apply any color
5628 %  transformation to the Hald image and then use this method to apply the
5629 %  transform to the image.
5630 %
5631 %  The format of the MagickHaldClutImage method is:
5632 %
5633 %      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5634 %        const MagickWand *hald_wand)
5635 %
5636 %  A description of each parameter follows:
5637 %
5638 %    o wand: the magick wand.
5639 %
5640 %    o hald_image: the hald CLUT image.
5641 %
5642 */
5643 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5644   const MagickWand *hald_wand)
5645 {
5646   MagickBooleanType
5647     status;
5648
5649   assert(wand != (MagickWand *) NULL);
5650   assert(wand->signature == WandSignature);
5651   if (wand->debug != MagickFalse)
5652     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5653   if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5654     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5655   status=HaldClutImage(wand->images,hald_wand->images,wand->exception);
5656   return(status);
5657 }
5658 \f
5659 /*
5660 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5661 %                                                                             %
5662 %                                                                             %
5663 %                                                                             %
5664 %   M a g i c k H a s N e x t I m a g e                                       %
5665 %                                                                             %
5666 %                                                                             %
5667 %                                                                             %
5668 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5669 %
5670 %  MagickHasNextImage() returns MagickTrue if the wand has more images when
5671 %  traversing the list in the forward direction
5672 %
5673 %  The format of the MagickHasNextImage method is:
5674 %
5675 %      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5676 %
5677 %  A description of each parameter follows:
5678 %
5679 %    o wand: the magick wand.
5680 %
5681 */
5682 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5683 {
5684   assert(wand != (MagickWand *) NULL);
5685   assert(wand->signature == WandSignature);
5686   if (wand->debug != MagickFalse)
5687     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5688   if (wand->images == (Image *) NULL)
5689     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5690   if (GetNextImageInList(wand->images) == (Image *) NULL)
5691     return(MagickFalse);
5692   return(MagickTrue);
5693 }
5694 \f
5695 /*
5696 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5697 %                                                                             %
5698 %                                                                             %
5699 %                                                                             %
5700 %   M a g i c k H a s P r e v i o u s I m a g e                               %
5701 %                                                                             %
5702 %                                                                             %
5703 %                                                                             %
5704 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5705 %
5706 %  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5707 %  traversing the list in the reverse direction
5708 %
5709 %  The format of the MagickHasPreviousImage method is:
5710 %
5711 %      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5712 %
5713 %  A description of each parameter follows:
5714 %
5715 %    o wand: the magick wand.
5716 %
5717 */
5718 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5719 {
5720   assert(wand != (MagickWand *) NULL);
5721   assert(wand->signature == WandSignature);
5722   if (wand->debug != MagickFalse)
5723     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5724   if (wand->images == (Image *) NULL)
5725     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5726   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5727     return(MagickFalse);
5728   return(MagickTrue);
5729 }
5730 \f
5731 /*
5732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5733 %                                                                             %
5734 %                                                                             %
5735 %                                                                             %
5736 %   M a g i c k I d e n t i f y I m a g e                                     %
5737 %                                                                             %
5738 %                                                                             %
5739 %                                                                             %
5740 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5741 %
5742 %  MagickIdentifyImage() identifies an image by printing its attributes to the
5743 %  file.  Attributes include the image width, height, size, and others.
5744 %
5745 %  The format of the MagickIdentifyImage method is:
5746 %
5747 %      const char *MagickIdentifyImage(MagickWand *wand)
5748 %
5749 %  A description of each parameter follows:
5750 %
5751 %    o wand: the magick wand.
5752 %
5753 */
5754 WandExport char *MagickIdentifyImage(MagickWand *wand)
5755 {
5756   char
5757     *description,
5758     filename[MaxTextExtent];
5759
5760   FILE
5761     *file;
5762
5763   int
5764     unique_file;
5765
5766   assert(wand != (MagickWand *) NULL);
5767   assert(wand->signature == WandSignature);
5768   if (wand->debug != MagickFalse)
5769     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5770   if (wand->images == (Image *) NULL)
5771     {
5772       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5773         "ContainsNoImages","`%s'",wand->name);
5774       return((char *) NULL);
5775     }
5776   description=(char *) NULL;
5777   unique_file=AcquireUniqueFileResource(filename);
5778   file=(FILE *) NULL;
5779   if (unique_file != -1)
5780     file=fdopen(unique_file,"wb");
5781   if ((unique_file == -1) || (file == (FILE *) NULL))
5782     {
5783       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5784         "UnableToCreateTemporaryFile","`%s'",wand->name);
5785       return((char *) NULL);
5786     }
5787   (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
5788   (void) fclose(file);
5789   description=FileToString(filename,~0,wand->exception);
5790   (void) RelinquishUniqueFileResource(filename);
5791   return(description);
5792 }
5793 \f
5794 /*
5795 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5796 %                                                                             %
5797 %                                                                             %
5798 %                                                                             %
5799 %   M a g i c k I m p l o d e I m a g e                                       %
5800 %                                                                             %
5801 %                                                                             %
5802 %                                                                             %
5803 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5804 %
5805 %  MagickImplodeImage() creates a new image that is a copy of an existing
5806 %  one with the image pixels "implode" by the specified percentage.  It
5807 %  allocates the memory necessary for the new Image structure and returns a
5808 %  pointer to the new image.
5809 %
5810 %  The format of the MagickImplodeImage method is:
5811 %
5812 %      MagickBooleanType MagickImplodeImage(MagickWand *wand,
5813 %        const double radius,const PixelInterpolateMethod method)
5814 %
5815 %  A description of each parameter follows:
5816 %
5817 %    o wand: the magick wand.
5818 %
5819 %    o amount: Define the extent of the implosion.
5820 %
5821 %    o method: the pixel interpolation method.
5822 %
5823 */
5824 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
5825   const double amount,const PixelInterpolateMethod method)
5826 {
5827   Image
5828     *implode_image;
5829
5830   assert(wand != (MagickWand *) NULL);
5831   assert(wand->signature == WandSignature);
5832   if (wand->debug != MagickFalse)
5833     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5834   if (wand->images == (Image *) NULL)
5835     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5836   implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
5837   if (implode_image == (Image *) NULL)
5838     return(MagickFalse);
5839   ReplaceImageInList(&wand->images,implode_image);
5840   return(MagickTrue);
5841 }
5842 \f
5843 /*
5844 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5845 %                                                                             %
5846 %                                                                             %
5847 %                                                                             %
5848 %   M a g i c k I m p o r t I m a g e P i x e l s                             %
5849 %                                                                             %
5850 %                                                                             %
5851 %                                                                             %
5852 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5853 %
5854 %  MagickImportImagePixels() accepts pixel datand stores it in the image at the
5855 %  location you specify.  The method returns MagickFalse on success otherwise
5856 %  MagickTrue if an error is encountered.  The pixel data can be either char,
5857 %  short int, int, ssize_t, float, or double in the order specified by map.
5858 %
5859 %  Suppose your want to upload the first scanline of a 640x480 image from
5860 %  character data in red-green-blue order:
5861 %
5862 %      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
5863 %
5864 %  The format of the MagickImportImagePixels method is:
5865 %
5866 %      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5867 %        const ssize_t x,const ssize_t y,const size_t columns,
5868 %        const size_t rows,const char *map,const StorageType storage,
5869 %        const void *pixels)
5870 %
5871 %  A description of each parameter follows:
5872 %
5873 %    o wand: the magick wand.
5874 %
5875 %    o x, y, columns, rows:  These values define the perimeter of a region
5876 %      of pixels you want to define.
5877 %
5878 %    o map:  This string reflects the expected ordering of the pixel array.
5879 %      It can be any combination or order of R = red, G = green, B = blue,
5880 %      A = alpha (0 is transparent), O = alpha (0 is opaque), C = cyan,
5881 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
5882 %      P = pad.
5883 %
5884 %    o storage: Define the data type of the pixels.  Float and double types are
5885 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
5886 %      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
5887 %      or DoublePixel.
5888 %
5889 %    o pixels: This array of values contain the pixel components as defined by
5890 %      map and type.  You must preallocate this array where the expected
5891 %      length varies depending on the values of width, height, map, and type.
5892 %
5893 */
5894 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5895   const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
5896   const char *map,const StorageType storage,const void *pixels)
5897 {
5898   MagickBooleanType
5899     status;
5900
5901   assert(wand != (MagickWand *) NULL);
5902   assert(wand->signature == WandSignature);
5903   if (wand->debug != MagickFalse)
5904     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5905   if (wand->images == (Image *) NULL)
5906     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5907   status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
5908     wand->exception);
5909   return(status);
5910 }
5911 \f
5912 /*
5913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5914 %                                                                             %
5915 %                                                                             %
5916 %                                                                             %
5917 %   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               %
5918 %                                                                             %
5919 %                                                                             %
5920 %                                                                             %
5921 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5922 %
5923 %  MagickInterpolativeResizeImage() resize image using a interpolative
5924 %  method.
5925 %
5926 %      MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
5927 %        const size_t columns,const size_t rows,
5928 %        const PixelInterpolateMethod method)
5929 %
5930 %  A description of each parameter follows:
5931 %
5932 %    o wand: the magick wand.
5933 %
5934 %    o columns: the number of columns in the scaled image.
5935 %
5936 %    o rows: the number of rows in the scaled image.
5937 %
5938 %    o interpolate: the pixel interpolation method.
5939 %
5940 */
5941 WandExport MagickBooleanType MagickInterpolativeResizeImage(MagickWand *wand,
5942   const size_t columns,const size_t rows,const PixelInterpolateMethod method)
5943 {
5944   Image
5945     *resize_image;
5946
5947   assert(wand != (MagickWand *) NULL);
5948   assert(wand->signature == WandSignature);
5949   if (wand->debug != MagickFalse)
5950     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5951   if (wand->images == (Image *) NULL)
5952     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5953   resize_image=InterpolativeResizeImage(wand->images,columns,rows,method,
5954     wand->exception);
5955   if (resize_image == (Image *) NULL)
5956     return(MagickFalse);
5957   ReplaceImageInList(&wand->images,resize_image);
5958   return(MagickTrue);
5959 }
5960 \f
5961 /*
5962 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5963 %                                                                             %
5964 %                                                                             %
5965 %                                                                             %
5966 %   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       %
5967 %                                                                             %
5968 %                                                                             %
5969 %                                                                             %
5970 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5971 %
5972 %  MagickInverseFourierTransformImage() implements the inverse discrete
5973 %  Fourier transform (DFT) of the image either as a magnitude / phase or real /
5974 %  imaginary image pair.
5975 %
5976 %  The format of the MagickInverseFourierTransformImage method is:
5977 %
5978 %      MagickBooleanType MagickInverseFourierTransformImage(
5979 %        MagickWand *magnitude_wand,MagickWand *phase_wand,
5980 %        const MagickBooleanType magnitude)
5981 %
5982 %  A description of each parameter follows:
5983 %
5984 %    o magnitude_wand: the magnitude or real wand.
5985 %
5986 %    o phase_wand: the phase or imaginary wand.
5987 %
5988 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
5989 %      imaginary image pair.
5990 %
5991 */
5992 WandExport MagickBooleanType MagickInverseFourierTransformImage(
5993   MagickWand *magnitude_wand,MagickWand *phase_wand,
5994   const MagickBooleanType magnitude)
5995 {
5996   Image
5997     *inverse_image;
5998
5999   MagickWand
6000     *wand;
6001
6002   assert(magnitude_wand != (MagickWand *) NULL);
6003   assert(magnitude_wand->signature == WandSignature);
6004   if (magnitude_wand->debug != MagickFalse)
6005     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6006       magnitude_wand->name);
6007   wand=magnitude_wand;
6008   if (magnitude_wand->images == (Image *) NULL)
6009     ThrowWandException(WandError,"ContainsNoImages",
6010       magnitude_wand->name);
6011   assert(phase_wand != (MagickWand *) NULL);
6012   assert(phase_wand->signature == WandSignature);
6013   inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6014     phase_wand->images,magnitude,wand->exception);
6015   if (inverse_image == (Image *) NULL)
6016     return(MagickFalse);
6017   ReplaceImageInList(&wand->images,inverse_image);
6018   return(MagickTrue);
6019 }
6020 \f
6021 /*
6022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6023 %                                                                             %
6024 %                                                                             %
6025 %                                                                             %
6026 %   M a g i c k L a b e l I m a g e                                           %
6027 %                                                                             %
6028 %                                                                             %
6029 %                                                                             %
6030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6031 %
6032 %  MagickLabelImage() adds a label to your image.
6033 %
6034 %  The format of the MagickLabelImage method is:
6035 %
6036 %      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6037 %
6038 %  A description of each parameter follows:
6039 %
6040 %    o wand: the magick wand.
6041 %
6042 %    o label: the image label.
6043 %
6044 */
6045 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6046   const char *label)
6047 {
6048   MagickBooleanType
6049     status;
6050
6051   assert(wand != (MagickWand *) NULL);
6052   assert(wand->signature == WandSignature);
6053   if (wand->debug != MagickFalse)
6054     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6055   if (wand->images == (Image *) NULL)
6056     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6057   status=SetImageProperty(wand->images,"label",label,wand->exception);
6058   return(status);
6059 }
6060 \f
6061 /*
6062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6063 %                                                                             %
6064 %                                                                             %
6065 %                                                                             %
6066 %   M a g i c k L e v e l I m a g e                                           %
6067 %                                                                             %
6068 %                                                                             %
6069 %                                                                             %
6070 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6071 %
6072 %  MagickLevelImage() adjusts the levels of an image by scaling the colors
6073 %  falling between specified white and black points to the full available
6074 %  quantum range. The parameters provided represent the black, mid, and white
6075 %  points. The black point specifies the darkest color in the image. Colors
6076 %  darker than the black point are set to zero. Mid point specifies a gamma
6077 %  correction to apply to the image.  White point specifies the lightest color
6078 %  in the image. Colors brighter than the white point are set to the maximum
6079 %  quantum value.
6080 %
6081 %  The format of the MagickLevelImage method is:
6082 %
6083 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6084 %        const double black_point,const double gamma,const double white_point)
6085 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6086 %        const ChannelType channel,const double black_point,const double gamma,
6087 %        const double white_point)
6088 %
6089 %  A description of each parameter follows:
6090 %
6091 %    o wand: the magick wand.
6092 %
6093 %    o channel: Identify which channel to level: RedPixelChannel,
6094 %      GreenPixelChannel, etc.
6095 %
6096 %    o black_point: the black point.
6097 %
6098 %    o gamma: the gamma.
6099 %
6100 %    o white_point: the white point.
6101 %
6102 */
6103 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6104   const double black_point,const double gamma,const double white_point)
6105 {
6106   MagickBooleanType
6107     status;
6108
6109   assert(wand != (MagickWand *) NULL);
6110   assert(wand->signature == WandSignature);
6111   if (wand->debug != MagickFalse)
6112     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6113   if (wand->images == (Image *) NULL)
6114     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6115   status=LevelImage(wand->images,black_point,white_point,gamma,
6116     wand->exception);
6117   return(status);
6118 }
6119 \f
6120 /*
6121 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6122 %                                                                             %
6123 %                                                                             %
6124 %                                                                             %
6125 %   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6126 %                                                                             %
6127 %                                                                             %
6128 %                                                                             %
6129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6130 %
6131 %  MagickLinearStretchImage() stretches with saturation the image intensity.
6132 %
6133 %  You can also reduce the influence of a particular channel with a gamma
6134 %  value of 0.
6135 %
6136 %  The format of the MagickLinearStretchImage method is:
6137 %
6138 %      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6139 %        const double black_point,const double white_point)
6140 %
6141 %  A description of each parameter follows:
6142 %
6143 %    o wand: the magick wand.
6144 %
6145 %    o black_point: the black point.
6146 %
6147 %    o white_point: the white point.
6148 %
6149 */
6150 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6151   const double black_point,const double white_point)
6152 {
6153   MagickBooleanType
6154     status;
6155
6156   assert(wand != (MagickWand *) NULL);
6157   assert(wand->signature == WandSignature);
6158   if (wand->debug != MagickFalse)
6159     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6160   if (wand->images == (Image *) NULL)
6161     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6162   status=LinearStretchImage(wand->images,black_point,white_point,
6163     wand->exception);
6164   return(status);
6165 }
6166 \f
6167 /*
6168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6169 %                                                                             %
6170 %                                                                             %
6171 %                                                                             %
6172 %   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6173 %                                                                             %
6174 %                                                                             %
6175 %                                                                             %
6176 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6177 %
6178 %  MagickLiquidRescaleImage() rescales image with seam carving.
6179 %
6180 %      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6181 %        const size_t columns,const size_t rows,
6182 %        const double delta_x,const double rigidity)
6183 %
6184 %  A description of each parameter follows:
6185 %
6186 %    o wand: the magick wand.
6187 %
6188 %    o columns: the number of columns in the scaled image.
6189 %
6190 %    o rows: the number of rows in the scaled image.
6191 %
6192 %    o delta_x: maximum seam transversal step (0 means straight seams).
6193 %
6194 %    o rigidity: introduce a bias for non-straight seams (typically 0).
6195 %
6196 */
6197 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6198   const size_t columns,const size_t rows,const double delta_x,
6199   const double rigidity)
6200 {
6201   Image
6202     *rescale_image;
6203
6204   assert(wand != (MagickWand *) NULL);
6205   assert(wand->signature == WandSignature);
6206   if (wand->debug != MagickFalse)
6207     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6208   if (wand->images == (Image *) NULL)
6209     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6210   rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6211     rigidity,wand->exception);
6212   if (rescale_image == (Image *) NULL)
6213     return(MagickFalse);
6214   ReplaceImageInList(&wand->images,rescale_image);
6215   return(MagickTrue);
6216 }
6217 \f
6218 /*
6219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6220 %                                                                             %
6221 %                                                                             %
6222 %                                                                             %
6223 %   M a g i c k M a g n i f y I m a g e                                       %
6224 %                                                                             %
6225 %                                                                             %
6226 %                                                                             %
6227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6228 %
6229 %  MagickMagnifyImage() is a convenience method that scales an image
6230 %  proportionally to twice its original size.
6231 %
6232 %  The format of the MagickMagnifyImage method is:
6233 %
6234 %      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6235 %
6236 %  A description of each parameter follows:
6237 %
6238 %    o wand: the magick wand.
6239 %
6240 */
6241 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6242 {
6243   Image
6244     *magnify_image;
6245
6246   assert(wand != (MagickWand *) NULL);
6247   assert(wand->signature == WandSignature);
6248   if (wand->debug != MagickFalse)
6249     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6250   if (wand->images == (Image *) NULL)
6251     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6252   magnify_image=MagnifyImage(wand->images,wand->exception);
6253   if (magnify_image == (Image *) NULL)
6254     return(MagickFalse);
6255   ReplaceImageInList(&wand->images,magnify_image);
6256   return(MagickTrue);
6257 }
6258 \f
6259 /*
6260 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6261 %                                                                             %
6262 %                                                                             %
6263 %                                                                             %
6264 %   M a g i c k M e r g e I m a g e L a y e r s                               %
6265 %                                                                             %
6266 %                                                                             %
6267 %                                                                             %
6268 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6269 %
6270 %  MagickMergeImageLayers() composes all the image layers from the current
6271 %  given image onward to produce a single image of the merged layers.
6272 %
6273 %  The inital canvas's size depends on the given ImageLayerMethod, and is
6274 %  initialized using the first images background color.  The images
6275 %  are then compositied onto that image in sequence using the given
6276 %  composition that has been assigned to each individual image.
6277 %
6278 %  The format of the MagickMergeImageLayers method is:
6279 %
6280 %      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6281 %        const ImageLayerMethod method)
6282 %
6283 %  A description of each parameter follows:
6284 %
6285 %    o wand: the magick wand.
6286 %
6287 %    o method: the method of selecting the size of the initial canvas.
6288 %
6289 %        MergeLayer: Merge all layers onto a canvas just large enough
6290 %           to hold all the actual images. The virtual canvas of the
6291 %           first image is preserved but otherwise ignored.
6292 %
6293 %        FlattenLayer: Use the virtual canvas size of first image.
6294 %           Images which fall outside this canvas is clipped.
6295 %           This can be used to 'fill out' a given virtual canvas.
6296 %
6297 %        MosaicLayer: Start with the virtual canvas of the first image,
6298 %           enlarging left and right edges to contain all images.
6299 %           Images with negative offsets will be clipped.
6300 %
6301 */
6302 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6303   const ImageLayerMethod method)
6304 {
6305   Image
6306     *mosaic_image;
6307
6308   assert(wand != (MagickWand *) NULL);
6309   assert(wand->signature == WandSignature);
6310   if (wand->debug != MagickFalse)
6311     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6312   if (wand->images == (Image *) NULL)
6313     return((MagickWand *) NULL);
6314   mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6315   if (mosaic_image == (Image *) NULL)
6316     return((MagickWand *) NULL);
6317   return(CloneMagickWandFromImages(wand,mosaic_image));
6318 }
6319 \f
6320 /*
6321 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6322 %                                                                             %
6323 %                                                                             %
6324 %                                                                             %
6325 %   M a g i c k M i n i f y I m a g e                                         %
6326 %                                                                             %
6327 %                                                                             %
6328 %                                                                             %
6329 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6330 %
6331 %  MagickMinifyImage() is a convenience method that scales an image
6332 %  proportionally to one-half its original size
6333 %
6334 %  The format of the MagickMinifyImage method is:
6335 %
6336 %      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6337 %
6338 %  A description of each parameter follows:
6339 %
6340 %    o wand: the magick wand.
6341 %
6342 */
6343 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6344 {
6345   Image
6346     *minify_image;
6347
6348   assert(wand != (MagickWand *) NULL);
6349   assert(wand->signature == WandSignature);
6350   if (wand->debug != MagickFalse)
6351     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6352   if (wand->images == (Image *) NULL)
6353     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6354   minify_image=MinifyImage(wand->images,wand->exception);
6355   if (minify_image == (Image *) NULL)
6356     return(MagickFalse);
6357   ReplaceImageInList(&wand->images,minify_image);
6358   return(MagickTrue);
6359 }
6360 \f
6361 /*
6362 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6363 %                                                                             %
6364 %                                                                             %
6365 %                                                                             %
6366 %   M a g i c k M o d u l a t e I m a g e                                     %
6367 %                                                                             %
6368 %                                                                             %
6369 %                                                                             %
6370 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6371 %
6372 %  MagickModulateImage() lets you control the brightness, saturation, and hue
6373 %  of an image.  Hue is the percentage of absolute rotation from the current
6374 %  position.  For example 50 results in a counter-clockwise rotation of 90
6375 %  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6376 %  both resulting in a rotation of 180 degrees.
6377 %
6378 %  To increase the color brightness by 20% and decrease the color saturation by
6379 %  10% and leave the hue unchanged, use: 120,90,100.
6380 %
6381 %  The format of the MagickModulateImage method is:
6382 %
6383 %      MagickBooleanType MagickModulateImage(MagickWand *wand,
6384 %        const double brightness,const double saturation,const double hue)
6385 %
6386 %  A description of each parameter follows:
6387 %
6388 %    o wand: the magick wand.
6389 %
6390 %    o brightness: the percent change in brighness.
6391 %
6392 %    o saturation: the percent change in saturation.
6393 %
6394 %    o hue: the percent change in hue.
6395 %
6396 */
6397 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6398   const double brightness,const double saturation,const double hue)
6399 {
6400   char
6401     modulate[MaxTextExtent];
6402
6403   MagickBooleanType
6404     status;
6405
6406   assert(wand != (MagickWand *) NULL);
6407   assert(wand->signature == WandSignature);
6408   if (wand->debug != MagickFalse)
6409     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6410   if (wand->images == (Image *) NULL)
6411     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6412   (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6413     brightness,saturation,hue);
6414   status=ModulateImage(wand->images,modulate,wand->exception);
6415   return(status);
6416 }
6417 \f
6418 /*
6419 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6420 %                                                                             %
6421 %                                                                             %
6422 %                                                                             %
6423 %   M a g i c k M o n t a g e I m a g e                                       %
6424 %                                                                             %
6425 %                                                                             %
6426 %                                                                             %
6427 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6428 %
6429 %  MagickMontageImage() creates a composite image by combining several
6430 %  separate images. The images are tiled on the composite image with the name
6431 %  of the image optionally appearing just below the individual tile.
6432 %
6433 %  The format of the MagickMontageImage method is:
6434 %
6435 %      MagickWand *MagickMontageImage(MagickWand *wand,
6436 %        const DrawingWand drawing_wand,const char *tile_geometry,
6437 %        const char *thumbnail_geometry,const MontageMode mode,
6438 %        const char *frame)
6439 %
6440 %  A description of each parameter follows:
6441 %
6442 %    o wand: the magick wand.
6443 %
6444 %    o drawing_wand: the drawing wand.  The font name, size, and color are
6445 %      obtained from this wand.
6446 %
6447 %    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6448 %
6449 %    o thumbnail_geometry: Preferred image size and border size of each
6450 %      thumbnail (e.g. 120x120+4+3>).
6451 %
6452 %    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6453 %
6454 %    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6455 %      The frame color is that of the thumbnail's matte color.
6456 %
6457 */
6458 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6459   const DrawingWand *drawing_wand,const char *tile_geometry,
6460   const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6461 {
6462   char
6463     *font;
6464
6465   Image
6466     *montage_image;
6467
6468   MontageInfo
6469     *montage_info;
6470
6471   PixelWand
6472     *pixel_wand;
6473
6474   assert(wand != (MagickWand *) NULL);
6475   assert(wand->signature == WandSignature);
6476   if (wand->debug != MagickFalse)
6477     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6478   if (wand->images == (Image *) NULL)
6479     return((MagickWand *) NULL);
6480   montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6481   switch (mode)
6482   {
6483     case FrameMode:
6484     {
6485       (void) CloneString(&montage_info->frame,"15x15+3+3");
6486       montage_info->shadow=MagickTrue;
6487       break;
6488     }
6489     case UnframeMode:
6490     {
6491       montage_info->frame=(char *) NULL;
6492       montage_info->shadow=MagickFalse;
6493       montage_info->border_width=0;
6494       break;
6495     }
6496     case ConcatenateMode:
6497     {
6498       montage_info->frame=(char *) NULL;
6499       montage_info->shadow=MagickFalse;
6500       (void) CloneString(&montage_info->geometry,"+0+0");
6501       montage_info->border_width=0;
6502       break;
6503     }
6504     default:
6505       break;
6506   }
6507   font=DrawGetFont(drawing_wand);
6508   if (font != (char *) NULL)
6509     (void) CloneString(&montage_info->font,font);
6510   if (frame != (char *) NULL)
6511     (void) CloneString(&montage_info->frame,frame);
6512   montage_info->pointsize=DrawGetFontSize(drawing_wand);
6513   pixel_wand=NewPixelWand();
6514   DrawGetFillColor(drawing_wand,pixel_wand);
6515   PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6516   DrawGetStrokeColor(drawing_wand,pixel_wand);
6517   PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6518   pixel_wand=DestroyPixelWand(pixel_wand);
6519   if (thumbnail_geometry != (char *) NULL)
6520     (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6521   if (tile_geometry != (char *) NULL)
6522     (void) CloneString(&montage_info->tile,tile_geometry);
6523   montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6524     wand->exception);
6525   montage_info=DestroyMontageInfo(montage_info);
6526   if (montage_image == (Image *) NULL)
6527     return((MagickWand *) NULL);
6528   return(CloneMagickWandFromImages(wand,montage_image));
6529 }
6530 \f
6531 /*
6532 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6533 %                                                                             %
6534 %                                                                             %
6535 %                                                                             %
6536 %   M a g i c k M o r p h I m a g e s                                         %
6537 %                                                                             %
6538 %                                                                             %
6539 %                                                                             %
6540 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6541 %
6542 %  MagickMorphImages() method morphs a set of images.  Both the image pixels
6543 %  and size are linearly interpolated to give the appearance of a
6544 %  meta-morphosis from one image to the next.
6545 %
6546 %  The format of the MagickMorphImages method is:
6547 %
6548 %      MagickWand *MagickMorphImages(MagickWand *wand,
6549 %        const size_t number_frames)
6550 %
6551 %  A description of each parameter follows:
6552 %
6553 %    o wand: the magick wand.
6554 %
6555 %    o number_frames: the number of in-between images to generate.
6556 %
6557 */
6558 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6559   const size_t number_frames)
6560 {
6561   Image
6562     *morph_image;
6563
6564   assert(wand != (MagickWand *) NULL);
6565   assert(wand->signature == WandSignature);
6566   if (wand->debug != MagickFalse)
6567     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6568   if (wand->images == (Image *) NULL)
6569     return((MagickWand *) NULL);
6570   morph_image=MorphImages(wand->images,number_frames,wand->exception);
6571   if (morph_image == (Image *) NULL)
6572     return((MagickWand *) NULL);
6573   return(CloneMagickWandFromImages(wand,morph_image));
6574 }
6575 \f
6576 /*
6577 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6578 %                                                                             %
6579 %                                                                             %
6580 %                                                                             %
6581 %   M a g i c k M o r p h o l o g y I m a g e                                 %
6582 %                                                                             %
6583 %                                                                             %
6584 %                                                                             %
6585 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6586 %
6587 %  MagickMorphologyImage() applies a user supplied kernel to the image
6588 %  according to the given mophology method.
6589 %
6590 %  The format of the MagickMorphologyImage method is:
6591 %
6592 %      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6593 %        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6594 %
6595 %  A description of each parameter follows:
6596 %
6597 %    o wand: the magick wand.
6598 %
6599 %    o method: the morphology method to be applied.
6600 %
6601 %    o iterations: apply the operation this many times (or no change).
6602 %      A value of -1 means loop until no change found.  How this is applied
6603 %      may depend on the morphology method.  Typically this is a value of 1.
6604 %
6605 %    o kernel: An array of doubles representing the morphology kernel.
6606 %
6607 */
6608 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6609   MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6610 {
6611   Image
6612     *morphology_image;
6613
6614   assert(wand != (MagickWand *) NULL);
6615   assert(wand->signature == WandSignature);
6616   if (wand->debug != MagickFalse)
6617     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6618   if (kernel == (const KernelInfo *) NULL)
6619     return(MagickFalse);
6620   if (wand->images == (Image *) NULL)
6621     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6622   morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6623     wand->exception);
6624   if (morphology_image == (Image *) NULL)
6625     return(MagickFalse);
6626   ReplaceImageInList(&wand->images,morphology_image);
6627   return(MagickTrue);
6628 }
6629 \f
6630 /*
6631 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6632 %                                                                             %
6633 %                                                                             %
6634 %                                                                             %
6635 %   M a g i c k M o t i o n B l u r I m a g e                                 %
6636 %                                                                             %
6637 %                                                                             %
6638 %                                                                             %
6639 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6640 %
6641 %  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6642 %  Gaussian operator of the given radius and standard deviation (sigma).
6643 %  For reasonable results, radius should be larger than sigma.  Use a
6644 %  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6645 %  Angle gives the angle of the blurring motion.
6646 %
6647 %  The format of the MagickMotionBlurImage method is:
6648 %
6649 %      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6650 %        const double radius,const double sigma,const double angle,
6651 %        const double bias)
6652 %
6653 %  A description of each parameter follows:
6654 %
6655 %    o wand: the magick wand.
6656 %
6657 %    o radius: the radius of the Gaussian, in pixels, not counting
6658 %      the center pixel.
6659 %
6660 %    o sigma: the standard deviation of the Gaussian, in pixels.
6661 %
6662 %    o angle: Apply the effect along this angle.
6663 %
6664 */
6665 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6666   const double radius,const double sigma,const double angle,const double bias)
6667 {
6668   Image
6669     *blur_image;
6670
6671   assert(wand != (MagickWand *) NULL);
6672   assert(wand->signature == WandSignature);
6673   if (wand->debug != MagickFalse)
6674     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6675   if (wand->images == (Image *) NULL)
6676     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6677   blur_image=MotionBlurImage(wand->images,radius,sigma,angle,bias,
6678     wand->exception);
6679   if (blur_image == (Image *) NULL)
6680     return(MagickFalse);
6681   ReplaceImageInList(&wand->images,blur_image);
6682   return(MagickTrue);
6683 }
6684 \f
6685 /*
6686 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6687 %                                                                             %
6688 %                                                                             %
6689 %                                                                             %
6690 %   M a g i c k N e g a t e I m a g e                                         %
6691 %                                                                             %
6692 %                                                                             %
6693 %                                                                             %
6694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6695 %
6696 %  MagickNegateImage() negates the colors in the reference image.  The
6697 %  Grayscale option means that only grayscale values within the image are
6698 %  negated.
6699 %
6700 %  You can also reduce the influence of a particular channel with a gamma
6701 %  value of 0.
6702 %
6703 %  The format of the MagickNegateImage method is:
6704 %
6705 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
6706 %        const MagickBooleanType gray)
6707 %
6708 %  A description of each parameter follows:
6709 %
6710 %    o wand: the magick wand.
6711 %
6712 %    o gray: If MagickTrue, only negate grayscale pixels within the image.
6713 %
6714 */
6715 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6716   const MagickBooleanType gray)
6717 {
6718   MagickBooleanType
6719     status;
6720
6721   assert(wand != (MagickWand *) NULL);
6722   assert(wand->signature == WandSignature);
6723   if (wand->debug != MagickFalse)
6724     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6725   if (wand->images == (Image *) NULL)
6726     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6727   status=NegateImage(wand->images,gray,wand->exception);
6728   return(status);
6729 }
6730 \f
6731 /*
6732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6733 %                                                                             %
6734 %                                                                             %
6735 %                                                                             %
6736 %   M a g i c k N e w I m a g e                                               %
6737 %                                                                             %
6738 %                                                                             %
6739 %                                                                             %
6740 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6741 %
6742 %  MagickNewImage() adds a blank image canvas of the specified size and
6743 %  background color to the wand.
6744 %
6745 %  The format of the MagickNewImage method is:
6746 %
6747 %      MagickBooleanType MagickNewImage(MagickWand *wand,
6748 %        const size_t columns,const size_t rows,
6749 %        const PixelWand *background)
6750 %
6751 %  A description of each parameter follows:
6752 %
6753 %    o wand: the magick wand.
6754 %
6755 %    o width: the image width.
6756 %
6757 %    o height: the image height.
6758 %
6759 %    o background: the image color.
6760 %
6761 */
6762 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,const size_t width,
6763   const size_t height,const PixelWand *background)
6764 {
6765   Image
6766     *images;
6767
6768   PixelInfo
6769     pixel;
6770
6771   assert(wand != (MagickWand *) NULL);
6772   assert(wand->signature == WandSignature);
6773   if (wand->debug != MagickFalse)
6774     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6775   PixelGetMagickColor(background,&pixel);
6776   images=NewMagickImage(wand->image_info,width,height,&pixel,wand->exception);
6777   if (images == (Image *) NULL)
6778     return(MagickFalse);
6779   return(InsertImageInWand(wand,images));
6780 }
6781 \f
6782 /*
6783 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6784 %                                                                             %
6785 %                                                                             %
6786 %                                                                             %
6787 %   M a g i c k N e x t I m a g e                                             %
6788 %                                                                             %
6789 %                                                                             %
6790 %                                                                             %
6791 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6792 %
6793 %  MagickNextImage() associates the next image in the image list with a magick
6794 %  wand.  It returns true if the it succeeds, meaning the current image is the
6795 %  next image to be iterated over.
6796 %
6797 %  The format of the MagickNextImage method is:
6798 %
6799 %      MagickBooleanType MagickNextImage(MagickWand *wand)
6800 %
6801 %  A description of each parameter follows:
6802 %
6803 %    o wand: the magick wand.
6804 %
6805 */
6806 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
6807 {
6808   assert(wand != (MagickWand *) NULL);
6809   assert(wand->signature == WandSignature);
6810   if (wand->debug != MagickFalse)
6811     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6812   if (wand->images == (Image *) NULL)
6813     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6814   /* If current image is 'pending' just return true.  */
6815   if (wand->image_pending != MagickFalse)
6816     {
6817       wand->image_pending=MagickFalse;
6818       return(MagickTrue);
6819     }
6820   /* If there is no next image, (Iterator is finished) */
6821   if (GetNextImageInList(wand->images) == (Image *) NULL)
6822       return(MagickFalse);
6823   /* just move to next image - current image is not 'pending' */
6824   wand->images=GetNextImageInList(wand->images);
6825   return(MagickTrue);
6826 }
6827 \f
6828 /*
6829 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6830 %                                                                             %
6831 %                                                                             %
6832 %                                                                             %
6833 %   M a g i c k N o r m a l i z e I m a g e                                   %
6834 %                                                                             %
6835 %                                                                             %
6836 %                                                                             %
6837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6838 %
6839 %  MagickNormalizeImage() enhances the contrast of a color image by adjusting
6840 %  the pixels color to span the entire range of colors available
6841 %
6842 %  You can also reduce the influence of a particular channel with a gamma
6843 %  value of 0.
6844 %
6845 %  The format of the MagickNormalizeImage method is:
6846 %
6847 %      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6848 %
6849 %  A description of each parameter follows:
6850 %
6851 %    o wand: the magick wand.
6852 %
6853 */
6854 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6855 {
6856   MagickBooleanType
6857     status;
6858
6859   assert(wand != (MagickWand *) NULL);
6860   assert(wand->signature == WandSignature);
6861   if (wand->debug != MagickFalse)
6862     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6863   if (wand->images == (Image *) NULL)
6864     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6865   status=NormalizeImage(wand->images,wand->exception);
6866   return(status);
6867 }
6868 \f
6869 /*
6870 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6871 %                                                                             %
6872 %                                                                             %
6873 %                                                                             %
6874 %   M a g i c k O i l P a i n t I m a g e                                     %
6875 %                                                                             %
6876 %                                                                             %
6877 %                                                                             %
6878 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6879 %
6880 %  MagickOilPaintImage() applies a special effect filter that simulates an oil
6881 %  painting.  Each pixel is replaced by the most frequent color occurring
6882 %  in a circular region defined by radius.
6883 %
6884 %  The format of the MagickOilPaintImage method is:
6885 %
6886 %      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6887 %        const double radius,const double sigma)
6888 %
6889 %  A description of each parameter follows:
6890 %
6891 %    o wand: the magick wand.
6892 %
6893 %    o radius: the radius of the circular neighborhood.
6894 %
6895 %    o sigma: the standard deviation of the Gaussian, in pixels.
6896 %
6897 */
6898 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6899   const double radius,const double sigma)
6900 {
6901   Image
6902     *paint_image;
6903
6904   assert(wand != (MagickWand *) NULL);
6905   assert(wand->signature == WandSignature);
6906   if (wand->debug != MagickFalse)
6907     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6908   if (wand->images == (Image *) NULL)
6909     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6910   paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
6911   if (paint_image == (Image *) NULL)
6912     return(MagickFalse);
6913   ReplaceImageInList(&wand->images,paint_image);
6914   return(MagickTrue);
6915 }
6916 \f
6917 /*
6918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6919 %                                                                             %
6920 %                                                                             %
6921 %                                                                             %
6922 %   M a g i c k O p a q u e P a i n t I m a g e                               %
6923 %                                                                             %
6924 %                                                                             %
6925 %                                                                             %
6926 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6927 %
6928 %  MagickOpaquePaintImage() changes any pixel that matches color with the color
6929 %  defined by fill.
6930 %
6931 %  The format of the MagickOpaquePaintImage method is:
6932 %
6933 %      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6934 %        const PixelWand *target,const PixelWand *fill,const double fuzz,
6935 %        const MagickBooleanType invert)
6936 %
6937 %  A description of each parameter follows:
6938 %
6939 %    o wand: the magick wand.
6940 %
6941 %    o target: Change this target color to the fill color within the image.
6942 %
6943 %    o fill: the fill pixel wand.
6944 %
6945 %    o fuzz: By default target must match a particular pixel color
6946 %      exactly.  However, in many cases two colors may differ by a small amount.
6947 %      The fuzz member of image defines how much tolerance is acceptable to
6948 %      consider two colors as the same.  For example, set fuzz to 10 and the
6949 %      color red at intensities of 100 and 102 respectively are now interpreted
6950 %      as the same color for the purposes of the floodfill.
6951 %
6952 %    o invert: paint any pixel that does not match the target color.
6953 %
6954 */
6955 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6956   const PixelWand *target,const PixelWand *fill,const double fuzz,
6957   const MagickBooleanType invert)
6958 {
6959   MagickBooleanType
6960     status;
6961
6962   PixelInfo
6963     fill_pixel,
6964     target_pixel;
6965
6966   assert(wand != (MagickWand *) NULL);
6967   assert(wand->signature == WandSignature);
6968   if (wand->debug != MagickFalse)
6969     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6970   if (wand->images == (Image *) NULL)
6971     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6972   PixelGetMagickColor(target,&target_pixel);
6973   PixelGetMagickColor(fill,&fill_pixel);
6974   wand->images->fuzz=fuzz;
6975   status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
6976     wand->exception);
6977   return(status);
6978 }
6979 \f
6980 /*
6981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6982 %                                                                             %
6983 %                                                                             %
6984 %                                                                             %
6985 %   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                         %
6986 %                                                                             %
6987 %                                                                             %
6988 %                                                                             %
6989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6990 %
6991 %  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
6992 %  previous image in the sequence.  From this it attempts to select the
6993 %  smallest cropped image to replace each frame, while preserving the results
6994 %  of the animation.
6995 %
6996 %  The format of the MagickOptimizeImageLayers method is:
6997 %
6998 %      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6999 %
7000 %  A description of each parameter follows:
7001 %
7002 %    o wand: the magick wand.
7003 %
7004 */
7005 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7006 {
7007   Image
7008     *optimize_image;
7009
7010   assert(wand != (MagickWand *) NULL);
7011   assert(wand->signature == WandSignature);
7012   if (wand->debug != MagickFalse)
7013     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7014   if (wand->images == (Image *) NULL)
7015     return((MagickWand *) NULL);
7016   optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7017   if (optimize_image == (Image *) NULL)
7018     return((MagickWand *) NULL);
7019   return(CloneMagickWandFromImages(wand,optimize_image));
7020 }
7021 \f
7022 /*
7023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7024 %                                                                             %
7025 %                                                                             %
7026 %                                                                             %
7027 %     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                   %
7028 %                                                                             %
7029 %                                                                             %
7030 %                                                                             %
7031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7032 %
7033 %  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7034 %  of pre-defined dithering threshold maps, but over multiple intensity levels,
7035 %  which can be different for different channels, according to the input
7036 %  arguments.
7037 %
7038 %  The format of the MagickOrderedPosterizeImage method is:
7039 %
7040 %      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7041 %        const char *threshold_map)
7042 %
7043 %  A description of each parameter follows:
7044 %
7045 %    o image: the image.
7046 %
7047 %    o threshold_map: A string containing the name of the threshold dither
7048 %      map to use, followed by zero or more numbers representing the number of
7049 %      color levels tho dither between.
7050 %
7051 %      Any level number less than 2 is equivalent to 2, and means only binary
7052 %      dithering will be applied to each color channel.
7053 %
7054 %      No numbers also means a 2 level (bitmap) dither will be applied to all
7055 %      channels, while a single number is the number of levels applied to each
7056 %      channel in sequence.  More numbers will be applied in turn to each of
7057 %      the color channels.
7058 %
7059 %      For example: "o3x3,6" generates a 6 level posterization of the image
7060 %      with a ordered 3x3 diffused pixel dither being applied between each
7061 %      level. While checker,8,8,4 will produce a 332 colormaped image with
7062 %      only a single checkerboard hash pattern (50% grey) between each color
7063 %      level, to basically double the number of color levels with a bare
7064 %      minimim of dithering.
7065 %
7066 */
7067 WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7068   const char *threshold_map)
7069 {
7070   MagickBooleanType
7071     status;
7072
7073   assert(wand != (MagickWand *) NULL);
7074   assert(wand->signature == WandSignature);
7075   if (wand->debug != MagickFalse)
7076     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7077   if (wand->images == (Image *) NULL)
7078     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7079   status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7080   return(status);
7081 }
7082 \f
7083 /*
7084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7085 %                                                                             %
7086 %                                                                             %
7087 %                                                                             %
7088 %   M a g i c k P i n g I m a g e                                             %
7089 %                                                                             %
7090 %                                                                             %
7091 %                                                                             %
7092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7093 %
7094 %  MagickPingImage() is the same as MagickReadImage() except the only valid
7095 %  information returned is the image width, height, size, and format.  It
7096 %  is designed to efficiently obtain this information from a file without
7097 %  reading the entire image sequence into memory.
7098 %
7099 %  The format of the MagickPingImage method is:
7100 %
7101 %      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7102 %
7103 %  A description of each parameter follows:
7104 %
7105 %    o wand: the magick wand.
7106 %
7107 %    o filename: the image filename.
7108 %
7109 */
7110 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7111   const char *filename)
7112 {
7113   Image
7114     *images;
7115
7116   ImageInfo
7117     *ping_info;
7118
7119   assert(wand != (MagickWand *) NULL);
7120   assert(wand->signature == WandSignature);
7121   if (wand->debug != MagickFalse)
7122     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7123   ping_info=CloneImageInfo(wand->image_info);
7124   if (filename != (const char *) NULL)
7125     (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7126   images=PingImage(ping_info,wand->exception);
7127   ping_info=DestroyImageInfo(ping_info);
7128   if (images == (Image *) NULL)
7129     return(MagickFalse);
7130   return(InsertImageInWand(wand,images));
7131 }
7132 \f
7133 /*
7134 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7135 %                                                                             %
7136 %                                                                             %
7137 %                                                                             %
7138 %   M a g i c k P i n g I m a g e B l o b                                     %
7139 %                                                                             %
7140 %                                                                             %
7141 %                                                                             %
7142 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7143 %
7144 %  MagickPingImageBlob() pings an image or image sequence from a blob.
7145 %
7146 %  The format of the MagickPingImageBlob method is:
7147 %
7148 %      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7149 %        const void *blob,const size_t length)
7150 %
7151 %  A description of each parameter follows:
7152 %
7153 %    o wand: the magick wand.
7154 %
7155 %    o blob: the blob.
7156 %
7157 %    o length: the blob length.
7158 %
7159 */
7160 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7161   const void *blob,const size_t length)
7162 {
7163   Image
7164     *images;
7165
7166   ImageInfo
7167     *read_info;
7168
7169   assert(wand != (MagickWand *) NULL);
7170   assert(wand->signature == WandSignature);
7171   if (wand->debug != MagickFalse)
7172     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7173   read_info=CloneImageInfo(wand->image_info);
7174   SetImageInfoBlob(read_info,blob,length);
7175   images=PingImage(read_info,wand->exception);
7176   read_info=DestroyImageInfo(read_info);
7177   if (images == (Image *) NULL)
7178     return(MagickFalse);
7179   return(InsertImageInWand(wand,images));
7180 }
7181 \f
7182 /*
7183 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7184 %                                                                             %
7185 %                                                                             %
7186 %                                                                             %
7187 %   M a g i c k P i n g I m a g e F i l e                                     %
7188 %                                                                             %
7189 %                                                                             %
7190 %                                                                             %
7191 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7192 %
7193 %  MagickPingImageFile() pings an image or image sequence from an open file
7194 %  descriptor.
7195 %
7196 %  The format of the MagickPingImageFile method is:
7197 %
7198 %      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7199 %
7200 %  A description of each parameter follows:
7201 %
7202 %    o wand: the magick wand.
7203 %
7204 %    o file: the file descriptor.
7205 %
7206 */
7207 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7208 {
7209   Image
7210     *images;
7211
7212   ImageInfo
7213     *read_info;
7214
7215   assert(wand != (MagickWand *) NULL);
7216   assert(wand->signature == WandSignature);
7217   assert(file != (FILE *) NULL);
7218   if (wand->debug != MagickFalse)
7219     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7220   read_info=CloneImageInfo(wand->image_info);
7221   SetImageInfoFile(read_info,file);
7222   images=PingImage(read_info,wand->exception);
7223   read_info=DestroyImageInfo(read_info);
7224   if (images == (Image *) NULL)
7225     return(MagickFalse);
7226   return(InsertImageInWand(wand,images));
7227 }
7228 \f
7229 /*
7230 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7231 %                                                                             %
7232 %                                                                             %
7233 %                                                                             %
7234 %   M a g i c k P o l a r o i d I m a g e                                     %
7235 %                                                                             %
7236 %                                                                             %
7237 %                                                                             %
7238 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7239 %
7240 %  MagickPolaroidImage() simulates a Polaroid picture.
7241 %
7242 %  The format of the MagickPolaroidImage method is:
7243 %
7244 %      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7245 %        const DrawingWand *drawing_wand,const char *caption,const double angle,
7246 %        const PixelInterpolateMethod method)
7247 %
7248 %  A description of each parameter follows:
7249 %
7250 %    o wand: the magick wand.
7251 %
7252 %    o drawing_wand: the draw wand.
7253 %
7254 %    o caption: the Polaroid caption.
7255 %
7256 %    o angle: Apply the effect along this angle.
7257 %
7258 %    o method: the pixel interpolation method.
7259 %
7260 */
7261 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7262   const DrawingWand *drawing_wand,const char *caption,const double angle,
7263   const PixelInterpolateMethod method)
7264 {
7265   DrawInfo
7266     *draw_info;
7267
7268   Image
7269     *polaroid_image;
7270
7271   assert(wand != (MagickWand *) NULL);
7272   assert(wand->signature == WandSignature);
7273   if (wand->debug != MagickFalse)
7274     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7275   if (wand->images == (Image *) NULL)
7276     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7277   draw_info=PeekDrawingWand(drawing_wand);
7278   if (draw_info == (DrawInfo *) NULL)
7279     return(MagickFalse);
7280   polaroid_image=PolaroidImage(wand->images,draw_info,caption,angle,method,
7281     wand->exception);
7282   if (polaroid_image == (Image *) NULL)
7283     return(MagickFalse);
7284   ReplaceImageInList(&wand->images,polaroid_image);
7285   return(MagickTrue);
7286 }
7287 \f
7288 /*
7289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7290 %                                                                             %
7291 %                                                                             %
7292 %                                                                             %
7293 %   M a g i c k P o s t e r i z e I m a g e                                   %
7294 %                                                                             %
7295 %                                                                             %
7296 %                                                                             %
7297 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7298 %
7299 %  MagickPosterizeImage() reduces the image to a limited number of color level.
7300 %
7301 %  The format of the MagickPosterizeImage method is:
7302 %
7303 %      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7304 %        const unsigned levels,const MagickBooleanType dither)
7305 %
7306 %  A description of each parameter follows:
7307 %
7308 %    o wand: the magick wand.
7309 %
7310 %    o levels: Number of color levels allowed in each channel.  Very low values
7311 %      (2, 3, or 4) have the most visible effect.
7312 %
7313 %    o dither: Set this integer value to something other than zero to dither
7314 %      the mapped image.
7315 %
7316 */
7317 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7318   const size_t levels,const MagickBooleanType dither)
7319 {
7320   MagickBooleanType
7321     status;
7322
7323   assert(wand != (MagickWand *) NULL);
7324   assert(wand->signature == WandSignature);
7325   if (wand->debug != MagickFalse)
7326     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7327   if (wand->images == (Image *) NULL)
7328     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7329   status=PosterizeImage(wand->images,levels,dither,wand->exception);
7330   return(status);
7331 }
7332 \f
7333 /*
7334 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7335 %                                                                             %
7336 %                                                                             %
7337 %                                                                             %
7338 %   M a g i c k P r e v i e w I m a g e s                                     %
7339 %                                                                             %
7340 %                                                                             %
7341 %                                                                             %
7342 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7343 %
7344 %  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7345 %  image processing operation applied at varying strengths.  This helpful
7346 %  to quickly pin-point an appropriate parameter for an image processing
7347 %  operation.
7348 %
7349 %  The format of the MagickPreviewImages method is:
7350 %
7351 %      MagickWand *MagickPreviewImages(MagickWand *wand,
7352 %        const PreviewType preview)
7353 %
7354 %  A description of each parameter follows:
7355 %
7356 %    o wand: the magick wand.
7357 %
7358 %    o preview: the preview type.
7359 %
7360 */
7361 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7362   const PreviewType preview)
7363 {
7364   Image
7365     *preview_image;
7366
7367   assert(wand != (MagickWand *) NULL);
7368   assert(wand->signature == WandSignature);
7369   if (wand->debug != MagickFalse)
7370     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7371   if (wand->images == (Image *) NULL)
7372     return((MagickWand *) NULL);
7373   preview_image=PreviewImage(wand->images,preview,wand->exception);
7374   if (preview_image == (Image *) NULL)
7375     return((MagickWand *) NULL);
7376   return(CloneMagickWandFromImages(wand,preview_image));
7377 }
7378 \f
7379 /*
7380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7381 %                                                                             %
7382 %                                                                             %
7383 %                                                                             %
7384 %   M a g i c k P r e v i o u s I m a g e                                     %
7385 %                                                                             %
7386 %                                                                             %
7387 %                                                                             %
7388 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7389 %
7390 %  MagickPreviousImage() assocates the previous image in an image list with
7391 %  the magick wand.
7392 %
7393 %  The format of the MagickPreviousImage method is:
7394 %
7395 %      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7396 %
7397 %  A description of each parameter follows:
7398 %
7399 %    o wand: the magick wand.
7400 %
7401 */
7402 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7403 {
7404   assert(wand != (MagickWand *) NULL);
7405   assert(wand->signature == WandSignature);
7406   if (wand->debug != MagickFalse)
7407     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7408   if (wand->images == (Image *) NULL)
7409     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7410
7411   wand->image_pending=MagickFalse;  /* pending status has no meaning */
7412   /* If there is no prev image, return false (Iterator is finished) */
7413   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7414       return(MagickFalse);
7415   /* just do it - current image is not 'pending' */
7416   wand->images=GetPreviousImageInList(wand->images);
7417   return(MagickTrue);
7418 }
7419 \f
7420 /*
7421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7422 %                                                                             %
7423 %                                                                             %
7424 %                                                                             %
7425 %   M a g i c k Q u a n t i z e I m a g e                                     %
7426 %                                                                             %
7427 %                                                                             %
7428 %                                                                             %
7429 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7430 %
7431 %  MagickQuantizeImage() analyzes the colors within a reference image and
7432 %  chooses a fixed number of colors to represent the image.  The goal of the
7433 %  algorithm is to minimize the color difference between the input and output
7434 %  image while minimizing the processing time.
7435 %
7436 %  The format of the MagickQuantizeImage method is:
7437 %
7438 %      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7439 %        const size_t number_colors,const ColorspaceType colorspace,
7440 %        const size_t treedepth,const MagickBooleanType dither,
7441 %        const MagickBooleanType measure_error)
7442 %
7443 %  A description of each parameter follows:
7444 %
7445 %    o wand: the magick wand.
7446 %
7447 %    o number_colors: the number of colors.
7448 %
7449 %    o colorspace: Perform color reduction in this colorspace, typically
7450 %      RGBColorspace.
7451 %
7452 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7453 %      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
7454 %      reference image with the least amount of memory and the fastest
7455 %      computational speed.  In some cases, such as an image with low color
7456 %      dispersion (a few number of colors), a value other than
7457 %      Log4(number_colors) is required.  To expand the color tree completely,
7458 %      use a value of 8.
7459 %
7460 %    o dither: A value other than zero distributes the difference between an
7461 %      original image and the corresponding color reduced image to
7462 %      neighboring pixels along a Hilbert curve.
7463 %
7464 %    o measure_error: A value other than zero measures the difference between
7465 %      the original and quantized images.  This difference is the total
7466 %      quantization error.  The error is computed by summing over all pixels
7467 %      in an image the distance squared in RGB space between each reference
7468 %      pixel value and its quantized value.
7469 %
7470 */
7471 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7472   const size_t number_colors,const ColorspaceType colorspace,
7473   const size_t treedepth,const MagickBooleanType dither,
7474   const MagickBooleanType measure_error)
7475 {
7476   MagickBooleanType
7477     status;
7478
7479   QuantizeInfo
7480     *quantize_info;
7481
7482   assert(wand != (MagickWand *) NULL);
7483   assert(wand->signature == WandSignature);
7484   if (wand->debug != MagickFalse)
7485     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7486   if (wand->images == (Image *) NULL)
7487     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7488   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7489   quantize_info->number_colors=number_colors;
7490   quantize_info->dither=dither;
7491   quantize_info->tree_depth=treedepth;
7492   quantize_info->colorspace=colorspace;
7493   quantize_info->measure_error=measure_error;
7494   status=QuantizeImage(quantize_info,wand->images,wand->exception);
7495   quantize_info=DestroyQuantizeInfo(quantize_info);
7496   return(status);
7497 }
7498 \f
7499 /*
7500 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7501 %                                                                             %
7502 %                                                                             %
7503 %                                                                             %
7504 %   M a g i c k Q u a n t i z e I m a g e s                                   %
7505 %                                                                             %
7506 %                                                                             %
7507 %                                                                             %
7508 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7509 %
7510 %  MagickQuantizeImages() analyzes the colors within a sequence of images and
7511 %  chooses a fixed number of colors to represent the image.  The goal of the
7512 %  algorithm is to minimize the color difference between the input and output
7513 %  image while minimizing the processing time.
7514 %
7515 %  The format of the MagickQuantizeImages method is:
7516 %
7517 %      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7518 %        const size_t number_colors,const ColorspaceType colorspace,
7519 %        const size_t treedepth,const MagickBooleanType dither,
7520 %        const MagickBooleanType measure_error)
7521 %
7522 %  A description of each parameter follows:
7523 %
7524 %    o wand: the magick wand.
7525 %
7526 %    o number_colors: the number of colors.
7527 %
7528 %    o colorspace: Perform color reduction in this colorspace, typically
7529 %      RGBColorspace.
7530 %
7531 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7532 %      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
7533 %      reference image with the least amount of memory and the fastest
7534 %      computational speed.  In some cases, such as an image with low color
7535 %      dispersion (a few number of colors), a value other than
7536 %      Log4(number_colors) is required.  To expand the color tree completely,
7537 %      use a value of 8.
7538 %
7539 %    o dither: A value other than zero distributes the difference between an
7540 %      original image and the corresponding color reduced algorithm to
7541 %      neighboring pixels along a Hilbert curve.
7542 %
7543 %    o measure_error: A value other than zero measures the difference between
7544 %      the original and quantized images.  This difference is the total
7545 %      quantization error.  The error is computed by summing over all pixels
7546 %      in an image the distance squared in RGB space between each reference
7547 %      pixel value and its quantized value.
7548 %
7549 */
7550 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7551   const size_t number_colors,const ColorspaceType colorspace,
7552   const size_t treedepth,const MagickBooleanType dither,
7553   const MagickBooleanType measure_error)
7554 {
7555   MagickBooleanType
7556     status;
7557
7558   QuantizeInfo
7559     *quantize_info;
7560
7561   assert(wand != (MagickWand *) NULL);
7562   assert(wand->signature == WandSignature);
7563   if (wand->debug != MagickFalse)
7564     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7565   if (wand->images == (Image *) NULL)
7566     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7567   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7568   quantize_info->number_colors=number_colors;
7569   quantize_info->dither=dither;
7570   quantize_info->tree_depth=treedepth;
7571   quantize_info->colorspace=colorspace;
7572   quantize_info->measure_error=measure_error;
7573   status=QuantizeImages(quantize_info,wand->images,wand->exception);
7574   quantize_info=DestroyQuantizeInfo(quantize_info);
7575   return(status);
7576 }
7577 \f
7578 /*
7579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7580 %                                                                             %
7581 %                                                                             %
7582 %                                                                             %
7583 %   M a g i c k R a d i a l B l u r I m a g e                                 %
7584 %                                                                             %
7585 %                                                                             %
7586 %                                                                             %
7587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7588 %
7589 %  MagickRadialBlurImage() radial blurs an image.
7590 %
7591 %  The format of the MagickRadialBlurImage method is:
7592 %
7593 %      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7594 %        const double angle,const double bias)
7595 %
7596 %  A description of each parameter follows:
7597 %
7598 %    o wand: the magick wand.
7599 %
7600 %    o angle: the angle of the blur in degrees.
7601 %
7602 %    o bias: the bias.
7603 %
7604 */
7605 WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7606   const double angle,const double bias)
7607 {
7608   Image
7609     *blur_image;
7610
7611   assert(wand != (MagickWand *) NULL);
7612   assert(wand->signature == WandSignature);
7613   if (wand->debug != MagickFalse)
7614     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7615   if (wand->images == (Image *) NULL)
7616     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7617   blur_image=RadialBlurImage(wand->images,angle,bias,wand->exception);
7618   if (blur_image == (Image *) NULL)
7619     return(MagickFalse);
7620   ReplaceImageInList(&wand->images,blur_image);
7621   return(MagickTrue);
7622 }
7623 \f
7624 /*
7625 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7626 %                                                                             %
7627 %                                                                             %
7628 %                                                                             %
7629 %   M a g i c k R a i s e I m a g e                                           %
7630 %                                                                             %
7631 %                                                                             %
7632 %                                                                             %
7633 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7634 %
7635 %  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7636 %  by lightening and darkening the edges of the image.  Members width and
7637 %  height of raise_info define the width of the vertical and horizontal
7638 %  edge of the effect.
7639 %
7640 %  The format of the MagickRaiseImage method is:
7641 %
7642 %      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7643 %        const size_t width,const size_t height,const ssize_t x,
7644 %        const ssize_t y,const MagickBooleanType raise)
7645 %
7646 %  A description of each parameter follows:
7647 %
7648 %    o wand: the magick wand.
7649 %
7650 %    o width,height,x,y:  Define the dimensions of the area to raise.
7651 %
7652 %    o raise: A value other than zero creates a 3-D raise effect,
7653 %      otherwise it has a lowered effect.
7654 %
7655 */
7656 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7657   const size_t width,const size_t height,const ssize_t x,
7658   const ssize_t y,const MagickBooleanType raise)
7659 {
7660   MagickBooleanType
7661     status;
7662
7663   RectangleInfo
7664     raise_info;
7665
7666   assert(wand != (MagickWand *) NULL);
7667   assert(wand->signature == WandSignature);
7668   if (wand->debug != MagickFalse)
7669     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7670   if (wand->images == (Image *) NULL)
7671     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7672   raise_info.width=width;
7673   raise_info.height=height;
7674   raise_info.x=x;
7675   raise_info.y=y;
7676   status=RaiseImage(wand->images,&raise_info,raise,wand->exception);
7677   return(status);
7678 }
7679 \f
7680 /*
7681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7682 %                                                                             %
7683 %                                                                             %
7684 %                                                                             %
7685 %   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                       %
7686 %                                                                             %
7687 %                                                                             %
7688 %                                                                             %
7689 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7690 %
7691 %  MagickRandomThresholdImage() changes the value of individual pixels based on
7692 %  the intensity of each pixel compared to threshold.  The result is a
7693 %  high-contrast, two color image.
7694 %
7695 %  The format of the MagickRandomThresholdImage method is:
7696 %
7697 %      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7698 %        const double low,const double high)
7699 %
7700 %  A description of each parameter follows:
7701 %
7702 %    o wand: the magick wand.
7703 %
7704 %    o low,high: Specify the high and low thresholds.  These values range from
7705 %      0 to QuantumRange.
7706 %
7707 */
7708 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7709   const double low,const double high)
7710 {
7711   char
7712     threshold[MaxTextExtent];
7713
7714   assert(wand != (MagickWand *) NULL);
7715   assert(wand->signature == WandSignature);
7716   if (wand->debug != MagickFalse)
7717     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7718   if (wand->images == (Image *) NULL)
7719     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7720   (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
7721   return(RandomThresholdImage(wand->images,threshold,wand->exception));
7722 }
7723 \f
7724 /*
7725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7726 %                                                                             %
7727 %                                                                             %
7728 %                                                                             %
7729 %   M a g i c k R e a d I m a g e                                             %
7730 %                                                                             %
7731 %                                                                             %
7732 %                                                                             %
7733 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7734 %
7735 %  MagickReadImage() reads an image or image sequence.  The images are inserted
7736 %  jjust before the current image pointer position.
7737 %
7738 %  Use MagickSetFirstIterator(), to insert new images before all the current
7739 %  images in the wand, MagickSetLastIterator() to append add to the end,
7740 %  MagickSetImageIndex() to place images just after the given index.
7741 %
7742 %  The format of the MagickReadImage method is:
7743 %
7744 %      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
7745 %
7746 %  A description of each parameter follows:
7747 %
7748 %    o wand: the magick wand.
7749 %
7750 %    o filename: the image filename.
7751 %
7752 */
7753 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
7754   const char *filename)
7755 {
7756   Image
7757     *images;
7758
7759   ImageInfo
7760     *read_info;
7761
7762   assert(wand != (MagickWand *) NULL);
7763   assert(wand->signature == WandSignature);
7764   if (wand->debug != MagickFalse)
7765     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7766   read_info=CloneImageInfo(wand->image_info);
7767   if (filename != (const char *) NULL)
7768     (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
7769   images=ReadImage(read_info,wand->exception);
7770   read_info=DestroyImageInfo(read_info);
7771   if (images == (Image *) NULL)
7772     return(MagickFalse);
7773   return(InsertImageInWand(wand,images));
7774 }
7775 \f
7776 /*
7777 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7778 %                                                                             %
7779 %                                                                             %
7780 %                                                                             %
7781 %   M a g i c k R e a d I m a g e B l o b                                     %
7782 %                                                                             %
7783 %                                                                             %
7784 %                                                                             %
7785 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7786 %
7787 %  MagickReadImageBlob() reads an image or image sequence from a blob.
7788 %  In all other respects it is like MagickReadImage().
7789 %
7790 %  The format of the MagickReadImageBlob method is:
7791 %
7792 %      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7793 %        const void *blob,const size_t length)
7794 %
7795 %  A description of each parameter follows:
7796 %
7797 %    o wand: the magick wand.
7798 %
7799 %    o blob: the blob.
7800 %
7801 %    o length: the blob length.
7802 %
7803 */
7804 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7805   const void *blob,const size_t length)
7806 {
7807   Image
7808     *images;
7809
7810   assert(wand != (MagickWand *) NULL);
7811   assert(wand->signature == WandSignature);
7812   if (wand->debug != MagickFalse)
7813     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7814   images=BlobToImage(wand->image_info,blob,length,wand->exception);
7815   if (images == (Image *) NULL)
7816     return(MagickFalse);
7817   return(InsertImageInWand(wand,images));
7818 }
7819 \f
7820 /*
7821 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7822 %                                                                             %
7823 %                                                                             %
7824 %                                                                             %
7825 %   M a g i c k R e a d I m a g e F i l e                                     %
7826 %                                                                             %
7827 %                                                                             %
7828 %                                                                             %
7829 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7830 %
7831 %  MagickReadImageFile() reads an image or image sequence from an already
7832 %  opened file descriptor.  Otherwise it is like MagickReadImage().
7833 %
7834 %  The format of the MagickReadImageFile method is:
7835 %
7836 %      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7837 %
7838 %  A description of each parameter follows:
7839 %
7840 %    o wand: the magick wand.
7841 %
7842 %    o file: the file descriptor.
7843 %
7844 */
7845 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7846 {
7847   Image
7848     *images;
7849
7850   ImageInfo
7851     *read_info;
7852
7853   assert(wand != (MagickWand *) NULL);
7854   assert(wand->signature == WandSignature);
7855   assert(file != (FILE *) NULL);
7856   if (wand->debug != MagickFalse)
7857     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7858   read_info=CloneImageInfo(wand->image_info);
7859   SetImageInfoFile(read_info,file);
7860   images=ReadImage(read_info,wand->exception);
7861   read_info=DestroyImageInfo(read_info);
7862   if (images == (Image *) NULL)
7863     return(MagickFalse);
7864   return(InsertImageInWand(wand,images));
7865 }
7866 \f
7867 /*
7868 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7869 %                                                                             %
7870 %                                                                             %
7871 %                                                                             %
7872 %   M a g i c k R e m a p I m a g e                                           %
7873 %                                                                             %
7874 %                                                                             %
7875 %                                                                             %
7876 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7877 %
7878 %  MagickRemapImage() replaces the colors of an image with the closest color
7879 %  from a reference image.
7880 %
7881 %  The format of the MagickRemapImage method is:
7882 %
7883 %      MagickBooleanType MagickRemapImage(MagickWand *wand,
7884 %        const MagickWand *remap_wand,const DitherMethod method)
7885 %
7886 %  A description of each parameter follows:
7887 %
7888 %    o wand: the magick wand.
7889 %
7890 %    o affinity: the affinity wand.
7891 %
7892 %    o method: choose from these dither methods: NoDitherMethod,
7893 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7894 %
7895 */
7896 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
7897   const MagickWand *remap_wand,const DitherMethod method)
7898 {
7899   MagickBooleanType
7900     status;
7901
7902   QuantizeInfo
7903     *quantize_info;
7904
7905   assert(wand != (MagickWand *) NULL);
7906   assert(wand->signature == WandSignature);
7907   if (wand->debug != MagickFalse)
7908     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7909   if ((wand->images == (Image *) NULL) ||
7910       (remap_wand->images == (Image *) NULL))
7911     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7912   quantize_info=AcquireQuantizeInfo(wand->image_info);
7913   quantize_info->dither_method=method;
7914   if (method == NoDitherMethod)
7915     quantize_info->dither=MagickFalse;
7916   status=RemapImage(quantize_info,wand->images,remap_wand->images,
7917     wand->exception);
7918   quantize_info=DestroyQuantizeInfo(quantize_info);
7919   return(status);
7920 }
7921 \f
7922 /*
7923 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7924 %                                                                             %
7925 %                                                                             %
7926 %                                                                             %
7927 %   M a g i c k R e m o v e I m a g e                                         %
7928 %                                                                             %
7929 %                                                                             %
7930 %                                                                             %
7931 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7932 %
7933 %  MagickRemoveImage() removes an image from the image list.
7934 %
7935 %  The format of the MagickRemoveImage method is:
7936 %
7937 %      MagickBooleanType MagickRemoveImage(MagickWand *wand)
7938 %
7939 %  A description of each parameter follows:
7940 %
7941 %    o wand: the magick wand.
7942 %
7943 %    o insert: the splice wand.
7944 %
7945 */
7946 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
7947 {
7948   assert(wand != (MagickWand *) NULL);
7949   assert(wand->signature == WandSignature);
7950   if (wand->debug != MagickFalse)
7951     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7952   if (wand->images == (Image *) NULL)
7953     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7954   DeleteImageFromList(&wand->images);
7955   return(MagickTrue);
7956 }
7957 \f
7958 /*
7959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7960 %                                                                             %
7961 %                                                                             %
7962 %                                                                             %
7963 %   M a g i c k R e s a m p l e I m a g e                                     %
7964 %                                                                             %
7965 %                                                                             %
7966 %                                                                             %
7967 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7968 %
7969 %  MagickResampleImage() resample image to desired resolution.
7970 %
7971 %    Bessel   Blackman   Box
7972 %    Catrom   Cubic      Gaussian
7973 %    Hanning  Hermite    Lanczos
7974 %    Mitchell Point      Quandratic
7975 %    Sinc     Triangle
7976 %
7977 %  Most of the filters are FIR (finite impulse response), however, Bessel,
7978 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
7979 %  are windowed (brought down to zero) with the Blackman filter.
7980 %
7981 %  The format of the MagickResampleImage method is:
7982 %
7983 %      MagickBooleanType MagickResampleImage(MagickWand *wand,
7984 %        const double x_resolution,const double y_resolution,
7985 %        const FilterTypes filter,const double blur)
7986 %
7987 %  A description of each parameter follows:
7988 %
7989 %    o wand: the magick wand.
7990 %
7991 %    o x_resolution: the new image x resolution.
7992 %
7993 %    o y_resolution: the new image y resolution.
7994 %
7995 %    o filter: Image filter to use.
7996 %
7997 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
7998 %
7999 */
8000 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8001   const double x_resolution,const double y_resolution,const FilterTypes filter,
8002   const double blur)
8003 {
8004   Image
8005     *resample_image;
8006
8007   assert(wand != (MagickWand *) NULL);
8008   assert(wand->signature == WandSignature);
8009   if (wand->debug != MagickFalse)
8010     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8011   if (wand->images == (Image *) NULL)
8012     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8013   resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8014     blur,wand->exception);
8015   if (resample_image == (Image *) NULL)
8016     return(MagickFalse);
8017   ReplaceImageInList(&wand->images,resample_image);
8018   return(MagickTrue);
8019 }
8020 \f
8021 /*
8022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8023 %                                                                             %
8024 %                                                                             %
8025 %                                                                             %
8026 %   M a g i c k R e s e t I m a g e P a g e                                   %
8027 %                                                                             %
8028 %                                                                             %
8029 %                                                                             %
8030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8031 %
8032 %  MagickResetImagePage() resets the Wand page canvas and position.
8033 %
8034 %  The format of the MagickResetImagePage method is:
8035 %
8036 %      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8037 %        const char *page)
8038 %
8039 %  A description of each parameter follows:
8040 %
8041 %    o wand: the magick wand.
8042 %
8043 %    o page: the relative page specification.
8044 %
8045 */
8046 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8047   const char *page)
8048 {
8049   assert(wand != (MagickWand *) NULL);
8050   assert(wand->signature == WandSignature);
8051   if (wand->debug != MagickFalse)
8052     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8053   if (wand->images == (Image *) NULL)
8054     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8055   if ((page == (char *) NULL) || (*page == '\0'))
8056     {
8057       (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8058       return(MagickTrue);
8059     }
8060   return(ResetImagePage(wand->images,page));
8061 }
8062 \f
8063 /*
8064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8065 %                                                                             %
8066 %                                                                             %
8067 %                                                                             %
8068 %   M a g i c k R e s i z e I m a g e                                         %
8069 %                                                                             %
8070 %                                                                             %
8071 %                                                                             %
8072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8073 %
8074 %  MagickResizeImage() scales an image to the desired dimensions with one of
8075 %  these filters:
8076 %
8077 %    Bessel   Blackman   Box
8078 %    Catrom   Cubic      Gaussian
8079 %    Hanning  Hermite    Lanczos
8080 %    Mitchell Point      Quandratic
8081 %    Sinc     Triangle
8082 %
8083 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8084 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8085 %  are windowed (brought down to zero) with the Blackman filter.
8086 %
8087 %  The format of the MagickResizeImage method is:
8088 %
8089 %      MagickBooleanType MagickResizeImage(MagickWand *wand,
8090 %        const size_t columns,const size_t rows,
8091 %        const FilterTypes filter,const double blur)
8092 %
8093 %  A description of each parameter follows:
8094 %
8095 %    o wand: the magick wand.
8096 %
8097 %    o columns: the number of columns in the scaled image.
8098 %
8099 %    o rows: the number of rows in the scaled image.
8100 %
8101 %    o filter: Image filter to use.
8102 %
8103 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8104 %
8105 */
8106 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8107   const size_t columns,const size_t rows,const FilterTypes filter,
8108   const double blur)
8109 {
8110   Image
8111     *resize_image;
8112
8113   assert(wand != (MagickWand *) NULL);
8114   assert(wand->signature == WandSignature);
8115   if (wand->debug != MagickFalse)
8116     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8117   if (wand->images == (Image *) NULL)
8118     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8119   resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8120     wand->exception);
8121   if (resize_image == (Image *) NULL)
8122     return(MagickFalse);
8123   ReplaceImageInList(&wand->images,resize_image);
8124   return(MagickTrue);
8125 }
8126 \f
8127 /*
8128 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8129 %                                                                             %
8130 %                                                                             %
8131 %                                                                             %
8132 %   M a g i c k R o l l I m a g e                                             %
8133 %                                                                             %
8134 %                                                                             %
8135 %                                                                             %
8136 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8137 %
8138 %  MagickRollImage() offsets an image as defined by x and y.
8139 %
8140 %  The format of the MagickRollImage method is:
8141 %
8142 %      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8143 %        const size_t y)
8144 %
8145 %  A description of each parameter follows:
8146 %
8147 %    o wand: the magick wand.
8148 %
8149 %    o x: the x offset.
8150 %
8151 %    o y: the y offset.
8152 %
8153 %
8154 */
8155 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8156   const ssize_t x,const ssize_t y)
8157 {
8158   Image
8159     *roll_image;
8160
8161   assert(wand != (MagickWand *) NULL);
8162   assert(wand->signature == WandSignature);
8163   if (wand->debug != MagickFalse)
8164     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8165   if (wand->images == (Image *) NULL)
8166     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8167   roll_image=RollImage(wand->images,x,y,wand->exception);
8168   if (roll_image == (Image *) NULL)
8169     return(MagickFalse);
8170   ReplaceImageInList(&wand->images,roll_image);
8171   return(MagickTrue);
8172 }
8173 \f
8174 /*
8175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8176 %                                                                             %
8177 %                                                                             %
8178 %                                                                             %
8179 %   M a g i c k R o t a t e I m a g e                                         %
8180 %                                                                             %
8181 %                                                                             %
8182 %                                                                             %
8183 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8184 %
8185 %  MagickRotateImage() rotates an image the specified number of degrees. Empty
8186 %  triangles left over from rotating the image are filled with the
8187 %  background color.
8188 %
8189 %  The format of the MagickRotateImage method is:
8190 %
8191 %      MagickBooleanType MagickRotateImage(MagickWand *wand,
8192 %        const PixelWand *background,const double degrees)
8193 %
8194 %  A description of each parameter follows:
8195 %
8196 %    o wand: the magick wand.
8197 %
8198 %    o background: the background pixel wand.
8199 %
8200 %    o degrees: the number of degrees to rotate the image.
8201 %
8202 %
8203 */
8204 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8205   const PixelWand *background,const double degrees)
8206 {
8207   Image
8208     *rotate_image;
8209
8210   assert(wand != (MagickWand *) NULL);
8211   assert(wand->signature == WandSignature);
8212   if (wand->debug != MagickFalse)
8213     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8214   if (wand->images == (Image *) NULL)
8215     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8216   PixelGetQuantumPacket(background,&wand->images->background_color);
8217   rotate_image=RotateImage(wand->images,degrees,wand->exception);
8218   if (rotate_image == (Image *) NULL)
8219     return(MagickFalse);
8220   ReplaceImageInList(&wand->images,rotate_image);
8221   return(MagickTrue);
8222 }
8223 \f
8224 /*
8225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8226 %                                                                             %
8227 %                                                                             %
8228 %                                                                             %
8229 %   M a g i c k S a m p l e I m a g e                                         %
8230 %                                                                             %
8231 %                                                                             %
8232 %                                                                             %
8233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8234 %
8235 %  MagickSampleImage() scales an image to the desired dimensions with pixel
8236 %  sampling.  Unlike other scaling methods, this method does not introduce
8237 %  any additional color into the scaled image.
8238 %
8239 %  The format of the MagickSampleImage method is:
8240 %
8241 %      MagickBooleanType MagickSampleImage(MagickWand *wand,
8242 %        const size_t columns,const size_t rows)
8243 %
8244 %  A description of each parameter follows:
8245 %
8246 %    o wand: the magick wand.
8247 %
8248 %    o columns: the number of columns in the scaled image.
8249 %
8250 %    o rows: the number of rows in the scaled image.
8251 %
8252 %
8253 */
8254 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8255   const size_t columns,const size_t rows)
8256 {
8257   Image
8258     *sample_image;
8259
8260   assert(wand != (MagickWand *) NULL);
8261   assert(wand->signature == WandSignature);
8262   if (wand->debug != MagickFalse)
8263     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8264   if (wand->images == (Image *) NULL)
8265     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8266   sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8267   if (sample_image == (Image *) NULL)
8268     return(MagickFalse);
8269   ReplaceImageInList(&wand->images,sample_image);
8270   return(MagickTrue);
8271 }
8272 \f
8273 /*
8274 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8275 %                                                                             %
8276 %                                                                             %
8277 %                                                                             %
8278 %   M a g i c k S c a l e I m a g e                                           %
8279 %                                                                             %
8280 %                                                                             %
8281 %                                                                             %
8282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8283 %
8284 %  MagickScaleImage() scales the size of an image to the given dimensions.
8285 %
8286 %  The format of the MagickScaleImage method is:
8287 %
8288 %      MagickBooleanType MagickScaleImage(MagickWand *wand,
8289 %        const size_t columns,const size_t rows)
8290 %
8291 %  A description of each parameter follows:
8292 %
8293 %    o wand: the magick wand.
8294 %
8295 %    o columns: the number of columns in the scaled image.
8296 %
8297 %    o rows: the number of rows in the scaled image.
8298 %
8299 %
8300 */
8301 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8302   const size_t columns,const size_t rows)
8303 {
8304   Image
8305     *scale_image;
8306
8307   assert(wand != (MagickWand *) NULL);
8308   assert(wand->signature == WandSignature);
8309   if (wand->debug != MagickFalse)
8310     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8311   if (wand->images == (Image *) NULL)
8312     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8313   scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8314   if (scale_image == (Image *) NULL)
8315     return(MagickFalse);
8316   ReplaceImageInList(&wand->images,scale_image);
8317   return(MagickTrue);
8318 }
8319 \f
8320 /*
8321 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8322 %                                                                             %
8323 %                                                                             %
8324 %                                                                             %
8325 %   M a g i c k S e g m e n t I m a g e                                       %
8326 %                                                                             %
8327 %                                                                             %
8328 %                                                                             %
8329 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8330 %
8331 %  MagickSegmentImage() segments an image by analyzing the histograms of the
8332 %  color components and identifying units that are homogeneous with the fuzzy
8333 %  C-means technique.
8334 %
8335 %  The format of the SegmentImage method is:
8336 %
8337 %      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8338 %        const ColorspaceType colorspace,const MagickBooleanType verbose,
8339 %        const double cluster_threshold,const double smooth_threshold)
8340 %
8341 %  A description of each parameter follows.
8342 %
8343 %    o wand: the wand.
8344 %
8345 %    o colorspace: the image colorspace.
8346 %
8347 %    o verbose:  Set to MagickTrue to print detailed information about the
8348 %      identified classes.
8349 %
8350 %    o cluster_threshold:  This represents the minimum number of pixels
8351 %      contained in a hexahedra before it can be considered valid (expressed as
8352 %      a percentage).
8353 %
8354 %    o smooth_threshold: the smoothing threshold eliminates noise in the second
8355 %      derivative of the histogram.  As the value is increased, you can expect a
8356 %      smoother second derivative.
8357 %
8358 */
8359 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8360   const ColorspaceType colorspace,const MagickBooleanType verbose,
8361   const double cluster_threshold,const double smooth_threshold)
8362 {
8363   MagickBooleanType
8364     status;
8365
8366   assert(wand != (MagickWand *) NULL);
8367   assert(wand->signature == WandSignature);
8368   if (wand->debug != MagickFalse)
8369     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8370   if (wand->images == (Image *) NULL)
8371     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8372   status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8373     smooth_threshold,wand->exception);
8374   return(status);
8375 }
8376 \f
8377 /*
8378 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8379 %                                                                             %
8380 %                                                                             %
8381 %                                                                             %
8382 %   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8383 %                                                                             %
8384 %                                                                             %
8385 %                                                                             %
8386 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8387 %
8388 %  MagickSelectiveBlurImage() selectively blur an image within a contrast
8389 %  threshold. It is similar to the unsharpen mask that sharpens everything with
8390 %  contrast above a certain threshold.
8391 %
8392 %  The format of the MagickSelectiveBlurImage method is:
8393 %
8394 %      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8395 %        const double radius,const double sigma,const double threshold,
8396 %        const double bias)
8397 %
8398 %  A description of each parameter follows:
8399 %
8400 %    o wand: the magick wand.
8401 %
8402 %    o radius: the radius of the gaussian, in pixels, not counting the center
8403 %      pixel.
8404 %
8405 %    o sigma: the standard deviation of the gaussian, in pixels.
8406 %
8407 %    o threshold: only pixels within this contrast threshold are included
8408 %      in the blur operation.
8409 %
8410 %    o bias: the bias.
8411 %
8412 */
8413 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8414   const double radius,const double sigma,const double threshold,
8415   const double bias)
8416 {
8417   Image
8418     *blur_image;
8419
8420   assert(wand != (MagickWand *) NULL);
8421   assert(wand->signature == WandSignature);
8422   if (wand->debug != MagickFalse)
8423     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8424   if (wand->images == (Image *) NULL)
8425     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8426   blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,bias,
8427     wand->exception);
8428   if (blur_image == (Image *) NULL)
8429     return(MagickFalse);
8430   ReplaceImageInList(&wand->images,blur_image);
8431   return(MagickTrue);
8432 }
8433 \f
8434 /*
8435 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8436 %                                                                             %
8437 %                                                                             %
8438 %                                                                             %
8439 %   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                       %
8440 %                                                                             %
8441 %                                                                             %
8442 %                                                                             %
8443 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8444 %
8445 %  MagickSeparateImage() separates a channel from the image and returns a
8446 %  grayscale image.  A channel is a particular color component of each pixel
8447 %  in the image.
8448 %
8449 %  The format of the MagickSeparateImage method is:
8450 %
8451 %      MagickBooleanType MagickSeparateImage(MagickWand *wand,
8452 %        const ChannelType channel)
8453 %
8454 %  A description of each parameter follows:
8455 %
8456 %    o wand: the magick wand.
8457 %
8458 %    o channel: the channel.
8459 %
8460 */
8461 WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand,
8462   const ChannelType channel)
8463 {
8464   Image
8465     *separate_image;
8466
8467   assert(wand != (MagickWand *) NULL);
8468   assert(wand->signature == WandSignature);
8469   if (wand->debug != MagickFalse)
8470     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8471   if (wand->images == (Image *) NULL)
8472     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8473   separate_image=SeparateImage(wand->images,channel,wand->exception);
8474   if (separate_image == (Image *) NULL)
8475     return(MagickFalse);
8476   ReplaceImageInList(&wand->images,separate_image);
8477   return(MagickTrue);
8478 }
8479 \f
8480 /*
8481 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8482 %                                                                             %
8483 %                                                                             %
8484 %                                                                             %
8485 %     M a g i c k S e p i a T o n e I m a g e                                 %
8486 %                                                                             %
8487 %                                                                             %
8488 %                                                                             %
8489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8490 %
8491 %  MagickSepiaToneImage() applies a special effect to the image, similar to the
8492 %  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8493 %  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8494 %  threshold of 80% is a good starting point for a reasonable tone.
8495 %
8496 %  The format of the MagickSepiaToneImage method is:
8497 %
8498 %      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8499 %        const double threshold)
8500 %
8501 %  A description of each parameter follows:
8502 %
8503 %    o wand: the magick wand.
8504 %
8505 %    o threshold:  Define the extent of the sepia toning.
8506 %
8507 */
8508 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8509   const double threshold)
8510 {
8511   Image
8512     *sepia_image;
8513
8514   assert(wand != (MagickWand *) NULL);
8515   assert(wand->signature == WandSignature);
8516   if (wand->debug != MagickFalse)
8517     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8518   if (wand->images == (Image *) NULL)
8519     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8520   sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8521   if (sepia_image == (Image *) NULL)
8522     return(MagickFalse);
8523   ReplaceImageInList(&wand->images,sepia_image);
8524   return(MagickTrue);
8525 }
8526 \f
8527 /*
8528 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8529 %                                                                             %
8530 %                                                                             %
8531 %                                                                             %
8532 %   M a g i c k S e t I m a g e                                               %
8533 %                                                                             %
8534 %                                                                             %
8535 %                                                                             %
8536 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8537 %
8538 %  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8539 %  MagickNextImage(), MagickPreviousImage() with the images from the specified
8540 %  wand.
8541 %
8542 %  The format of the MagickSetImage method is:
8543 %
8544 %      MagickBooleanType MagickSetImage(MagickWand *wand,
8545 %        const MagickWand *set_wand)
8546 %
8547 %  A description of each parameter follows:
8548 %
8549 %    o wand: the magick wand.
8550 %
8551 %    o set_wand: the set_wand wand.
8552 %
8553 */
8554 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8555   const MagickWand *set_wand)
8556 {
8557   Image
8558     *images;
8559
8560   assert(wand != (MagickWand *) NULL);
8561   assert(wand->signature == WandSignature);
8562   if (wand->debug != MagickFalse)
8563     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8564   assert(set_wand != (MagickWand *) NULL);
8565   assert(set_wand->signature == WandSignature);
8566   if (wand->debug != MagickFalse)
8567     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8568   if (set_wand->images == (Image *) NULL)
8569     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8570   images=CloneImageList(set_wand->images,wand->exception);
8571   if (images == (Image *) NULL)
8572     return(MagickFalse);
8573   ReplaceImageInList(&wand->images,images);
8574   return(MagickTrue);
8575 }
8576 \f
8577 /*
8578 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8579 %                                                                             %
8580 %                                                                             %
8581 %                                                                             %
8582 %   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                       %
8583 %                                                                             %
8584 %                                                                             %
8585 %                                                                             %
8586 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8587 %
8588 %  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8589 %  alpha channel.
8590 %
8591 %  The format of the MagickSetImageAlphaChannel method is:
8592 %
8593 %      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8594 %        const AlphaChannelType alpha_type)
8595 %
8596 %  A description of each parameter follows:
8597 %
8598 %    o wand: the magick wand.
8599 %
8600 %    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8601 %      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8602 %
8603 */
8604 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8605   const AlphaChannelType alpha_type)
8606 {
8607   assert(wand != (MagickWand *) NULL);
8608   assert(wand->signature == WandSignature);
8609   if (wand->debug != MagickFalse)
8610     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8611   if (wand->images == (Image *) NULL)
8612     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8613   return(SetImageAlphaChannel(wand->images,alpha_type,wand->exception));
8614 }
8615 \f
8616 /*
8617 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8618 %                                                                             %
8619 %                                                                             %
8620 %                                                                             %
8621 %   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                 %
8622 %                                                                             %
8623 %                                                                             %
8624 %                                                                             %
8625 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8626 %
8627 %  MagickSetImageBackgroundColor() sets the image background color.
8628 %
8629 %  The format of the MagickSetImageBackgroundColor method is:
8630 %
8631 %      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8632 %        const PixelWand *background)
8633 %
8634 %  A description of each parameter follows:
8635 %
8636 %    o wand: the magick wand.
8637 %
8638 %    o background: the background pixel wand.
8639 %
8640 */
8641 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8642   const PixelWand *background)
8643 {
8644   assert(wand != (MagickWand *) NULL);
8645   assert(wand->signature == WandSignature);
8646   if (wand->debug != MagickFalse)
8647     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8648   if (wand->images == (Image *) NULL)
8649     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8650   PixelGetQuantumPacket(background,&wand->images->background_color);
8651   return(MagickTrue);
8652 }
8653 \f
8654 /*
8655 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8656 %                                                                             %
8657 %                                                                             %
8658 %                                                                             %
8659 %   M a g i c k S e t I m a g e B i a s                                       %
8660 %                                                                             %
8661 %                                                                             %
8662 %                                                                             %
8663 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8664 %
8665 %  MagickSetImageBias() sets the image bias for any method that convolves an
8666 %  image (e.g. MagickConvolveImage()).
8667 %
8668 %  The format of the MagickSetImageBias method is:
8669 %
8670 %      MagickBooleanType MagickSetImageBias(MagickWand *wand,
8671 %        const double bias)
8672 %
8673 %  A description of each parameter follows:
8674 %
8675 %    o wand: the magick wand.
8676 %
8677 %    o bias: the image bias.
8678 %
8679 */
8680 WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
8681   const double bias)
8682 {
8683   assert(wand != (MagickWand *) NULL);
8684   assert(wand->signature == WandSignature);
8685   if (wand->debug != MagickFalse)
8686     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8687   if (wand->images == (Image *) NULL)
8688     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8689   wand->images->bias=bias;
8690   return(MagickTrue);
8691 }
8692 \f
8693 /*
8694 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8695 %                                                                             %
8696 %                                                                             %
8697 %                                                                             %
8698 %   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                         %
8699 %                                                                             %
8700 %                                                                             %
8701 %                                                                             %
8702 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8703 %
8704 %  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8705 %
8706 %  The format of the MagickSetImageBluePrimary method is:
8707 %
8708 %      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8709 %        const double x,const double y)
8710 %
8711 %  A description of each parameter follows:
8712 %
8713 %    o wand: the magick wand.
8714 %
8715 %    o x: the blue primary x-point.
8716 %
8717 %    o y: the blue primary y-point.
8718 %
8719 */
8720 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8721   const double x,const double y)
8722 {
8723   assert(wand != (MagickWand *) NULL);
8724   assert(wand->signature == WandSignature);
8725   if (wand->debug != MagickFalse)
8726     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8727   if (wand->images == (Image *) NULL)
8728     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8729   wand->images->chromaticity.blue_primary.x=x;
8730   wand->images->chromaticity.blue_primary.y=y;
8731   return(MagickTrue);
8732 }
8733 \f
8734 /*
8735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8736 %                                                                             %
8737 %                                                                             %
8738 %                                                                             %
8739 %   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                         %
8740 %                                                                             %
8741 %                                                                             %
8742 %                                                                             %
8743 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8744 %
8745 %  MagickSetImageBorderColor() sets the image border color.
8746 %
8747 %  The format of the MagickSetImageBorderColor method is:
8748 %
8749 %      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8750 %        const PixelWand *border)
8751 %
8752 %  A description of each parameter follows:
8753 %
8754 %    o wand: the magick wand.
8755 %
8756 %    o border: the border pixel wand.
8757 %
8758 */
8759 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8760   const PixelWand *border)
8761 {
8762   assert(wand != (MagickWand *) NULL);
8763   assert(wand->signature == WandSignature);
8764   if (wand->debug != MagickFalse)
8765     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8766   if (wand->images == (Image *) NULL)
8767     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8768   PixelGetQuantumPacket(border,&wand->images->border_color);
8769   return(MagickTrue);
8770 }
8771 \f
8772 /*
8773 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8774 %                                                                             %
8775 %                                                                             %
8776 %                                                                             %
8777 %   M a g i c k S e t I m a g e C l i p M a s k                               %
8778 %                                                                             %
8779 %                                                                             %
8780 %                                                                             %
8781 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8782 %
8783 %  MagickSetImageMask() sets image clip mask.
8784 %
8785 %  The format of the MagickSetImageMask method is:
8786 %
8787 %      MagickBooleanType MagickSetImageMask(MagickWand *wand,
8788 %        const MagickWand *clip_mask)
8789 %
8790 %  A description of each parameter follows:
8791 %
8792 %    o wand: the magick wand.
8793 %
8794 %    o clip_mask: the clip_mask wand.
8795 %
8796 */
8797 WandExport MagickBooleanType MagickSetImageMask(MagickWand *wand,
8798   const MagickWand *clip_mask)
8799 {
8800   assert(wand != (MagickWand *) NULL);
8801   assert(wand->signature == WandSignature);
8802   if (wand->debug != MagickFalse)
8803     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8804   assert(clip_mask != (MagickWand *) NULL);
8805   assert(clip_mask->signature == WandSignature);
8806   if (clip_mask->debug != MagickFalse)
8807     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
8808   if (clip_mask->images == (Image *) NULL)
8809     ThrowWandException(WandError,"ContainsNoImages",clip_mask->name);
8810   return(SetImageMask(wand->images,clip_mask->images,wand->exception));
8811 }
8812 \f
8813 /*
8814 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8815 %                                                                             %
8816 %                                                                             %
8817 %                                                                             %
8818 %   M a g i c k S e t I m a g e C o l o r                                     %
8819 %                                                                             %
8820 %                                                                             %
8821 %                                                                             %
8822 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8823 %
8824 %  MagickSetImageColor() set the entire wand canvas to the specified color.
8825 %
8826 %  The format of the MagickSetImageColor method is:
8827 %
8828 %      MagickBooleanType MagickSetImageColor(MagickWand *wand,
8829 %        const PixelWand *color)
8830 %
8831 %  A description of each parameter follows:
8832 %
8833 %    o wand: the magick wand.
8834 %
8835 %    o background: the image color.
8836 %
8837 */
8838 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
8839   const PixelWand *color)
8840 {
8841   PixelInfo
8842     pixel;
8843
8844   assert(wand != (MagickWand *) NULL);
8845   assert(wand->signature == WandSignature);
8846   if (wand->debug != MagickFalse)
8847     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8848   PixelGetMagickColor(color,&pixel);
8849   return(SetImageColor(wand->images,&pixel,wand->exception));
8850 }
8851 \f
8852 /*
8853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8854 %                                                                             %
8855 %                                                                             %
8856 %                                                                             %
8857 %   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                     %
8858 %                                                                             %
8859 %                                                                             %
8860 %                                                                             %
8861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8862 %
8863 %  MagickSetImageColormapColor() sets the color of the specified colormap
8864 %  index.
8865 %
8866 %  The format of the MagickSetImageColormapColor method is:
8867 %
8868 %      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8869 %        const size_t index,const PixelWand *color)
8870 %
8871 %  A description of each parameter follows:
8872 %
8873 %    o wand: the magick wand.
8874 %
8875 %    o index: the offset into the image colormap.
8876 %
8877 %    o color: Return the colormap color in this wand.
8878 %
8879 */
8880 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8881   const size_t index,const PixelWand *color)
8882 {
8883   assert(wand != (MagickWand *) NULL);
8884   assert(wand->signature == WandSignature);
8885   if (wand->debug != MagickFalse)
8886     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8887   if (wand->images == (Image *) NULL)
8888     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8889   if ((wand->images->colormap == (PixelInfo *) NULL) ||
8890       (index >= wand->images->colors))
8891     ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
8892   PixelGetQuantumPacket(color,wand->images->colormap+index);
8893   return(SyncImage(wand->images,wand->exception));
8894 }
8895 \f
8896 /*
8897 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8898 %                                                                             %
8899 %                                                                             %
8900 %                                                                             %
8901 %   M a g i c k S e t I m a g e C o l o r s p a c e                           %
8902 %                                                                             %
8903 %                                                                             %
8904 %                                                                             %
8905 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8906 %
8907 %  MagickSetImageColorspace() sets the image colorspace.
8908 %
8909 %  The format of the MagickSetImageColorspace method is:
8910 %
8911 %      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8912 %        const ColorspaceType colorspace)
8913 %
8914 %  A description of each parameter follows:
8915 %
8916 %    o wand: the magick wand.
8917 %
8918 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
8919 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
8920 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
8921 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
8922 %      HSLColorspace, or HWBColorspace.
8923 %
8924 */
8925 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8926   const ColorspaceType colorspace)
8927 {
8928   assert(wand != (MagickWand *) NULL);
8929   assert(wand->signature == WandSignature);
8930   if (wand->debug != MagickFalse)
8931     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8932   if (wand->images == (Image *) NULL)
8933     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8934   return(SetImageColorspace(wand->images,colorspace,wand->exception));
8935 }
8936 \f
8937 /*
8938 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8939 %                                                                             %
8940 %                                                                             %
8941 %                                                                             %
8942 %   M a g i c k S e t I m a g e C o m p o s e                                 %
8943 %                                                                             %
8944 %                                                                             %
8945 %                                                                             %
8946 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8947 %
8948 %  MagickSetImageCompose() sets the image composite operator, useful for
8949 %  specifying how to composite the image thumbnail when using the
8950 %  MagickMontageImage() method.
8951 %
8952 %  The format of the MagickSetImageCompose method is:
8953 %
8954 %      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8955 %        const CompositeOperator compose)
8956 %
8957 %  A description of each parameter follows:
8958 %
8959 %    o wand: the magick wand.
8960 %
8961 %    o compose: the image composite operator.
8962 %
8963 */
8964 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8965   const CompositeOperator compose)
8966 {
8967   assert(wand != (MagickWand *) NULL);
8968   assert(wand->signature == WandSignature);
8969   if (wand->debug != MagickFalse)
8970     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8971   if (wand->images == (Image *) NULL)
8972     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8973   wand->images->compose=compose;
8974   return(MagickTrue);
8975 }
8976 \f
8977 /*
8978 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8979 %                                                                             %
8980 %                                                                             %
8981 %                                                                             %
8982 %   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                         %
8983 %                                                                             %
8984 %                                                                             %
8985 %                                                                             %
8986 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8987 %
8988 %  MagickSetImageCompression() sets the image compression.
8989 %
8990 %  The format of the MagickSetImageCompression method is:
8991 %
8992 %      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8993 %        const CompressionType compression)
8994 %
8995 %  A description of each parameter follows:
8996 %
8997 %    o wand: the magick wand.
8998 %
8999 %    o compression: the image compression type.
9000 %
9001 */
9002 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9003   const CompressionType compression)
9004 {
9005   assert(wand != (MagickWand *) NULL);
9006   assert(wand->signature == WandSignature);
9007   if (wand->debug != MagickFalse)
9008     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9009   if (wand->images == (Image *) NULL)
9010     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9011   wand->images->compression=compression;
9012   return(MagickTrue);
9013 }
9014 \f
9015 /*
9016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9017 %                                                                             %
9018 %                                                                             %
9019 %                                                                             %
9020 %   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           %
9021 %                                                                             %
9022 %                                                                             %
9023 %                                                                             %
9024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9025 %
9026 %  MagickSetImageCompressionQuality() sets the image compression quality.
9027 %
9028 %  The format of the MagickSetImageCompressionQuality method is:
9029 %
9030 %      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9031 %        const size_t quality)
9032 %
9033 %  A description of each parameter follows:
9034 %
9035 %    o wand: the magick wand.
9036 %
9037 %    o quality: the image compression tlityype.
9038 %
9039 */
9040 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9041   const size_t quality)
9042 {
9043   assert(wand != (MagickWand *) NULL);
9044   assert(wand->signature == WandSignature);
9045   if (wand->debug != MagickFalse)
9046     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9047   if (wand->images == (Image *) NULL)
9048     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9049   wand->images->quality=quality;
9050   return(MagickTrue);
9051 }
9052 \f
9053 /*
9054 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9055 %                                                                             %
9056 %                                                                             %
9057 %                                                                             %
9058 %   M a g i c k S e t I m a g e D e l a y                                     %
9059 %                                                                             %
9060 %                                                                             %
9061 %                                                                             %
9062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9063 %
9064 %  MagickSetImageDelay() sets the image delay.
9065 %
9066 %  The format of the MagickSetImageDelay method is:
9067 %
9068 %      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9069 %        const size_t delay)
9070 %
9071 %  A description of each parameter follows:
9072 %
9073 %    o wand: the magick wand.
9074 %
9075 %    o delay: the image delay in ticks-per-second units.
9076 %
9077 */
9078 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9079   const size_t delay)
9080 {
9081   assert(wand != (MagickWand *) NULL);
9082   assert(wand->signature == WandSignature);
9083   if (wand->debug != MagickFalse)
9084     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9085   if (wand->images == (Image *) NULL)
9086     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9087   wand->images->delay=delay;
9088   return(MagickTrue);
9089 }
9090 \f
9091 /*
9092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9093 %                                                                             %
9094 %                                                                             %
9095 %                                                                             %
9096 %   M a g i c k S e t I m a g e D e p t h                                     %
9097 %                                                                             %
9098 %                                                                             %
9099 %                                                                             %
9100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9101 %
9102 %  MagickSetImageDepth() sets the image depth.
9103 %
9104 %  The format of the MagickSetImageDepth method is:
9105 %
9106 %      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9107 %        const size_t depth)
9108 %
9109 %  A description of each parameter follows:
9110 %
9111 %    o wand: the magick wand.
9112 %
9113 %    o depth: the image depth in bits: 8, 16, or 32.
9114 %
9115 */
9116 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9117   const size_t depth)
9118 {
9119   assert(wand != (MagickWand *) NULL);
9120   assert(wand->signature == WandSignature);
9121   if (wand->debug != MagickFalse)
9122     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9123   if (wand->images == (Image *) NULL)
9124     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9125   return(SetImageDepth(wand->images,depth,wand->exception));
9126 }
9127 \f
9128 /*
9129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9130 %                                                                             %
9131 %                                                                             %
9132 %                                                                             %
9133 %   M a g i c k S e t I m a g e D i s p o s e                                 %
9134 %                                                                             %
9135 %                                                                             %
9136 %                                                                             %
9137 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9138 %
9139 %  MagickSetImageDispose() sets the image disposal method.
9140 %
9141 %  The format of the MagickSetImageDispose method is:
9142 %
9143 %      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9144 %        const DisposeType dispose)
9145 %
9146 %  A description of each parameter follows:
9147 %
9148 %    o wand: the magick wand.
9149 %
9150 %    o dispose: the image disposeal type.
9151 %
9152 */
9153 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9154   const DisposeType dispose)
9155 {
9156   assert(wand != (MagickWand *) NULL);
9157   assert(wand->signature == WandSignature);
9158   if (wand->debug != MagickFalse)
9159     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9160   if (wand->images == (Image *) NULL)
9161     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9162   wand->images->dispose=dispose;
9163   return(MagickTrue);
9164 }
9165 \f
9166 /*
9167 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9168 %                                                                             %
9169 %                                                                             %
9170 %                                                                             %
9171 %   M a g i c k S e t I m a g e E x t e n t                                   %
9172 %                                                                             %
9173 %                                                                             %
9174 %                                                                             %
9175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9176 %
9177 %  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9178 %
9179 %  The format of the MagickSetImageExtent method is:
9180 %
9181 %      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9182 %        const size_t columns,const unsigned rows)
9183 %
9184 %  A description of each parameter follows:
9185 %
9186 %    o wand: the magick wand.
9187 %
9188 %    o columns:  The image width in pixels.
9189 %
9190 %    o rows:  The image height in pixels.
9191 %
9192 */
9193 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9194   const size_t columns,const size_t rows)
9195 {
9196   assert(wand != (MagickWand *) NULL);
9197   assert(wand->signature == WandSignature);
9198   if (wand->debug != MagickFalse)
9199     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9200   if (wand->images == (Image *) NULL)
9201     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9202   return(SetImageExtent(wand->images,columns,rows,wand->exception));
9203 }
9204 \f
9205 /*
9206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9207 %                                                                             %
9208 %                                                                             %
9209 %                                                                             %
9210 %   M a g i c k S e t I m a g e F i l e n a m e                               %
9211 %                                                                             %
9212 %                                                                             %
9213 %                                                                             %
9214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9215 %
9216 %  MagickSetImageFilename() sets the filename of a particular image in a
9217 %  sequence.
9218 %
9219 %  The format of the MagickSetImageFilename method is:
9220 %
9221 %      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9222 %        const char *filename)
9223 %
9224 %  A description of each parameter follows:
9225 %
9226 %    o wand: the magick wand.
9227 %
9228 %    o filename: the image filename.
9229 %
9230 */
9231 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9232   const char *filename)
9233 {
9234   assert(wand != (MagickWand *) NULL);
9235   assert(wand->signature == WandSignature);
9236   if (wand->debug != MagickFalse)
9237     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9238   if (wand->images == (Image *) NULL)
9239     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9240   if (filename != (const char *) NULL)
9241     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9242   return(MagickTrue);
9243 }
9244 \f
9245 /*
9246 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9247 %                                                                             %
9248 %                                                                             %
9249 %                                                                             %
9250 %   M a g i c k S e t I m a g e F o r m a t                                   %
9251 %                                                                             %
9252 %                                                                             %
9253 %                                                                             %
9254 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9255 %
9256 %  MagickSetImageFormat() sets the format of a particular image in a
9257 %  sequence.
9258 %
9259 %  The format of the MagickSetImageFormat method is:
9260 %
9261 %      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9262 %        const char *format)
9263 %
9264 %  A description of each parameter follows:
9265 %
9266 %    o wand: the magick wand.
9267 %
9268 %    o format: the image format.
9269 %
9270 */
9271 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9272   const char *format)
9273 {
9274   const MagickInfo
9275     *magick_info;
9276
9277   assert(wand != (MagickWand *) NULL);
9278   assert(wand->signature == WandSignature);
9279   if (wand->debug != MagickFalse)
9280     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9281   if (wand->images == (Image *) NULL)
9282     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9283   if ((format == (char *) NULL) || (*format == '\0'))
9284     {
9285       *wand->images->magick='\0';
9286       return(MagickTrue);
9287     }
9288   magick_info=GetMagickInfo(format,wand->exception);
9289   if (magick_info == (const MagickInfo *) NULL)
9290     return(MagickFalse);
9291   ClearMagickException(wand->exception);
9292   (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9293   return(MagickTrue);
9294 }
9295 \f
9296 /*
9297 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9298 %                                                                             %
9299 %                                                                             %
9300 %                                                                             %
9301 %   M a g i c k S e t I m a g e F u z z                                       %
9302 %                                                                             %
9303 %                                                                             %
9304 %                                                                             %
9305 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9306 %
9307 %  MagickSetImageFuzz() sets the image fuzz.
9308 %
9309 %  The format of the MagickSetImageFuzz method is:
9310 %
9311 %      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9312 %        const double fuzz)
9313 %
9314 %  A description of each parameter follows:
9315 %
9316 %    o wand: the magick wand.
9317 %
9318 %    o fuzz: the image fuzz.
9319 %
9320 */
9321 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9322   const double fuzz)
9323 {
9324   assert(wand != (MagickWand *) NULL);
9325   assert(wand->signature == WandSignature);
9326   if (wand->debug != MagickFalse)
9327     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9328   if (wand->images == (Image *) NULL)
9329     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9330   wand->images->fuzz=fuzz;
9331   return(MagickTrue);
9332 }
9333 \f
9334 /*
9335 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9336 %                                                                             %
9337 %                                                                             %
9338 %                                                                             %
9339 %   M a g i c k S e t I m a g e G a m m a                                     %
9340 %                                                                             %
9341 %                                                                             %
9342 %                                                                             %
9343 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9344 %
9345 %  MagickSetImageGamma() sets the image gamma.
9346 %
9347 %  The format of the MagickSetImageGamma method is:
9348 %
9349 %      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9350 %        const double gamma)
9351 %
9352 %  A description of each parameter follows:
9353 %
9354 %    o wand: the magick wand.
9355 %
9356 %    o gamma: the image gamma.
9357 %
9358 */
9359 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9360   const double gamma)
9361 {
9362   assert(wand != (MagickWand *) NULL);
9363   assert(wand->signature == WandSignature);
9364   if (wand->debug != MagickFalse)
9365     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9366   if (wand->images == (Image *) NULL)
9367     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9368   wand->images->gamma=gamma;
9369   return(MagickTrue);
9370 }
9371 \f
9372 /*
9373 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9374 %                                                                             %
9375 %                                                                             %
9376 %                                                                             %
9377 %   M a g i c k S e t I m a g e G r a v i t y                                 %
9378 %                                                                             %
9379 %                                                                             %
9380 %                                                                             %
9381 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9382 %
9383 %  MagickSetImageGravity() sets the image gravity type.
9384 %
9385 %  The format of the MagickSetImageGravity method is:
9386 %
9387 %      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9388 %        const GravityType gravity)
9389 %
9390 %  A description of each parameter follows:
9391 %
9392 %    o wand: the magick wand.
9393 %
9394 %    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9395 %      PlaneInterlace, PartitionInterlace.
9396 %
9397 */
9398 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9399   const GravityType gravity)
9400 {
9401   assert(wand != (MagickWand *) NULL);
9402   assert(wand->signature == WandSignature);
9403   if (wand->debug != MagickFalse)
9404     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9405   if (wand->images == (Image *) NULL)
9406     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9407   wand->images->gravity=gravity;
9408   return(MagickTrue);
9409 }
9410 \f
9411 /*
9412 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9413 %                                                                             %
9414 %                                                                             %
9415 %                                                                             %
9416 %   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                       %
9417 %                                                                             %
9418 %                                                                             %
9419 %                                                                             %
9420 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9421 %
9422 %  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9423 %  point.
9424 %
9425 %  The format of the MagickSetImageGreenPrimary method is:
9426 %
9427 %      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9428 %        const double x,const double y)
9429 %
9430 %  A description of each parameter follows:
9431 %
9432 %    o wand: the magick wand.
9433 %
9434 %    o x: the green primary x-point.
9435 %
9436 %    o y: the green primary y-point.
9437 %
9438 %
9439 */
9440 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9441   const double x,const double y)
9442 {
9443   assert(wand != (MagickWand *) NULL);
9444   assert(wand->signature == WandSignature);
9445   if (wand->debug != MagickFalse)
9446     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9447   if (wand->images == (Image *) NULL)
9448     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9449   wand->images->chromaticity.green_primary.x=x;
9450   wand->images->chromaticity.green_primary.y=y;
9451   return(MagickTrue);
9452 }
9453 \f
9454 /*
9455 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9456 %                                                                             %
9457 %                                                                             %
9458 %                                                                             %
9459 %   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                 %
9460 %                                                                             %
9461 %                                                                             %
9462 %                                                                             %
9463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9464 %
9465 %  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9466 %
9467 %  The format of the MagickSetImageInterlaceScheme method is:
9468 %
9469 %      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9470 %        const InterlaceType interlace)
9471 %
9472 %  A description of each parameter follows:
9473 %
9474 %    o wand: the magick wand.
9475 %
9476 %    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9477 %      PlaneInterlace, PartitionInterlace.
9478 %
9479 */
9480 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9481   const InterlaceType interlace)
9482 {
9483   assert(wand != (MagickWand *) NULL);
9484   assert(wand->signature == WandSignature);
9485   if (wand->debug != MagickFalse)
9486     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9487   if (wand->images == (Image *) NULL)
9488     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9489   wand->images->interlace=interlace;
9490   return(MagickTrue);
9491 }
9492 \f
9493 /*
9494 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9495 %                                                                             %
9496 %                                                                             %
9497 %                                                                             %
9498 %   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             %
9499 %                                                                             %
9500 %                                                                             %
9501 %                                                                             %
9502 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9503 %
9504 %  MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel method.
9505 %
9506 %  The format of the MagickSetImagePixelInterpolateMethod method is:
9507 %
9508 %      MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9509 %        const PixelInterpolateMethod method)
9510 %
9511 %  A description of each parameter follows:
9512 %
9513 %    o wand: the magick wand.
9514 %
9515 %    o method: the image interpole pixel methods: choose from Undefined,
9516 %      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9517 %
9518 */
9519 WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9520   const PixelInterpolateMethod method)
9521 {
9522   assert(wand != (MagickWand *) NULL);
9523   assert(wand->signature == WandSignature);
9524   if (wand->debug != MagickFalse)
9525     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9526   if (wand->images == (Image *) NULL)
9527     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9528   wand->images->interpolate=method;
9529   return(MagickTrue);
9530 }
9531 \f
9532 /*
9533 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9534 %                                                                             %
9535 %                                                                             %
9536 %                                                                             %
9537 %   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9538 %                                                                             %
9539 %                                                                             %
9540 %                                                                             %
9541 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9542 %
9543 %  MagickSetImageIterations() sets the image iterations.
9544 %
9545 %  The format of the MagickSetImageIterations method is:
9546 %
9547 %      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9548 %        const size_t iterations)
9549 %
9550 %  A description of each parameter follows:
9551 %
9552 %    o wand: the magick wand.
9553 %
9554 %    o delay: the image delay in 1/100th of a second.
9555 %
9556 */
9557 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9558   const size_t iterations)
9559 {
9560   assert(wand != (MagickWand *) NULL);
9561   assert(wand->signature == WandSignature);
9562   if (wand->debug != MagickFalse)
9563     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9564   if (wand->images == (Image *) NULL)
9565     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9566   wand->images->iterations=iterations;
9567   return(MagickTrue);
9568 }
9569 \f
9570 /*
9571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9572 %                                                                             %
9573 %                                                                             %
9574 %                                                                             %
9575 %   M a g i c k S e t I m a g e M a t t e                                     %
9576 %                                                                             %
9577 %                                                                             %
9578 %                                                                             %
9579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9580 %
9581 %  MagickSetImageMatte() sets the image matte channel.
9582 %
9583 %  The format of the MagickSetImageMatteColor method is:
9584 %
9585 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9586 %        const MagickBooleanType *matte)
9587 %
9588 %  A description of each parameter follows:
9589 %
9590 %    o wand: the magick wand.
9591 %
9592 %    o matte: Set to MagickTrue to enable the image matte channel otherwise
9593 %      MagickFalse.
9594 %
9595 */
9596 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9597   const MagickBooleanType matte)
9598 {
9599   assert(wand != (MagickWand *) NULL);
9600   assert(wand->signature == WandSignature);
9601   if (wand->debug != MagickFalse)
9602     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9603   if (wand->images == (Image *) NULL)
9604     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9605   if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
9606     (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
9607   wand->images->matte=matte;
9608   return(MagickTrue);
9609 }
9610 \f
9611 /*
9612 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9613 %                                                                             %
9614 %                                                                             %
9615 %                                                                             %
9616 %   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9617 %                                                                             %
9618 %                                                                             %
9619 %                                                                             %
9620 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9621 %
9622 %  MagickSetImageMatteColor() sets the image matte color.
9623 %
9624 %  The format of the MagickSetImageMatteColor method is:
9625 %
9626 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9627 %        const PixelWand *matte)
9628 %
9629 %  A description of each parameter follows:
9630 %
9631 %    o wand: the magick wand.
9632 %
9633 %    o matte: the matte pixel wand.
9634 %
9635 */
9636 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9637   const PixelWand *matte)
9638 {
9639   assert(wand != (MagickWand *) NULL);
9640   assert(wand->signature == WandSignature);
9641   if (wand->debug != MagickFalse)
9642     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9643   if (wand->images == (Image *) NULL)
9644     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9645   PixelGetQuantumPacket(matte,&wand->images->matte_color);
9646   return(MagickTrue);
9647 }
9648 \f
9649 /*
9650 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9651 %                                                                             %
9652 %                                                                             %
9653 %                                                                             %
9654 %   M a g i c k S e t I m a g e O p a c i t y                                 %
9655 %                                                                             %
9656 %                                                                             %
9657 %                                                                             %
9658 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9659 %
9660 %  MagickSetImageAlpha() sets the image to the specified alpha level.
9661 %
9662 %  The format of the MagickSetImageAlpha method is:
9663 %
9664 %      MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9665 %        const double alpha)
9666 %
9667 %  A description of each parameter follows:
9668 %
9669 %    o wand: the magick wand.
9670 %
9671 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9672 %      transparent.
9673 %
9674 */
9675 WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand,
9676   const double alpha)
9677 {
9678   MagickBooleanType
9679     status;
9680
9681   assert(wand != (MagickWand *) NULL);
9682   assert(wand->signature == WandSignature);
9683   if (wand->debug != MagickFalse)
9684     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9685   if (wand->images == (Image *) NULL)
9686     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9687   status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha),
9688     wand->exception);
9689   return(status);
9690 }
9691 \f
9692 /*
9693 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9694 %                                                                             %
9695 %                                                                             %
9696 %                                                                             %
9697 %   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                         %
9698 %                                                                             %
9699 %                                                                             %
9700 %                                                                             %
9701 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9702 %
9703 %  MagickSetImageOrientation() sets the image orientation.
9704 %
9705 %  The format of the MagickSetImageOrientation method is:
9706 %
9707 %      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9708 %        const OrientationType orientation)
9709 %
9710 %  A description of each parameter follows:
9711 %
9712 %    o wand: the magick wand.
9713 %
9714 %    o orientation: the image orientation type.
9715 %
9716 */
9717 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9718   const OrientationType orientation)
9719 {
9720   assert(wand != (MagickWand *) NULL);
9721   assert(wand->signature == WandSignature);
9722   if (wand->debug != MagickFalse)
9723     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9724   if (wand->images == (Image *) NULL)
9725     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9726   wand->images->orientation=orientation;
9727   return(MagickTrue);
9728 }
9729 \f
9730 /*
9731 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9732 %                                                                             %
9733 %                                                                             %
9734 %                                                                             %
9735 %   M a g i c k S e t I m a g e P a g e                                       %
9736 %                                                                             %
9737 %                                                                             %
9738 %                                                                             %
9739 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9740 %
9741 %  MagickSetImagePage() sets the page geometry of the image.
9742 %
9743 %  The format of the MagickSetImagePage method is:
9744 %
9745 %      MagickBooleanType MagickSetImagePage(MagickWand *wand,
9746 %        const size_t width,const size_t height,const ssize_t x,
9747 %        const ssize_t y)
9748 %
9749 %  A description of each parameter follows:
9750 %
9751 %    o wand: the magick wand.
9752 %
9753 %    o width: the page width.
9754 %
9755 %    o height: the page height.
9756 %
9757 %    o x: the page x-offset.
9758 %
9759 %    o y: the page y-offset.
9760 %
9761 */
9762 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
9763   const size_t width,const size_t height,const ssize_t x,
9764   const ssize_t y)
9765 {
9766   assert(wand != (MagickWand *) NULL);
9767   assert(wand->signature == WandSignature);
9768   if (wand->debug != MagickFalse)
9769     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9770   if (wand->images == (Image *) NULL)
9771     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9772   wand->images->page.width=width;
9773   wand->images->page.height=height;
9774   wand->images->page.x=x;
9775   wand->images->page.y=y;
9776   return(MagickTrue);
9777 }
9778 \f
9779 /*
9780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9781 %                                                                             %
9782 %                                                                             %
9783 %                                                                             %
9784 %   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                 %
9785 %                                                                             %
9786 %                                                                             %
9787 %                                                                             %
9788 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9789 %
9790 %  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
9791 %  specified method and returns the previous progress monitor if any.  The
9792 %  progress monitor method looks like this:
9793 %
9794 %    MagickBooleanType MagickProgressMonitor(const char *text,
9795 %      const MagickOffsetType offset,const MagickSizeType span,
9796 %      void *client_data)
9797 %
9798 %  If the progress monitor returns MagickFalse, the current operation is
9799 %  interrupted.
9800 %
9801 %  The format of the MagickSetImageProgressMonitor method is:
9802 %
9803 %      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
9804 %        const MagickProgressMonitor progress_monitor,void *client_data)
9805 %
9806 %  A description of each parameter follows:
9807 %
9808 %    o wand: the magick wand.
9809 %
9810 %    o progress_monitor: Specifies a pointer to a method to monitor progress
9811 %      of an image operation.
9812 %
9813 %    o client_data: Specifies a pointer to any client data.
9814 %
9815 */
9816 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
9817   const MagickProgressMonitor progress_monitor,void *client_data)
9818 {
9819   MagickProgressMonitor
9820     previous_monitor;
9821
9822   assert(wand != (MagickWand *) NULL);
9823   assert(wand->signature == WandSignature);
9824   if (wand->debug != MagickFalse)
9825     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9826   if (wand->images == (Image *) NULL)
9827     {
9828       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
9829         "ContainsNoImages","`%s'",wand->name);
9830       return((MagickProgressMonitor) NULL);
9831     }
9832   previous_monitor=SetImageProgressMonitor(wand->images,
9833     progress_monitor,client_data);
9834   return(previous_monitor);
9835 }
9836 \f
9837 /*
9838 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9839 %                                                                             %
9840 %                                                                             %
9841 %                                                                             %
9842 %   M a g i c k S e t I m a g e R e d P r i m a r y                           %
9843 %                                                                             %
9844 %                                                                             %
9845 %                                                                             %
9846 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9847 %
9848 %  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
9849 %
9850 %  The format of the MagickSetImageRedPrimary method is:
9851 %
9852 %      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9853 %        const double x,const double y)
9854 %
9855 %  A description of each parameter follows:
9856 %
9857 %    o wand: the magick wand.
9858 %
9859 %    o x: the red primary x-point.
9860 %
9861 %    o y: the red primary y-point.
9862 %
9863 */
9864 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9865   const double x,const double y)
9866 {
9867   assert(wand != (MagickWand *) NULL);
9868   assert(wand->signature == WandSignature);
9869   if (wand->debug != MagickFalse)
9870     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9871   if (wand->images == (Image *) NULL)
9872     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9873   wand->images->chromaticity.red_primary.x=x;
9874   wand->images->chromaticity.red_primary.y=y;
9875   return(MagickTrue);
9876 }
9877 \f
9878 /*
9879 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9880 %                                                                             %
9881 %                                                                             %
9882 %                                                                             %
9883 %   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                 %
9884 %                                                                             %
9885 %                                                                             %
9886 %                                                                             %
9887 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9888 %
9889 %  MagickSetImageRenderingIntent() sets the image rendering intent.
9890 %
9891 %  The format of the MagickSetImageRenderingIntent method is:
9892 %
9893 %      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9894 %        const RenderingIntent rendering_intent)
9895 %
9896 %  A description of each parameter follows:
9897 %
9898 %    o wand: the magick wand.
9899 %
9900 %    o rendering_intent: the image rendering intent: UndefinedIntent,
9901 %      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
9902 %
9903 */
9904 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9905   const RenderingIntent rendering_intent)
9906 {
9907   assert(wand != (MagickWand *) NULL);
9908   assert(wand->signature == WandSignature);
9909   if (wand->debug != MagickFalse)
9910     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9911   if (wand->images == (Image *) NULL)
9912     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9913   wand->images->rendering_intent=rendering_intent;
9914   return(MagickTrue);
9915 }
9916 \f
9917 /*
9918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9919 %                                                                             %
9920 %                                                                             %
9921 %                                                                             %
9922 %   M a g i c k S e t I m a g e R e s o l u t i o n                           %
9923 %                                                                             %
9924 %                                                                             %
9925 %                                                                             %
9926 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9927 %
9928 %  MagickSetImageResolution() sets the image resolution.
9929 %
9930 %  The format of the MagickSetImageResolution method is:
9931 %
9932 %      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9933 %        const double x_resolution,const doubtl y_resolution)
9934 %
9935 %  A description of each parameter follows:
9936 %
9937 %    o wand: the magick wand.
9938 %
9939 %    o x_resolution: the image x resolution.
9940 %
9941 %    o y_resolution: the image y resolution.
9942 %
9943 */
9944 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9945   const double x_resolution,const double y_resolution)
9946 {
9947   assert(wand != (MagickWand *) NULL);
9948   assert(wand->signature == WandSignature);
9949   if (wand->debug != MagickFalse)
9950     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9951   if (wand->images == (Image *) NULL)
9952     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9953   wand->images->resolution.x=x_resolution;
9954   wand->images->resolution.y=y_resolution;
9955   return(MagickTrue);
9956 }
9957 \f
9958 /*
9959 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9960 %                                                                             %
9961 %                                                                             %
9962 %                                                                             %
9963 %   M a g i c k S e t I m a g e S c e n e                                     %
9964 %                                                                             %
9965 %                                                                             %
9966 %                                                                             %
9967 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9968 %
9969 %  MagickSetImageScene() sets the image scene.
9970 %
9971 %  The format of the MagickSetImageScene method is:
9972 %
9973 %      MagickBooleanType MagickSetImageScene(MagickWand *wand,
9974 %        const size_t scene)
9975 %
9976 %  A description of each parameter follows:
9977 %
9978 %    o wand: the magick wand.
9979 %
9980 %    o delay: the image scene number.
9981 %
9982 */
9983 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
9984   const size_t scene)
9985 {
9986   assert(wand != (MagickWand *) NULL);
9987   assert(wand->signature == WandSignature);
9988   if (wand->debug != MagickFalse)
9989     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9990   if (wand->images == (Image *) NULL)
9991     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9992   wand->images->scene=scene;
9993   return(MagickTrue);
9994 }
9995 \f
9996 /*
9997 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9998 %                                                                             %
9999 %                                                                             %
10000 %                                                                             %
10001 %   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                   %
10002 %                                                                             %
10003 %                                                                             %
10004 %                                                                             %
10005 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10006 %
10007 %  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10008 %
10009 %  The format of the MagickSetImageTicksPerSecond method is:
10010 %
10011 %      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10012 %        const ssize_t ticks_per-second)
10013 %
10014 %  A description of each parameter follows:
10015 %
10016 %    o wand: the magick wand.
10017 %
10018 %    o ticks_per_second: the units to use for the image delay.
10019 %
10020 */
10021 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10022   const ssize_t ticks_per_second)
10023 {
10024   assert(wand != (MagickWand *) NULL);
10025   assert(wand->signature == WandSignature);
10026   if (wand->debug != MagickFalse)
10027     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10028   if (wand->images == (Image *) NULL)
10029     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10030   wand->images->ticks_per_second=ticks_per_second;
10031   return(MagickTrue);
10032 }
10033 \f
10034 /*
10035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10036 %                                                                             %
10037 %                                                                             %
10038 %                                                                             %
10039 %   M a g i c k S e t I m a g e T y p e                                       %
10040 %                                                                             %
10041 %                                                                             %
10042 %                                                                             %
10043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10044 %
10045 %  MagickSetImageType() sets the image type.
10046 %
10047 %  The format of the MagickSetImageType method is:
10048 %
10049 %      MagickBooleanType MagickSetImageType(MagickWand *wand,
10050 %        const ImageType image_type)
10051 %
10052 %  A description of each parameter follows:
10053 %
10054 %    o wand: the magick wand.
10055 %
10056 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10057 %      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10058 %      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10059 %      or OptimizeType.
10060 %
10061 */
10062 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10063   const ImageType image_type)
10064 {
10065   assert(wand != (MagickWand *) NULL);
10066   assert(wand->signature == WandSignature);
10067   if (wand->debug != MagickFalse)
10068     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10069   if (wand->images == (Image *) NULL)
10070     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10071   return(SetImageType(wand->images,image_type,wand->exception));
10072 }
10073 \f
10074 /*
10075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10076 %                                                                             %
10077 %                                                                             %
10078 %                                                                             %
10079 %   M a g i c k S e t I m a g e U n i t s                                     %
10080 %                                                                             %
10081 %                                                                             %
10082 %                                                                             %
10083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10084 %
10085 %  MagickSetImageUnits() sets the image units of resolution.
10086 %
10087 %  The format of the MagickSetImageUnits method is:
10088 %
10089 %      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10090 %        const ResolutionType units)
10091 %
10092 %  A description of each parameter follows:
10093 %
10094 %    o wand: the magick wand.
10095 %
10096 %    o units: the image units of resolution : UndefinedResolution,
10097 %      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10098 %
10099 */
10100 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10101   const ResolutionType units)
10102 {
10103   assert(wand != (MagickWand *) NULL);
10104   assert(wand->signature == WandSignature);
10105   if (wand->debug != MagickFalse)
10106     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10107   if (wand->images == (Image *) NULL)
10108     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10109   wand->images->units=units;
10110   return(MagickTrue);
10111 }
10112 \f
10113 /*
10114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10115 %                                                                             %
10116 %                                                                             %
10117 %                                                                             %
10118 %   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           %
10119 %                                                                             %
10120 %                                                                             %
10121 %                                                                             %
10122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10123 %
10124 %  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10125 %
10126 %  The format of the MagickSetImageVirtualPixelMethod method is:
10127 %
10128 %      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10129 %        const VirtualPixelMethod method)
10130 %
10131 %  A description of each parameter follows:
10132 %
10133 %    o wand: the magick wand.
10134 %
10135 %    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10136 %      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10137 %      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10138 %
10139 */
10140 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10141   const VirtualPixelMethod method)
10142 {
10143   assert(wand != (MagickWand *) NULL);
10144   assert(wand->signature == WandSignature);
10145   if (wand->debug != MagickFalse)
10146     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10147   if (wand->images == (Image *) NULL)
10148     return(UndefinedVirtualPixelMethod);
10149   return(SetImageVirtualPixelMethod(wand->images,method,wand->exception));
10150 }
10151 \f
10152 /*
10153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10154 %                                                                             %
10155 %                                                                             %
10156 %                                                                             %
10157 %   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10158 %                                                                             %
10159 %                                                                             %
10160 %                                                                             %
10161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10162 %
10163 %  MagickSetImageWhitePoint() sets the image chromaticity white point.
10164 %
10165 %  The format of the MagickSetImageWhitePoint method is:
10166 %
10167 %      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10168 %        const double x,const double y)
10169 %
10170 %  A description of each parameter follows:
10171 %
10172 %    o wand: the magick wand.
10173 %
10174 %    o x: the white x-point.
10175 %
10176 %    o y: the white y-point.
10177 %
10178 */
10179 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10180   const double x,const double y)
10181 {
10182   assert(wand != (MagickWand *) NULL);
10183   assert(wand->signature == WandSignature);
10184   if (wand->debug != MagickFalse)
10185     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10186   if (wand->images == (Image *) NULL)
10187     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10188   wand->images->chromaticity.white_point.x=x;
10189   wand->images->chromaticity.white_point.y=y;
10190   return(MagickTrue);
10191 }
10192 \f
10193 /*
10194 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10195 %                                                                             %
10196 %                                                                             %
10197 %                                                                             %
10198 %   M a g i c k S h a d e I m a g e C h a n n e l                             %
10199 %                                                                             %
10200 %                                                                             %
10201 %                                                                             %
10202 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10203 %
10204 %  MagickShadeImage() shines a distant light on an image to create a
10205 %  three-dimensional effect. You control the positioning of the light with
10206 %  azimuth and elevation; azimuth is measured in degrees off the x axis
10207 %  and elevation is measured in pixels above the Z axis.
10208 %
10209 %  The format of the MagickShadeImage method is:
10210 %
10211 %      MagickBooleanType MagickShadeImage(MagickWand *wand,
10212 %        const MagickBooleanType gray,const double azimuth,
10213 %        const double elevation)
10214 %
10215 %  A description of each parameter follows:
10216 %
10217 %    o wand: the magick wand.
10218 %
10219 %    o gray: A value other than zero shades the intensity of each pixel.
10220 %
10221 %    o azimuth, elevation:  Define the light source direction.
10222 %
10223 */
10224 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10225   const MagickBooleanType gray,const double asimuth,const double elevation)
10226 {
10227   Image
10228     *shade_image;
10229
10230   assert(wand != (MagickWand *) NULL);
10231   assert(wand->signature == WandSignature);
10232   if (wand->debug != MagickFalse)
10233     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10234   if (wand->images == (Image *) NULL)
10235     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10236   shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10237   if (shade_image == (Image *) NULL)
10238     return(MagickFalse);
10239   ReplaceImageInList(&wand->images,shade_image);
10240   return(MagickTrue);
10241 }
10242 \f
10243 /*
10244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10245 %                                                                             %
10246 %                                                                             %
10247 %                                                                             %
10248 %   M a g i c k S h a d o w I m a g e                                         %
10249 %                                                                             %
10250 %                                                                             %
10251 %                                                                             %
10252 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10253 %
10254 %  MagickShadowImage() simulates an image shadow.
10255 %
10256 %  The format of the MagickShadowImage method is:
10257 %
10258 %      MagickBooleanType MagickShadowImage(MagickWand *wand,
10259 %        const double alpha,const double sigma,const double bias,
10260 %        const ssize_t x,const ssize_t y)
10261 %
10262 %  A description of each parameter follows:
10263 %
10264 %    o wand: the magick wand.
10265 %
10266 %    o alpha: percentage transparency.
10267 %
10268 %    o sigma: the standard deviation of the Gaussian, in pixels.
10269 %
10270 %    o bias: the bias.
10271 %
10272 %    o x: the shadow x-offset.
10273 %
10274 %    o y: the shadow y-offset.
10275 %
10276 */
10277 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10278   const double alpha,const double sigma,const double bias,const ssize_t x,
10279   const ssize_t y)
10280 {
10281   Image
10282     *shadow_image;
10283
10284   assert(wand != (MagickWand *) NULL);
10285   assert(wand->signature == WandSignature);
10286   if (wand->debug != MagickFalse)
10287     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10288   if (wand->images == (Image *) NULL)
10289     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10290   shadow_image=ShadowImage(wand->images,alpha,sigma,bias,x,y,wand->exception);
10291   if (shadow_image == (Image *) NULL)
10292     return(MagickFalse);
10293   ReplaceImageInList(&wand->images,shadow_image);
10294   return(MagickTrue);
10295 }
10296 \f
10297 /*
10298 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10299 %                                                                             %
10300 %                                                                             %
10301 %                                                                             %
10302 %   M a g i c k S h a r p e n I m a g e                                       %
10303 %                                                                             %
10304 %                                                                             %
10305 %                                                                             %
10306 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10307 %
10308 %  MagickSharpenImage() sharpens an image.  We convolve the image with a
10309 %  Gaussian operator of the given radius and standard deviation (sigma).
10310 %  For reasonable results, the radius should be larger than sigma.  Use a
10311 %  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10312 %
10313 %  The format of the MagickSharpenImage method is:
10314 %
10315 %      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10316 %        const double radius,const double sigma,const double bias)
10317 %
10318 %  A description of each parameter follows:
10319 %
10320 %    o wand: the magick wand.
10321 %
10322 %    o radius: the radius of the Gaussian, in pixels, not counting the center
10323 %      pixel.
10324 %
10325 %    o sigma: the standard deviation of the Gaussian, in pixels.
10326 %
10327 %    o bias: the bias.
10328 %
10329 */
10330 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10331   const double radius,const double sigma,const double bias)
10332 {
10333   Image
10334     *sharp_image;
10335
10336   assert(wand != (MagickWand *) NULL);
10337   assert(wand->signature == WandSignature);
10338   if (wand->debug != MagickFalse)
10339     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10340   if (wand->images == (Image *) NULL)
10341     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10342   sharp_image=SharpenImage(wand->images,radius,sigma,bias,wand->exception);
10343   if (sharp_image == (Image *) NULL)
10344     return(MagickFalse);
10345   ReplaceImageInList(&wand->images,sharp_image);
10346   return(MagickTrue);
10347 }
10348 \f
10349 /*
10350 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10351 %                                                                             %
10352 %                                                                             %
10353 %                                                                             %
10354 %   M a g i c k S h a v e I m a g e                                           %
10355 %                                                                             %
10356 %                                                                             %
10357 %                                                                             %
10358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10359 %
10360 %  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10361 %  memory necessary for the new Image structure and returns a pointer to the
10362 %  new image.
10363 %
10364 %  The format of the MagickShaveImage method is:
10365 %
10366 %      MagickBooleanType MagickShaveImage(MagickWand *wand,
10367 %        const size_t columns,const size_t rows)
10368 %
10369 %  A description of each parameter follows:
10370 %
10371 %    o wand: the magick wand.
10372 %
10373 %    o columns: the number of columns in the scaled image.
10374 %
10375 %    o rows: the number of rows in the scaled image.
10376 %
10377 %
10378 */
10379 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10380   const size_t columns,const size_t rows)
10381 {
10382   Image
10383     *shave_image;
10384
10385   RectangleInfo
10386     shave_info;
10387
10388   assert(wand != (MagickWand *) NULL);
10389   assert(wand->signature == WandSignature);
10390   if (wand->debug != MagickFalse)
10391     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10392   if (wand->images == (Image *) NULL)
10393     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10394   shave_info.width=columns;
10395   shave_info.height=rows;
10396   shave_info.x=0;
10397   shave_info.y=0;
10398   shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10399   if (shave_image == (Image *) NULL)
10400     return(MagickFalse);
10401   ReplaceImageInList(&wand->images,shave_image);
10402   return(MagickTrue);
10403 }
10404 \f
10405 /*
10406 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10407 %                                                                             %
10408 %                                                                             %
10409 %                                                                             %
10410 %   M a g i c k S h e a r I m a g e                                           %
10411 %                                                                             %
10412 %                                                                             %
10413 %                                                                             %
10414 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10415 %
10416 %  MagickShearImage() slides one edge of an image along the X or Y axis,
10417 %  creating a parallelogram.  An X direction shear slides an edge along the X
10418 %  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10419 %  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10420 %  is measured relative to the Y axis, and similarly, for Y direction shears
10421 %  y_shear is measured relative to the X axis.  Empty triangles left over from
10422 %  shearing the image are filled with the background color.
10423 %
10424 %  The format of the MagickShearImage method is:
10425 %
10426 %      MagickBooleanType MagickShearImage(MagickWand *wand,
10427 %        const PixelWand *background,const double x_shear,onst double y_shear)
10428 %
10429 %  A description of each parameter follows:
10430 %
10431 %    o wand: the magick wand.
10432 %
10433 %    o background: the background pixel wand.
10434 %
10435 %    o x_shear: the number of degrees to shear the image.
10436 %
10437 %    o y_shear: the number of degrees to shear the image.
10438 %
10439 */
10440 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10441   const PixelWand *background,const double x_shear,const double y_shear)
10442 {
10443   Image
10444     *shear_image;
10445
10446   assert(wand != (MagickWand *) NULL);
10447   assert(wand->signature == WandSignature);
10448   if (wand->debug != MagickFalse)
10449     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10450   if (wand->images == (Image *) NULL)
10451     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10452   PixelGetQuantumPacket(background,&wand->images->background_color);
10453   shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10454   if (shear_image == (Image *) NULL)
10455     return(MagickFalse);
10456   ReplaceImageInList(&wand->images,shear_image);
10457   return(MagickTrue);
10458 }
10459 \f
10460 /*
10461 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10462 %                                                                             %
10463 %                                                                             %
10464 %                                                                             %
10465 %   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                   %
10466 %                                                                             %
10467 %                                                                             %
10468 %                                                                             %
10469 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10470 %
10471 %  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10472 %  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10473 %  image using a sigmoidal transfer function without saturating highlights or
10474 %  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10475 %  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10476 %  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10477 %  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10478 %  is reduced.
10479 %
10480 %  The format of the MagickSigmoidalContrastImage method is:
10481 %
10482 %      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10483 %        const MagickBooleanType sharpen,const double alpha,const double beta)
10484 %
10485 %  A description of each parameter follows:
10486 %
10487 %    o wand: the magick wand.
10488 %
10489 %    o sharpen: Increase or decrease image contrast.
10490 %
10491 %    o alpha: strength of the contrast, the larger the number the more
10492 %      'threshold-like' it becomes.
10493 %
10494 %    o beta: midpoint of the function as a color value 0 to QuantumRange.
10495 %
10496 */
10497 WandExport MagickBooleanType MagickSigmoidalContrastImage(
10498   MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10499   const double beta)
10500 {
10501   MagickBooleanType
10502     status;
10503
10504   assert(wand != (MagickWand *) NULL);
10505   assert(wand->signature == WandSignature);
10506   if (wand->debug != MagickFalse)
10507     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10508   if (wand->images == (Image *) NULL)
10509     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10510   status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10511     wand->exception);
10512   return(status);
10513 }
10514 \f
10515 /*
10516 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10517 %                                                                             %
10518 %                                                                             %
10519 %                                                                             %
10520 %   M a g i c k S i m i l a r i t y I m a g e                                 %
10521 %                                                                             %
10522 %                                                                             %
10523 %                                                                             %
10524 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10525 %
10526 %  MagickSimilarityImage() compares the reference image of the image and
10527 %  returns the best match offset.  In addition, it returns a similarity image
10528 %  such that an exact match location is completely white and if none of the
10529 %  pixels match, black, otherwise some gray level in-between.
10530 %
10531 %  The format of the MagickSimilarityImage method is:
10532 %
10533 %      MagickWand *MagickSimilarityImage(MagickWand *wand,
10534 %        const MagickWand *reference,const MetricType metric,
10535 %        RectangeInfo *offset,double *similarity)
10536 %
10537 %  A description of each parameter follows:
10538 %
10539 %    o wand: the magick wand.
10540 %
10541 %    o reference: the reference wand.
10542 %
10543 %    o metric: the metric.
10544 %
10545 %    o offset: the best match offset of the reference image within the image.
10546 %
10547 %    o similarity: the computed similarity between the images.
10548 %
10549 */
10550 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10551   const MagickWand *reference,const MetricType metric,RectangleInfo *offset,
10552   double *similarity)
10553 {
10554   Image
10555     *similarity_image;
10556
10557   assert(wand != (MagickWand *) NULL);
10558   assert(wand->signature == WandSignature);
10559   if (wand->debug != MagickFalse)
10560     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10561   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10562     {
10563       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10564         "ContainsNoImages","`%s'",wand->name);
10565       return((MagickWand *) NULL);
10566     }
10567   similarity_image=SimilarityImage(wand->images,reference->images,metric,offset,
10568     similarity,wand->exception);
10569   if (similarity_image == (Image *) NULL)
10570     return((MagickWand *) NULL);
10571   return(CloneMagickWandFromImages(wand,similarity_image));
10572 }
10573 \f
10574 /*
10575 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10576 %                                                                             %
10577 %                                                                             %
10578 %                                                                             %
10579 %   M a g i c k S k e t c h I m a g e                                         %
10580 %                                                                             %
10581 %                                                                             %
10582 %                                                                             %
10583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10584 %
10585 %  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10586 %  a Gaussian operator of the given radius and standard deviation (sigma).
10587 %  For reasonable results, radius should be larger than sigma.  Use a
10588 %  radius of 0 and SketchImage() selects a suitable radius for you.
10589 %  Angle gives the angle of the blurring motion.
10590 %
10591 %  The format of the MagickSketchImage method is:
10592 %
10593 %      MagickBooleanType MagickSketchImage(MagickWand *wand,
10594 %        const double radius,const double sigma,const double angle,
10595 %        const double bias)
10596 %
10597 %  A description of each parameter follows:
10598 %
10599 %    o wand: the magick wand.
10600 %
10601 %    o radius: the radius of the Gaussian, in pixels, not counting
10602 %      the center pixel.
10603 %
10604 %    o sigma: the standard deviation of the Gaussian, in pixels.
10605 %
10606 %    o angle: apply the effect along this angle.
10607 %
10608 %    o bias: the bias.
10609 %
10610 */
10611 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10612   const double radius,const double sigma,const double angle,const double bias)
10613 {
10614   Image
10615     *sketch_image;
10616
10617   assert(wand != (MagickWand *) NULL);
10618   assert(wand->signature == WandSignature);
10619   if (wand->debug != MagickFalse)
10620     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10621   if (wand->images == (Image *) NULL)
10622     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10623   sketch_image=SketchImage(wand->images,radius,sigma,angle,bias,
10624     wand->exception);
10625   if (sketch_image == (Image *) NULL)
10626     return(MagickFalse);
10627   ReplaceImageInList(&wand->images,sketch_image);
10628   return(MagickTrue);
10629 }
10630 \f
10631 /*
10632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10633 %                                                                             %
10634 %                                                                             %
10635 %                                                                             %
10636 %   M a g i c k S m u s h I m a g e s                                         %
10637 %                                                                             %
10638 %                                                                             %
10639 %                                                                             %
10640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10641 %
10642 %  MagickSmushImages() takes all images from the current image pointer to the
10643 %  end of the image list and smushs them to each other top-to-bottom if the
10644 %  stack parameter is true, otherwise left-to-right.
10645 %
10646 %  The format of the MagickSmushImages method is:
10647 %
10648 %      MagickWand *MagickSmushImages(MagickWand *wand,
10649 %        const MagickBooleanType stack,const ssize_t offset)
10650 %
10651 %  A description of each parameter follows:
10652 %
10653 %    o wand: the magick wand.
10654 %
10655 %    o stack: By default, images are stacked left-to-right. Set stack to
10656 %      MagickTrue to stack them top-to-bottom.
10657 %
10658 %    o offset: minimum distance in pixels between images.
10659 %
10660 */
10661 WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10662   const MagickBooleanType stack,const ssize_t offset)
10663 {
10664   Image
10665     *smush_image;
10666
10667   assert(wand != (MagickWand *) NULL);
10668   assert(wand->signature == WandSignature);
10669   if (wand->debug != MagickFalse)
10670     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10671   if (wand->images == (Image *) NULL)
10672     return((MagickWand *) NULL);
10673   smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10674   if (smush_image == (Image *) NULL)
10675     return((MagickWand *) NULL);
10676   return(CloneMagickWandFromImages(wand,smush_image));
10677 }
10678 \f
10679 /*
10680 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10681 %                                                                             %
10682 %                                                                             %
10683 %                                                                             %
10684 %     M a g i c k S o l a r i z e I m a g e                                   %
10685 %                                                                             %
10686 %                                                                             %
10687 %                                                                             %
10688 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10689 %
10690 %  MagickSolarizeImage() applies a special effect to the image, similar to the
10691 %  effect achieved in a photo darkroom by selectively exposing areas of photo
10692 %  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
10693 %  measure of the extent of the solarization.
10694 %
10695 %  The format of the MagickSolarizeImage method is:
10696 %
10697 %      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10698 %        const double threshold)
10699 %
10700 %  A description of each parameter follows:
10701 %
10702 %    o wand: the magick wand.
10703 %
10704 %    o threshold:  Define the extent of the solarization.
10705 %
10706 */
10707 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10708   const double threshold)
10709 {
10710   MagickBooleanType
10711     status;
10712
10713   assert(wand != (MagickWand *) NULL);
10714   assert(wand->signature == WandSignature);
10715   if (wand->debug != MagickFalse)
10716     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10717   if (wand->images == (Image *) NULL)
10718     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10719   status=SolarizeImage(wand->images,threshold,wand->exception);
10720   return(status);
10721 }
10722 \f
10723 /*
10724 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10725 %                                                                             %
10726 %                                                                             %
10727 %                                                                             %
10728 %   M a g i c k S p a r s e C o l o r I m a g e                               %
10729 %                                                                             %
10730 %                                                                             %
10731 %                                                                             %
10732 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10733 %
10734 %  MagickSparseColorImage(), given a set of coordinates, interpolates the
10735 %  colors found at those coordinates, across the whole image, using various
10736 %  methods.
10737 %
10738 %  The format of the MagickSparseColorImage method is:
10739 %
10740 %      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10741 %        const SparseColorMethod method,const size_t number_arguments,
10742 %        const double *arguments)
10743 %
10744 %  A description of each parameter follows:
10745 %
10746 %    o image: the image to be sparseed.
10747 %
10748 %    o method: the method of image sparseion.
10749 %
10750 %        ArcSparseColorion will always ignore source image offset, and always
10751 %        'bestfit' the destination image with the top left corner offset
10752 %        relative to the polar mapping center.
10753 %
10754 %        Bilinear has no simple inverse mapping so will not allow 'bestfit'
10755 %        style of image sparseion.
10756 %
10757 %        Affine, Perspective, and Bilinear, will do least squares fitting of
10758 %        the distrotion when more than the minimum number of control point
10759 %        pairs are provided.
10760 %
10761 %        Perspective, and Bilinear, will fall back to a Affine sparseion when
10762 %        less than 4 control point pairs are provided. While Affine sparseions
10763 %        will let you use any number of control point pairs, that is Zero pairs
10764 %        is a No-Op (viewport only) distrotion, one pair is a translation and
10765 %        two pairs of control points will do a scale-rotate-translate, without
10766 %        any shearing.
10767 %
10768 %    o number_arguments: the number of arguments given for this sparseion
10769 %      method.
10770 %
10771 %    o arguments: the arguments for this sparseion method.
10772 %
10773 */
10774 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10775   const SparseColorMethod method,const size_t number_arguments,
10776   const double *arguments)
10777 {
10778   Image
10779     *sparse_image;
10780
10781   assert(wand != (MagickWand *) NULL);
10782   assert(wand->signature == WandSignature);
10783   if (wand->debug != MagickFalse)
10784     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10785   if (wand->images == (Image *) NULL)
10786     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10787   sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
10788     wand->exception);
10789   if (sparse_image == (Image *) NULL)
10790     return(MagickFalse);
10791   ReplaceImageInList(&wand->images,sparse_image);
10792   return(MagickTrue);
10793 }
10794 \f
10795 /*
10796 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10797 %                                                                             %
10798 %                                                                             %
10799 %                                                                             %
10800 %   M a g i c k S p l i c e I m a g e                                         %
10801 %                                                                             %
10802 %                                                                             %
10803 %                                                                             %
10804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10805 %
10806 %  MagickSpliceImage() splices a solid color into the image.
10807 %
10808 %  The format of the MagickSpliceImage method is:
10809 %
10810 %      MagickBooleanType MagickSpliceImage(MagickWand *wand,
10811 %        const size_t width,const size_t height,const ssize_t x,
10812 %        const ssize_t y)
10813 %
10814 %  A description of each parameter follows:
10815 %
10816 %    o wand: the magick wand.
10817 %
10818 %    o width: the region width.
10819 %
10820 %    o height: the region height.
10821 %
10822 %    o x: the region x offset.
10823 %
10824 %    o y: the region y offset.
10825 %
10826 */
10827 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
10828   const size_t width,const size_t height,const ssize_t x,
10829   const ssize_t y)
10830 {
10831   Image
10832     *splice_image;
10833
10834   RectangleInfo
10835     splice;
10836
10837   assert(wand != (MagickWand *) NULL);
10838   assert(wand->signature == WandSignature);
10839   if (wand->debug != MagickFalse)
10840     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10841   if (wand->images == (Image *) NULL)
10842     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10843   splice.width=width;
10844   splice.height=height;
10845   splice.x=x;
10846   splice.y=y;
10847   splice_image=SpliceImage(wand->images,&splice,wand->exception);
10848   if (splice_image == (Image *) NULL)
10849     return(MagickFalse);
10850   ReplaceImageInList(&wand->images,splice_image);
10851   return(MagickTrue);
10852 }
10853 \f
10854 /*
10855 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10856 %                                                                             %
10857 %                                                                             %
10858 %                                                                             %
10859 %   M a g i c k S p r e a d I m a g e                                         %
10860 %                                                                             %
10861 %                                                                             %
10862 %                                                                             %
10863 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10864 %
10865 %  MagickSpreadImage() is a special effects method that randomly displaces each
10866 %  pixel in a block defined by the radius parameter.
10867 %
10868 %  The format of the MagickSpreadImage method is:
10869 %
10870 %      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius,
10871 %        const PixelInterpolateMethod method)
10872 %
10873 %  A description of each parameter follows:
10874 %
10875 %    o wand: the magick wand.
10876 %
10877 %    o radius:  Choose a random pixel in a neighborhood of this extent.
10878 %
10879 %    o method: the pixel interpolation method.
10880 %
10881 */
10882 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
10883   const double radius,const PixelInterpolateMethod method)
10884 {
10885   Image
10886     *spread_image;
10887
10888   assert(wand != (MagickWand *) NULL);
10889   assert(wand->signature == WandSignature);
10890   if (wand->debug != MagickFalse)
10891     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10892   if (wand->images == (Image *) NULL)
10893     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10894   spread_image=SpreadImage(wand->images,radius,method,wand->exception);
10895   if (spread_image == (Image *) NULL)
10896     return(MagickFalse);
10897   ReplaceImageInList(&wand->images,spread_image);
10898   return(MagickTrue);
10899 }
10900 \f
10901 /*
10902 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10903 %                                                                             %
10904 %                                                                             %
10905 %                                                                             %
10906 %   M a g i c k S t a t i s t i c I m a g e                                   %
10907 %                                                                             %
10908 %                                                                             %
10909 %                                                                             %
10910 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10911 %
10912 %  MagickStatisticImage() replace each pixel with corresponding statistic from
10913 %  the neighborhood of the specified width and height.
10914 %
10915 %  The format of the MagickStatisticImage method is:
10916 %
10917 %      MagickBooleanType MagickStatisticImage(MagickWand *wand,
10918 %        const StatisticType type,const double width,const size_t height)
10919 %
10920 %  A description of each parameter follows:
10921 %
10922 %    o wand: the magick wand.
10923 %
10924 %    o type: the statistic type (e.g. median, mode, etc.).
10925 %
10926 %    o width: the width of the pixel neighborhood.
10927 %
10928 %    o height: the height of the pixel neighborhood.
10929 %
10930 */
10931 WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
10932   const StatisticType type,const size_t width,const size_t height)
10933 {
10934   Image
10935     *statistic_image;
10936
10937   assert(wand != (MagickWand *) NULL);
10938   assert(wand->signature == WandSignature);
10939   if (wand->debug != MagickFalse)
10940     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10941   if (wand->images == (Image *) NULL)
10942     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10943   statistic_image=StatisticImage(wand->images,type,width,height,
10944     wand->exception);
10945   if (statistic_image == (Image *) NULL)
10946     return(MagickFalse);
10947   ReplaceImageInList(&wand->images,statistic_image);
10948   return(MagickTrue);
10949 }
10950 \f
10951 /*
10952 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10953 %                                                                             %
10954 %                                                                             %
10955 %                                                                             %
10956 %   M a g i c k S t e g a n o I m a g e                                       %
10957 %                                                                             %
10958 %                                                                             %
10959 %                                                                             %
10960 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10961 %
10962 %  MagickSteganoImage() hides a digital watermark within the image.
10963 %  Recover the hidden watermark later to prove that the authenticity of
10964 %  an image.  Offset defines the start position within the image to hide
10965 %  the watermark.
10966 %
10967 %  The format of the MagickSteganoImage method is:
10968 %
10969 %      MagickWand *MagickSteganoImage(MagickWand *wand,
10970 %        const MagickWand *watermark_wand,const ssize_t offset)
10971 %
10972 %  A description of each parameter follows:
10973 %
10974 %    o wand: the magick wand.
10975 %
10976 %    o watermark_wand: the watermark wand.
10977 %
10978 %    o offset: Start hiding at this offset into the image.
10979 %
10980 */
10981 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
10982   const MagickWand *watermark_wand,const ssize_t offset)
10983 {
10984   Image
10985     *stegano_image;
10986
10987   assert(wand != (MagickWand *) NULL);
10988   assert(wand->signature == WandSignature);
10989   if (wand->debug != MagickFalse)
10990     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10991   if ((wand->images == (Image *) NULL) ||
10992       (watermark_wand->images == (Image *) NULL))
10993     {
10994       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10995         "ContainsNoImages","`%s'",wand->name);
10996       return((MagickWand *) NULL);
10997     }
10998   wand->images->offset=offset;
10999   stegano_image=SteganoImage(wand->images,watermark_wand->images,
11000     wand->exception);
11001   if (stegano_image == (Image *) NULL)
11002     return((MagickWand *) NULL);
11003   return(CloneMagickWandFromImages(wand,stegano_image));
11004 }
11005 \f
11006 /*
11007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11008 %                                                                             %
11009 %                                                                             %
11010 %                                                                             %
11011 %   M a g i c k S t e r e o I m a g e                                         %
11012 %                                                                             %
11013 %                                                                             %
11014 %                                                                             %
11015 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11016 %
11017 %  MagickStereoImage() composites two images and produces a single image that
11018 %  is the composite of a left and right image of a stereo pair
11019 %
11020 %  The format of the MagickStereoImage method is:
11021 %
11022 %      MagickWand *MagickStereoImage(MagickWand *wand,
11023 %        const MagickWand *offset_wand)
11024 %
11025 %  A description of each parameter follows:
11026 %
11027 %    o wand: the magick wand.
11028 %
11029 %    o offset_wand: Another image wand.
11030 %
11031 */
11032 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11033   const MagickWand *offset_wand)
11034 {
11035   Image
11036     *stereo_image;
11037
11038   assert(wand != (MagickWand *) NULL);
11039   assert(wand->signature == WandSignature);
11040   if (wand->debug != MagickFalse)
11041     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11042   if ((wand->images == (Image *) NULL) ||
11043       (offset_wand->images == (Image *) NULL))
11044     {
11045       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11046         "ContainsNoImages","`%s'",wand->name);
11047       return((MagickWand *) NULL);
11048     }
11049   stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11050   if (stereo_image == (Image *) NULL)
11051     return((MagickWand *) NULL);
11052   return(CloneMagickWandFromImages(wand,stereo_image));
11053 }
11054 \f
11055 /*
11056 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11057 %                                                                             %
11058 %                                                                             %
11059 %                                                                             %
11060 %   M a g i c k S t r i p I m a g e                                           %
11061 %                                                                             %
11062 %                                                                             %
11063 %                                                                             %
11064 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11065 %
11066 %  MagickStripImage() strips an image of all profiles and comments.
11067 %
11068 %  The format of the MagickStripImage method is:
11069 %
11070 %      MagickBooleanType MagickStripImage(MagickWand *wand)
11071 %
11072 %  A description of each parameter follows:
11073 %
11074 %    o wand: the magick wand.
11075 %
11076 */
11077 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11078 {
11079   assert(wand != (MagickWand *) NULL);
11080   assert(wand->signature == WandSignature);
11081   if (wand->debug != MagickFalse)
11082     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11083   if (wand->images == (Image *) NULL)
11084     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11085   return(StripImage(wand->images,wand->exception));
11086 }
11087 \f
11088 /*
11089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11090 %                                                                             %
11091 %                                                                             %
11092 %                                                                             %
11093 %   M a g i c k S w i r l I m a g e                                           %
11094 %                                                                             %
11095 %                                                                             %
11096 %                                                                             %
11097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11098 %
11099 %  MagickSwirlImage() swirls the pixels about the center of the image, where
11100 %  degrees indicates the sweep of the arc through which each pixel is moved.
11101 %  You get a more dramatic effect as the degrees move from 1 to 360.
11102 %
11103 %  The format of the MagickSwirlImage method is:
11104 %
11105 %      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11106 %        const PixelInterpolateMethod method)
11107 %
11108 %  A description of each parameter follows:
11109 %
11110 %    o wand: the magick wand.
11111 %
11112 %    o degrees: Define the tightness of the swirling effect.
11113 %
11114 %    o method: the pixel interpolation method.
11115 %
11116 */
11117 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11118   const double degrees,const PixelInterpolateMethod method)
11119 {
11120   Image
11121     *swirl_image;
11122
11123   assert(wand != (MagickWand *) NULL);
11124   assert(wand->signature == WandSignature);
11125   if (wand->debug != MagickFalse)
11126     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11127   if (wand->images == (Image *) NULL)
11128     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11129   swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
11130   if (swirl_image == (Image *) NULL)
11131     return(MagickFalse);
11132   ReplaceImageInList(&wand->images,swirl_image);
11133   return(MagickTrue);
11134 }
11135 \f
11136 /*
11137 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11138 %                                                                             %
11139 %                                                                             %
11140 %                                                                             %
11141 %   M a g i c k T e x t u r e I m a g e                                       %
11142 %                                                                             %
11143 %                                                                             %
11144 %                                                                             %
11145 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11146 %
11147 %  MagickTextureImage() repeatedly tiles the texture image across and down the
11148 %  image canvas.
11149 %
11150 %  The format of the MagickTextureImage method is:
11151 %
11152 %      MagickWand *MagickTextureImage(MagickWand *wand,
11153 %        const MagickWand *texture_wand)
11154 %
11155 %  A description of each parameter follows:
11156 %
11157 %    o wand: the magick wand.
11158 %
11159 %    o texture_wand: the texture wand
11160 %
11161 */
11162 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11163   const MagickWand *texture_wand)
11164 {
11165   Image
11166     *texture_image;
11167
11168   MagickBooleanType
11169     status;
11170
11171   assert(wand != (MagickWand *) NULL);
11172   assert(wand->signature == WandSignature);
11173   if (wand->debug != MagickFalse)
11174     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11175   if ((wand->images == (Image *) NULL) ||
11176       (texture_wand->images == (Image *) NULL))
11177     {
11178       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11179         "ContainsNoImages","`%s'",wand->name);
11180       return((MagickWand *) NULL);
11181     }
11182   texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11183   if (texture_image == (Image *) NULL)
11184     return((MagickWand *) NULL);
11185   status=TextureImage(texture_image,texture_wand->images,wand->exception);
11186   if (status == MagickFalse)
11187     {
11188       texture_image=DestroyImage(texture_image);
11189       return((MagickWand *) NULL);
11190     }
11191   return(CloneMagickWandFromImages(wand,texture_image));
11192 }
11193 \f
11194 /*
11195 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11196 %                                                                             %
11197 %                                                                             %
11198 %                                                                             %
11199 %   M a g i c k T h r e s h o l d I m a g e                                   %
11200 %                                                                             %
11201 %                                                                             %
11202 %                                                                             %
11203 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11204 %
11205 %  MagickThresholdImage() changes the value of individual pixels based on
11206 %  the intensity of each pixel compared to threshold.  The result is a
11207 %  high-contrast, two color image.
11208 %
11209 %  The format of the MagickThresholdImage method is:
11210 %
11211 %      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11212 %        const double threshold)
11213 %      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11214 %        const ChannelType channel,const double threshold)
11215 %
11216 %  A description of each parameter follows:
11217 %
11218 %    o wand: the magick wand.
11219 %
11220 %    o channel: the image channel(s).
11221 %
11222 %    o threshold: Define the threshold value.
11223 %
11224 */
11225 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11226   const double threshold)
11227 {
11228   MagickBooleanType
11229     status;
11230
11231   status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11232   return(status);
11233 }
11234
11235 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11236   const ChannelType channel,const double threshold)
11237 {
11238   MagickBooleanType
11239     status;
11240
11241   assert(wand != (MagickWand *) NULL);
11242   assert(wand->signature == WandSignature);
11243   if (wand->debug != MagickFalse)
11244     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11245   if (wand->images == (Image *) NULL)
11246     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11247   status=BilevelImage(wand->images,threshold,wand->exception);
11248   return(status);
11249 }
11250 \f
11251 /*
11252 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11253 %                                                                             %
11254 %                                                                             %
11255 %                                                                             %
11256 %   M a g i c k T h u m b n a i l I m a g e                                   %
11257 %                                                                             %
11258 %                                                                             %
11259 %                                                                             %
11260 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11261 %
11262 %  MagickThumbnailImage()  changes the size of an image to the given dimensions
11263 %  and removes any associated profiles.  The goal is to produce small low cost
11264 %  thumbnail images suited for display on the Web.
11265 %
11266 %  The format of the MagickThumbnailImage method is:
11267 %
11268 %      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11269 %        const size_t columns,const size_t rows)
11270 %
11271 %  A description of each parameter follows:
11272 %
11273 %    o wand: the magick wand.
11274 %
11275 %    o columns: the number of columns in the scaled image.
11276 %
11277 %    o rows: the number of rows in the scaled image.
11278 %
11279 */
11280 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11281   const size_t columns,const size_t rows)
11282 {
11283   Image
11284     *thumbnail_image;
11285
11286   assert(wand != (MagickWand *) NULL);
11287   assert(wand->signature == WandSignature);
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   thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11293   if (thumbnail_image == (Image *) NULL)
11294     return(MagickFalse);
11295   ReplaceImageInList(&wand->images,thumbnail_image);
11296   return(MagickTrue);
11297 }
11298 \f
11299 /*
11300 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11301 %                                                                             %
11302 %                                                                             %
11303 %                                                                             %
11304 %   M a g i c k T i n t I m a g e                                             %
11305 %                                                                             %
11306 %                                                                             %
11307 %                                                                             %
11308 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11309 %
11310 %  MagickTintImage() applies a color vector to each pixel in the image.  The
11311 %  length of the vector is 0 for black and white and at its maximum for the
11312 %  midtones.  The vector weighting function is
11313 %  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11314 %
11315 %  The format of the MagickTintImage method is:
11316 %
11317 %      MagickBooleanType MagickTintImage(MagickWand *wand,
11318 %        const PixelWand *tint,const PixelWand *blend)
11319 %
11320 %  A description of each parameter follows:
11321 %
11322 %    o wand: the magick wand.
11323 %
11324 %    o tint: the tint pixel wand.
11325 %
11326 %    o alpha: the alpha pixel wand.
11327 %
11328 */
11329 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11330   const PixelWand *tint,const PixelWand *blend)
11331 {
11332   char
11333     percent_blend[MaxTextExtent];
11334
11335   Image
11336     *tint_image;
11337
11338   PixelInfo
11339     target;
11340
11341   assert(wand != (MagickWand *) NULL);
11342   assert(wand->signature == WandSignature);
11343   if (wand->debug != MagickFalse)
11344     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11345   if (wand->images == (Image *) NULL)
11346     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11347   if (wand->images->colorspace != CMYKColorspace)
11348     (void) FormatLocaleString(percent_blend,MaxTextExtent,
11349       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11350       PixelGetRedQuantum(blend)),(double) (100.0*QuantumScale*
11351       PixelGetGreenQuantum(blend)),(double) (100.0*QuantumScale*
11352       PixelGetBlueQuantum(blend)),(double) (100.0*QuantumScale*
11353       PixelGetAlphaQuantum(blend)));
11354   else
11355     (void) FormatLocaleString(percent_blend,MaxTextExtent,
11356       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
11357       PixelGetCyanQuantum(blend)),(double) (100.0*QuantumScale*
11358       PixelGetMagentaQuantum(blend)),(double) (100.0*QuantumScale*
11359       PixelGetYellowQuantum(blend)),(double) (100.0*QuantumScale*
11360       PixelGetBlackQuantum(blend)),(double) (100.0*QuantumScale*
11361       PixelGetAlphaQuantum(blend)));
11362   target=PixelGetPixel(tint);
11363   tint_image=TintImage(wand->images,percent_blend,&target,wand->exception);
11364   if (tint_image == (Image *) NULL)
11365     return(MagickFalse);
11366   ReplaceImageInList(&wand->images,tint_image);
11367   return(MagickTrue);
11368 }
11369 \f
11370 /*
11371 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11372 %                                                                             %
11373 %                                                                             %
11374 %                                                                             %
11375 %   M a g i c k T r a n s f o r m I m a g e                                   %
11376 %                                                                             %
11377 %                                                                             %
11378 %                                                                             %
11379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11380 %
11381 %  MagickTransformImage() is a convenience method that behaves like
11382 %  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11383 %  information as a region geometry specification.  If the operation fails,
11384 %  a NULL image handle is returned.
11385 %
11386 %  The format of the MagickTransformImage method is:
11387 %
11388 %      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11389 %        const char *geometry)
11390 %
11391 %  A description of each parameter follows:
11392 %
11393 %    o wand: the magick wand.
11394 %
11395 %    o crop: A crop geometry string.  This geometry defines a subregion of the
11396 %      image to crop.
11397 %
11398 %    o geometry: An image geometry string.  This geometry defines the final
11399 %      size of the image.
11400 %
11401 */
11402 WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11403   const char *crop,const char *geometry)
11404 {
11405   Image
11406     *transform_image;
11407
11408   MagickBooleanType
11409     status;
11410
11411   assert(wand != (MagickWand *) NULL);
11412   assert(wand->signature == WandSignature);
11413   if (wand->debug != MagickFalse)
11414     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11415   if (wand->images == (Image *) NULL)
11416     return((MagickWand *) NULL);
11417   transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11418   if (transform_image == (Image *) NULL)
11419     return((MagickWand *) NULL);
11420   status=TransformImage(&transform_image,crop,geometry,wand->exception);
11421   if (status == MagickFalse)
11422     {
11423       transform_image=DestroyImage(transform_image);
11424       return((MagickWand *) NULL);
11425     }
11426   return(CloneMagickWandFromImages(wand,transform_image));
11427 }
11428 \f
11429 /*
11430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11431 %                                                                             %
11432 %                                                                             %
11433 %                                                                             %
11434 %   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               %
11435 %                                                                             %
11436 %                                                                             %
11437 %                                                                             %
11438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11439 %
11440 %  MagickTransformImageColorspace() transform the image colorspace.
11441 %
11442 %  The format of the MagickTransformImageColorspace method is:
11443 %
11444 %      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11445 %        const ColorspaceType colorspace)
11446 %
11447 %  A description of each parameter follows:
11448 %
11449 %    o wand: the magick wand.
11450 %
11451 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
11452 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
11453 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
11454 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
11455 %      HSLColorspace, or HWBColorspace.
11456 %
11457 */
11458 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11459   const ColorspaceType colorspace)
11460 {
11461   assert(wand != (MagickWand *) NULL);
11462   assert(wand->signature == WandSignature);
11463   if (wand->debug != MagickFalse)
11464     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11465   if (wand->images == (Image *) NULL)
11466     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11467   return(TransformImageColorspace(wand->images,colorspace,wand->exception));
11468 }
11469 \f
11470 /*
11471 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11472 %                                                                             %
11473 %                                                                             %
11474 %                                                                             %
11475 %   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                     %
11476 %                                                                             %
11477 %                                                                             %
11478 %                                                                             %
11479 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11480 %
11481 %  MagickTransparentPaintImage() changes any pixel that matches color with the
11482 %  color defined by fill.
11483 %
11484 %  The format of the MagickTransparentPaintImage method is:
11485 %
11486 %      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11487 %        const PixelWand *target,const double alpha,const double fuzz,
11488 %        const MagickBooleanType invert)
11489 %
11490 %  A description of each parameter follows:
11491 %
11492 %    o wand: the magick wand.
11493 %
11494 %    o target: Change this target color to specified alpha value within
11495 %      the image.
11496 %
11497 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11498 %      transparent.
11499 %
11500 %    o fuzz: By default target must match a particular pixel color
11501 %      exactly.  However, in many cases two colors may differ by a small amount.
11502 %      The fuzz member of image defines how much tolerance is acceptable to
11503 %      consider two colors as the same.  For example, set fuzz to 10 and the
11504 %      color red at intensities of 100 and 102 respectively are now interpreted
11505 %      as the same color for the purposes of the floodfill.
11506 %
11507 %    o invert: paint any pixel that does not match the target color.
11508 %
11509 */
11510 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11511   const PixelWand *target,const double alpha,const double fuzz,
11512   const MagickBooleanType invert)
11513 {
11514   MagickBooleanType
11515     status;
11516
11517   PixelInfo
11518     target_pixel;
11519
11520   assert(wand != (MagickWand *) NULL);
11521   assert(wand->signature == WandSignature);
11522   if (wand->debug != MagickFalse)
11523     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11524   if (wand->images == (Image *) NULL)
11525     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11526   PixelGetMagickColor(target,&target_pixel);
11527   wand->images->fuzz=fuzz;
11528   status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11529     QuantumRange*alpha),invert,wand->exception);
11530   return(status);
11531 }
11532 \f
11533 /*
11534 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11535 %                                                                             %
11536 %                                                                             %
11537 %                                                                             %
11538 %   M a g i c k T r a n s p o s e I m a g e                                   %
11539 %                                                                             %
11540 %                                                                             %
11541 %                                                                             %
11542 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11543 %
11544 %  MagickTransposeImage() creates a vertical mirror image by reflecting the
11545 %  pixels around the central x-axis while rotating them 90-degrees.
11546 %
11547 %  The format of the MagickTransposeImage method is:
11548 %
11549 %      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11550 %
11551 %  A description of each parameter follows:
11552 %
11553 %    o wand: the magick wand.
11554 %
11555 */
11556 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11557 {
11558   Image
11559     *transpose_image;
11560
11561   assert(wand != (MagickWand *) NULL);
11562   assert(wand->signature == WandSignature);
11563   if (wand->debug != MagickFalse)
11564     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11565   if (wand->images == (Image *) NULL)
11566     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11567   transpose_image=TransposeImage(wand->images,wand->exception);
11568   if (transpose_image == (Image *) NULL)
11569     return(MagickFalse);
11570   ReplaceImageInList(&wand->images,transpose_image);
11571   return(MagickTrue);
11572 }
11573 \f
11574 /*
11575 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11576 %                                                                             %
11577 %                                                                             %
11578 %                                                                             %
11579 %   M a g i c k T r a n s v e r s e I m a g e                                 %
11580 %                                                                             %
11581 %                                                                             %
11582 %                                                                             %
11583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11584 %
11585 %  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11586 %  pixels around the central y-axis while rotating them 270-degrees.
11587 %
11588 %  The format of the MagickTransverseImage method is:
11589 %
11590 %      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11591 %
11592 %  A description of each parameter follows:
11593 %
11594 %    o wand: the magick wand.
11595 %
11596 */
11597 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11598 {
11599   Image
11600     *transverse_image;
11601
11602   assert(wand != (MagickWand *) NULL);
11603   assert(wand->signature == WandSignature);
11604   if (wand->debug != MagickFalse)
11605     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11606   if (wand->images == (Image *) NULL)
11607     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11608   transverse_image=TransverseImage(wand->images,wand->exception);
11609   if (transverse_image == (Image *) NULL)
11610     return(MagickFalse);
11611   ReplaceImageInList(&wand->images,transverse_image);
11612   return(MagickTrue);
11613 }
11614 \f
11615 /*
11616 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11617 %                                                                             %
11618 %                                                                             %
11619 %                                                                             %
11620 %   M a g i c k T r i m I m a g e                                             %
11621 %                                                                             %
11622 %                                                                             %
11623 %                                                                             %
11624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11625 %
11626 %  MagickTrimImage() remove edges that are the background color from the image.
11627 %
11628 %  The format of the MagickTrimImage method is:
11629 %
11630 %      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11631 %
11632 %  A description of each parameter follows:
11633 %
11634 %    o wand: the magick wand.
11635 %
11636 %    o fuzz: By default target must match a particular pixel color
11637 %      exactly.  However, in many cases two colors may differ by a small amount.
11638 %      The fuzz member of image defines how much tolerance is acceptable to
11639 %      consider two colors as the same.  For example, set fuzz to 10 and the
11640 %      color red at intensities of 100 and 102 respectively are now interpreted
11641 %      as the same color for the purposes of the floodfill.
11642 %
11643 */
11644 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11645 {
11646   Image
11647     *trim_image;
11648
11649   assert(wand != (MagickWand *) NULL);
11650   assert(wand->signature == WandSignature);
11651   if (wand->debug != MagickFalse)
11652     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11653   if (wand->images == (Image *) NULL)
11654     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11655   wand->images->fuzz=fuzz;
11656   trim_image=TrimImage(wand->images,wand->exception);
11657   if (trim_image == (Image *) NULL)
11658     return(MagickFalse);
11659   ReplaceImageInList(&wand->images,trim_image);
11660   return(MagickTrue);
11661 }
11662 \f
11663 /*
11664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11665 %                                                                             %
11666 %                                                                             %
11667 %                                                                             %
11668 %   M a g i c k U n i q u e I m a g e C o l o r s                             %
11669 %                                                                             %
11670 %                                                                             %
11671 %                                                                             %
11672 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11673 %
11674 %  MagickUniqueImageColors() discards all but one of any pixel color.
11675 %
11676 %  The format of the MagickUniqueImageColors method is:
11677 %
11678 %      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11679 %
11680 %  A description of each parameter follows:
11681 %
11682 %    o wand: the magick wand.
11683 %
11684 */
11685 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11686 {
11687   Image
11688     *unique_image;
11689
11690   assert(wand != (MagickWand *) NULL);
11691   assert(wand->signature == WandSignature);
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   unique_image=UniqueImageColors(wand->images,wand->exception);
11697   if (unique_image == (Image *) NULL)
11698     return(MagickFalse);
11699   ReplaceImageInList(&wand->images,unique_image);
11700   return(MagickTrue);
11701 }
11702 \f
11703 /*
11704 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11705 %                                                                             %
11706 %                                                                             %
11707 %                                                                             %
11708 %   M a g i c k U n s h a r p M a s k I m a g e                               %
11709 %                                                                             %
11710 %                                                                             %
11711 %                                                                             %
11712 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11713 %
11714 %  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
11715 %  Gaussian operator of the given radius and standard deviation (sigma).
11716 %  For reasonable results, radius should be larger than sigma.  Use a radius
11717 %  of 0 and UnsharpMaskImage() selects a suitable radius for you.
11718 %
11719 %  The format of the MagickUnsharpMaskImage method is:
11720 %
11721 %      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11722 %        const double radius,const double sigma,const double amount,
11723 %        const double threshold)
11724 %
11725 %  A description of each parameter follows:
11726 %
11727 %    o wand: the magick wand.
11728 %
11729 %    o radius: the radius of the Gaussian, in pixels, not counting the center
11730 %      pixel.
11731 %
11732 %    o sigma: the standard deviation of the Gaussian, in pixels.
11733 %
11734 %    o amount: the percentage of the difference between the original and the
11735 %      blur image that is added back into the original.
11736 %
11737 %    o threshold: the threshold in pixels needed to apply the diffence amount.
11738 %
11739 */
11740 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11741   const double radius,const double sigma,const double amount,
11742   const double threshold)
11743 {
11744   Image
11745     *unsharp_image;
11746
11747   assert(wand != (MagickWand *) NULL);
11748   assert(wand->signature == WandSignature);
11749   if (wand->debug != MagickFalse)
11750     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11751   if (wand->images == (Image *) NULL)
11752     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11753   unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
11754     wand->exception);
11755   if (unsharp_image == (Image *) NULL)
11756     return(MagickFalse);
11757   ReplaceImageInList(&wand->images,unsharp_image);
11758   return(MagickTrue);
11759 }
11760 \f
11761 /*
11762 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11763 %                                                                             %
11764 %                                                                             %
11765 %                                                                             %
11766 %   M a g i c k V i g n e t t e I m a g e                                     %
11767 %                                                                             %
11768 %                                                                             %
11769 %                                                                             %
11770 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11771 %
11772 %  MagickVignetteImage() softens the edges of the image in vignette style.
11773 %
11774 %  The format of the MagickVignetteImage method is:
11775 %
11776 %      MagickBooleanType MagickVignetteImage(MagickWand *wand,
11777 %        const double radius,const double sigma,const double bias,
11778 %        const ssize_t x,const ssize_t y)
11779 %
11780 %  A description of each parameter follows:
11781 %
11782 %    o wand: the magick wand.
11783 %
11784 %    o radius: the radius.
11785 %
11786 %    o sigma: the sigma.
11787 %
11788 %    o bias: the bias.
11789 %
11790 %    o x, y:  Define the x and y ellipse offset.
11791 %
11792 */
11793 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
11794   const double radius,const double sigma,const double bias,const ssize_t x,
11795   const ssize_t y)
11796 {
11797   Image
11798     *vignette_image;
11799
11800   assert(wand != (MagickWand *) NULL);
11801   assert(wand->signature == WandSignature);
11802   if (wand->debug != MagickFalse)
11803     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11804   if (wand->images == (Image *) NULL)
11805     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11806   vignette_image=VignetteImage(wand->images,radius,sigma,bias,x,y,
11807     wand->exception);
11808   if (vignette_image == (Image *) NULL)
11809     return(MagickFalse);
11810   ReplaceImageInList(&wand->images,vignette_image);
11811   return(MagickTrue);
11812 }
11813 \f
11814 /*
11815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11816 %                                                                             %
11817 %                                                                             %
11818 %                                                                             %
11819 %   M a g i c k W a v e I m a g e                                             %
11820 %                                                                             %
11821 %                                                                             %
11822 %                                                                             %
11823 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11824 %
11825 %  MagickWaveImage()  creates a "ripple" effect in the image by shifting
11826 %  the pixels vertically along a sine wave whose amplitude and wavelength
11827 %  is specified by the given parameters.
11828 %
11829 %  The format of the MagickWaveImage method is:
11830 %
11831 %      MagickBooleanType MagickWaveImage(MagickWand *wand,
11832 %        const double amplitude,const double wave_length,
11833 %        const PixelInterpolateMethod method)
11834 %
11835 %  A description of each parameter follows:
11836 %
11837 %    o wand: the magick wand.
11838 %
11839 %    o amplitude, wave_length:  Define the amplitude and wave length of the
11840 %      sine wave.
11841 %
11842 %    o method: the pixel interpolation method.
11843 %
11844 */
11845 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
11846   const double amplitude,const double wave_length,
11847   const PixelInterpolateMethod method)
11848 {
11849   Image
11850     *wave_image;
11851
11852   assert(wand != (MagickWand *) NULL);
11853   assert(wand->signature == WandSignature);
11854   if (wand->debug != MagickFalse)
11855     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11856   if (wand->images == (Image *) NULL)
11857     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11858   wave_image=WaveImage(wand->images,amplitude,wave_length,method,
11859     wand->exception);
11860   if (wave_image == (Image *) NULL)
11861     return(MagickFalse);
11862   ReplaceImageInList(&wand->images,wave_image);
11863   return(MagickTrue);
11864 }
11865 \f
11866 /*
11867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11868 %                                                                             %
11869 %                                                                             %
11870 %                                                                             %
11871 %   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                         %
11872 %                                                                             %
11873 %                                                                             %
11874 %                                                                             %
11875 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11876 %
11877 %  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
11878 %  above the threshold into white while leaving all pixels below the threshold
11879 %  unchanged.
11880 %
11881 %  The format of the MagickWhiteThresholdImage method is:
11882 %
11883 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11884 %        const PixelWand *threshold)
11885 %
11886 %  A description of each parameter follows:
11887 %
11888 %    o wand: the magick wand.
11889 %
11890 %    o threshold: the pixel wand.
11891 %
11892 */
11893 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11894   const PixelWand *threshold)
11895 {
11896   char
11897     thresholds[MaxTextExtent];
11898
11899   assert(wand != (MagickWand *) NULL);
11900   assert(wand->signature == WandSignature);
11901   if (wand->debug != MagickFalse)
11902     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11903   if (wand->images == (Image *) NULL)
11904     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11905   (void) FormatLocaleString(thresholds,MaxTextExtent,
11906     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
11907     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
11908     PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold));
11909   return(WhiteThresholdImage(wand->images,thresholds,wand->exception));
11910 }
11911 \f
11912 /*
11913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11914 %                                                                             %
11915 %                                                                             %
11916 %                                                                             %
11917 %   M a g i c k W r i t e I m a g e                                           %
11918 %                                                                             %
11919 %                                                                             %
11920 %                                                                             %
11921 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11922 %
11923 %  MagickWriteImage() writes an image to the specified filename.  If the
11924 %  filename parameter is NULL, the image is written to the filename set
11925 %  by MagickReadImage() or MagickSetImageFilename().
11926 %
11927 %  The format of the MagickWriteImage method is:
11928 %
11929 %      MagickBooleanType MagickWriteImage(MagickWand *wand,
11930 %        const char *filename)
11931 %
11932 %  A description of each parameter follows:
11933 %
11934 %    o wand: the magick wand.
11935 %
11936 %    o filename: the image filename.
11937 %
11938 %
11939 */
11940 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
11941   const char *filename)
11942 {
11943   Image
11944     *image;
11945
11946   ImageInfo
11947     *write_info;
11948
11949   MagickBooleanType
11950     status;
11951
11952   assert(wand != (MagickWand *) NULL);
11953   assert(wand->signature == WandSignature);
11954   if (wand->debug != MagickFalse)
11955     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11956   if (wand->images == (Image *) NULL)
11957     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11958   if (filename != (const char *) NULL)
11959     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
11960   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11961   if (image == (Image *) NULL)
11962     return(MagickFalse);
11963   write_info=CloneImageInfo(wand->image_info);
11964   write_info->adjoin=MagickTrue;
11965   status=WriteImage(write_info,image,wand->exception);
11966   image=DestroyImage(image);
11967   write_info=DestroyImageInfo(write_info);
11968   return(status);
11969 }
11970 \f
11971 /*
11972 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11973 %                                                                             %
11974 %                                                                             %
11975 %                                                                             %
11976 %   M a g i c k W r i t e I m a g e F i l e                                   %
11977 %                                                                             %
11978 %                                                                             %
11979 %                                                                             %
11980 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11981 %
11982 %  MagickWriteImageFile() writes an image to an open file descriptor.
11983 %
11984 %  The format of the MagickWriteImageFile method is:
11985 %
11986 %      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11987 %
11988 %  A description of each parameter follows:
11989 %
11990 %    o wand: the magick wand.
11991 %
11992 %    o file: the file descriptor.
11993 %
11994 */
11995 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11996 {
11997   Image
11998     *image;
11999
12000   ImageInfo
12001     *write_info;
12002
12003   MagickBooleanType
12004     status;
12005
12006   assert(wand != (MagickWand *) NULL);
12007   assert(wand->signature == WandSignature);
12008   assert(file != (FILE *) NULL);
12009   if (wand->debug != MagickFalse)
12010     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12011   if (wand->images == (Image *) NULL)
12012     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12013   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12014   if (image == (Image *) NULL)
12015     return(MagickFalse);
12016   write_info=CloneImageInfo(wand->image_info);
12017   SetImageInfoFile(write_info,file);
12018   write_info->adjoin=MagickTrue;
12019   status=WriteImage(write_info,image,wand->exception);
12020   write_info=DestroyImageInfo(write_info);
12021   image=DestroyImage(image);
12022   return(status);
12023 }
12024 \f
12025 /*
12026 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12027 %                                                                             %
12028 %                                                                             %
12029 %                                                                             %
12030 %   M a g i c k W r i t e I m a g e s                                         %
12031 %                                                                             %
12032 %                                                                             %
12033 %                                                                             %
12034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12035 %
12036 %  MagickWriteImages() writes an image or image sequence.
12037 %
12038 %  The format of the MagickWriteImages method is:
12039 %
12040 %      MagickBooleanType MagickWriteImages(MagickWand *wand,
12041 %        const char *filename,const MagickBooleanType adjoin)
12042 %
12043 %  A description of each parameter follows:
12044 %
12045 %    o wand: the magick wand.
12046 %
12047 %    o filename: the image filename.
12048 %
12049 %    o adjoin: join images into a single multi-image file.
12050 %
12051 */
12052 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12053   const char *filename,const MagickBooleanType adjoin)
12054 {
12055   ImageInfo
12056     *write_info;
12057
12058   MagickBooleanType
12059     status;
12060
12061   assert(wand != (MagickWand *) NULL);
12062   assert(wand->signature == WandSignature);
12063   if (wand->debug != MagickFalse)
12064     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12065   if (wand->images == (Image *) NULL)
12066     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12067   write_info=CloneImageInfo(wand->image_info);
12068   write_info->adjoin=adjoin;
12069   status=WriteImages(write_info,wand->images,filename,wand->exception);
12070   write_info=DestroyImageInfo(write_info);
12071   return(status);
12072 }
12073 \f
12074 /*
12075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12076 %                                                                             %
12077 %                                                                             %
12078 %                                                                             %
12079 %   M a g i c k W r i t e I m a g e s F i l e                                 %
12080 %                                                                             %
12081 %                                                                             %
12082 %                                                                             %
12083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12084 %
12085 %  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12086 %
12087 %  The format of the MagickWriteImagesFile method is:
12088 %
12089 %      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12090 %
12091 %  A description of each parameter follows:
12092 %
12093 %    o wand: the magick wand.
12094 %
12095 %    o file: the file descriptor.
12096 %
12097 */
12098 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12099 {
12100   ImageInfo
12101     *write_info;
12102
12103   MagickBooleanType
12104     status;
12105
12106   assert(wand != (MagickWand *) NULL);
12107   assert(wand->signature == WandSignature);
12108   if (wand->debug != MagickFalse)
12109     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12110   if (wand->images == (Image *) NULL)
12111     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12112   write_info=CloneImageInfo(wand->image_info);
12113   SetImageInfoFile(write_info,file);
12114   write_info->adjoin=MagickTrue;
12115   status=WriteImages(write_info,wand->images,(const char *) NULL,
12116     wand->exception);
12117   write_info=DestroyImageInfo(write_info);
12118   return(status);
12119 }