]> granicus.if.org Git - imagemagick/blob - MagickWand/magick-image.c
(no commit message)
[imagemagick] / MagickWand / magick-image.c
1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %                                                                             %
4 %                                                                             %
5 %                                                                             %
6 %                 M   M   AAA    GGGG  IIIII   CCCC  K   K                    %
7 %                 MM MM  A   A  G        I    C      K  K                     %
8 %                 M M M  AAAAA  G GGG    I    C      KKK                      %
9 %                 M   M  A   A  G   G    I    C      K  K                     %
10 %                 M   M  A   A   GGGG  IIIII   CCCC  K   K                    %
11 %                                                                             %
12 %                     IIIII  M   M   AAA    GGGG  EEEEE                       %
13 %                       I    MM MM  A   A  G      E                           %
14 %                       I    M M M  AAAAA  G  GG  EEE                         %
15 %                       I    M   M  A   A  G   G  E                           %
16 %                     IIIII  M   M  A   A   GGGG  EEEEE                       %
17 %                                                                             %
18 %                                                                             %
19 %                          MagickWand Image Methods                           %
20 %                                                                             %
21 %                               Software Design                               %
22 %                                 John Cristy                                 %
23 %                                 August 2003                                 %
24 %                                                                             %
25 %                                                                             %
26 %  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
27 %  dedicated to making software imaging solutions freely available.           %
28 %                                                                             %
29 %  You may not use this file except in compliance with the License.  You may  %
30 %  obtain a copy of the License at                                            %
31 %                                                                             %
32 %    http://www.imagemagick.org/script/license.php                            %
33 %                                                                             %
34 %  Unless required by applicable law or agreed to in writing, software        %
35 %  distributed under the License is distributed on an "AS IS" BASIS,          %
36 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
37 %  See the License for the specific language governing permissions and        %
38 %  limitations under the License.                                             %
39 %                                                                             %
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41 %
42 %
43 %
44 */
45 \f
46 /*
47   Include declarations.
48 */
49 #include "MagickWand/studio.h"
50 #include "MagickWand/MagickWand.h"
51 #include "MagickWand/magick-wand-private.h"
52 #include "MagickWand/wand.h"
53 #include "MagickWand/pixel-wand-private.h"
54 \f
55 /*
56   Define declarations.
57 */
58 #define ThrowWandException(severity,tag,context) \
59 { \
60   (void) ThrowMagickException(wand->exception,GetMagickModule(),severity, \
61     tag,"`%s'",context); \
62   return(MagickFalse); \
63 }
64 #define MagickWandId  "MagickWand"
65 \f
66 /*
67 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68 %                                                                             %
69 %                                                                             %
70 %                                                                             %
71 +   C l o n e M a g i c k W a n d F r o m I m a g e s                         %
72 %                                                                             %
73 %                                                                             %
74 %                                                                             %
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76 %
77 %  CloneMagickWandFromImages() clones the magick wand and inserts a new image
78 %  list.
79 %
80 %  The format of the CloneMagickWandFromImages method is:
81 %
82 %      MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
83 %        Image *images)
84 %
85 %  A description of each parameter follows:
86 %
87 %    o wand: the magick wand.
88 %
89 %    o images: replace the image list with these image(s).
90 %
91 */
92 static MagickWand *CloneMagickWandFromImages(const MagickWand *wand,
93   Image *images)
94 {
95   MagickWand
96     *clone_wand;
97
98   assert(wand != (MagickWand *) NULL);
99   assert(wand->signature == WandSignature);
100   if (wand->debug != MagickFalse)
101     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
102   clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
103   if (clone_wand == (MagickWand *) NULL)
104     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
105       images->filename);
106   (void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
107   clone_wand->id=AcquireWandId();
108   (void) FormatLocaleString(clone_wand->name,MaxTextExtent,"%s-%.20g",
109     MagickWandId,(double) clone_wand->id);
110   clone_wand->exception=AcquireExceptionInfo();
111   InheritException(clone_wand->exception,wand->exception);
112   clone_wand->image_info=CloneImageInfo(wand->image_info);
113   clone_wand->quantize_info=CloneQuantizeInfo(wand->quantize_info);
114   clone_wand->images=images;
115   clone_wand->debug=IsEventLogging();
116   if (clone_wand->debug != MagickFalse)
117     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
118   clone_wand->signature=WandSignature;
119   return(clone_wand);
120 }
121 \f
122 /*
123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
124 %                                                                             %
125 %                                                                             %
126 %                                                                             %
127 %   G e t I m a g e F r o m M a g i c k W a n d                               %
128 %                                                                             %
129 %                                                                             %
130 %                                                                             %
131 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
132 %
133 %  GetImageFromMagickWand() returns the current image from the magick wand.
134 %
135 %  The format of the GetImageFromMagickWand method is:
136 %
137 %      Image *GetImageFromMagickWand(const MagickWand *wand)
138 %
139 %  A description of each parameter follows:
140 %
141 %    o wand: the magick wand.
142 %
143 */
144 WandExport Image *GetImageFromMagickWand(const MagickWand *wand)
145 {
146   assert(wand != (MagickWand *) NULL);
147   assert(wand->signature == WandSignature);
148   if (wand->debug != MagickFalse)
149     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
150   if (wand->images == (Image *) NULL)
151     {
152       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
153         "ContainsNoImages","`%s'",wand->name);
154       return((Image *) NULL);
155     }
156   return(wand->images);
157 }
158 \f
159 /*
160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
161 %                                                                             %
162 %                                                                             %
163 %                                                                             %
164 %   M a g i c k A d a p t i v e S h a r p e n I m a g e                       %
165 %                                                                             %
166 %                                                                             %
167 %                                                                             %
168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
169 %
170 %  MagickAdaptiveBlurImage() adaptively blurs the image by blurring
171 %  less intensely near image edges and more intensely far from edges. We
172 %  blur the image with a Gaussian operator of the given radius and standard
173 %  deviation (sigma).  For reasonable results, radius should be larger than
174 %  sigma.  Use a radius of 0 and MagickAdaptiveBlurImage() selects a
175 %  suitable radius for you.
176 %
177 %  The format of the MagickAdaptiveBlurImage method is:
178 %
179 %      MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
180 %        const double radius,const double sigma,const double bias)
181 %
182 %  A description of each parameter follows:
183 %
184 %    o wand: the magick wand.
185 %
186 %    o radius: the radius of the Gaussian, in pixels, not counting the center
187 %      pixel.
188 %
189 %    o sigma: the standard deviation of the Gaussian, in pixels.
190 %
191 %    o bias: the bias.
192 %
193 */
194 WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
195   const double radius,const double sigma,const double bias)
196 {
197   Image
198     *sharp_image;
199
200   assert(wand != (MagickWand *) NULL);
201   assert(wand->signature == WandSignature);
202   if (wand->debug != MagickFalse)
203     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
204   if (wand->images == (Image *) NULL)
205     ThrowWandException(WandError,"ContainsNoImages",wand->name);
206   sharp_image=AdaptiveBlurImage(wand->images,radius,sigma,bias,wand->exception);
207   if (sharp_image == (Image *) NULL)
208     return(MagickFalse);
209   ReplaceImageInList(&wand->images,sharp_image);
210   return(MagickTrue);
211 }
212 \f
213 /*
214 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
215 %                                                                             %
216 %                                                                             %
217 %                                                                             %
218 %   M a g i c k A d a p t i v e R e s i z e I m a g e                         %
219 %                                                                             %
220 %                                                                             %
221 %                                                                             %
222 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
223 %
224 %  MagickAdaptiveResizeImage() adaptively resize image with data dependent
225 %  triangulation.
226 %
227 %      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
228 %        const size_t columns,const size_t rows,
229 %        const PixelInterpolateMethod method)
230 %
231 %  A description of each parameter follows:
232 %
233 %    o wand: the magick wand.
234 %
235 %    o columns: the number of columns in the scaled image.
236 %
237 %    o rows: the number of rows in the scaled image.
238 %
239 %    o interpolate: the pixel interpolation method.
240 %
241 */
242 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
243   const size_t columns,const size_t rows,const PixelInterpolateMethod method)
244 {
245   Image
246     *resize_image;
247
248   assert(wand != (MagickWand *) NULL);
249   assert(wand->signature == WandSignature);
250   if (wand->debug != MagickFalse)
251     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
252   if (wand->images == (Image *) NULL)
253     ThrowWandException(WandError,"ContainsNoImages",wand->name);
254   resize_image=AdaptiveResizeImage(wand->images,columns,rows,method,
255     wand->exception);
256   if (resize_image == (Image *) NULL)
257     return(MagickFalse);
258   ReplaceImageInList(&wand->images,resize_image);
259   return(MagickTrue);
260 }
261 \f
262 /*
263 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
264 %                                                                             %
265 %                                                                             %
266 %                                                                             %
267 %   M a g i c k A d a p t i v e S h a r p e n I m a g e                       %
268 %                                                                             %
269 %                                                                             %
270 %                                                                             %
271 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
272 %
273 %  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
274 %  more intensely near image edges and less intensely far from edges. We
275 %  sharpen the image with a Gaussian operator of the given radius and standard
276 %  deviation (sigma).  For reasonable results, radius should be larger than
277 %  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
278 %  suitable radius for you.
279 %
280 %  The format of the MagickAdaptiveSharpenImage method is:
281 %
282 %      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
283 %        const double radius,const double sigma,const double bias)
284 %
285 %  A description of each parameter follows:
286 %
287 %    o wand: the magick wand.
288 %
289 %    o radius: the radius of the Gaussian, in pixels, not counting the center
290 %      pixel.
291 %
292 %    o sigma: the standard deviation of the Gaussian, in pixels.
293 %
294 %    o bias: the bias.
295 %
296 */
297 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
298   const double radius,const double sigma,const double bias)
299 {
300   Image
301     *sharp_image;
302
303   assert(wand != (MagickWand *) NULL);
304   assert(wand->signature == WandSignature);
305   if (wand->debug != MagickFalse)
306     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
307   if (wand->images == (Image *) NULL)
308     ThrowWandException(WandError,"ContainsNoImages",wand->name);
309   sharp_image=AdaptiveSharpenImage(wand->images,radius,sigma,bias,
310     wand->exception);
311   if (sharp_image == (Image *) NULL)
312     return(MagickFalse);
313   ReplaceImageInList(&wand->images,sharp_image);
314   return(MagickTrue);
315 }
316 \f
317 /*
318 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
319 %                                                                             %
320 %                                                                             %
321 %                                                                             %
322 %   M a g i c k A d a p t i v e T h r e s h o l d I m a g e                   %
323 %                                                                             %
324 %                                                                             %
325 %                                                                             %
326 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
327 %
328 %  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
329 %  based on the range of intensity values in its local neighborhood.  This
330 %  allows for thresholding of an image whose global intensity histogram
331 %  doesn't contain distinctive peaks.
332 %
333 %  The format of the AdaptiveThresholdImage method is:
334 %
335 %      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
336 %        const size_t width,const size_t height,const ssize_t offset)
337 %
338 %  A description of each parameter follows:
339 %
340 %    o wand: the magick wand.
341 %
342 %    o width: the width of the local neighborhood.
343 %
344 %    o height: the height of the local neighborhood.
345 %
346 %    o offset: the mean offset.
347 %
348 */
349 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
350   const size_t width,const size_t height,const ssize_t offset)
351 {
352   Image
353     *threshold_image;
354
355   assert(wand != (MagickWand *) NULL);
356   assert(wand->signature == WandSignature);
357   if (wand->debug != MagickFalse)
358     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
359   if (wand->images == (Image *) NULL)
360     ThrowWandException(WandError,"ContainsNoImages",wand->name);
361   threshold_image=AdaptiveThresholdImage(wand->images,width,height,offset,
362     wand->exception);
363   if (threshold_image == (Image *) NULL)
364     return(MagickFalse);
365   ReplaceImageInList(&wand->images,threshold_image);
366   return(MagickTrue);
367 }
368 \f
369 /*
370 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
371 %                                                                             %
372 %                                                                             %
373 %                                                                             %
374 %   M a g i c k A d d I m a g e                                               %
375 %                                                                             %
376 %                                                                             %
377 %                                                                             %
378 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
379 %
380 %  MagickAddImage() adds the specified images at the current image location.
381 %
382 %  The format of the MagickAddImage method is:
383 %
384 %      MagickBooleanType MagickAddImage(MagickWand *wand,
385 %        const MagickWand *add_wand)
386 %
387 %  A description of each parameter follows:
388 %
389 %    o wand: the magick wand.
390 %
391 %    o add_wand: A wand that contains images to add at the current image
392 %      location.
393 %
394 */
395
396 static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
397   Image *images)
398 {
399   Image
400     *sentinel;
401
402   sentinel=wand->images;
403   if (sentinel == (Image *) NULL)
404     {
405       wand->images=GetFirstImageInList(images);
406       return(MagickTrue);
407     }
408   if (wand->active == MagickFalse)
409     {
410       if ((wand->pend != MagickFalse) && (sentinel->next == (Image *) NULL))
411         {
412           AppendImageToList(&sentinel,images);
413           wand->images=GetLastImageInList(images);
414           return(MagickTrue);
415         }
416       if ((wand->pend != MagickFalse) && (sentinel->previous == (Image *) NULL))
417         {
418           PrependImageToList(&sentinel,images);
419           wand->images=GetFirstImageInList(images);
420           return(MagickTrue);
421         }
422     }
423   if (sentinel->next == (Image *) NULL)
424     {
425       InsertImageInList(&sentinel,images);
426       wand->images=GetLastImageInList(images);
427       return(MagickTrue);
428     }
429   InsertImageInList(&sentinel,images);
430   wand->images=GetFirstImageInList(images);
431   return(MagickTrue);
432 }
433
434 WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
435   const MagickWand *add_wand)
436 {
437   Image
438     *images;
439
440   assert(wand != (MagickWand *) NULL);
441   assert(wand->signature == WandSignature);
442   if (wand->debug != MagickFalse)
443     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
444   assert(add_wand != (MagickWand *) NULL);
445   assert(add_wand->signature == WandSignature);
446   if (add_wand->images == (Image *) NULL)
447     ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
448   images=CloneImageList(add_wand->images,wand->exception);
449   if (images == (Image *) NULL)
450     return(MagickFalse);
451   return(InsertImageInWand(wand,images));
452 }
453 \f
454 /*
455 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
456 %                                                                             %
457 %                                                                             %
458 %                                                                             %
459 %     M a g i c k A d d N o i s e I m a g e                                   %
460 %                                                                             %
461 %                                                                             %
462 %                                                                             %
463 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
464 %
465 %  MagickAddNoiseImage() adds random noise to the image.
466 %
467 %  The format of the MagickAddNoiseImage method is:
468 %
469 %      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
470 %        const NoiseType noise_type)
471 %
472 %  A description of each parameter follows:
473 %
474 %    o wand: the magick wand.
475 %
476 %    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
477 %      Impulse, Laplacian, or Poisson.
478 %
479 */
480 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
481   const NoiseType noise_type)
482 {
483   Image
484     *noise_image;
485
486   assert(wand != (MagickWand *) NULL);
487   assert(wand->signature == WandSignature);
488   if (wand->debug != MagickFalse)
489     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
490   if (wand->images == (Image *) NULL)
491     ThrowWandException(WandError,"ContainsNoImages",wand->name);
492   noise_image=AddNoiseImage(wand->images,noise_type,wand->exception);
493   if (noise_image == (Image *) NULL)
494     return(MagickFalse);
495   ReplaceImageInList(&wand->images,noise_image);
496   return(MagickTrue);
497 }
498 \f
499 /*
500 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
501 %                                                                             %
502 %                                                                             %
503 %                                                                             %
504 %   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                       %
505 %                                                                             %
506 %                                                                             %
507 %                                                                             %
508 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
509 %
510 %  MagickAffineTransformImage() transforms an image as dictated by the affine
511 %  matrix of the drawing wand.
512 %
513 %  The format of the MagickAffineTransformImage method is:
514 %
515 %      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
516 %        const DrawingWand *drawing_wand)
517 %
518 %  A description of each parameter follows:
519 %
520 %    o wand: the magick wand.
521 %
522 %    o drawing_wand: the draw wand.
523 %
524 */
525 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
526   const DrawingWand *drawing_wand)
527 {
528   DrawInfo
529     *draw_info;
530
531   Image
532     *affine_image;
533
534   assert(wand != (MagickWand *) NULL);
535   assert(wand->signature == WandSignature);
536   if (wand->debug != MagickFalse)
537     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
538   if (wand->images == (Image *) NULL)
539     ThrowWandException(WandError,"ContainsNoImages",wand->name);
540   draw_info=PeekDrawingWand(drawing_wand);
541   if (draw_info == (DrawInfo *) NULL)
542     return(MagickFalse);
543   affine_image=AffineTransformImage(wand->images,&draw_info->affine,
544     wand->exception);
545   draw_info=DestroyDrawInfo(draw_info);
546   if (affine_image == (Image *) NULL)
547     return(MagickFalse);
548   ReplaceImageInList(&wand->images,affine_image);
549   return(MagickTrue);
550 }
551 \f
552 /*
553 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
554 %                                                                             %
555 %                                                                             %
556 %                                                                             %
557 %   M a g i c k A n n o t a t e I m a g e                                     %
558 %                                                                             %
559 %                                                                             %
560 %                                                                             %
561 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
562 %
563 %  MagickAnnotateImage() annotates an image with text.
564 %
565 %  The format of the MagickAnnotateImage method is:
566 %
567 %      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
568 %        const DrawingWand *drawing_wand,const double x,const double y,
569 %        const double angle,const char *text)
570 %
571 %  A description of each parameter follows:
572 %
573 %    o wand: the magick wand.
574 %
575 %    o drawing_wand: the draw wand.
576 %
577 %    o x: x ordinate to left of text
578 %
579 %    o y: y ordinate to text baseline
580 %
581 %    o angle: rotate text relative to this angle.
582 %
583 %    o text: text to draw
584 %
585 */
586 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
587   const DrawingWand *drawing_wand,const double x,const double y,
588   const double angle,const char *text)
589 {
590   char
591     geometry[MaxTextExtent];
592
593   DrawInfo
594     *draw_info;
595
596   MagickBooleanType
597     status;
598
599   assert(wand != (MagickWand *) NULL);
600   assert(wand->signature == WandSignature);
601   if (wand->debug != MagickFalse)
602     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
603   if (wand->images == (Image *) NULL)
604     ThrowWandException(WandError,"ContainsNoImages",wand->name);
605   draw_info=PeekDrawingWand(drawing_wand);
606   if (draw_info == (DrawInfo *) NULL)
607     return(MagickFalse);
608   (void) CloneString(&draw_info->text,text);
609   (void) FormatLocaleString(geometry,MaxTextExtent,"%+g%+g",x,y);
610   draw_info->affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
611   draw_info->affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
612   draw_info->affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
613   draw_info->affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
614   (void) CloneString(&draw_info->geometry,geometry);
615   status=AnnotateImage(wand->images,draw_info,&wand->images->exception);
616   draw_info=DestroyDrawInfo(draw_info);
617   return(status);
618 }
619 \f
620 /*
621 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
622 %                                                                             %
623 %                                                                             %
624 %                                                                             %
625 %   M a g i c k A n i m a t e I m a g e s                                     %
626 %                                                                             %
627 %                                                                             %
628 %                                                                             %
629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
630 %
631 %  MagickAnimateImages() animates an image or image sequence.
632 %
633 %  The format of the MagickAnimateImages method is:
634 %
635 %      MagickBooleanType MagickAnimateImages(MagickWand *wand,
636 %        const char *server_name)
637 %
638 %  A description of each parameter follows:
639 %
640 %    o wand: the magick wand.
641 %
642 %    o server_name: the X server name.
643 %
644 */
645 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
646   const char *server_name)
647 {
648   MagickBooleanType
649     status;
650
651   assert(wand != (MagickWand *) NULL);
652   assert(wand->signature == WandSignature);
653   if (wand->debug != MagickFalse)
654     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
655   (void) CloneString(&wand->image_info->server_name,server_name);
656   status=AnimateImages(wand->image_info,wand->images,&wand->images->exception);
657   return(status);
658 }
659 \f
660 /*
661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
662 %                                                                             %
663 %                                                                             %
664 %                                                                             %
665 %   M a g i c k A p p e n d I m a g e s                                       %
666 %                                                                             %
667 %                                                                             %
668 %                                                                             %
669 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
670 %
671 %  MagickAppendImages() append a set of images.
672 %
673 %  The format of the MagickAppendImages method is:
674 %
675 %      MagickWand *MagickAppendImages(MagickWand *wand,
676 %        const MagickBooleanType stack)
677 %
678 %  A description of each parameter follows:
679 %
680 %    o wand: the magick wand.
681 %
682 %    o stack: By default, images are stacked left-to-right. Set stack to
683 %      MagickTrue to stack them top-to-bottom.
684 %
685 */
686 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
687   const MagickBooleanType stack)
688 {
689   Image
690     *append_image;
691
692   assert(wand != (MagickWand *) NULL);
693   assert(wand->signature == WandSignature);
694   if (wand->debug != MagickFalse)
695     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
696   if (wand->images == (Image *) NULL)
697     return((MagickWand *) NULL);
698   append_image=AppendImages(wand->images,stack,wand->exception);
699   if (append_image == (Image *) NULL)
700     return((MagickWand *) NULL);
701   return(CloneMagickWandFromImages(wand,append_image));
702 }
703 \f
704 /*
705 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
706 %                                                                             %
707 %                                                                             %
708 %                                                                             %
709 %   M a g i c k A u t o G a m m a I m a g e                                   %
710 %                                                                             %
711 %                                                                             %
712 %                                                                             %
713 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
714 %
715 %  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
716 %  image to try make set its gamma appropriatally.
717 %
718 %  The format of the MagickAutoGammaImage method is:
719 %
720 %      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
721 %
722 %  A description of each parameter follows:
723 %
724 %    o wand: the magick wand.
725 %
726 */
727 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
728 {
729   MagickBooleanType
730     status;
731
732   assert(wand != (MagickWand *) NULL);
733   assert(wand->signature == WandSignature);
734   if (wand->debug != MagickFalse)
735     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
736   if (wand->images == (Image *) NULL)
737     ThrowWandException(WandError,"ContainsNoImages",wand->name);
738   status=AutoGammaImage(wand->images,&wand->images->exception);
739   return(status);
740 }
741 \f
742 /*
743 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
744 %                                                                             %
745 %                                                                             %
746 %                                                                             %
747 %   M a g i c k A u t o L e v e l I m a g e                                   %
748 %                                                                             %
749 %                                                                             %
750 %                                                                             %
751 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
752 %
753 %  MagickAutoLevelImage() adjusts the levels of a particular image channel by
754 %  scaling the minimum and maximum values to the full quantum range.
755 %
756 %  The format of the MagickAutoLevelImage method is:
757 %
758 %      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
759 %
760 %  A description of each parameter follows:
761 %
762 %    o wand: the magick wand.
763 %
764 */
765 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
766 {
767   MagickBooleanType
768     status;
769
770   assert(wand != (MagickWand *) NULL);
771   assert(wand->signature == WandSignature);
772   if (wand->debug != MagickFalse)
773     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
774   if (wand->images == (Image *) NULL)
775     ThrowWandException(WandError,"ContainsNoImages",wand->name);
776   status=AutoLevelImage(wand->images,&wand->images->exception);
777   return(status);
778 }
779 \f
780 /*
781 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
782 %                                                                             %
783 %                                                                             %
784 %                                                                             %
785 %   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                         %
786 %                                                                             %
787 %                                                                             %
788 %                                                                             %
789 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
790 %
791 %  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
792 %  pixels below the threshold into black while leaving all pixels above the
793 %  threshold unchanged.
794 %
795 %  The format of the MagickBlackThresholdImage method is:
796 %
797 %      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
798 %        const PixelWand *threshold)
799 %
800 %  A description of each parameter follows:
801 %
802 %    o wand: the magick wand.
803 %
804 %    o threshold: the pixel wand.
805 %
806 */
807 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
808   const PixelWand *threshold)
809 {
810   char
811     thresholds[MaxTextExtent];
812
813   MagickBooleanType
814     status;
815
816   assert(wand != (MagickWand *) NULL);
817   assert(wand->signature == WandSignature);
818   if (wand->debug != MagickFalse)
819     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
820   if (wand->images == (Image *) NULL)
821     ThrowWandException(WandError,"ContainsNoImages",wand->name);
822   (void) FormatLocaleString(thresholds,MaxTextExtent,
823     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
824     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
825     PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
826   status=BlackThresholdImage(wand->images,thresholds,&wand->images->exception);
827   if (status == MagickFalse)
828     InheritException(wand->exception,&wand->images->exception);
829   return(status);
830 }
831 \f
832 /*
833 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
834 %                                                                             %
835 %                                                                             %
836 %                                                                             %
837 %   M a g i c k B l u e S h i f t I m a g e                                   %
838 %                                                                             %
839 %                                                                             %
840 %                                                                             %
841 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
842 %
843 %  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
844 %  nighttime in the moonlight.
845 %
846 %  The format of the MagickBlueShiftImage method is:
847 %
848 %      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
849 %        const double factor)
850 %
851 %  A description of each parameter follows:
852 %
853 %    o wand: the magick wand.
854 %
855 %    o factor: the blue shift factor (default 1.5)
856 %
857 */
858 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
859   const double factor)
860 {
861   Image
862     *shift_image;
863
864   assert(wand != (MagickWand *) NULL);
865   assert(wand->signature == WandSignature);
866   if (wand->debug != MagickFalse)
867     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
868   if (wand->images == (Image *) NULL)
869     ThrowWandException(WandError,"ContainsNoImages",wand->name);
870   shift_image=BlueShiftImage(wand->images,factor,wand->exception);
871   if (shift_image == (Image *) NULL)
872     return(MagickFalse);
873   ReplaceImageInList(&wand->images,shift_image);
874   return(MagickTrue);
875 }
876 \f
877 /*
878 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
879 %                                                                             %
880 %                                                                             %
881 %                                                                             %
882 %   M a g i c k B l u r I m a g e                                             %
883 %                                                                             %
884 %                                                                             %
885 %                                                                             %
886 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
887 %
888 %  MagickBlurImage() blurs an image.  We convolve the image with a
889 %  gaussian operator of the given radius and standard deviation (sigma).
890 %  For reasonable results, the radius should be larger than sigma.  Use a
891 %  radius of 0 and BlurImage() selects a suitable radius for you.
892 %
893 %  The format of the MagickBlurImage method is:
894 %
895 %      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
896 %        const double sigmaconst double bias)
897 %
898 %  A description of each parameter follows:
899 %
900 %    o wand: the magick wand.
901 %
902 %    o radius: the radius of the , in pixels, not counting the center
903 %      pixel.
904 %
905 %    o sigma: the standard deviation of the , in pixels.
906 %
907 %    o bias: the bias.
908 %
909 */
910 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
911   const double radius,const double sigma,const double bias)
912 {
913   Image
914     *blur_image;
915
916   assert(wand != (MagickWand *) NULL);
917   assert(wand->signature == WandSignature);
918   if (wand->debug != MagickFalse)
919     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
920   if (wand->images == (Image *) NULL)
921     ThrowWandException(WandError,"ContainsNoImages",wand->name);
922   blur_image=BlurImage(wand->images,radius,sigma,bias,wand->exception);
923   if (blur_image == (Image *) NULL)
924     return(MagickFalse);
925   ReplaceImageInList(&wand->images,blur_image);
926   return(MagickTrue);
927 }
928 \f
929 /*
930 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
931 %                                                                             %
932 %                                                                             %
933 %                                                                             %
934 %   M a g i c k B o r d e r I m a g e                                         %
935 %                                                                             %
936 %                                                                             %
937 %                                                                             %
938 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
939 %
940 %  MagickBorderImage() surrounds the image with a border of the color defined
941 %  by the bordercolor pixel wand.
942 %
943 %  The format of the MagickBorderImage method is:
944 %
945 %      MagickBooleanType MagickBorderImage(MagickWand *wand,
946 %        const PixelWand *bordercolor,const size_t width,
947 %        const size_t height,const CompositeOperator compose)
948 %
949 %  A description of each parameter follows:
950 %
951 %    o wand: the magick wand.
952 %
953 %    o bordercolor: the border color pixel wand.
954 %
955 %    o width: the border width.
956 %
957 %    o height: the border height.
958 %
959 %    o compose: the composite operator.
960 %
961 */
962 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
963   const PixelWand *bordercolor,const size_t width,const size_t height,
964   const CompositeOperator compose)
965 {
966   Image
967     *border_image;
968
969   RectangleInfo
970     border_info;
971
972   assert(wand != (MagickWand *) NULL);
973   assert(wand->signature == WandSignature);
974   if (wand->debug != MagickFalse)
975     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
976   if (wand->images == (Image *) NULL)
977     ThrowWandException(WandError,"ContainsNoImages",wand->name);
978   border_info.width=width;
979   border_info.height=height;
980   border_info.x=0;
981   border_info.y=0;
982   PixelGetQuantumPacket(bordercolor,&wand->images->border_color);
983   border_image=BorderImage(wand->images,&border_info,compose,wand->exception);
984   if (border_image == (Image *) NULL)
985     return(MagickFalse);
986   ReplaceImageInList(&wand->images,border_image);
987   return(MagickTrue);
988 }
989 \f
990 /*
991 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
992 %                                                                             %
993 %                                                                             %
994 %                                                                             %
995 %   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   %
996 %                                                                             %
997 %                                                                             %
998 %                                                                             %
999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1000 %
1001 %  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1002 %  of an image.  It converts the brightness and contrast parameters into slope
1003 %  and intercept and calls a polynomical function to apply to the image.
1004
1005 %
1006 %  The format of the MagickBrightnessContrastImage method is:
1007 %
1008 %      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1009 %        const double brightness,const double contrast)
1010 %
1011 %  A description of each parameter follows:
1012 %
1013 %    o wand: the magick wand.
1014 %
1015 %    o brightness: the brightness percent (-100 .. 100).
1016 %
1017 %    o contrast: the contrast percent (-100 .. 100).
1018 %
1019 */
1020 WandExport MagickBooleanType MagickBrightnessContrastImage(
1021   MagickWand *wand,const double brightness,const double contrast)
1022 {
1023   MagickBooleanType
1024     status;
1025
1026   assert(wand != (MagickWand *) NULL);
1027   assert(wand->signature == WandSignature);
1028   if (wand->debug != MagickFalse)
1029     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1030   if (wand->images == (Image *) NULL)
1031     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1032   status=BrightnessContrastImage(wand->images,brightness,contrast,
1033     &wand->images->exception);
1034   return(status);
1035 }
1036 \f
1037 /*
1038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1039 %                                                                             %
1040 %                                                                             %
1041 %                                                                             %
1042 %   M a g i c k C h a r c o a l I m a g e                                     %
1043 %                                                                             %
1044 %                                                                             %
1045 %                                                                             %
1046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1047 %
1048 %  MagickCharcoalImage() simulates a charcoal drawing.
1049 %
1050 %  The format of the MagickCharcoalImage method is:
1051 %
1052 %      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1053 %        const double radius,const double sigma,const double bias)
1054 %
1055 %  A description of each parameter follows:
1056 %
1057 %    o wand: the magick wand.
1058 %
1059 %    o radius: the radius of the Gaussian, in pixels, not counting the center
1060 %      pixel.
1061 %
1062 %    o sigma: the standard deviation of the Gaussian, in pixels.
1063 %
1064 %    o bias: the bias.
1065 %
1066 */
1067 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1068   const double radius,const double sigma,const double bias)
1069 {
1070   Image
1071     *charcoal_image;
1072
1073   assert(wand != (MagickWand *) NULL);
1074   assert(wand->signature == WandSignature);
1075   if (wand->debug != MagickFalse)
1076     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1077   if (wand->images == (Image *) NULL)
1078     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1079   charcoal_image=CharcoalImage(wand->images,radius,sigma,bias,wand->exception);
1080   if (charcoal_image == (Image *) NULL)
1081     return(MagickFalse);
1082   ReplaceImageInList(&wand->images,charcoal_image);
1083   return(MagickTrue);
1084 }
1085 \f
1086 /*
1087 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1088 %                                                                             %
1089 %                                                                             %
1090 %                                                                             %
1091 %   M a g i c k C h o p I m a g e                                             %
1092 %                                                                             %
1093 %                                                                             %
1094 %                                                                             %
1095 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1096 %
1097 %  MagickChopImage() removes a region of an image and collapses the image to
1098 %  occupy the removed portion
1099 %
1100 %  The format of the MagickChopImage method is:
1101 %
1102 %      MagickBooleanType MagickChopImage(MagickWand *wand,
1103 %        const size_t width,const size_t height,const ssize_t x,
1104 %        const ssize_t y)
1105 %
1106 %  A description of each parameter follows:
1107 %
1108 %    o wand: the magick wand.
1109 %
1110 %    o width: the region width.
1111 %
1112 %    o height: the region height.
1113 %
1114 %    o x: the region x offset.
1115 %
1116 %    o y: the region y offset.
1117 %
1118 %
1119 */
1120 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1121   const size_t width,const size_t height,const ssize_t x,
1122   const ssize_t y)
1123 {
1124   Image
1125     *chop_image;
1126
1127   RectangleInfo
1128     chop;
1129
1130   assert(wand != (MagickWand *) NULL);
1131   assert(wand->signature == WandSignature);
1132   if (wand->debug != MagickFalse)
1133     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1134   if (wand->images == (Image *) NULL)
1135     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1136   chop.width=width;
1137   chop.height=height;
1138   chop.x=x;
1139   chop.y=y;
1140   chop_image=ChopImage(wand->images,&chop,wand->exception);
1141   if (chop_image == (Image *) NULL)
1142     return(MagickFalse);
1143   ReplaceImageInList(&wand->images,chop_image);
1144   return(MagickTrue);
1145 }
1146 \f
1147 /*
1148 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1149 %                                                                             %
1150 %                                                                             %
1151 %                                                                             %
1152 %   M a g i c k C l a m p I m a g e                                           %
1153 %                                                                             %
1154 %                                                                             %
1155 %                                                                             %
1156 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1157 %
1158 %  MagickClampImage() restricts the color range from 0 to the quantum depth.
1159 %
1160 %  The format of the MagickClampImage method is:
1161 %
1162 %      MagickBooleanType MagickClampImage(MagickWand *wand)
1163 %
1164 %  A description of each parameter follows:
1165 %
1166 %    o wand: the magick wand.
1167 %
1168 %    o channel: the channel.
1169 %
1170 */
1171 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1172 {
1173   MagickBooleanType
1174     status;
1175
1176   assert(wand != (MagickWand *) NULL);
1177   assert(wand->signature == WandSignature);
1178   if (wand->debug != MagickFalse)
1179     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1180   if (wand->images == (Image *) NULL)
1181     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1182   status=ClampImage(wand->images);
1183   if (status == MagickFalse)
1184     InheritException(wand->exception,&wand->images->exception);
1185   return(status);
1186 }
1187 \f
1188 /*
1189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1190 %                                                                             %
1191 %                                                                             %
1192 %                                                                             %
1193 %   M a g i c k C l i p I m a g e                                             %
1194 %                                                                             %
1195 %                                                                             %
1196 %                                                                             %
1197 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1198 %
1199 %  MagickClipImage() clips along the first path from the 8BIM profile, if
1200 %  present.
1201 %
1202 %  The format of the MagickClipImage method is:
1203 %
1204 %      MagickBooleanType MagickClipImage(MagickWand *wand)
1205 %
1206 %  A description of each parameter follows:
1207 %
1208 %    o wand: the magick wand.
1209 %
1210 */
1211 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1212 {
1213   MagickBooleanType
1214     status;
1215
1216   assert(wand != (MagickWand *) NULL);
1217   assert(wand->signature == WandSignature);
1218   if (wand->debug != MagickFalse)
1219     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1220   if (wand->images == (Image *) NULL)
1221     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1222   status=ClipImage(wand->images,wand->exception);
1223   return(status);
1224 }
1225 \f
1226 /*
1227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1228 %                                                                             %
1229 %                                                                             %
1230 %                                                                             %
1231 %   M a g i c k C l i p I m a g e P a t h                                     %
1232 %                                                                             %
1233 %                                                                             %
1234 %                                                                             %
1235 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1236 %
1237 %  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1238 %  present. Later operations take effect inside the path.  Id may be a number
1239 %  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1240 %  path.
1241 %
1242 %  The format of the MagickClipImagePath method is:
1243 %
1244 %      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1245 %        const char *pathname,const MagickBooleanType inside)
1246 %
1247 %  A description of each parameter follows:
1248 %
1249 %    o wand: the magick wand.
1250 %
1251 %    o pathname: name of clipping path resource. If name is preceded by #, use
1252 %      clipping path numbered by name.
1253 %
1254 %    o inside: if non-zero, later operations take effect inside clipping path.
1255 %      Otherwise later operations take effect outside clipping path.
1256 %
1257 */
1258 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1259   const char *pathname,const MagickBooleanType inside)
1260 {
1261   MagickBooleanType
1262     status;
1263
1264   assert(wand != (MagickWand *) NULL);
1265   assert(wand->signature == WandSignature);
1266   if (wand->debug != MagickFalse)
1267     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1268   if (wand->images == (Image *) NULL)
1269     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1270   status=ClipImagePath(wand->images,pathname,inside,wand->exception);
1271   return(status);
1272 }
1273 \f
1274 /*
1275 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1276 %                                                                             %
1277 %                                                                             %
1278 %                                                                             %
1279 %   M a g i c k C l u t I m a g e                                             %
1280 %                                                                             %
1281 %                                                                             %
1282 %                                                                             %
1283 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1284 %
1285 %  MagickClutImage() replaces colors in the image from a color lookup table.
1286 %
1287 %  The format of the MagickClutImage method is:
1288 %
1289 %      MagickBooleanType MagickClutImage(MagickWand *wand,
1290 %        const MagickWand *clut_wand,const PixelInterpolateMethod method)
1291 %
1292 %  A description of each parameter follows:
1293 %
1294 %    o wand: the magick wand.
1295 %
1296 %    o clut_image: the clut image.
1297 %
1298 %    o method: the pixel interpolation method.
1299 %
1300 */
1301 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1302   const MagickWand *clut_wand,const PixelInterpolateMethod method)
1303 {
1304   MagickBooleanType
1305     status;
1306
1307   assert(wand != (MagickWand *) NULL);
1308   assert(wand->signature == WandSignature);
1309   if (wand->debug != MagickFalse)
1310     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1311   if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1312     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1313   status=ClutImage(wand->images,clut_wand->images,method,wand->exception);
1314   return(status);
1315 }
1316 \f
1317 /*
1318 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1319 %                                                                             %
1320 %                                                                             %
1321 %                                                                             %
1322 %   M a g i c k C o a l e s c e I m a g e s                                   %
1323 %                                                                             %
1324 %                                                                             %
1325 %                                                                             %
1326 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1327 %
1328 %  MagickCoalesceImages() composites a set of images while respecting any page
1329 %  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1330 %  typically start with an image background and each subsequent image
1331 %  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1332 %  where each image in the sequence is the same size as the first and
1333 %  composited with the next image in the sequence.
1334 %
1335 %  The format of the MagickCoalesceImages method is:
1336 %
1337 %      MagickWand *MagickCoalesceImages(MagickWand *wand)
1338 %
1339 %  A description of each parameter follows:
1340 %
1341 %    o wand: the magick wand.
1342 %
1343 */
1344 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1345 {
1346   Image
1347     *coalesce_image;
1348
1349   assert(wand != (MagickWand *) NULL);
1350   assert(wand->signature == WandSignature);
1351   if (wand->debug != MagickFalse)
1352     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1353   if (wand->images == (Image *) NULL)
1354     return((MagickWand *) NULL);
1355   coalesce_image=CoalesceImages(wand->images,wand->exception);
1356   if (coalesce_image == (Image *) NULL)
1357     return((MagickWand *) NULL);
1358   return(CloneMagickWandFromImages(wand,coalesce_image));
1359 }
1360 \f
1361 /*
1362 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1363 %                                                                             %
1364 %                                                                             %
1365 %                                                                             %
1366 %   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1367 %                                                                             %
1368 %                                                                             %
1369 %                                                                             %
1370 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1371 %
1372 %  MagickColorDecisionListImage() accepts a lightweight Color Correction
1373 %  Collection (CCC) file which solely contains one or more color corrections
1374 %  and applies the color correction to the image.  Here is a sample CCC file:
1375 %
1376 %    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1377 %          <ColorCorrection id="cc03345">
1378 %                <SOPNode>
1379 %                     <Slope> 0.9 1.2 0.5 </Slope>
1380 %                     <Offset> 0.4 -0.5 0.6 </Offset>
1381 %                     <Power> 1.0 0.8 1.5 </Power>
1382 %                </SOPNode>
1383 %                <SATNode>
1384 %                     <Saturation> 0.85 </Saturation>
1385 %                </SATNode>
1386 %          </ColorCorrection>
1387 %    </ColorCorrectionCollection>
1388 %
1389 %  which includes the offset, slope, and power for each of the RGB channels
1390 %  as well as the saturation.
1391 %
1392 %  The format of the MagickColorDecisionListImage method is:
1393 %
1394 %      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1395 %        const double gamma)
1396 %
1397 %  A description of each parameter follows:
1398 %
1399 %    o wand: the magick wand.
1400 %
1401 %    o color_correction_collection: the color correction collection in XML.
1402 %
1403 */
1404 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1405   const char *color_correction_collection)
1406 {
1407   MagickBooleanType
1408     status;
1409
1410   assert(wand != (MagickWand *) NULL);
1411   assert(wand->signature == WandSignature);
1412   if (wand->debug != MagickFalse)
1413     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1414   if (wand->images == (Image *) NULL)
1415     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1416   status=ColorDecisionListImage(wand->images,color_correction_collection,
1417     &wand->images->exception);
1418   return(status);
1419 }
1420 \f
1421 /*
1422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1423 %                                                                             %
1424 %                                                                             %
1425 %                                                                             %
1426 %   M a g i c k C o l o r i z e I m a g e                                     %
1427 %                                                                             %
1428 %                                                                             %
1429 %                                                                             %
1430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1431 %
1432 %  MagickColorizeImage() blends the fill color with each pixel in the image.
1433 %
1434 %  The format of the MagickColorizeImage method is:
1435 %
1436 %      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1437 %        const PixelWand *colorize,const PixelWand *opacity)
1438 %
1439 %  A description of each parameter follows:
1440 %
1441 %    o wand: the magick wand.
1442 %
1443 %    o colorize: the colorize pixel wand.
1444 %
1445 %    o opacity: the opacity pixel wand.
1446 %
1447 */
1448 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1449   const PixelWand *colorize,const PixelWand *opacity)
1450 {
1451   char
1452     percent_opaque[MaxTextExtent];
1453
1454   Image
1455     *colorize_image;
1456
1457   PixelPacket
1458     target;
1459
1460   assert(wand != (MagickWand *) NULL);
1461   assert(wand->signature == WandSignature);
1462   if (wand->debug != MagickFalse)
1463     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1464   if (wand->images == (Image *) NULL)
1465     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1466   (void) FormatLocaleString(percent_opaque,MaxTextExtent,
1467     "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1468     PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
1469     PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
1470     PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
1471     PixelGetOpacityQuantum(opacity)));
1472   PixelGetQuantumPacket(colorize,&target);
1473   colorize_image=ColorizeImage(wand->images,percent_opaque,target,
1474     wand->exception);
1475   if (colorize_image == (Image *) NULL)
1476     return(MagickFalse);
1477   ReplaceImageInList(&wand->images,colorize_image);
1478   return(MagickTrue);
1479 }
1480 \f
1481 /*
1482 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1483 %                                                                             %
1484 %                                                                             %
1485 %                                                                             %
1486 %   M a g i c k C o l o r M a t r i x I m a g e                               %
1487 %                                                                             %
1488 %                                                                             %
1489 %                                                                             %
1490 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1491 %
1492 %  MagickColorMatrixImage() apply color transformation to an image. The method
1493 %  permits saturation changes, hue rotation, luminance to alpha, and various
1494 %  other effects.  Although variable-sized transformation matrices can be used,
1495 %  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1496 %  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1497 %  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1498 %  and offsets are normalized (divide Flash offset by 255).
1499 %
1500 %  The format of the MagickColorMatrixImage method is:
1501 %
1502 %      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1503 %        const KernelInfo *color_matrix)
1504 %
1505 %  A description of each parameter follows:
1506 %
1507 %    o wand: the magick wand.
1508 %
1509 %    o color_matrix:  the color matrix.
1510 %
1511 */
1512 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1513   const KernelInfo *color_matrix)
1514 {
1515   Image
1516     *color_image;
1517
1518   assert(wand != (MagickWand *) NULL);
1519   assert(wand->signature == WandSignature);
1520   if (wand->debug != MagickFalse)
1521     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1522   if (color_matrix == (const KernelInfo *) NULL)
1523     return(MagickFalse);
1524   if (wand->images == (Image *) NULL)
1525     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1526   color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1527   if (color_image == (Image *) NULL)
1528     return(MagickFalse);
1529   ReplaceImageInList(&wand->images,color_image);
1530   return(MagickTrue);
1531 }
1532 \f
1533 /*
1534 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1535 %                                                                             %
1536 %                                                                             %
1537 %                                                                             %
1538 %   M a g i c k C o m b i n e I m a g e s                                     %
1539 %                                                                             %
1540 %                                                                             %
1541 %                                                                             %
1542 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1543 %
1544 %  MagickCombineImages() combines one or more images into a single image.  The
1545 %  grayscale value of the pixels of each image in the sequence is assigned in
1546 %  order to the specified  hannels of the combined image.   The typical
1547 %  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1548 %
1549 %  The format of the MagickCombineImages method is:
1550 %
1551 %      MagickWand *MagickCombineImages(MagickWand *wand)
1552 %
1553 %  A description of each parameter follows:
1554 %
1555 %    o wand: the magick wand.
1556 %
1557 */
1558 WandExport MagickWand *MagickCombineImages(MagickWand *wand)
1559 {
1560   Image
1561     *combine_image;
1562
1563   assert(wand != (MagickWand *) NULL);
1564   assert(wand->signature == WandSignature);
1565   if (wand->debug != MagickFalse)
1566     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1567   if (wand->images == (Image *) NULL)
1568     return((MagickWand *) NULL);
1569   combine_image=CombineImages(wand->images,wand->exception);
1570   if (combine_image == (Image *) NULL)
1571     return((MagickWand *) NULL);
1572   return(CloneMagickWandFromImages(wand,combine_image));
1573 }
1574 \f
1575 /*
1576 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1577 %                                                                             %
1578 %                                                                             %
1579 %                                                                             %
1580 %   M a g i c k C o m m e n t I m a g e                                       %
1581 %                                                                             %
1582 %                                                                             %
1583 %                                                                             %
1584 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1585 %
1586 %  MagickCommentImage() adds a comment to your image.
1587 %
1588 %  The format of the MagickCommentImage method is:
1589 %
1590 %      MagickBooleanType MagickCommentImage(MagickWand *wand,
1591 %        const char *comment)
1592 %
1593 %  A description of each parameter follows:
1594 %
1595 %    o wand: the magick wand.
1596 %
1597 %    o comment: the image comment.
1598 %
1599 */
1600 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1601   const char *comment)
1602 {
1603   MagickBooleanType
1604     status;
1605
1606   assert(wand != (MagickWand *) NULL);
1607   assert(wand->signature == WandSignature);
1608   if (wand->debug != MagickFalse)
1609     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1610   if (wand->images == (Image *) NULL)
1611     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1612   status=SetImageProperty(wand->images,"comment",comment);
1613   if (status == MagickFalse)
1614     InheritException(wand->exception,&wand->images->exception);
1615   return(status);
1616 }
1617 \f
1618 /*
1619 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1620 %                                                                             %
1621 %                                                                             %
1622 %                                                                             %
1623 %   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1624 %                                                                             %
1625 %                                                                             %
1626 %                                                                             %
1627 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1628 %
1629 %  MagickCompareImagesLayers() compares each image with the next in a sequence
1630 %  and returns the maximum bounding region of any pixel differences it
1631 %  discovers.
1632 %
1633 %  The format of the MagickCompareImagesLayers method is:
1634 %
1635 %      MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1636 %        const ImageLayerMethod method)
1637 %
1638 %  A description of each parameter follows:
1639 %
1640 %    o wand: the magick wand.
1641 %
1642 %    o method: the compare method.
1643 %
1644 */
1645 WandExport MagickWand *MagickCompareImagesLayers(MagickWand *wand,
1646   const ImageLayerMethod method)
1647 {
1648   Image
1649     *layers_image;
1650
1651   assert(wand != (MagickWand *) NULL);
1652   assert(wand->signature == WandSignature);
1653   if (wand->debug != MagickFalse)
1654     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1655   if (wand->images == (Image *) NULL)
1656     return((MagickWand *) NULL);
1657   layers_image=CompareImagesLayers(wand->images,method,wand->exception);
1658   if (layers_image == (Image *) NULL)
1659     return((MagickWand *) NULL);
1660   return(CloneMagickWandFromImages(wand,layers_image));
1661 }
1662 \f
1663 /*
1664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1665 %                                                                             %
1666 %                                                                             %
1667 %                                                                             %
1668 %   M a g i c k C o m p a r e I m a g e s                                     %
1669 %                                                                             %
1670 %                                                                             %
1671 %                                                                             %
1672 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1673 %
1674 %  MagickCompareImages() compares an image to a reconstructed image and returns
1675 %  the specified difference image.
1676 %
1677 %  The format of the MagickCompareImages method is:
1678 %
1679 %      MagickWand *MagickCompareImages(MagickWand *wand,
1680 %        const MagickWand *reference,const MetricType metric,
1681 %        double *distortion)
1682 %
1683 %  A description of each parameter follows:
1684 %
1685 %    o wand: the magick wand.
1686 %
1687 %    o reference: the reference wand.
1688 %
1689 %    o metric: the metric.
1690 %
1691 %    o distortion: the computed distortion between the images.
1692 %
1693 */
1694 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1695   const MagickWand *reference,const MetricType metric,double *distortion)
1696 {
1697   Image
1698     *compare_image;
1699
1700
1701   assert(wand != (MagickWand *) NULL);
1702   assert(wand->signature == WandSignature);
1703   if (wand->debug != MagickFalse)
1704     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1705   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1706     {
1707       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1708         "ContainsNoImages","`%s'",wand->name);
1709       return((MagickWand *) NULL);
1710     }
1711   compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1712     &wand->images->exception);
1713   if (compare_image == (Image *) NULL)
1714     return((MagickWand *) NULL);
1715   return(CloneMagickWandFromImages(wand,compare_image));
1716 }
1717 \f
1718 /*
1719 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1720 %                                                                             %
1721 %                                                                             %
1722 %                                                                             %
1723 %   M a g i c k C o m p o s i t e I m a g e                                   %
1724 %                                                                             %
1725 %                                                                             %
1726 %                                                                             %
1727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1728 %
1729 %  MagickCompositeImage() composite one image onto another at the specified
1730 %  offset.
1731 %
1732 %  The format of the MagickCompositeImage method is:
1733 %
1734 %      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1735 %        const MagickWand *composite_wand,const CompositeOperator compose,
1736 %        const ssize_t x,const ssize_t y)
1737 %
1738 %  A description of each parameter follows:
1739 %
1740 %    o wand: the magick wand.
1741 %
1742 %    o composite_image: the composite image.
1743 %
1744 %    o compose: This operator affects how the composite is applied to the
1745 %      image.  The default is Over.  Choose from these operators:
1746 %
1747 %        OverCompositeOp       InCompositeOp         OutCompositeOp
1748 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1749 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1750 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1751 %        DisplaceCompositeOp
1752 %
1753 %    o x: the column offset of the composited image.
1754 %
1755 %    o y: the row offset of the composited image.
1756 %
1757 */
1758 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1759   const MagickWand *composite_wand,const CompositeOperator compose,
1760   const ssize_t x,const ssize_t y)
1761 {
1762   MagickBooleanType
1763     status;
1764
1765   assert(wand != (MagickWand *) NULL);
1766   assert(wand->signature == WandSignature);
1767   if (wand->debug != MagickFalse)
1768     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1769   if ((wand->images == (Image *) NULL) ||
1770       (composite_wand->images == (Image *) NULL))
1771     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1772   status=CompositeImage(wand->images,compose,composite_wand->images,x,y);
1773   if (status == MagickFalse)
1774     InheritException(wand->exception,&wand->images->exception);
1775   return(status);
1776 }
1777 \f
1778 /*
1779 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1780 %                                                                             %
1781 %                                                                             %
1782 %                                                                             %
1783 %   M a g i c k C o n t r a s t I m a g e                                     %
1784 %                                                                             %
1785 %                                                                             %
1786 %                                                                             %
1787 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1788 %
1789 %  MagickContrastImage() enhances the intensity differences between the lighter
1790 %  and darker elements of the image.  Set sharpen to a value other than 0 to
1791 %  increase the image contrast otherwise the contrast is reduced.
1792 %
1793 %  The format of the MagickContrastImage method is:
1794 %
1795 %      MagickBooleanType MagickContrastImage(MagickWand *wand,
1796 %        const MagickBooleanType sharpen)
1797 %
1798 %  A description of each parameter follows:
1799 %
1800 %    o wand: the magick wand.
1801 %
1802 %    o sharpen: Increase or decrease image contrast.
1803 %
1804 %
1805 */
1806 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
1807   const MagickBooleanType sharpen)
1808 {
1809   MagickBooleanType
1810     status;
1811
1812   assert(wand != (MagickWand *) NULL);
1813   assert(wand->signature == WandSignature);
1814   if (wand->debug != MagickFalse)
1815     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1816   if (wand->images == (Image *) NULL)
1817     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1818   status=ContrastImage(wand->images,sharpen,&wand->images->exception);
1819   return(status);
1820 }
1821 \f
1822 /*
1823 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1824 %                                                                             %
1825 %                                                                             %
1826 %                                                                             %
1827 %   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                       %
1828 %                                                                             %
1829 %                                                                             %
1830 %                                                                             %
1831 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1832 %
1833 %  MagickContrastStretchImage() enhances the contrast of a color image by
1834 %  adjusting the pixels color to span the entire range of colors available.
1835 %  You can also reduce the influence of a particular channel with a gamma
1836 %  value of 0.
1837 %
1838 %  The format of the MagickContrastStretchImage method is:
1839 %
1840 %      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1841 %        const double black_point,const double white_point)
1842 %
1843 %  A description of each parameter follows:
1844 %
1845 %    o wand: the magick wand.
1846 %
1847 %    o black_point: the black point.
1848 %
1849 %    o white_point: the white point.
1850 %
1851 */
1852 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
1853   const double black_point,const double white_point)
1854 {
1855   MagickBooleanType
1856     status;
1857
1858   assert(wand != (MagickWand *) NULL);
1859   assert(wand->signature == WandSignature);
1860   if (wand->debug != MagickFalse)
1861     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1862   if (wand->images == (Image *) NULL)
1863     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1864   status=ContrastStretchImage(wand->images,black_point,white_point,
1865     &wand->images->exception);
1866   return(status);
1867 }
1868 \f
1869 /*
1870 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1871 %                                                                             %
1872 %                                                                             %
1873 %                                                                             %
1874 %   M a g i c k C o n v o l v e I m a g e                                     %
1875 %                                                                             %
1876 %                                                                             %
1877 %                                                                             %
1878 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1879 %
1880 %  MagickConvolveImage() applies a custom convolution kernel to the image.
1881 %
1882 %  The format of the MagickConvolveImage method is:
1883 %
1884 %      MagickBooleanType MagickConvolveImage(MagickWand *wand,
1885 %        const KernelInfo *kernel)
1886 %
1887 %  A description of each parameter follows:
1888 %
1889 %    o wand: the magick wand.
1890 %
1891 %    o kernel: An array of doubles representing the convolution kernel.
1892 %
1893 */
1894 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
1895   const KernelInfo *kernel)
1896 {
1897   Image
1898     *filter_image;
1899
1900   assert(wand != (MagickWand *) NULL);
1901   assert(wand->signature == WandSignature);
1902   if (wand->debug != MagickFalse)
1903     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1904   if (kernel == (const KernelInfo *) NULL)
1905     return(MagickFalse);
1906   if (wand->images == (Image *) NULL)
1907     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1908   filter_image=ConvolveImage(wand->images,kernel,wand->exception);
1909   if (filter_image == (Image *) NULL)
1910     return(MagickFalse);
1911   ReplaceImageInList(&wand->images,filter_image);
1912   return(MagickTrue);
1913 }
1914 \f
1915 /*
1916 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1917 %                                                                             %
1918 %                                                                             %
1919 %                                                                             %
1920 %   M a g i c k C r o p I m a g e                                             %
1921 %                                                                             %
1922 %                                                                             %
1923 %                                                                             %
1924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1925 %
1926 %  MagickCropImage() extracts a region of the image.
1927 %
1928 %  The format of the MagickCropImage method is:
1929 %
1930 %      MagickBooleanType MagickCropImage(MagickWand *wand,
1931 %        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1932 %
1933 %  A description of each parameter follows:
1934 %
1935 %    o wand: the magick wand.
1936 %
1937 %    o width: the region width.
1938 %
1939 %    o height: the region height.
1940 %
1941 %    o x: the region x-offset.
1942 %
1943 %    o y: the region y-offset.
1944 %
1945 */
1946 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
1947   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
1948 {
1949   Image
1950     *crop_image;
1951
1952   RectangleInfo
1953     crop;
1954
1955   assert(wand != (MagickWand *) NULL);
1956   assert(wand->signature == WandSignature);
1957   if (wand->debug != MagickFalse)
1958     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1959   if (wand->images == (Image *) NULL)
1960     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1961   crop.width=width;
1962   crop.height=height;
1963   crop.x=x;
1964   crop.y=y;
1965   crop_image=CropImage(wand->images,&crop,wand->exception);
1966   if (crop_image == (Image *) NULL)
1967     return(MagickFalse);
1968   ReplaceImageInList(&wand->images,crop_image);
1969   return(MagickTrue);
1970 }
1971 \f
1972 /*
1973 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1974 %                                                                             %
1975 %                                                                             %
1976 %                                                                             %
1977 %   M a g i c k C y c l e C o l o r m a p I m a g e                           %
1978 %                                                                             %
1979 %                                                                             %
1980 %                                                                             %
1981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1982 %
1983 %  MagickCycleColormapImage() displaces an image's colormap by a given number
1984 %  of positions.  If you cycle the colormap a number of times you can produce
1985 %  a psychodelic effect.
1986 %
1987 %  The format of the MagickCycleColormapImage method is:
1988 %
1989 %      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
1990 %        const ssize_t displace)
1991 %
1992 %  A description of each parameter follows:
1993 %
1994 %    o wand: the magick wand.
1995 %
1996 %    o pixel_wand: the pixel wand.
1997 %
1998 */
1999 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2000   const ssize_t displace)
2001 {
2002   MagickBooleanType
2003     status;
2004
2005   assert(wand != (MagickWand *) NULL);
2006   assert(wand->signature == WandSignature);
2007   if (wand->debug != MagickFalse)
2008     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2009   if (wand->images == (Image *) NULL)
2010     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2011   status=CycleColormapImage(wand->images,displace,wand->exception);
2012   return(status);
2013 }
2014 \f
2015 /*
2016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2017 %                                                                             %
2018 %                                                                             %
2019 %                                                                             %
2020 %   M a g i c k C o n s t i t u t e I m a g e                                 %
2021 %                                                                             %
2022 %                                                                             %
2023 %                                                                             %
2024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2025 %
2026 %  MagickConstituteImage() adds an image to the wand comprised of the pixel
2027 %  data you supply.  The pixel data must be in scanline order top-to-bottom.
2028 %  The data can be char, short int, int, float, or double.  Float and double
2029 %  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2030 %  is the maximum value the type can accomodate (e.g. 255 for char).  For
2031 %  example, to create a 640x480 image from unsigned red-green-blue character
2032 %  data, use
2033 %
2034 %      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2035 %
2036 %  The format of the MagickConstituteImage method is:
2037 %
2038 %      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2039 %        const size_t columns,const size_t rows,const char *map,
2040 %        const StorageType storage,void *pixels)
2041 %
2042 %  A description of each parameter follows:
2043 %
2044 %    o wand: the magick wand.
2045 %
2046 %    o columns: width in pixels of the image.
2047 %
2048 %    o rows: height in pixels of the image.
2049 %
2050 %    o map:  This string reflects the expected ordering of the pixel array.
2051 %      It can be any combination or order of R = red, G = green, B = blue,
2052 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2053 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2054 %      P = pad.
2055 %
2056 %    o storage: Define the data type of the pixels.  Float and double types are
2057 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2058 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2059 %      LongPixel, QuantumPixel, or ShortPixel.
2060 %
2061 %    o pixels: This array of values contain the pixel components as defined by
2062 %      map and type.  You must preallocate this array where the expected
2063 %      length varies depending on the values of width, height, map, and type.
2064 %
2065 %
2066 */
2067 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2068   const size_t columns,const size_t rows,const char *map,
2069   const StorageType storage,const void *pixels)
2070 {
2071   Image
2072     *images;
2073
2074   assert(wand != (MagickWand *) NULL);
2075   assert(wand->signature == WandSignature);
2076   if (wand->debug != MagickFalse)
2077     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2078   images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2079   if (images == (Image *) NULL)
2080     return(MagickFalse);
2081   return(InsertImageInWand(wand,images));
2082 }
2083 \f
2084 /*
2085 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2086 %                                                                             %
2087 %                                                                             %
2088 %                                                                             %
2089 %   M a g i c k D e c i p h e r I m a g e                                     %
2090 %                                                                             %
2091 %                                                                             %
2092 %                                                                             %
2093 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2094 %
2095 %  MagickDecipherImage() converts cipher pixels to plain pixels.
2096 %
2097 %  The format of the MagickDecipherImage method is:
2098 %
2099 %      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2100 %        const char *passphrase)
2101 %
2102 %  A description of each parameter follows:
2103 %
2104 %    o wand: the magick wand.
2105 %
2106 %    o passphrase: the passphrase.
2107 %
2108 */
2109 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2110   const char *passphrase)
2111 {
2112   assert(wand != (MagickWand *) NULL);
2113   assert(wand->signature == WandSignature);
2114   if (wand->debug != MagickFalse)
2115     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2116   if (wand->images == (Image *) NULL)
2117     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2118   return(DecipherImage(wand->images,passphrase,&wand->images->exception));
2119 }
2120 \f
2121 /*
2122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2123 %                                                                             %
2124 %                                                                             %
2125 %                                                                             %
2126 %   M a g i c k D e c o n s t r u c t I m a g e s                             %
2127 %                                                                             %
2128 %                                                                             %
2129 %                                                                             %
2130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2131 %
2132 %  MagickDeconstructImages() compares each image with the next in a sequence
2133 %  and returns the maximum bounding region of any pixel differences it
2134 %  discovers.
2135 %
2136 %  The format of the MagickDeconstructImages method is:
2137 %
2138 %      MagickWand *MagickDeconstructImages(MagickWand *wand)
2139 %
2140 %  A description of each parameter follows:
2141 %
2142 %    o wand: the magick wand.
2143 %
2144 */
2145 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2146 {
2147   Image
2148     *deconstruct_image;
2149
2150   assert(wand != (MagickWand *) NULL);
2151   assert(wand->signature == WandSignature);
2152   if (wand->debug != MagickFalse)
2153     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2154   if (wand->images == (Image *) NULL)
2155     return((MagickWand *) NULL);
2156   deconstruct_image=CompareImagesLayers(wand->images,CompareAnyLayer,
2157     wand->exception);
2158   if (deconstruct_image == (Image *) NULL)
2159     return((MagickWand *) NULL);
2160   return(CloneMagickWandFromImages(wand,deconstruct_image));
2161 }
2162 \f
2163 /*
2164 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2165 %                                                                             %
2166 %                                                                             %
2167 %                                                                             %
2168 %     M a g i c k D e s k e w I m a g e                                       %
2169 %                                                                             %
2170 %                                                                             %
2171 %                                                                             %
2172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2173 %
2174 %  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2175 %  occurs in scanned images because of the camera being misaligned,
2176 %  imperfections in the scanning or surface, or simply because the paper was
2177 %  not placed completely flat when scanned.
2178 %
2179 %  The format of the MagickDeskewImage method is:
2180 %
2181 %      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2182 %        const double threshold)
2183 %
2184 %  A description of each parameter follows:
2185 %
2186 %    o wand: the magick wand.
2187 %
2188 %    o threshold: separate background from foreground.
2189 %
2190 */
2191 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2192   const double threshold)
2193 {
2194   Image
2195     *sepia_image;
2196
2197   assert(wand != (MagickWand *) NULL);
2198   assert(wand->signature == WandSignature);
2199   if (wand->debug != MagickFalse)
2200     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2201   if (wand->images == (Image *) NULL)
2202     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2203   sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2204   if (sepia_image == (Image *) NULL)
2205     return(MagickFalse);
2206   ReplaceImageInList(&wand->images,sepia_image);
2207   return(MagickTrue);
2208 }
2209 \f
2210 /*
2211 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2212 %                                                                             %
2213 %                                                                             %
2214 %                                                                             %
2215 %     M a g i c k D e s p e c k l e I m a g e                                 %
2216 %                                                                             %
2217 %                                                                             %
2218 %                                                                             %
2219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2220 %
2221 %  MagickDespeckleImage() reduces the speckle noise in an image while
2222 %  perserving the edges of the original image.
2223 %
2224 %  The format of the MagickDespeckleImage method is:
2225 %
2226 %      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2227 %
2228 %  A description of each parameter follows:
2229 %
2230 %    o wand: the magick wand.
2231 %
2232 */
2233 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2234 {
2235   Image
2236     *despeckle_image;
2237
2238   assert(wand != (MagickWand *) NULL);
2239   assert(wand->signature == WandSignature);
2240   if (wand->debug != MagickFalse)
2241     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2242   if (wand->images == (Image *) NULL)
2243     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2244   despeckle_image=DespeckleImage(wand->images,wand->exception);
2245   if (despeckle_image == (Image *) NULL)
2246     return(MagickFalse);
2247   ReplaceImageInList(&wand->images,despeckle_image);
2248   return(MagickTrue);
2249 }
2250 \f
2251 /*
2252 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2253 %                                                                             %
2254 %                                                                             %
2255 %                                                                             %
2256 %   M a g i c k D e s t r o y I m a g e                                       %
2257 %                                                                             %
2258 %                                                                             %
2259 %                                                                             %
2260 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2261 %
2262 %  MagickDestroyImage() dereferences an image, deallocating memory associated
2263 %  with the image if the reference count becomes zero.
2264 %
2265 %  The format of the MagickDestroyImage method is:
2266 %
2267 %      Image *MagickDestroyImage(Image *image)
2268 %
2269 %  A description of each parameter follows:
2270 %
2271 %    o image: the image.
2272 %
2273 */
2274 WandExport Image *MagickDestroyImage(Image *image)
2275 {
2276   return(DestroyImage(image));
2277 }
2278 \f
2279 /*
2280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2281 %                                                                             %
2282 %                                                                             %
2283 %                                                                             %
2284 %   M a g i c k D i s p l a y I m a g e                                       %
2285 %                                                                             %
2286 %                                                                             %
2287 %                                                                             %
2288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2289 %
2290 %  MagickDisplayImage() displays an image.
2291 %
2292 %  The format of the MagickDisplayImage method is:
2293 %
2294 %      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2295 %        const char *server_name)
2296 %
2297 %  A description of each parameter follows:
2298 %
2299 %    o wand: the magick wand.
2300 %
2301 %    o server_name: the X server name.
2302 %
2303 */
2304 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2305   const char *server_name)
2306 {
2307   Image
2308     *image;
2309
2310   MagickBooleanType
2311     status;
2312
2313   assert(wand != (MagickWand *) NULL);
2314   assert(wand->signature == WandSignature);
2315   if (wand->debug != MagickFalse)
2316     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2317   if (wand->images == (Image *) NULL)
2318     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2319   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2320   if (image == (Image *) NULL)
2321     return(MagickFalse);
2322   (void) CloneString(&wand->image_info->server_name,server_name);
2323   status=DisplayImages(wand->image_info,image,&image->exception);
2324   image=DestroyImage(image);
2325   return(status);
2326 }
2327 \f
2328 /*
2329 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2330 %                                                                             %
2331 %                                                                             %
2332 %                                                                             %
2333 %   M a g i c k D i s p l a y I m a g e s                                     %
2334 %                                                                             %
2335 %                                                                             %
2336 %                                                                             %
2337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2338 %
2339 %  MagickDisplayImages() displays an image or image sequence.
2340 %
2341 %  The format of the MagickDisplayImages method is:
2342 %
2343 %      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2344 %        const char *server_name)
2345 %
2346 %  A description of each parameter follows:
2347 %
2348 %    o wand: the magick wand.
2349 %
2350 %    o server_name: the X server name.
2351 %
2352 */
2353 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2354   const char *server_name)
2355 {
2356   MagickBooleanType
2357     status;
2358
2359   assert(wand != (MagickWand *) NULL);
2360   assert(wand->signature == WandSignature);
2361   if (wand->debug != MagickFalse)
2362     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2363   (void) CloneString(&wand->image_info->server_name,server_name);
2364   status=DisplayImages(wand->image_info,wand->images,&wand->images->exception);
2365   return(status);
2366 }
2367 \f
2368 /*
2369 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2370 %                                                                             %
2371 %                                                                             %
2372 %                                                                             %
2373 %   M a g i c k D i s t o r t I m a g e                                       %
2374 %                                                                             %
2375 %                                                                             %
2376 %                                                                             %
2377 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2378 %
2379 %  MagickDistortImage() distorts an image using various distortion methods, by
2380 %  mapping color lookups of the source image to a new destination image
2381 %  usally of the same size as the source image, unless 'bestfit' is set to
2382 %  true.
2383 %
2384 %  If 'bestfit' is enabled, and distortion allows it, the destination image is
2385 %  adjusted to ensure the whole source 'image' will just fit within the final
2386 %  destination image, which will be sized and offset accordingly.  Also in
2387 %  many cases the virtual offset of the source image will be taken into
2388 %  account in the mapping.
2389 %
2390 %  The format of the MagickDistortImage method is:
2391 %
2392 %      MagickBooleanType MagickDistortImage(MagickWand *wand,
2393 %        const DistortImageMethod method,const size_t number_arguments,
2394 %        const double *arguments,const MagickBooleanType bestfit)
2395 %
2396 %  A description of each parameter follows:
2397 %
2398 %    o image: the image to be distorted.
2399 %
2400 %    o method: the method of image distortion.
2401 %
2402 %        ArcDistortion always ignores the source image offset, and always
2403 %        'bestfit' the destination image with the top left corner offset
2404 %        relative to the polar mapping center.
2405 %
2406 %        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2407 %        style of image distortion.
2408 %
2409 %        Affine, Perspective, and Bilinear, do least squares fitting of the
2410 %        distortion when more than the minimum number of control point pairs
2411 %        are provided.
2412 %
2413 %        Perspective, and Bilinear, falls back to a Affine distortion when less
2414 %        that 4 control point pairs are provided. While Affine distortions let
2415 %        you use any number of control point pairs, that is Zero pairs is a
2416 %        no-Op (viewport only) distrotion, one pair is a translation and two
2417 %        pairs of control points do a scale-rotate-translate, without any
2418 %        shearing.
2419 %
2420 %    o number_arguments: the number of arguments given for this distortion
2421 %      method.
2422 %
2423 %    o arguments: the arguments for this distortion method.
2424 %
2425 %    o bestfit: Attempt to resize destination to fit distorted source.
2426 %
2427 */
2428 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2429   const DistortImageMethod method,const size_t number_arguments,
2430   const double *arguments,const MagickBooleanType bestfit)
2431 {
2432   Image
2433     *distort_image;
2434
2435   assert(wand != (MagickWand *) NULL);
2436   assert(wand->signature == WandSignature);
2437   if (wand->debug != MagickFalse)
2438     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2439   if (wand->images == (Image *) NULL)
2440     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2441   distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2442     bestfit,wand->exception);
2443   if (distort_image == (Image *) NULL)
2444     return(MagickFalse);
2445   ReplaceImageInList(&wand->images,distort_image);
2446   return(MagickTrue);
2447 }
2448 \f
2449 /*
2450 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2451 %                                                                             %
2452 %                                                                             %
2453 %                                                                             %
2454 %   M a g i c k D r a w I m a g e                                             %
2455 %                                                                             %
2456 %                                                                             %
2457 %                                                                             %
2458 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2459 %
2460 %  MagickDrawImage() renders the drawing wand on the current image.
2461 %
2462 %  The format of the MagickDrawImage method is:
2463 %
2464 %      MagickBooleanType MagickDrawImage(MagickWand *wand,
2465 %        const DrawingWand *drawing_wand)
2466 %
2467 %  A description of each parameter follows:
2468 %
2469 %    o wand: the magick wand.
2470 %
2471 %    o drawing_wand: the draw wand.
2472 %
2473 */
2474 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2475   const DrawingWand *drawing_wand)
2476 {
2477   char
2478     *primitive;
2479
2480   DrawInfo
2481     *draw_info;
2482
2483   MagickBooleanType
2484     status;
2485
2486   assert(wand != (MagickWand *) NULL);
2487   assert(wand->signature == WandSignature);
2488   if (wand->debug != MagickFalse)
2489     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2490   if (wand->images == (Image *) NULL)
2491     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2492   draw_info=PeekDrawingWand(drawing_wand);
2493   if ((draw_info == (DrawInfo *) NULL) ||
2494       (draw_info->primitive == (char *) NULL))
2495     return(MagickFalse);
2496   primitive=AcquireString(draw_info->primitive);
2497   draw_info=DestroyDrawInfo(draw_info);
2498   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2499   draw_info->primitive=primitive;
2500   status=DrawImage(wand->images,draw_info,wand->exception);
2501   draw_info=DestroyDrawInfo(draw_info);
2502   return(status);
2503 }
2504 \f
2505 /*
2506 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2507 %                                                                             %
2508 %                                                                             %
2509 %                                                                             %
2510 %   M a g i c k E d g e I m a g e                                             %
2511 %                                                                             %
2512 %                                                                             %
2513 %                                                                             %
2514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2515 %
2516 %  MagickEdgeImage() enhance edges within the image with a convolution filter
2517 %  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2518 %  radius for you.
2519 %
2520 %  The format of the MagickEdgeImage method is:
2521 %
2522 %      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius,
2523 %        const double sigma)
2524 %
2525 %  A description of each parameter follows:
2526 %
2527 %    o wand: the magick wand.
2528 %
2529 %    o radius: the radius of the pixel neighborhood.
2530 %
2531 %    o sigma: the standard deviation of the Gaussian, in pixels.
2532 %
2533 */
2534 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2535   const double radius,const double sigma)
2536 {
2537   Image
2538     *edge_image;
2539
2540   assert(wand != (MagickWand *) NULL);
2541   assert(wand->signature == WandSignature);
2542   if (wand->debug != MagickFalse)
2543     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2544   if (wand->images == (Image *) NULL)
2545     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2546   edge_image=EdgeImage(wand->images,radius,sigma,wand->exception);
2547   if (edge_image == (Image *) NULL)
2548     return(MagickFalse);
2549   ReplaceImageInList(&wand->images,edge_image);
2550   return(MagickTrue);
2551 }
2552 \f
2553 /*
2554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2555 %                                                                             %
2556 %                                                                             %
2557 %                                                                             %
2558 %   M a g i c k E m b o s s I m a g e                                         %
2559 %                                                                             %
2560 %                                                                             %
2561 %                                                                             %
2562 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2563 %
2564 %  MagickEmbossImage() returns a grayscale image with a three-dimensional
2565 %  effect.  We convolve the image with a Gaussian operator of the given radius
2566 %  and standard deviation (sigma).  For reasonable results, radius should be
2567 %  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2568 %  radius for you.
2569 %
2570 %  The format of the MagickEmbossImage method is:
2571 %
2572 %      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2573 %        const double sigma)
2574 %
2575 %  A description of each parameter follows:
2576 %
2577 %    o wand: the magick wand.
2578 %
2579 %    o radius: the radius of the Gaussian, in pixels, not counting the center
2580 %      pixel.
2581 %
2582 %    o sigma: the standard deviation of the Gaussian, in pixels.
2583 %
2584 */
2585 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2586   const double radius,const double sigma)
2587 {
2588   Image
2589     *emboss_image;
2590
2591   assert(wand != (MagickWand *) NULL);
2592   assert(wand->signature == WandSignature);
2593   if (wand->debug != MagickFalse)
2594     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2595   if (wand->images == (Image *) NULL)
2596     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2597   emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2598   if (emboss_image == (Image *) NULL)
2599     return(MagickFalse);
2600   ReplaceImageInList(&wand->images,emboss_image);
2601   return(MagickTrue);
2602 }
2603 \f
2604 /*
2605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2606 %                                                                             %
2607 %                                                                             %
2608 %                                                                             %
2609 %   M a g i c k E n c i p h e r I m a g e                                     %
2610 %                                                                             %
2611 %                                                                             %
2612 %                                                                             %
2613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2614 %
2615 %  MagickEncipherImage() converts plaint pixels to cipher pixels.
2616 %
2617 %  The format of the MagickEncipherImage method is:
2618 %
2619 %      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2620 %        const char *passphrase)
2621 %
2622 %  A description of each parameter follows:
2623 %
2624 %    o wand: the magick wand.
2625 %
2626 %    o passphrase: the passphrase.
2627 %
2628 */
2629 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2630   const char *passphrase)
2631 {
2632   assert(wand != (MagickWand *) NULL);
2633   assert(wand->signature == WandSignature);
2634   if (wand->debug != MagickFalse)
2635     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2636   if (wand->images == (Image *) NULL)
2637     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2638   return(EncipherImage(wand->images,passphrase,&wand->images->exception));
2639 }
2640 \f
2641 /*
2642 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2643 %                                                                             %
2644 %                                                                             %
2645 %                                                                             %
2646 %   M a g i c k E n h a n c e I m a g e                                       %
2647 %                                                                             %
2648 %                                                                             %
2649 %                                                                             %
2650 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2651 %
2652 %  MagickEnhanceImage() applies a digital filter that improves the quality of a
2653 %  noisy image.
2654 %
2655 %  The format of the MagickEnhanceImage method is:
2656 %
2657 %      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2658 %
2659 %  A description of each parameter follows:
2660 %
2661 %    o wand: the magick wand.
2662 %
2663 */
2664 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2665 {
2666   Image
2667     *enhance_image;
2668
2669   assert(wand != (MagickWand *) NULL);
2670   assert(wand->signature == WandSignature);
2671   if (wand->debug != MagickFalse)
2672     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2673   if (wand->images == (Image *) NULL)
2674     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2675   enhance_image=EnhanceImage(wand->images,wand->exception);
2676   if (enhance_image == (Image *) NULL)
2677     return(MagickFalse);
2678   ReplaceImageInList(&wand->images,enhance_image);
2679   return(MagickTrue);
2680 }
2681 \f
2682 /*
2683 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2684 %                                                                             %
2685 %                                                                             %
2686 %                                                                             %
2687 %   M a g i c k E q u a l i z e I m a g e                                     %
2688 %                                                                             %
2689 %                                                                             %
2690 %                                                                             %
2691 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2692 %
2693 %  MagickEqualizeImage() equalizes the image histogram.
2694 %
2695 %  The format of the MagickEqualizeImage method is:
2696 %
2697 %      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2698 %
2699 %  A description of each parameter follows:
2700 %
2701 %    o wand: the magick wand.
2702 %
2703 %    o channel: the image channel(s).
2704 %
2705 */
2706 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2707 {
2708   MagickBooleanType
2709     status;
2710
2711   assert(wand != (MagickWand *) NULL);
2712   assert(wand->signature == WandSignature);
2713   if (wand->debug != MagickFalse)
2714     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2715   if (wand->images == (Image *) NULL)
2716     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2717   status=EqualizeImage(wand->images,&wand->images->exception);
2718   return(status);
2719 }
2720 \f
2721 /*
2722 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2723 %                                                                             %
2724 %                                                                             %
2725 %                                                                             %
2726 %   M a g i c k E v a l u a t e I m a g e                                     %
2727 %                                                                             %
2728 %                                                                             %
2729 %                                                                             %
2730 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2731 %
2732 %  MagickEvaluateImage() applys an arithmetic, relational, or logical
2733 %  expression to an image.  Use these operators to lighten or darken an image,
2734 %  to increase or decrease contrast in an image, or to produce the "negative"
2735 %  of an image.
2736 %
2737 %  The format of the MagickEvaluateImage method is:
2738 %
2739 %      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2740 %        const MagickEvaluateOperator operator,const double value)
2741 %      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
2742 %        const MagickEvaluateOperator operator)
2743 %
2744 %  A description of each parameter follows:
2745 %
2746 %    o wand: the magick wand.
2747 %
2748 %    o op: A channel operator.
2749 %
2750 %    o value: A value value.
2751 %
2752 */
2753
2754 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
2755   const MagickEvaluateOperator op)
2756 {
2757   Image
2758     *evaluate_image;
2759
2760   assert(wand != (MagickWand *) NULL);
2761   assert(wand->signature == WandSignature);
2762   if (wand->debug != MagickFalse)
2763     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2764   if (wand->images == (Image *) NULL)
2765     return((MagickWand *) NULL);
2766   evaluate_image=EvaluateImages(wand->images,op,wand->exception);
2767   if (evaluate_image == (Image *) NULL)
2768     return((MagickWand *) NULL);
2769   return(CloneMagickWandFromImages(wand,evaluate_image));
2770 }
2771
2772 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
2773   const MagickEvaluateOperator op,const double value)
2774 {
2775   MagickBooleanType
2776     status;
2777
2778   assert(wand != (MagickWand *) NULL);
2779   assert(wand->signature == WandSignature);
2780   if (wand->debug != MagickFalse)
2781     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2782   if (wand->images == (Image *) NULL)
2783     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2784   status=EvaluateImage(wand->images,op,value,&wand->images->exception);
2785   return(status);
2786 }
2787 \f
2788 /*
2789 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2790 %                                                                             %
2791 %                                                                             %
2792 %                                                                             %
2793 %   M a g i c k E x p o r t I m a g e P i x e l s                             %
2794 %                                                                             %
2795 %                                                                             %
2796 %                                                                             %
2797 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2798 %
2799 %  MagickExportImagePixels() extracts pixel data from an image and returns it
2800 %  to you.  The method returns MagickTrue on success otherwise MagickFalse if
2801 %  an error is encountered.  The data is returned as char, short int, int,
2802 %  ssize_t, float, or double in the order specified by map.
2803 %
2804 %  Suppose you want to extract the first scanline of a 640x480 image as
2805 %  character data in red-green-blue order:
2806 %
2807 %      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
2808 %
2809 %  The format of the MagickExportImagePixels method is:
2810 %
2811 %      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2812 %        const ssize_t x,const ssize_t y,const size_t columns,
2813 %        const size_t rows,const char *map,const StorageType storage,
2814 %        void *pixels)
2815 %
2816 %  A description of each parameter follows:
2817 %
2818 %    o wand: the magick wand.
2819 %
2820 %    o x, y, columns, rows:  These values define the perimeter
2821 %      of a region of pixels you want to extract.
2822 %
2823 %    o map:  This string reflects the expected ordering of the pixel array.
2824 %      It can be any combination or order of R = red, G = green, B = blue,
2825 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2826 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2827 %      P = pad.
2828 %
2829 %    o storage: Define the data type of the pixels.  Float and double types are
2830 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2831 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2832 %      LongPixel, QuantumPixel, or ShortPixel.
2833 %
2834 %    o pixels: This array of values contain the pixel components as defined by
2835 %      map and type.  You must preallocate this array where the expected
2836 %      length varies depending on the values of width, height, map, and type.
2837 %
2838 */
2839 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
2840   const ssize_t x,const ssize_t y,const size_t columns,
2841   const size_t rows,const char *map,const StorageType storage,
2842   void *pixels)
2843 {
2844   MagickBooleanType
2845     status;
2846
2847   assert(wand != (MagickWand *) NULL);
2848   assert(wand->signature == WandSignature);
2849   if (wand->debug != MagickFalse)
2850     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2851   if (wand->images == (Image *) NULL)
2852     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2853   status=ExportImagePixels(wand->images,x,y,columns,rows,map,
2854     storage,pixels,wand->exception);
2855   if (status == MagickFalse)
2856     InheritException(wand->exception,&wand->images->exception);
2857   return(status);
2858 }
2859 \f
2860 /*
2861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2862 %                                                                             %
2863 %                                                                             %
2864 %                                                                             %
2865 %   M a g i c k E x t e n t I m a g e                                         %
2866 %                                                                             %
2867 %                                                                             %
2868 %                                                                             %
2869 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2870 %
2871 %  MagickExtentImage() extends the image as defined by the geometry, gravity,
2872 %  and wand background color.  Set the (x,y) offset of the geometry to move
2873 %  the original wand relative to the extended wand.
2874 %
2875 %  The format of the MagickExtentImage method is:
2876 %
2877 %      MagickBooleanType MagickExtentImage(MagickWand *wand,
2878 %        const size_t width,const size_t height,const ssize_t x,
2879 %        const ssize_t y)
2880 %
2881 %  A description of each parameter follows:
2882 %
2883 %    o wand: the magick wand.
2884 %
2885 %    o width: the region width.
2886 %
2887 %    o height: the region height.
2888 %
2889 %    o x: the region x offset.
2890 %
2891 %    o y: the region y offset.
2892 %
2893 */
2894 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
2895   const size_t width,const size_t height,const ssize_t x,
2896   const ssize_t y)
2897 {
2898   Image
2899     *extent_image;
2900
2901   RectangleInfo
2902     extent;
2903
2904   assert(wand != (MagickWand *) NULL);
2905   assert(wand->signature == WandSignature);
2906   if (wand->debug != MagickFalse)
2907     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2908   if (wand->images == (Image *) NULL)
2909     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2910   extent.width=width;
2911   extent.height=height;
2912   extent.x=x;
2913   extent.y=y;
2914   extent_image=ExtentImage(wand->images,&extent,wand->exception);
2915   if (extent_image == (Image *) NULL)
2916     return(MagickFalse);
2917   ReplaceImageInList(&wand->images,extent_image);
2918   return(MagickTrue);
2919 }
2920 \f
2921 /*
2922 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2923 %                                                                             %
2924 %                                                                             %
2925 %                                                                             %
2926 %   M a g i c k F l i p I m a g e                                             %
2927 %                                                                             %
2928 %                                                                             %
2929 %                                                                             %
2930 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2931 %
2932 %  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
2933 %  around the central x-axis.
2934 %
2935 %  The format of the MagickFlipImage method is:
2936 %
2937 %      MagickBooleanType MagickFlipImage(MagickWand *wand)
2938 %
2939 %  A description of each parameter follows:
2940 %
2941 %    o wand: the magick wand.
2942 %
2943 */
2944 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
2945 {
2946   Image
2947     *flip_image;
2948
2949   assert(wand != (MagickWand *) NULL);
2950   assert(wand->signature == WandSignature);
2951   if (wand->debug != MagickFalse)
2952     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2953   if (wand->images == (Image *) NULL)
2954     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2955   flip_image=FlipImage(wand->images,wand->exception);
2956   if (flip_image == (Image *) NULL)
2957     return(MagickFalse);
2958   ReplaceImageInList(&wand->images,flip_image);
2959   return(MagickTrue);
2960 }
2961 \f
2962 /*
2963 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2964 %                                                                             %
2965 %                                                                             %
2966 %                                                                             %
2967 %   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                         %
2968 %                                                                             %
2969 %                                                                             %
2970 %                                                                             %
2971 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2972 %
2973 %  MagickFloodfillPaintImage() changes the color value of any pixel that matches
2974 %  target and is an immediate neighbor.  If the method FillToBorderMethod is
2975 %  specified, the color value is changed for any neighbor pixel that does not
2976 %  match the bordercolor member of image.
2977 %
2978 %  The format of the MagickFloodfillPaintImage method is:
2979 %
2980 %      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
2981 %        const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
2982 %        const ssize_t x,const ssize_t y,const MagickBooleanType invert)
2983 %
2984 %  A description of each parameter follows:
2985 %
2986 %    o wand: the magick wand.
2987 %
2988 %    o fill: the floodfill color pixel wand.
2989 %
2990 %    o fuzz: By default target must match a particular pixel color
2991 %      exactly.  However, in many cases two colors may differ by a small amount.
2992 %      The fuzz member of image defines how much tolerance is acceptable to
2993 %      consider two colors as the same.  For example, set fuzz to 10 and the
2994 %      color red at intensities of 100 and 102 respectively are now interpreted
2995 %      as the same color for the purposes of the floodfill.
2996 %
2997 %    o bordercolor: the border color pixel wand.
2998 %
2999 %    o x,y: the starting location of the operation.
3000 %
3001 %    o invert: paint any pixel that does not match the target color.
3002 %
3003 */
3004 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3005   const PixelWand *fill,const double fuzz,const PixelWand *bordercolor,
3006   const ssize_t x,const ssize_t y,const MagickBooleanType invert)
3007 {
3008   DrawInfo
3009     *draw_info;
3010
3011   MagickBooleanType
3012     status;
3013
3014   PixelInfo
3015     target;
3016
3017   assert(wand != (MagickWand *) NULL);
3018   assert(wand->signature == WandSignature);
3019   if (wand->debug != MagickFalse)
3020     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3021   if (wand->images == (Image *) NULL)
3022     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3023   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3024   PixelGetQuantumPacket(fill,&draw_info->fill);
3025   (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
3026     y % wand->images->rows,&target,wand->exception);
3027   if (bordercolor != (PixelWand *) NULL)
3028     PixelGetMagickColor(bordercolor,&target);
3029   wand->images->fuzz=fuzz;
3030   status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert,
3031     &wand->images->exception);
3032   draw_info=DestroyDrawInfo(draw_info);
3033   return(status);
3034 }
3035 \f
3036 /*
3037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3038 %                                                                             %
3039 %                                                                             %
3040 %                                                                             %
3041 %   M a g i c k F l o p I m a g e                                             %
3042 %                                                                             %
3043 %                                                                             %
3044 %                                                                             %
3045 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3046 %
3047 %  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3048 %  around the central y-axis.
3049 %
3050 %  The format of the MagickFlopImage method is:
3051 %
3052 %      MagickBooleanType MagickFlopImage(MagickWand *wand)
3053 %
3054 %  A description of each parameter follows:
3055 %
3056 %    o wand: the magick wand.
3057 %
3058 */
3059 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3060 {
3061   Image
3062     *flop_image;
3063
3064   assert(wand != (MagickWand *) NULL);
3065   assert(wand->signature == WandSignature);
3066   if (wand->debug != MagickFalse)
3067     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3068   if (wand->images == (Image *) NULL)
3069     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3070   flop_image=FlopImage(wand->images,wand->exception);
3071   if (flop_image == (Image *) NULL)
3072     return(MagickFalse);
3073   ReplaceImageInList(&wand->images,flop_image);
3074   return(MagickTrue);
3075 }
3076 \f
3077 /*
3078 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3079 %                                                                             %
3080 %                                                                             %
3081 %                                                                             %
3082 %   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                     %
3083 %                                                                             %
3084 %                                                                             %
3085 %                                                                             %
3086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3087 %
3088 %  MagickForwardFourierTransformImage() implements the discrete Fourier
3089 %  transform (DFT) of the image either as a magnitude / phase or real /
3090 %  imaginary image pair.
3091 %
3092 %  The format of the MagickForwardFourierTransformImage method is:
3093 %
3094 %      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3095 %        const MagickBooleanType magnitude)
3096 %
3097 %  A description of each parameter follows:
3098 %
3099 %    o wand: the magick wand.
3100 %
3101 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3102 %      imaginary image pair.
3103 %
3104 */
3105 WandExport MagickBooleanType MagickForwardFourierTransformImage(
3106   MagickWand *wand,const MagickBooleanType magnitude)
3107 {
3108   Image
3109     *forward_image;
3110
3111   assert(wand != (MagickWand *) NULL);
3112   assert(wand->signature == WandSignature);
3113   if (wand->debug != MagickFalse)
3114     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3115   if (wand->images == (Image *) NULL)
3116     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3117   forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3118     wand->exception);
3119   if (forward_image == (Image *) NULL)
3120     return(MagickFalse);
3121   ReplaceImageInList(&wand->images,forward_image);
3122   return(MagickTrue);
3123 }
3124 \f
3125 /*
3126 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3127 %                                                                             %
3128 %                                                                             %
3129 %                                                                             %
3130 %   M a g i c k F r a m e I m a g e                                           %
3131 %                                                                             %
3132 %                                                                             %
3133 %                                                                             %
3134 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3135 %
3136 %  MagickFrameImage() adds a simulated three-dimensional border around the
3137 %  image.  The width and height specify the border width of the vertical and
3138 %  horizontal sides of the frame.  The inner and outer bevels indicate the
3139 %  width of the inner and outer shadows of the frame.
3140 %
3141 %  The format of the MagickFrameImage method is:
3142 %
3143 %      MagickBooleanType MagickFrameImage(MagickWand *wand,
3144 %        const PixelWand *matte_color,const size_t width,
3145 %        const size_t height,const ssize_t inner_bevel,
3146 %        const ssize_t outer_bevel,const CompositeOperator compose)
3147 %
3148 %  A description of each parameter follows:
3149 %
3150 %    o wand: the magick wand.
3151 %
3152 %    o matte_color: the frame color pixel wand.
3153 %
3154 %    o width: the border width.
3155 %
3156 %    o height: the border height.
3157 %
3158 %    o inner_bevel: the inner bevel width.
3159 %
3160 %    o outer_bevel: the outer bevel width.
3161 %
3162 %    o compose: the composite operator.
3163 %
3164 */
3165 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3166   const PixelWand *matte_color,const size_t width,const size_t height,
3167   const ssize_t inner_bevel,const ssize_t outer_bevel,
3168   const CompositeOperator compose)
3169 {
3170   Image
3171     *frame_image;
3172
3173   FrameInfo
3174     frame_info;
3175
3176   assert(wand != (MagickWand *) NULL);
3177   assert(wand->signature == WandSignature);
3178   if (wand->debug != MagickFalse)
3179     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3180   if (wand->images == (Image *) NULL)
3181     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3182   (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3183   frame_info.width=wand->images->columns+2*width;
3184   frame_info.height=wand->images->rows+2*height;
3185   frame_info.x=(ssize_t) width;
3186   frame_info.y=(ssize_t) height;
3187   frame_info.inner_bevel=inner_bevel;
3188   frame_info.outer_bevel=outer_bevel;
3189   PixelGetQuantumPacket(matte_color,&wand->images->matte_color);
3190   frame_image=FrameImage(wand->images,&frame_info,compose,wand->exception);
3191   if (frame_image == (Image *) NULL)
3192     return(MagickFalse);
3193   ReplaceImageInList(&wand->images,frame_image);
3194   return(MagickTrue);
3195 }
3196 \f
3197 /*
3198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3199 %                                                                             %
3200 %                                                                             %
3201 %                                                                             %
3202 %   M a g i c k F u n c t i o n I m a g e                                     %
3203 %                                                                             %
3204 %                                                                             %
3205 %                                                                             %
3206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3207 %
3208 %  MagickFunctionImage() applys an arithmetic, relational, or logical
3209 %  expression to an image.  Use these operators to lighten or darken an image,
3210 %  to increase or decrease contrast in an image, or to produce the "negative"
3211 %  of an image.
3212 %
3213 %  The format of the MagickFunctionImage method is:
3214 %
3215 %      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3216 %        const MagickFunction function,const size_t number_arguments,
3217 %        const double *arguments)
3218 %
3219 %  A description of each parameter follows:
3220 %
3221 %    o wand: the magick wand.
3222 %
3223 %    o function: the image function.
3224 %
3225 %    o number_arguments: the number of function arguments.
3226 %
3227 %    o arguments: the function arguments.
3228 %
3229 */
3230 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3231   const MagickFunction function,const size_t number_arguments,
3232   const double *arguments)
3233 {
3234   MagickBooleanType
3235     status;
3236
3237   assert(wand != (MagickWand *) NULL);
3238   assert(wand->signature == WandSignature);
3239   if (wand->debug != MagickFalse)
3240     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3241   if (wand->images == (Image *) NULL)
3242     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3243   status=FunctionImage(wand->images,function,number_arguments,arguments,
3244     &wand->images->exception);
3245   return(status);
3246 }
3247 \f
3248 /*
3249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3250 %                                                                             %
3251 %                                                                             %
3252 %                                                                             %
3253 %   M a g i c k F x I m a g e                                                 %
3254 %                                                                             %
3255 %                                                                             %
3256 %                                                                             %
3257 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3258 %
3259 %  MagickFxImage() evaluate expression for each pixel in the image.
3260 %
3261 %  The format of the MagickFxImage method is:
3262 %
3263 %      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3264 %
3265 %  A description of each parameter follows:
3266 %
3267 %    o wand: the magick wand.
3268 %
3269 %    o expression: the expression.
3270 %
3271 */
3272 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3273 {
3274   Image
3275     *fx_image;
3276
3277   assert(wand != (MagickWand *) NULL);
3278   assert(wand->signature == WandSignature);
3279   if (wand->debug != MagickFalse)
3280     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3281   if (wand->images == (Image *) NULL)
3282     return((MagickWand *) NULL);
3283   fx_image=FxImage(wand->images,expression,wand->exception);
3284   if (fx_image == (Image *) NULL)
3285     return((MagickWand *) NULL);
3286   return(CloneMagickWandFromImages(wand,fx_image));
3287 }
3288 \f
3289 /*
3290 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3291 %                                                                             %
3292 %                                                                             %
3293 %                                                                             %
3294 %   M a g i c k G a m m a I m a g e                                           %
3295 %                                                                             %
3296 %                                                                             %
3297 %                                                                             %
3298 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3299 %
3300 %  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3301 %  different devices will have perceptual differences in the way the image's
3302 %  intensities are represented on the screen.  Specify individual gamma levels
3303 %  for the red, green, and blue channels, or adjust all three with the gamma
3304 %  parameter.  Values typically range from 0.8 to 2.3.
3305 %
3306 %  You can also reduce the influence of a particular channel with a gamma
3307 %  value of 0.
3308 %
3309 %  The format of the MagickGammaImage method is:
3310 %
3311 %      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3312 %
3313 %  A description of each parameter follows:
3314 %
3315 %    o wand: the magick wand.
3316 %
3317 %    o level: Define the level of gamma correction.
3318 %
3319 */
3320 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3321   const double gamma)
3322 {
3323   MagickBooleanType
3324     status;
3325
3326   assert(wand != (MagickWand *) NULL);
3327   assert(wand->signature == WandSignature);
3328   if (wand->debug != MagickFalse)
3329     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3330   if (wand->images == (Image *) NULL)
3331     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3332   status=GammaImage(wand->images,gamma,wand->exception);
3333   return(status);
3334 }
3335 \f
3336 /*
3337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3338 %                                                                             %
3339 %                                                                             %
3340 %                                                                             %
3341 %   M a g i c k G a u s s i a n B l u r I m a g e                             %
3342 %                                                                             %
3343 %                                                                             %
3344 %                                                                             %
3345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3346 %
3347 %  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3348 %  Gaussian operator of the given radius and standard deviation (sigma).
3349 %  For reasonable results, the radius should be larger than sigma.  Use a
3350 %  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3351 %
3352 %  The format of the MagickGaussianBlurImage method is:
3353 %
3354 %      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3355 %        const double radius,const double sigma,const double bias)
3356 %
3357 %  A description of each parameter follows:
3358 %
3359 %    o wand: the magick wand.
3360 %
3361 %    o radius: the radius of the Gaussian, in pixels, not counting the center
3362 %      pixel.
3363 %
3364 %    o sigma: the standard deviation of the Gaussian, in pixels.
3365 %
3366 %    o bias: the bias.
3367 %
3368 */
3369 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3370   const double radius,const double sigma,const double bias)
3371 {
3372   Image
3373     *blur_image;
3374
3375   assert(wand != (MagickWand *) NULL);
3376   assert(wand->signature == WandSignature);
3377   if (wand->debug != MagickFalse)
3378     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3379   if (wand->images == (Image *) NULL)
3380     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3381   blur_image=GaussianBlurImage(wand->images,radius,sigma,bias,wand->exception);
3382   if (blur_image == (Image *) NULL)
3383     return(MagickFalse);
3384   ReplaceImageInList(&wand->images,blur_image);
3385   return(MagickTrue);
3386 }
3387 \f
3388 /*
3389 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3390 %                                                                             %
3391 %                                                                             %
3392 %                                                                             %
3393 %   M a g i c k G e t I m a g e                                               %
3394 %                                                                             %
3395 %                                                                             %
3396 %                                                                             %
3397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3398 %
3399 %  MagickGetImage() gets the image at the current image index.
3400 %
3401 %  The format of the MagickGetImage method is:
3402 %
3403 %      MagickWand *MagickGetImage(MagickWand *wand)
3404 %
3405 %  A description of each parameter follows:
3406 %
3407 %    o wand: the magick wand.
3408 %
3409 */
3410 WandExport MagickWand *MagickGetImage(MagickWand *wand)
3411 {
3412   Image
3413     *image;
3414
3415   assert(wand != (MagickWand *) NULL);
3416   assert(wand->signature == WandSignature);
3417   if (wand->debug != MagickFalse)
3418     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3419   if (wand->images == (Image *) NULL)
3420     {
3421       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3422         "ContainsNoImages","`%s'",wand->name);
3423       return((MagickWand *) NULL);
3424     }
3425   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3426   if (image == (Image *) NULL)
3427     return((MagickWand *) NULL);
3428   return(CloneMagickWandFromImages(wand,image));
3429 }
3430 \f
3431 /*
3432 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3433 %                                                                             %
3434 %                                                                             %
3435 %                                                                             %
3436 %   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                       %
3437 %                                                                             %
3438 %                                                                             %
3439 %                                                                             %
3440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3441 %
3442 %  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3443 %  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3444 %  than CMYKA.
3445 %
3446 %  The format of the MagickGetImageAlphaChannel method is:
3447 %
3448 %      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3449 %
3450 %  A description of each parameter follows:
3451 %
3452 %    o wand: the magick wand.
3453 %
3454 */
3455 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3456 {
3457   assert(wand != (MagickWand *) NULL);
3458   assert(wand->signature == WandSignature);
3459   if (wand->debug != MagickFalse)
3460     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3461   if (wand->images == (Image *) NULL)
3462     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3463   return(GetImageAlphaChannel(wand->images));
3464 }
3465 \f
3466 /*
3467 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3468 %                                                                             %
3469 %                                                                             %
3470 %                                                                             %
3471 %   M a g i c k G e t I m a g e C l i p M a s k                               %
3472 %                                                                             %
3473 %                                                                             %
3474 %                                                                             %
3475 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3476 %
3477 %  MagickGetImageClipMask() gets the image clip mask at the current image index.
3478 %
3479 %  The format of the MagickGetImageClipMask method is:
3480 %
3481 %      MagickWand *MagickGetImageClipMask(MagickWand *wand)
3482 %
3483 %  A description of each parameter follows:
3484 %
3485 %    o wand: the magick wand.
3486 %
3487 */
3488 WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
3489 {
3490   Image
3491     *image;
3492
3493   assert(wand != (MagickWand *) NULL);
3494   assert(wand->signature == WandSignature);
3495   if (wand->debug != MagickFalse)
3496     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3497   if (wand->images == (Image *) NULL)
3498     {
3499       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3500         "ContainsNoImages","`%s'",wand->name);
3501       return((MagickWand *) NULL);
3502     }
3503   image=GetImageClipMask(wand->images,wand->exception);
3504   if (image == (Image *) NULL)
3505     return((MagickWand *) NULL);
3506   return(CloneMagickWandFromImages(wand,image));
3507 }
3508 \f
3509 /*
3510 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3511 %                                                                             %
3512 %                                                                             %
3513 %                                                                             %
3514 %   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                 %
3515 %                                                                             %
3516 %                                                                             %
3517 %                                                                             %
3518 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3519 %
3520 %  MagickGetImageBackgroundColor() returns the image background color.
3521 %
3522 %  The format of the MagickGetImageBackgroundColor method is:
3523 %
3524 %      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3525 %        PixelWand *background_color)
3526 %
3527 %  A description of each parameter follows:
3528 %
3529 %    o wand: the magick wand.
3530 %
3531 %    o background_color: Return the background color.
3532 %
3533 */
3534 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3535   PixelWand *background_color)
3536 {
3537   assert(wand != (MagickWand *) NULL);
3538   assert(wand->signature == WandSignature);
3539   if (wand->debug != MagickFalse)
3540     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3541   if (wand->images == (Image *) NULL)
3542     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3543   PixelSetQuantumPacket(background_color,&wand->images->background_color);
3544   return(MagickTrue);
3545 }
3546 \f
3547 /*
3548 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3549 %                                                                             %
3550 %                                                                             %
3551 %                                                                             %
3552 %   M a g i c k G e t I m a g e B l o b                                       %
3553 %                                                                             %
3554 %                                                                             %
3555 %                                                                             %
3556 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3557 %
3558 %  MagickGetImageBlob() implements direct to memory image formats.  It returns
3559 %  the image as a blob (a formatted "file" in memory) and its length, starting
3560 %  from the current position in the image sequence.  Use MagickSetImageFormat() 
3561 %  to set the format to write to the blob (GIF, JPEG,  PNG, etc.).
3562 %
3563 %  Utilize MagickResetIterator() to ensure the write is from the beginning of
3564 %  the image sequence.
3565 %
3566 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
3567 %
3568 %  The format of the MagickGetImageBlob method is:
3569 %
3570 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3571 %
3572 %  A description of each parameter follows:
3573 %
3574 %    o wand: the magick wand.
3575 %
3576 %    o length: the length of the blob.
3577 %
3578 */
3579 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
3580 {
3581   assert(wand != (MagickWand *) NULL);
3582   assert(wand->signature == WandSignature);
3583   if (wand->debug != MagickFalse)
3584     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3585   if (wand->images == (Image *) NULL)
3586     {
3587       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3588         "ContainsNoImages","`%s'",wand->name);
3589       return((unsigned char *) NULL);
3590     }
3591   return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
3592 }
3593 \f
3594 /*
3595 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3596 %                                                                             %
3597 %                                                                             %
3598 %                                                                             %
3599 %   M a g i c k G e t I m a g e s B l o b                                     %
3600 %                                                                             %
3601 %                                                                             %
3602 %                                                                             %
3603 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3604 %
3605 %  MagickGetImageBlob() implements direct to memory image formats.  It
3606 %  returns the image sequence as a blob and its length.  The format of the image
3607 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
3608 %  return a different image format, use MagickSetImageFormat().
3609 %
3610 %  Note, some image formats do not permit multiple images to the same image
3611 %  stream (e.g. JPEG).  in this instance, just the first image of the
3612 %  sequence is returned as a blob.
3613 %
3614 %  The format of the MagickGetImagesBlob method is:
3615 %
3616 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3617 %
3618 %  A description of each parameter follows:
3619 %
3620 %    o wand: the magick wand.
3621 %
3622 %    o length: the length of the blob.
3623 %
3624 */
3625 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
3626 {
3627   unsigned char
3628     *blob;
3629
3630   assert(wand != (MagickWand *) NULL);
3631   assert(wand->signature == WandSignature);
3632   if (wand->debug != MagickFalse)
3633     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3634   if (wand->images == (Image *) NULL)
3635     {
3636       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3637         "ContainsNoImages","`%s'",wand->name);
3638       return((unsigned char *) NULL);
3639     }
3640   blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
3641     wand->exception);
3642   return(blob);
3643 }
3644 \f
3645 /*
3646 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3647 %                                                                             %
3648 %                                                                             %
3649 %                                                                             %
3650 %   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                         %
3651 %                                                                             %
3652 %                                                                             %
3653 %                                                                             %
3654 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3655 %
3656 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
3657 %  image.
3658 %
3659 %  The format of the MagickGetImageBluePrimary method is:
3660 %
3661 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
3662 %        double *y)
3663 %
3664 %  A description of each parameter follows:
3665 %
3666 %    o wand: the magick wand.
3667 %
3668 %    o x: the chromaticity blue primary x-point.
3669 %
3670 %    o y: the chromaticity blue primary y-point.
3671 %
3672 */
3673 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
3674   double *x,double *y)
3675 {
3676   assert(wand != (MagickWand *) NULL);
3677   assert(wand->signature == WandSignature);
3678   if (wand->debug != MagickFalse)
3679     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3680   if (wand->images == (Image *) NULL)
3681     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3682   *x=wand->images->chromaticity.blue_primary.x;
3683   *y=wand->images->chromaticity.blue_primary.y;
3684   return(MagickTrue);
3685 }
3686 \f
3687 /*
3688 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3689 %                                                                             %
3690 %                                                                             %
3691 %                                                                             %
3692 %   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                         %
3693 %                                                                             %
3694 %                                                                             %
3695 %                                                                             %
3696 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3697 %
3698 %  MagickGetImageBorderColor() returns the image border color.
3699 %
3700 %  The format of the MagickGetImageBorderColor method is:
3701 %
3702 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3703 %        PixelWand *border_color)
3704 %
3705 %  A description of each parameter follows:
3706 %
3707 %    o wand: the magick wand.
3708 %
3709 %    o border_color: Return the border color.
3710 %
3711 */
3712 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
3713   PixelWand *border_color)
3714 {
3715   assert(wand != (MagickWand *) NULL);
3716   assert(wand->signature == WandSignature);
3717   if (wand->debug != MagickFalse)
3718     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3719   if (wand->images == (Image *) NULL)
3720     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3721   PixelSetQuantumPacket(border_color,&wand->images->border_color);
3722   return(MagickTrue);
3723 }
3724 \f
3725 /*
3726 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3727 %                                                                             %
3728 %                                                                             %
3729 %                                                                             %
3730 %   M a g i c k G e t I m a g e F e a t u r e s                               %
3731 %                                                                             %
3732 %                                                                             %
3733 %                                                                             %
3734 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3735 %
3736 %  MagickGetImageFeatures() returns features for each channel in the
3737 %  image in each of four directions (horizontal, vertical, left and right
3738 %  diagonals) for the specified distance.  The features include the angular
3739 %  second moment, contrast, correlation, sum of squares: variance, inverse
3740 %  difference moment, sum average, sum varience, sum entropy, entropy,
3741 %  difference variance, difference entropy, information measures of
3742 %  correlation 1, information measures of correlation 2, and maximum
3743 %  correlation coefficient.  You can access the red channel contrast, for
3744 %  example, like this:
3745 %
3746 %      channel_features=MagickGetImageFeatures(wand,1);
3747 %      contrast=channel_features[RedChannel].contrast[0];
3748 %
3749 %  Use MagickRelinquishMemory() to free the statistics buffer.
3750 %
3751 %  The format of the MagickGetImageFeatures method is:
3752 %
3753 %      ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3754 %        const size_t distance)
3755 %
3756 %  A description of each parameter follows:
3757 %
3758 %    o wand: the magick wand.
3759 %
3760 %    o distance: the distance.
3761 %
3762 */
3763 WandExport ChannelFeatures *MagickGetImageFeatures(MagickWand *wand,
3764   const size_t distance)
3765 {
3766   assert(wand != (MagickWand *) NULL);
3767   assert(wand->signature == WandSignature);
3768   if (wand->debug != MagickFalse)
3769     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3770   if (wand->images == (Image *) NULL)
3771     {
3772       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3773         "ContainsNoImages","`%s'",wand->name);
3774       return((ChannelFeatures *) NULL);
3775     }
3776   return(GetImageFeatures(wand->images,distance,wand->exception));
3777 }
3778 \f
3779 /*
3780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3781 %                                                                             %
3782 %                                                                             %
3783 %                                                                             %
3784 %   M a g i c k G e t I m a g e K u r t o s i s                               %
3785 %                                                                             %
3786 %                                                                             %
3787 %                                                                             %
3788 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3789 %
3790 %  MagickGetImageKurtosis() gets the kurtosis and skewness of one or
3791 %  more image channels.
3792 %
3793 %  The format of the MagickGetImageKurtosis method is:
3794 %
3795 %      MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3796 %        double *kurtosis,double *skewness)
3797 %
3798 %  A description of each parameter follows:
3799 %
3800 %    o wand: the magick wand.
3801 %
3802 %    o kurtosis:  The kurtosis for the specified channel(s).
3803 %
3804 %    o skewness:  The skewness for the specified channel(s).
3805 %
3806 */
3807 WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand,
3808   double *kurtosis,double *skewness)
3809 {
3810   MagickBooleanType
3811     status;
3812
3813   assert(wand != (MagickWand *) NULL);
3814   assert(wand->signature == WandSignature);
3815   if (wand->debug != MagickFalse)
3816     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3817   if (wand->images == (Image *) NULL)
3818     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3819   status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception);
3820   return(status);
3821 }
3822 \f
3823 /*
3824 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3825 %                                                                             %
3826 %                                                                             %
3827 %                                                                             %
3828 %   M a g i c k G e t I m a g e M e a n                                       %
3829 %                                                                             %
3830 %                                                                             %
3831 %                                                                             %
3832 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3833 %
3834 %  MagickGetImageMean() gets the mean and standard deviation of one or more
3835 %  image channels.
3836 %
3837 %  The format of the MagickGetImageMean method is:
3838 %
3839 %      MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3840 %        double *standard_deviation)
3841 %
3842 %  A description of each parameter follows:
3843 %
3844 %    o wand: the magick wand.
3845 %
3846 %    o channel: the image channel(s).
3847 %
3848 %    o mean:  The mean pixel value for the specified channel(s).
3849 %
3850 %    o standard_deviation:  The standard deviation for the specified channel(s).
3851 %
3852 */
3853 WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean,
3854   double *standard_deviation)
3855 {
3856   MagickBooleanType
3857     status;
3858
3859   assert(wand != (MagickWand *) NULL);
3860   assert(wand->signature == WandSignature);
3861   if (wand->debug != MagickFalse)
3862     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3863   if (wand->images == (Image *) NULL)
3864     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3865   status=GetImageMean(wand->images,mean,standard_deviation,wand->exception);
3866   return(status);
3867 }
3868 \f
3869 /*
3870 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3871 %                                                                             %
3872 %                                                                             %
3873 %                                                                             %
3874 %   M a g i c k G e t I m a g e R a n g e                                     %
3875 %                                                                             %
3876 %                                                                             %
3877 %                                                                             %
3878 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3879 %
3880 %  MagickGetImageRange() gets the range for one or more image channels.
3881 %
3882 %  The format of the MagickGetImageRange method is:
3883 %
3884 %      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
3885 %        double *maxima)
3886 %
3887 %  A description of each parameter follows:
3888 %
3889 %    o wand: the magick wand.
3890 %
3891 %    o minima:  The minimum pixel value for the specified channel(s).
3892 %
3893 %    o maxima:  The maximum pixel value for the specified channel(s).
3894 %
3895 */
3896 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
3897   double *minima,double *maxima)
3898 {
3899   MagickBooleanType
3900     status;
3901
3902   assert(wand != (MagickWand *) NULL);
3903   assert(wand->signature == WandSignature);
3904   if (wand->debug != MagickFalse)
3905     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3906   if (wand->images == (Image *) NULL)
3907     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3908   status=GetImageRange(wand->images,minima,maxima,wand->exception);
3909   return(status);
3910 }
3911 \f
3912 /*
3913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3914 %                                                                             %
3915 %                                                                             %
3916 %                                                                             %
3917 %   M a g i c k G e t I m a g e S t a t i s t i c s                           %
3918 %                                                                             %
3919 %                                                                             %
3920 %                                                                             %
3921 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3922 %
3923 %  MagickGetImageStatistics() returns statistics for each channel in the
3924 %  image.  The statistics include the channel depth, its minima and
3925 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
3926 %  You can access the red channel mean, for example, like this:
3927 %
3928 %      channel_statistics=MagickGetImageStatistics(wand);
3929 %      red_mean=channel_statistics[RedChannel].mean;
3930 %
3931 %  Use MagickRelinquishMemory() to free the statistics buffer.
3932 %
3933 %  The format of the MagickGetImageStatistics method is:
3934 %
3935 %      ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3936 %
3937 %  A description of each parameter follows:
3938 %
3939 %    o wand: the magick wand.
3940 %
3941 */
3942 WandExport ChannelStatistics *MagickGetImageStatistics(MagickWand *wand)
3943 {
3944   assert(wand != (MagickWand *) NULL);
3945   assert(wand->signature == WandSignature);
3946   if (wand->debug != MagickFalse)
3947     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3948   if (wand->images == (Image *) NULL)
3949     {
3950       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3951         "ContainsNoImages","`%s'",wand->name);
3952       return((ChannelStatistics *) NULL);
3953     }
3954   return(GetImageStatistics(wand->images,wand->exception));
3955 }
3956 \f
3957 /*
3958 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3959 %                                                                             %
3960 %                                                                             %
3961 %                                                                             %
3962 %   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                     %
3963 %                                                                             %
3964 %                                                                             %
3965 %                                                                             %
3966 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3967 %
3968 %  MagickGetImageColormapColor() returns the color of the specified colormap
3969 %  index.
3970 %
3971 %  The format of the MagickGetImageColormapColor method is:
3972 %
3973 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
3974 %        const size_t index,PixelWand *color)
3975 %
3976 %  A description of each parameter follows:
3977 %
3978 %    o wand: the magick wand.
3979 %
3980 %    o index: the offset into the image colormap.
3981 %
3982 %    o color: Return the colormap color in this wand.
3983 %
3984 */
3985 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
3986   const size_t index,PixelWand *color)
3987 {
3988   assert(wand != (MagickWand *) NULL);
3989   assert(wand->signature == WandSignature);
3990   if (wand->debug != MagickFalse)
3991     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3992   if (wand->images == (Image *) NULL)
3993     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3994   if ((wand->images->colormap == (PixelPacket *) NULL) ||
3995       (index >= wand->images->colors))
3996     {
3997       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3998         "InvalidColormapIndex","`%s'",wand->name);
3999       return(MagickFalse);
4000     }
4001   PixelSetQuantumPacket(color,wand->images->colormap+index);
4002   return(MagickTrue);
4003 }
4004 \f
4005 /*
4006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4007 %                                                                             %
4008 %                                                                             %
4009 %                                                                             %
4010 %   M a g i c k G e t I m a g e C o l o r s                                   %
4011 %                                                                             %
4012 %                                                                             %
4013 %                                                                             %
4014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4015 %
4016 %  MagickGetImageColors() gets the number of unique colors in the image.
4017 %
4018 %  The format of the MagickGetImageColors method is:
4019 %
4020 %      size_t MagickGetImageColors(MagickWand *wand)
4021 %
4022 %  A description of each parameter follows:
4023 %
4024 %    o wand: the magick wand.
4025 %
4026 */
4027 WandExport size_t MagickGetImageColors(MagickWand *wand)
4028 {
4029   assert(wand != (MagickWand *) NULL);
4030   assert(wand->signature == WandSignature);
4031   if (wand->debug != MagickFalse)
4032     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4033   if (wand->images == (Image *) NULL)
4034     {
4035       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4036         "ContainsNoImages","`%s'",wand->name);
4037       return(0);
4038     }
4039   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4040 }
4041 \f
4042 /*
4043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4044 %                                                                             %
4045 %                                                                             %
4046 %                                                                             %
4047 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4048 %                                                                             %
4049 %                                                                             %
4050 %                                                                             %
4051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4052 %
4053 %  MagickGetImageColorspace() gets the image colorspace.
4054 %
4055 %  The format of the MagickGetImageColorspace method is:
4056 %
4057 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4058 %
4059 %  A description of each parameter follows:
4060 %
4061 %    o wand: the magick wand.
4062 %
4063 */
4064 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4065 {
4066   assert(wand != (MagickWand *) NULL);
4067   assert(wand->signature == WandSignature);
4068   if (wand->debug != MagickFalse)
4069     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4070   if (wand->images == (Image *) NULL)
4071     {
4072       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4073         "ContainsNoImages","`%s'",wand->name);
4074       return(UndefinedColorspace);
4075     }
4076   return(wand->images->colorspace);
4077 }
4078 \f
4079 /*
4080 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4081 %                                                                             %
4082 %                                                                             %
4083 %                                                                             %
4084 %   M a g i c k G e t I m a g e C o m p o s e                                 %
4085 %                                                                             %
4086 %                                                                             %
4087 %                                                                             %
4088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4089 %
4090 %  MagickGetImageCompose() returns the composite operator associated with the
4091 %  image.
4092 %
4093 %  The format of the MagickGetImageCompose method is:
4094 %
4095 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4096 %
4097 %  A description of each parameter follows:
4098 %
4099 %    o wand: the magick wand.
4100 %
4101 */
4102 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4103 {
4104   assert(wand != (MagickWand *) NULL);
4105   assert(wand->signature == WandSignature);
4106   if (wand->debug != MagickFalse)
4107     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4108   if (wand->images == (Image *) NULL)
4109     {
4110       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4111         "ContainsNoImages","`%s'",wand->name);
4112       return(UndefinedCompositeOp);
4113     }
4114   return(wand->images->compose);
4115 }
4116 \f
4117 /*
4118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4119 %                                                                             %
4120 %                                                                             %
4121 %                                                                             %
4122 %   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                         %
4123 %                                                                             %
4124 %                                                                             %
4125 %                                                                             %
4126 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4127 %
4128 %  MagickGetImageCompression() gets the image compression.
4129 %
4130 %  The format of the MagickGetImageCompression method is:
4131 %
4132 %      CompressionType MagickGetImageCompression(MagickWand *wand)
4133 %
4134 %  A description of each parameter follows:
4135 %
4136 %    o wand: the magick wand.
4137 %
4138 */
4139 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4140 {
4141   assert(wand != (MagickWand *) NULL);
4142   assert(wand->signature == WandSignature);
4143   if (wand->debug != MagickFalse)
4144     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4145   if (wand->images == (Image *) NULL)
4146     {
4147       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4148         "ContainsNoImages","`%s'",wand->name);
4149       return(UndefinedCompression);
4150     }
4151   return(wand->images->compression);
4152 }
4153 \f
4154 /*
4155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4156 %                                                                             %
4157 %                                                                             %
4158 %                                                                             %
4159 %   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           %
4160 %                                                                             %
4161 %                                                                             %
4162 %                                                                             %
4163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4164 %
4165 %  MagickGetImageCompression() gets the image compression quality.
4166 %
4167 %  The format of the MagickGetImageCompression method is:
4168 %
4169 %      size_t MagickGetImageCompression(MagickWand *wand)
4170 %
4171 %  A description of each parameter follows:
4172 %
4173 %    o wand: the magick wand.
4174 %
4175 */
4176 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4177 {
4178   assert(wand != (MagickWand *) NULL);
4179   assert(wand->signature == WandSignature);
4180   if (wand->debug != MagickFalse)
4181     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4182   if (wand->images == (Image *) NULL)
4183     {
4184       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4185         "ContainsNoImages","`%s'",wand->name);
4186       return(0UL);
4187     }
4188   return(wand->images->quality);
4189 }
4190 \f
4191 /*
4192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4193 %                                                                             %
4194 %                                                                             %
4195 %                                                                             %
4196 %   M a g i c k G e t I m a g e D e l a y                                     %
4197 %                                                                             %
4198 %                                                                             %
4199 %                                                                             %
4200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4201 %
4202 %  MagickGetImageDelay() gets the image delay.
4203 %
4204 %  The format of the MagickGetImageDelay method is:
4205 %
4206 %      size_t MagickGetImageDelay(MagickWand *wand)
4207 %
4208 %  A description of each parameter follows:
4209 %
4210 %    o wand: the magick wand.
4211 %
4212 */
4213 WandExport size_t MagickGetImageDelay(MagickWand *wand)
4214 {
4215   assert(wand != (MagickWand *) NULL);
4216   assert(wand->signature == WandSignature);
4217   if (wand->debug != MagickFalse)
4218     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4219   if (wand->images == (Image *) NULL)
4220     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4221   return(wand->images->delay);
4222 }
4223 \f
4224 /*
4225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4226 %                                                                             %
4227 %                                                                             %
4228 %                                                                             %
4229 %   M a g i c k G e t I m a g e D e p t h                                     %
4230 %                                                                             %
4231 %                                                                             %
4232 %                                                                             %
4233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4234 %
4235 %  MagickGetImageDepth() gets the image depth.
4236 %
4237 %  The format of the MagickGetImageDepth method is:
4238 %
4239 %      size_t MagickGetImageDepth(MagickWand *wand)
4240 %
4241 %  A description of each parameter follows:
4242 %
4243 %    o wand: the magick wand.
4244 %
4245 */
4246 WandExport size_t MagickGetImageDepth(MagickWand *wand)
4247 {
4248   assert(wand != (MagickWand *) NULL);
4249   assert(wand->signature == WandSignature);
4250   if (wand->debug != MagickFalse)
4251     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4252   if (wand->images == (Image *) NULL)
4253     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4254   return(GetImageDepth(wand->images,wand->exception));
4255 }
4256 \f
4257 /*
4258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4259 %                                                                             %
4260 %                                                                             %
4261 %                                                                             %
4262 %   M a g i c k G e t I m a g e D i s p o s e                                 %
4263 %                                                                             %
4264 %                                                                             %
4265 %                                                                             %
4266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4267 %
4268 %  MagickGetImageDispose() gets the image disposal method.
4269 %
4270 %  The format of the MagickGetImageDispose method is:
4271 %
4272 %      DisposeType MagickGetImageDispose(MagickWand *wand)
4273 %
4274 %  A description of each parameter follows:
4275 %
4276 %    o wand: the magick wand.
4277 %
4278 */
4279 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4280 {
4281   assert(wand != (MagickWand *) NULL);
4282   assert(wand->signature == WandSignature);
4283   if (wand->debug != MagickFalse)
4284     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4285   if (wand->images == (Image *) NULL)
4286     {
4287       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4288         "ContainsNoImages","`%s'",wand->name);
4289       return(UndefinedDispose);
4290     }
4291   return((DisposeType) wand->images->dispose);
4292 }
4293 \f
4294 /*
4295 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4296 %                                                                             %
4297 %                                                                             %
4298 %                                                                             %
4299 %   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4300 %                                                                             %
4301 %                                                                             %
4302 %                                                                             %
4303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4304 %
4305 %  MagickGetImageDistortion() compares an image to a reconstructed image and
4306 %  returns the specified distortion metric.
4307 %
4308 %  The format of the MagickGetImageDistortion method is:
4309 %
4310 %      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4311 %        const MagickWand *reference,const MetricType metric,
4312 %        double *distortion)
4313 %
4314 %  A description of each parameter follows:
4315 %
4316 %    o wand: the magick wand.
4317 %
4318 %    o reference: the reference wand.
4319 %
4320 %    o metric: the metric.
4321 %
4322 %    o distortion: the computed distortion between the images.
4323 %
4324 */
4325 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4326   const MagickWand *reference,const MetricType metric,double *distortion)
4327 {
4328   MagickBooleanType
4329     status;
4330
4331   assert(wand != (MagickWand *) NULL);
4332   assert(wand->signature == WandSignature);
4333   if (wand->debug != MagickFalse)
4334     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4335   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4336     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4337   status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4338     &wand->images->exception);
4339   return(status);
4340 }
4341 \f
4342 /*
4343 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4344 %                                                                             %
4345 %                                                                             %
4346 %                                                                             %
4347 %   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                         %
4348 %                                                                             %
4349 %                                                                             %
4350 %                                                                             %
4351 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4352 %
4353 %  MagickGetImageDistortions() compares one or more pixel channels of an
4354 %  image to a reconstructed image and returns the specified distortion metrics.
4355 %
4356 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4357 %
4358 %  The format of the MagickGetImageDistortion method is:
4359 %
4360 %      double *MagickGetImageDistortion(MagickWand *wand,
4361 %        const MagickWand *reference,const MetricType metric)
4362 %
4363 %  A description of each parameter follows:
4364 %
4365 %    o wand: the magick wand.
4366 %
4367 %    o reference: the reference wand.
4368 %
4369 %    o metric: the metric.
4370 %
4371 */
4372 WandExport double *MagickGetImageDistortions(MagickWand *wand,
4373   const MagickWand *reference,const MetricType metric)
4374 {
4375   double
4376     *channel_distortion;
4377
4378   assert(wand != (MagickWand *) NULL);
4379   assert(wand->signature == WandSignature);
4380   if (wand->debug != MagickFalse)
4381     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4382   assert(reference != (MagickWand *) NULL);
4383   assert(reference->signature == WandSignature);
4384   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4385     {
4386       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4387         "ContainsNoImages","`%s'",wand->name);
4388       return((double *) NULL);
4389     }
4390   channel_distortion=GetImageDistortions(wand->images,reference->images,
4391     metric,&wand->images->exception);
4392   return(channel_distortion);
4393 }
4394 \f
4395 /*
4396 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4397 %                                                                             %
4398 %                                                                             %
4399 %                                                                             %
4400 %   M a g i c k G e t I m a g e F i l e n a m e                               %
4401 %                                                                             %
4402 %                                                                             %
4403 %                                                                             %
4404 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4405 %
4406 %  MagickGetImageFilename() returns the filename of a particular image in a
4407 %  sequence.
4408 %
4409 %  The format of the MagickGetImageFilename method is:
4410 %
4411 %      char *MagickGetImageFilename(MagickWand *wand)
4412 %
4413 %  A description of each parameter follows:
4414 %
4415 %    o wand: the magick wand.
4416 %
4417 */
4418 WandExport char *MagickGetImageFilename(MagickWand *wand)
4419 {
4420   assert(wand != (MagickWand *) NULL);
4421   assert(wand->signature == WandSignature);
4422   if (wand->debug != MagickFalse)
4423     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4424   if (wand->images == (Image *) NULL)
4425     {
4426       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4427         "ContainsNoImages","`%s'",wand->name);
4428       return((char *) NULL);
4429     }
4430   return(AcquireString(wand->images->filename));
4431 }
4432 \f
4433 /*
4434 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4435 %                                                                             %
4436 %                                                                             %
4437 %                                                                             %
4438 %   M a g i c k G e t I m a g e F o r m a t                                   %
4439 %                                                                             %
4440 %                                                                             %
4441 %                                                                             %
4442 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4443 %
4444 %  MagickGetImageFormat() returns the format of a particular image in a
4445 %  sequence.
4446 %
4447 %  The format of the MagickGetImageFormat method is:
4448 %
4449 %      const char *MagickGetImageFormat(MagickWand *wand)
4450 %
4451 %  A description of each parameter follows:
4452 %
4453 %    o wand: the magick wand.
4454 %
4455 */
4456 WandExport char *MagickGetImageFormat(MagickWand *wand)
4457 {
4458   assert(wand != (MagickWand *) NULL);
4459   assert(wand->signature == WandSignature);
4460   if (wand->debug != MagickFalse)
4461     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4462   if (wand->images == (Image *) NULL)
4463     {
4464       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4465         "ContainsNoImages","`%s'",wand->name);
4466       return((char *) NULL);
4467     }
4468   return(AcquireString(wand->images->magick));
4469 }
4470 \f
4471 /*
4472 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4473 %                                                                             %
4474 %                                                                             %
4475 %                                                                             %
4476 %   M a g i c k G e t I m a g e F u z z                                       %
4477 %                                                                             %
4478 %                                                                             %
4479 %                                                                             %
4480 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4481 %
4482 %  MagickGetImageFuzz() gets the image fuzz.
4483 %
4484 %  The format of the MagickGetImageFuzz method is:
4485 %
4486 %      double MagickGetImageFuzz(MagickWand *wand)
4487 %
4488 %  A description of each parameter follows:
4489 %
4490 %    o wand: the magick wand.
4491 %
4492 */
4493 WandExport double MagickGetImageFuzz(MagickWand *wand)
4494 {
4495   assert(wand != (MagickWand *) NULL);
4496   assert(wand->signature == WandSignature);
4497   if (wand->debug != MagickFalse)
4498     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4499   if (wand->images == (Image *) NULL)
4500     {
4501       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4502         "ContainsNoImages","`%s'",wand->name);
4503       return(0.0);
4504     }
4505   return(wand->images->fuzz);
4506 }
4507 \f
4508 /*
4509 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4510 %                                                                             %
4511 %                                                                             %
4512 %                                                                             %
4513 %   M a g i c k G e t I m a g e G a m m a                                     %
4514 %                                                                             %
4515 %                                                                             %
4516 %                                                                             %
4517 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4518 %
4519 %  MagickGetImageGamma() gets the image gamma.
4520 %
4521 %  The format of the MagickGetImageGamma method is:
4522 %
4523 %      double MagickGetImageGamma(MagickWand *wand)
4524 %
4525 %  A description of each parameter follows:
4526 %
4527 %    o wand: the magick wand.
4528 %
4529 */
4530 WandExport double MagickGetImageGamma(MagickWand *wand)
4531 {
4532   assert(wand != (MagickWand *) NULL);
4533   assert(wand->signature == WandSignature);
4534   if (wand->debug != MagickFalse)
4535     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4536   if (wand->images == (Image *) NULL)
4537     {
4538       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4539         "ContainsNoImages","`%s'",wand->name);
4540       return(0.0);
4541     }
4542   return(wand->images->gamma);
4543 }
4544 \f
4545 /*
4546 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4547 %                                                                             %
4548 %                                                                             %
4549 %                                                                             %
4550 %   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                 %
4551 %                                                                             %
4552 %                                                                             %
4553 %                                                                             %
4554 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4555 %
4556 %  MagickGetImageGravity() gets the image gravity.
4557 %
4558 %  The format of the MagickGetImageGravity method is:
4559 %
4560 %      GravityType MagickGetImageGravity(MagickWand *wand)
4561 %
4562 %  A description of each parameter follows:
4563 %
4564 %    o wand: the magick wand.
4565 %
4566 */
4567 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
4568 {
4569   assert(wand != (MagickWand *) NULL);
4570   assert(wand->signature == WandSignature);
4571   if (wand->debug != MagickFalse)
4572     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4573   if (wand->images == (Image *) NULL)
4574     {
4575       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4576         "ContainsNoImages","`%s'",wand->name);
4577       return(UndefinedGravity);
4578     }
4579   return(wand->images->gravity);
4580 }
4581 \f
4582 /*
4583 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4584 %                                                                             %
4585 %                                                                             %
4586 %                                                                             %
4587 %   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                       %
4588 %                                                                             %
4589 %                                                                             %
4590 %                                                                             %
4591 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4592 %
4593 %  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
4594 %
4595 %  The format of the MagickGetImageGreenPrimary method is:
4596 %
4597 %      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
4598 %        double *y)
4599 %
4600 %  A description of each parameter follows:
4601 %
4602 %    o wand: the magick wand.
4603 %
4604 %    o x: the chromaticity green primary x-point.
4605 %
4606 %    o y: the chromaticity green primary y-point.
4607 %
4608 */
4609 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
4610   double *x,double *y)
4611 {
4612   assert(wand != (MagickWand *) NULL);
4613   assert(wand->signature == WandSignature);
4614   if (wand->debug != MagickFalse)
4615     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4616   if (wand->images == (Image *) NULL)
4617     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4618   *x=wand->images->chromaticity.green_primary.x;
4619   *y=wand->images->chromaticity.green_primary.y;
4620   return(MagickTrue);
4621 }
4622 \f
4623 /*
4624 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4625 %                                                                             %
4626 %                                                                             %
4627 %                                                                             %
4628 %   M a g i c k G e t I m a g e H e i g h t                                   %
4629 %                                                                             %
4630 %                                                                             %
4631 %                                                                             %
4632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4633 %
4634 %  MagickGetImageHeight() returns the image height.
4635 %
4636 %  The format of the MagickGetImageHeight method is:
4637 %
4638 %      size_t MagickGetImageHeight(MagickWand *wand)
4639 %
4640 %  A description of each parameter follows:
4641 %
4642 %    o wand: the magick wand.
4643 %
4644 */
4645 WandExport size_t MagickGetImageHeight(MagickWand *wand)
4646 {
4647   assert(wand != (MagickWand *) NULL);
4648   assert(wand->signature == WandSignature);
4649   if (wand->debug != MagickFalse)
4650     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4651   if (wand->images == (Image *) NULL)
4652     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4653   return(wand->images->rows);
4654 }
4655 \f
4656 /*
4657 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4658 %                                                                             %
4659 %                                                                             %
4660 %                                                                             %
4661 %   M a g i c k G e t I m a g e H i s t o g r a m                             %
4662 %                                                                             %
4663 %                                                                             %
4664 %                                                                             %
4665 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4666 %
4667 %  MagickGetImageHistogram() returns the image histogram as an array of
4668 %  PixelWand wands.
4669 %
4670 %  The format of the MagickGetImageHistogram method is:
4671 %
4672 %      PixelWand **MagickGetImageHistogram(MagickWand *wand,
4673 %        size_t *number_colors)
4674 %
4675 %  A description of each parameter follows:
4676 %
4677 %    o wand: the magick wand.
4678 %
4679 %    o number_colors: the number of unique colors in the image and the number
4680 %      of pixel wands returned.
4681 %
4682 */
4683 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
4684   size_t *number_colors)
4685 {
4686   PixelPacket
4687     *histogram;
4688
4689   PixelWand
4690     **pixel_wands;
4691
4692   register ssize_t
4693     i;
4694
4695   assert(wand != (MagickWand *) NULL);
4696   assert(wand->signature == WandSignature);
4697   if (wand->debug != MagickFalse)
4698     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4699   if (wand->images == (Image *) NULL)
4700     {
4701       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4702         "ContainsNoImages","`%s'",wand->name);
4703       return((PixelWand **) NULL);
4704     }
4705   histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
4706   if (histogram == (PixelPacket *) NULL)
4707     return((PixelWand **) NULL);
4708   pixel_wands=NewPixelWands(*number_colors);
4709   for (i=0; i < (ssize_t) *number_colors; i++)
4710   {
4711     PixelSetQuantumPacket(pixel_wands[i],&histogram[i]);
4712     PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
4713   }
4714   histogram=(PixelPacket *) RelinquishMagickMemory(histogram);
4715   return(pixel_wands);
4716 }
4717 \f
4718 /*
4719 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4720 %                                                                             %
4721 %                                                                             %
4722 %                                                                             %
4723 %   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                 %
4724 %                                                                             %
4725 %                                                                             %
4726 %                                                                             %
4727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4728 %
4729 %  MagickGetImageInterlaceScheme() gets the image interlace scheme.
4730 %
4731 %  The format of the MagickGetImageInterlaceScheme method is:
4732 %
4733 %      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4734 %
4735 %  A description of each parameter follows:
4736 %
4737 %    o wand: the magick wand.
4738 %
4739 */
4740 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
4741 {
4742   assert(wand != (MagickWand *) NULL);
4743   assert(wand->signature == WandSignature);
4744   if (wand->debug != MagickFalse)
4745     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4746   if (wand->images == (Image *) NULL)
4747     {
4748       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4749         "ContainsNoImages","`%s'",wand->name);
4750       return(UndefinedInterlace);
4751     }
4752   return(wand->images->interlace);
4753 }
4754 \f
4755 /*
4756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4757 %                                                                             %
4758 %                                                                             %
4759 %                                                                             %
4760 %   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             %
4761 %                                                                             %
4762 %                                                                             %
4763 %                                                                             %
4764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4765 %
4766 %  MagickGetImageInterpolateMethod() returns the interpolation method for the
4767 %  sepcified image.
4768 %
4769 %  The format of the MagickGetImageInterpolateMethod method is:
4770 %
4771 %      PixelInterpolateMethod MagickGetImagePixelInterpolateMethod(
4772 %        MagickWand *wand)
4773 %
4774 %  A description of each parameter follows:
4775 %
4776 %    o wand: the magick wand.
4777 %
4778 */
4779 WandExport PixelInterpolateMethod MagickGetImageInterpolateMethod(
4780   MagickWand *wand)
4781 {
4782   assert(wand != (MagickWand *) NULL);
4783   assert(wand->signature == WandSignature);
4784   if (wand->debug != MagickFalse)
4785     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4786   if (wand->images == (Image *) NULL)
4787     {
4788       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4789         "ContainsNoImages","`%s'",wand->name);
4790       return(UndefinedInterpolatePixel);
4791     }
4792   return(wand->images->interpolate);
4793 }
4794 \f
4795 /*
4796 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4797 %                                                                             %
4798 %                                                                             %
4799 %                                                                             %
4800 %   M a g i c k G e t I m a g e I t e r a t i o n s                           %
4801 %                                                                             %
4802 %                                                                             %
4803 %                                                                             %
4804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4805 %
4806 %  MagickGetImageIterations() gets the image iterations.
4807 %
4808 %  The format of the MagickGetImageIterations method is:
4809 %
4810 %      size_t MagickGetImageIterations(MagickWand *wand)
4811 %
4812 %  A description of each parameter follows:
4813 %
4814 %    o wand: the magick wand.
4815 %
4816 */
4817 WandExport size_t MagickGetImageIterations(MagickWand *wand)
4818 {
4819   assert(wand != (MagickWand *) NULL);
4820   assert(wand->signature == WandSignature);
4821   if (wand->debug != MagickFalse)
4822     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4823   if (wand->images == (Image *) NULL)
4824     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4825   return(wand->images->iterations);
4826 }
4827 \f
4828 /*
4829 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4830 %                                                                             %
4831 %                                                                             %
4832 %                                                                             %
4833 %   M a g i c k G e t I m a g e L e n g t h                                   %
4834 %                                                                             %
4835 %                                                                             %
4836 %                                                                             %
4837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4838 %
4839 %  MagickGetImageLength() returns the image length in bytes.
4840 %
4841 %  The format of the MagickGetImageLength method is:
4842 %
4843 %      MagickBooleanType MagickGetImageLength(MagickWand *wand,
4844 %        MagickSizeType *length)
4845 %
4846 %  A description of each parameter follows:
4847 %
4848 %    o wand: the magick wand.
4849 %
4850 %    o length: the image length in bytes.
4851 %
4852 */
4853 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
4854   MagickSizeType *length)
4855 {
4856   assert(wand != (MagickWand *) NULL);
4857   assert(wand->signature == WandSignature);
4858   if (wand->debug != MagickFalse)
4859     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4860   if (wand->images == (Image *) NULL)
4861     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4862   *length=GetBlobSize(wand->images);
4863   return(MagickTrue);
4864 }
4865 \f
4866 /*
4867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4868 %                                                                             %
4869 %                                                                             %
4870 %                                                                             %
4871 %   M a g i c k G e t I m a g e M a t t e C o l o r                           %
4872 %                                                                             %
4873 %                                                                             %
4874 %                                                                             %
4875 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4876 %
4877 %  MagickGetImageMatteColor() returns the image matte color.
4878 %
4879 %  The format of the MagickGetImageMatteColor method is:
4880 %
4881 %      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
4882 %        PixelWand *matte_color)
4883 %
4884 %  A description of each parameter follows:
4885 %
4886 %    o wand: the magick wand.
4887 %
4888 %    o matte_color: Return the matte color.
4889 %
4890 */
4891 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
4892   PixelWand *matte_color)
4893 {
4894   assert(wand != (MagickWand *) NULL);
4895   assert(wand->signature == WandSignature);
4896   if (wand->debug != MagickFalse)
4897     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4898   if (wand->images == (Image *) NULL)
4899     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4900   PixelSetQuantumPacket(matte_color,&wand->images->matte_color);
4901   return(MagickTrue);
4902 }
4903 \f
4904 /*
4905 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4906 %                                                                             %
4907 %                                                                             %
4908 %                                                                             %
4909 %   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                         %
4910 %                                                                             %
4911 %                                                                             %
4912 %                                                                             %
4913 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4914 %
4915 %  MagickGetImageOrientation() returns the image orientation.
4916 %
4917 %  The format of the MagickGetImageOrientation method is:
4918 %
4919 %      OrientationType MagickGetImageOrientation(MagickWand *wand)
4920 %
4921 %  A description of each parameter follows:
4922 %
4923 %    o wand: the magick wand.
4924 %
4925 */
4926 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
4927 {
4928   assert(wand != (MagickWand *) NULL);
4929   assert(wand->signature == WandSignature);
4930   if (wand->debug != MagickFalse)
4931     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4932   if (wand->images == (Image *) NULL)
4933     {
4934       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4935         "ContainsNoImages","`%s'",wand->name);
4936       return(UndefinedOrientation);
4937     }
4938   return(wand->images->orientation);
4939 }
4940 \f
4941 /*
4942 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4943 %                                                                             %
4944 %                                                                             %
4945 %                                                                             %
4946 %   M a g i c k G e t I m a g e P a g e                                       %
4947 %                                                                             %
4948 %                                                                             %
4949 %                                                                             %
4950 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4951 %
4952 %  MagickGetImagePage() returns the page geometry associated with the image.
4953 %
4954 %  The format of the MagickGetImagePage method is:
4955 %
4956 %      MagickBooleanType MagickGetImagePage(MagickWand *wand,
4957 %        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4958 %
4959 %  A description of each parameter follows:
4960 %
4961 %    o wand: the magick wand.
4962 %
4963 %    o width: the page width.
4964 %
4965 %    o height: the page height.
4966 %
4967 %    o x: the page x-offset.
4968 %
4969 %    o y: the page y-offset.
4970 %
4971 */
4972 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
4973   size_t *width,size_t *height,ssize_t *x,ssize_t *y)
4974 {
4975   assert(wand != (const MagickWand *) NULL);
4976   assert(wand->signature == WandSignature);
4977   if (wand->debug != MagickFalse)
4978     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4979   if (wand->images == (Image *) NULL)
4980     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4981   *width=wand->images->page.width;
4982   *height=wand->images->page.height;
4983   *x=wand->images->page.x;
4984   *y=wand->images->page.y;
4985   return(MagickTrue);
4986 }
4987 \f
4988 /*
4989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4990 %                                                                             %
4991 %                                                                             %
4992 %                                                                             %
4993 %   M a g i c k G e t I m a g e P i x e l C o l o r                           %
4994 %                                                                             %
4995 %                                                                             %
4996 %                                                                             %
4997 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4998 %
4999 %  MagickGetImagePixelColor() returns the color of the specified pixel.
5000 %
5001 %  The format of the MagickGetImagePixelColor method is:
5002 %
5003 %      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5004 %        const ssize_t x,const ssize_t y,PixelWand *color)
5005 %
5006 %  A description of each parameter follows:
5007 %
5008 %    o wand: the magick wand.
5009 %
5010 %    o x,y: the pixel offset into the image.
5011 %
5012 %    o color: Return the colormap color in this wand.
5013 %
5014 */
5015 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5016   const ssize_t x,const ssize_t y,PixelWand *color)
5017 {
5018   register const Quantum
5019     *p;
5020
5021   CacheView
5022     *image_view;
5023
5024   assert(wand != (MagickWand *) NULL);
5025   assert(wand->signature == WandSignature);
5026   if (wand->debug != MagickFalse)
5027     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5028   if (wand->images == (Image *) NULL)
5029     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5030   image_view=AcquireCacheView(wand->images);
5031   p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5032   if (p == (const Quantum *) NULL)
5033     {
5034       image_view=DestroyCacheView(image_view);
5035       return(MagickFalse);
5036     }
5037   PixelSetQuantumPixel(wand->images,p,color);
5038   image_view=DestroyCacheView(image_view);
5039   return(MagickTrue);
5040 }
5041 \f
5042 /*
5043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5044 %                                                                             %
5045 %                                                                             %
5046 %                                                                             %
5047 %   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5048 %                                                                             %
5049 %                                                                             %
5050 %                                                                             %
5051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5052 %
5053 %  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5054 %
5055 %  The format of the MagickGetImageRedPrimary method is:
5056 %
5057 %      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5058 %        double *y)
5059 %
5060 %  A description of each parameter follows:
5061 %
5062 %    o wand: the magick wand.
5063 %
5064 %    o x: the chromaticity red primary x-point.
5065 %
5066 %    o y: the chromaticity red primary y-point.
5067 %
5068 */
5069 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5070   double *x,double *y)
5071 {
5072   assert(wand != (MagickWand *) NULL);
5073   assert(wand->signature == WandSignature);
5074   if (wand->debug != MagickFalse)
5075     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5076   if (wand->images == (Image *) NULL)
5077     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5078   *x=wand->images->chromaticity.red_primary.x;
5079   *y=wand->images->chromaticity.red_primary.y;
5080   return(MagickTrue);
5081 }
5082 \f
5083 /*
5084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5085 %                                                                             %
5086 %                                                                             %
5087 %                                                                             %
5088 %   M a g i c k G e t I m a g e R e g i o n                                   %
5089 %                                                                             %
5090 %                                                                             %
5091 %                                                                             %
5092 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5093 %
5094 %  MagickGetImageRegion() extracts a region of the image and returns it as a
5095 %  a new wand.
5096 %
5097 %  The format of the MagickGetImageRegion method is:
5098 %
5099 %      MagickWand *MagickGetImageRegion(MagickWand *wand,
5100 %        const size_t width,const size_t height,const ssize_t x,
5101 %        const ssize_t y)
5102 %
5103 %  A description of each parameter follows:
5104 %
5105 %    o wand: the magick wand.
5106 %
5107 %    o width: the region width.
5108 %
5109 %    o height: the region height.
5110 %
5111 %    o x: the region x offset.
5112 %
5113 %    o y: the region y offset.
5114 %
5115 */
5116 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5117   const size_t width,const size_t height,const ssize_t x,
5118   const ssize_t y)
5119 {
5120   Image
5121     *region_image;
5122
5123   RectangleInfo
5124     region;
5125
5126   assert(wand != (MagickWand *) NULL);
5127   assert(wand->signature == WandSignature);
5128   if (wand->debug != MagickFalse)
5129     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5130   if (wand->images == (Image *) NULL)
5131     return((MagickWand *) NULL);
5132   region.width=width;
5133   region.height=height;
5134   region.x=x;
5135   region.y=y;
5136   region_image=CropImage(wand->images,&region,wand->exception);
5137   if (region_image == (Image *) NULL)
5138     return((MagickWand *) NULL);
5139   return(CloneMagickWandFromImages(wand,region_image));
5140 }
5141 \f
5142 /*
5143 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5144 %                                                                             %
5145 %                                                                             %
5146 %                                                                             %
5147 %   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                 %
5148 %                                                                             %
5149 %                                                                             %
5150 %                                                                             %
5151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5152 %
5153 %  MagickGetImageRenderingIntent() gets the image rendering intent.
5154 %
5155 %  The format of the MagickGetImageRenderingIntent method is:
5156 %
5157 %      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5158 %
5159 %  A description of each parameter follows:
5160 %
5161 %    o wand: the magick wand.
5162 %
5163 */
5164 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5165 {
5166   assert(wand != (MagickWand *) NULL);
5167   assert(wand->signature == WandSignature);
5168   if (wand->debug != MagickFalse)
5169     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5170   if (wand->images == (Image *) NULL)
5171     {
5172       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5173         "ContainsNoImages","`%s'",wand->name);
5174       return(UndefinedIntent);
5175     }
5176   return((RenderingIntent) wand->images->rendering_intent);
5177 }
5178 \f
5179 /*
5180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5181 %                                                                             %
5182 %                                                                             %
5183 %                                                                             %
5184 %   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5185 %                                                                             %
5186 %                                                                             %
5187 %                                                                             %
5188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5189 %
5190 %  MagickGetImageResolution() gets the image X and Y resolution.
5191 %
5192 %  The format of the MagickGetImageResolution method is:
5193 %
5194 %      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5195 %        double *y)
5196 %
5197 %  A description of each parameter follows:
5198 %
5199 %    o wand: the magick wand.
5200 %
5201 %    o x: the image x-resolution.
5202 %
5203 %    o y: the image y-resolution.
5204 %
5205 */
5206 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5207   double *x,double *y)
5208 {
5209   assert(wand != (MagickWand *) NULL);
5210   assert(wand->signature == WandSignature);
5211   if (wand->debug != MagickFalse)
5212     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5213   if (wand->images == (Image *) NULL)
5214     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5215   *x=wand->images->x_resolution;
5216   *y=wand->images->y_resolution;
5217   return(MagickTrue);
5218 }
5219 \f
5220 /*
5221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5222 %                                                                             %
5223 %                                                                             %
5224 %                                                                             %
5225 %   M a g i c k G e t I m a g e S c e n e                                     %
5226 %                                                                             %
5227 %                                                                             %
5228 %                                                                             %
5229 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5230 %
5231 %  MagickGetImageScene() gets the image scene.
5232 %
5233 %  The format of the MagickGetImageScene method is:
5234 %
5235 %      size_t MagickGetImageScene(MagickWand *wand)
5236 %
5237 %  A description of each parameter follows:
5238 %
5239 %    o wand: the magick wand.
5240 %
5241 */
5242 WandExport size_t MagickGetImageScene(MagickWand *wand)
5243 {
5244   assert(wand != (MagickWand *) NULL);
5245   assert(wand->signature == WandSignature);
5246   if (wand->debug != MagickFalse)
5247     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5248   if (wand->images == (Image *) NULL)
5249     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5250   return(wand->images->scene);
5251 }
5252 \f
5253 /*
5254 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5255 %                                                                             %
5256 %                                                                             %
5257 %                                                                             %
5258 %   M a g i c k G e t I m a g e S i g n a t u r e                             %
5259 %                                                                             %
5260 %                                                                             %
5261 %                                                                             %
5262 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5263 %
5264 %  MagickGetImageSignature() generates an SHA-256 message digest for the image
5265 %  pixel stream.
5266 %
5267 %  The format of the MagickGetImageSignature method is:
5268 %
5269 %      const char MagickGetImageSignature(MagickWand *wand)
5270 %
5271 %  A description of each parameter follows:
5272 %
5273 %    o wand: the magick wand.
5274 %
5275 */
5276 WandExport char *MagickGetImageSignature(MagickWand *wand)
5277 {
5278   const char
5279     *value;
5280
5281   MagickBooleanType
5282     status;
5283
5284   assert(wand != (MagickWand *) NULL);
5285   assert(wand->signature == WandSignature);
5286   if (wand->debug != MagickFalse)
5287     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5288   if (wand->images == (Image *) NULL)
5289     {
5290       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5291         "ContainsNoImages","`%s'",wand->name);
5292       return((char *) NULL);
5293     }
5294   status=SignatureImage(wand->images,wand->exception);
5295   if (status == MagickFalse)
5296     return((char *) NULL);
5297   value=GetImageProperty(wand->images,"signature");
5298   if (value == (const char *) NULL)
5299     return((char *) NULL);
5300   return(AcquireString(value));
5301 }
5302 \f
5303 /*
5304 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5305 %                                                                             %
5306 %                                                                             %
5307 %                                                                             %
5308 %   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                   %
5309 %                                                                             %
5310 %                                                                             %
5311 %                                                                             %
5312 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5313 %
5314 %  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5315 %
5316 %  The format of the MagickGetImageTicksPerSecond method is:
5317 %
5318 %      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5319 %
5320 %  A description of each parameter follows:
5321 %
5322 %    o wand: the magick wand.
5323 %
5324 */
5325 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5326 {
5327   assert(wand != (MagickWand *) NULL);
5328   assert(wand->signature == WandSignature);
5329   if (wand->debug != MagickFalse)
5330     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5331   if (wand->images == (Image *) NULL)
5332     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5333   return((size_t) wand->images->ticks_per_second);
5334 }
5335 \f
5336 /*
5337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5338 %                                                                             %
5339 %                                                                             %
5340 %                                                                             %
5341 %   M a g i c k G e t I m a g e T y p e                                       %
5342 %                                                                             %
5343 %                                                                             %
5344 %                                                                             %
5345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5346 %
5347 %  MagickGetImageType() gets the potential image type:
5348 %
5349 %        Bilevel        Grayscale       GrayscaleMatte
5350 %        Palette        PaletteMatte    TrueColor
5351 %        TrueColorMatte ColorSeparation ColorSeparationMatte
5352 %
5353 %  To ensure the image type matches its potential, use MagickSetImageType():
5354 %
5355 %    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5356 %
5357 %  The format of the MagickGetImageType method is:
5358 %
5359 %      ImageType MagickGetImageType(MagickWand *wand)
5360 %
5361 %  A description of each parameter follows:
5362 %
5363 %    o wand: the magick wand.
5364 %
5365 */
5366 WandExport ImageType MagickGetImageType(MagickWand *wand)
5367 {
5368   assert(wand != (MagickWand *) NULL);
5369   assert(wand->signature == WandSignature);
5370   if (wand->debug != MagickFalse)
5371     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5372   if (wand->images == (Image *) NULL)
5373     {
5374       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5375         "ContainsNoImages","`%s'",wand->name);
5376       return(UndefinedType);
5377     }
5378   return(GetImageType(wand->images,wand->exception));
5379 }
5380 \f
5381 /*
5382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5383 %                                                                             %
5384 %                                                                             %
5385 %                                                                             %
5386 %   M a g i c k G e t I m a g e U n i t s                                     %
5387 %                                                                             %
5388 %                                                                             %
5389 %                                                                             %
5390 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5391 %
5392 %  MagickGetImageUnits() gets the image units of resolution.
5393 %
5394 %  The format of the MagickGetImageUnits method is:
5395 %
5396 %      ResolutionType MagickGetImageUnits(MagickWand *wand)
5397 %
5398 %  A description of each parameter follows:
5399 %
5400 %    o wand: the magick wand.
5401 %
5402 */
5403 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5404 {
5405   assert(wand != (MagickWand *) NULL);
5406   assert(wand->signature == WandSignature);
5407   if (wand->debug != MagickFalse)
5408     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5409   if (wand->images == (Image *) NULL)
5410     {
5411       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5412         "ContainsNoImages","`%s'",wand->name);
5413       return(UndefinedResolution);
5414     }
5415   return(wand->images->units);
5416 }
5417 \f
5418 /*
5419 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5420 %                                                                             %
5421 %                                                                             %
5422 %                                                                             %
5423 %   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           %
5424 %                                                                             %
5425 %                                                                             %
5426 %                                                                             %
5427 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5428 %
5429 %  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
5430 %  sepcified image.
5431 %
5432 %  The format of the MagickGetImageVirtualPixelMethod method is:
5433 %
5434 %      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5435 %
5436 %  A description of each parameter follows:
5437 %
5438 %    o wand: the magick wand.
5439 %
5440 */
5441 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
5442 {
5443   assert(wand != (MagickWand *) NULL);
5444   assert(wand->signature == WandSignature);
5445   if (wand->debug != MagickFalse)
5446     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5447   if (wand->images == (Image *) NULL)
5448     {
5449       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5450         "ContainsNoImages","`%s'",wand->name);
5451       return(UndefinedVirtualPixelMethod);
5452     }
5453   return(GetImageVirtualPixelMethod(wand->images));
5454 }
5455 \f
5456 /*
5457 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5458 %                                                                             %
5459 %                                                                             %
5460 %                                                                             %
5461 %   M a g i c k G e t I m a g e W h i t e P o i n t                           %
5462 %                                                                             %
5463 %                                                                             %
5464 %                                                                             %
5465 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5466 %
5467 %  MagickGetImageWhitePoint() returns the chromaticy white point.
5468 %
5469 %  The format of the MagickGetImageWhitePoint method is:
5470 %
5471 %      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
5472 %        double *y)
5473 %
5474 %  A description of each parameter follows:
5475 %
5476 %    o wand: the magick wand.
5477 %
5478 %    o x: the chromaticity white x-point.
5479 %
5480 %    o y: the chromaticity white y-point.
5481 %
5482 */
5483 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
5484   double *x,double *y)
5485 {
5486   assert(wand != (MagickWand *) NULL);
5487   assert(wand->signature == WandSignature);
5488   if (wand->debug != MagickFalse)
5489     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5490   if (wand->images == (Image *) NULL)
5491     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5492   *x=wand->images->chromaticity.white_point.x;
5493   *y=wand->images->chromaticity.white_point.y;
5494   return(MagickTrue);
5495 }
5496 \f
5497 /*
5498 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5499 %                                                                             %
5500 %                                                                             %
5501 %                                                                             %
5502 %   M a g i c k G e t I m a g e W i d t h                                     %
5503 %                                                                             %
5504 %                                                                             %
5505 %                                                                             %
5506 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5507 %
5508 %  MagickGetImageWidth() returns the image width.
5509 %
5510 %  The format of the MagickGetImageWidth method is:
5511 %
5512 %      size_t MagickGetImageWidth(MagickWand *wand)
5513 %
5514 %  A description of each parameter follows:
5515 %
5516 %    o wand: the magick wand.
5517 %
5518 */
5519 WandExport size_t MagickGetImageWidth(MagickWand *wand)
5520 {
5521   assert(wand != (MagickWand *) NULL);
5522   assert(wand->signature == WandSignature);
5523   if (wand->debug != MagickFalse)
5524     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5525   if (wand->images == (Image *) NULL)
5526     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5527   return(wand->images->columns);
5528 }
5529 \f
5530 /*
5531 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5532 %                                                                             %
5533 %                                                                             %
5534 %                                                                             %
5535 %   M a g i c k G e t N u m b e r I m a g e s                                 %
5536 %                                                                             %
5537 %                                                                             %
5538 %                                                                             %
5539 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5540 %
5541 %  MagickGetNumberImages() returns the number of images associated with a
5542 %  magick wand.
5543 %
5544 %  The format of the MagickGetNumberImages method is:
5545 %
5546 %      size_t MagickGetNumberImages(MagickWand *wand)
5547 %
5548 %  A description of each parameter follows:
5549 %
5550 %    o wand: the magick wand.
5551 %
5552 */
5553 WandExport size_t MagickGetNumberImages(MagickWand *wand)
5554 {
5555   assert(wand != (MagickWand *) NULL);
5556   assert(wand->signature == WandSignature);
5557   if (wand->debug != MagickFalse)
5558     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5559   return(GetImageListLength(wand->images));
5560 }
5561 \f
5562 /*
5563 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5564 %                                                                             %
5565 %                                                                             %
5566 %                                                                             %
5567 %   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                 %
5568 %                                                                             %
5569 %                                                                             %
5570 %                                                                             %
5571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5572 %
5573 %  MagickGetImageTotalInkDensity() gets the image total ink density.
5574 %
5575 %  The format of the MagickGetImageTotalInkDensity method is:
5576 %
5577 %      double MagickGetImageTotalInkDensity(MagickWand *wand)
5578 %
5579 %  A description of each parameter follows:
5580 %
5581 %    o wand: the magick wand.
5582 %
5583 */
5584 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
5585 {
5586   assert(wand != (MagickWand *) NULL);
5587   assert(wand->signature == WandSignature);
5588   if (wand->debug != MagickFalse)
5589     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5590   if (wand->images == (Image *) NULL)
5591     {
5592       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5593         "ContainsNoImages","`%s'",wand->name);
5594       return(0.0);
5595     }
5596   return(GetImageTotalInkDensity(wand->images));
5597 }
5598 \f
5599 /*
5600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5601 %                                                                             %
5602 %                                                                             %
5603 %                                                                             %
5604 %   M a g i c k H a l d C l u t I m a g e                                     %
5605 %                                                                             %
5606 %                                                                             %
5607 %                                                                             %
5608 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5609 %
5610 %  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
5611 %  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
5612 %  dimensions.  Create it with the HALD coder.  You can apply any color
5613 %  transformation to the Hald image and then use this method to apply the
5614 %  transform to the image.
5615 %
5616 %  The format of the MagickHaldClutImage method is:
5617 %
5618 %      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5619 %        const MagickWand *hald_wand)
5620 %
5621 %  A description of each parameter follows:
5622 %
5623 %    o wand: the magick wand.
5624 %
5625 %    o hald_image: the hald CLUT image.
5626 %
5627 */
5628 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
5629   const MagickWand *hald_wand)
5630 {
5631   MagickBooleanType
5632     status;
5633
5634   assert(wand != (MagickWand *) NULL);
5635   assert(wand->signature == WandSignature);
5636   if (wand->debug != MagickFalse)
5637     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5638   if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
5639     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5640   status=HaldClutImage(wand->images,hald_wand->images,&wand->images->exception);
5641   return(status);
5642 }
5643 \f
5644 /*
5645 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5646 %                                                                             %
5647 %                                                                             %
5648 %                                                                             %
5649 %   M a g i c k H a s N e x t I m a g e                                       %
5650 %                                                                             %
5651 %                                                                             %
5652 %                                                                             %
5653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5654 %
5655 %  MagickHasNextImage() returns MagickTrue if the wand has more images when
5656 %  traversing the list in the forward direction
5657 %
5658 %  The format of the MagickHasNextImage method is:
5659 %
5660 %      MagickBooleanType MagickHasNextImage(MagickWand *wand)
5661 %
5662 %  A description of each parameter follows:
5663 %
5664 %    o wand: the magick wand.
5665 %
5666 */
5667 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
5668 {
5669   assert(wand != (MagickWand *) NULL);
5670   assert(wand->signature == WandSignature);
5671   if (wand->debug != MagickFalse)
5672     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5673   if (wand->images == (Image *) NULL)
5674     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5675   if (GetNextImageInList(wand->images) == (Image *) NULL)
5676     return(MagickFalse);
5677   return(MagickTrue);
5678 }
5679 \f
5680 /*
5681 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5682 %                                                                             %
5683 %                                                                             %
5684 %                                                                             %
5685 %   M a g i c k H a s P r e v i o u s I m a g e                               %
5686 %                                                                             %
5687 %                                                                             %
5688 %                                                                             %
5689 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5690 %
5691 %  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
5692 %  traversing the list in the reverse direction
5693 %
5694 %  The format of the MagickHasPreviousImage method is:
5695 %
5696 %      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5697 %
5698 %  A description of each parameter follows:
5699 %
5700 %    o wand: the magick wand.
5701 %
5702 */
5703 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
5704 {
5705   assert(wand != (MagickWand *) NULL);
5706   assert(wand->signature == WandSignature);
5707   if (wand->debug != MagickFalse)
5708     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5709   if (wand->images == (Image *) NULL)
5710     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5711   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
5712     return(MagickFalse);
5713   return(MagickTrue);
5714 }
5715 \f
5716 /*
5717 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5718 %                                                                             %
5719 %                                                                             %
5720 %                                                                             %
5721 %   M a g i c k I d e n t i f y I m a g e                                     %
5722 %                                                                             %
5723 %                                                                             %
5724 %                                                                             %
5725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5726 %
5727 %  MagickIdentifyImage() identifies an image by printing its attributes to the
5728 %  file.  Attributes include the image width, height, size, and others.
5729 %
5730 %  The format of the MagickIdentifyImage method is:
5731 %
5732 %      const char *MagickIdentifyImage(MagickWand *wand)
5733 %
5734 %  A description of each parameter follows:
5735 %
5736 %    o wand: the magick wand.
5737 %
5738 */
5739 WandExport char *MagickIdentifyImage(MagickWand *wand)
5740 {
5741   char
5742     *description,
5743     filename[MaxTextExtent];
5744
5745   FILE
5746     *file;
5747
5748   int
5749     unique_file;
5750
5751   assert(wand != (MagickWand *) NULL);
5752   assert(wand->signature == WandSignature);
5753   if (wand->debug != MagickFalse)
5754     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5755   if (wand->images == (Image *) NULL)
5756     {
5757       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5758         "ContainsNoImages","`%s'",wand->name);
5759       return((char *) NULL);
5760     }
5761   description=(char *) NULL;
5762   unique_file=AcquireUniqueFileResource(filename);
5763   file=(FILE *) NULL;
5764   if (unique_file != -1)
5765     file=fdopen(unique_file,"wb");
5766   if ((unique_file == -1) || (file == (FILE *) NULL))
5767     {
5768       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5769         "UnableToCreateTemporaryFile","`%s'",wand->name);
5770       return((char *) NULL);
5771     }
5772   (void) IdentifyImage(wand->images,file,MagickTrue,wand->exception);
5773   (void) fclose(file);
5774   description=FileToString(filename,~0,wand->exception);
5775   (void) RelinquishUniqueFileResource(filename);
5776   return(description);
5777 }
5778 \f
5779 /*
5780 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5781 %                                                                             %
5782 %                                                                             %
5783 %                                                                             %
5784 %   M a g i c k I m p l o d e I m a g e                                       %
5785 %                                                                             %
5786 %                                                                             %
5787 %                                                                             %
5788 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5789 %
5790 %  MagickImplodeImage() creates a new image that is a copy of an existing
5791 %  one with the image pixels "implode" by the specified percentage.  It
5792 %  allocates the memory necessary for the new Image structure and returns a
5793 %  pointer to the new image.
5794 %
5795 %  The format of the MagickImplodeImage method is:
5796 %
5797 %      MagickBooleanType MagickImplodeImage(MagickWand *wand,
5798 %        const double radius,const PixelInterpolateMethod method)
5799 %
5800 %  A description of each parameter follows:
5801 %
5802 %    o wand: the magick wand.
5803 %
5804 %    o amount: Define the extent of the implosion.
5805 %
5806 %    o method: the pixel interpolation method.
5807 %
5808 */
5809 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
5810   const double amount,const PixelInterpolateMethod method)
5811 {
5812   Image
5813     *implode_image;
5814
5815   assert(wand != (MagickWand *) NULL);
5816   assert(wand->signature == WandSignature);
5817   if (wand->debug != MagickFalse)
5818     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5819   if (wand->images == (Image *) NULL)
5820     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5821   implode_image=ImplodeImage(wand->images,amount,method,wand->exception);
5822   if (implode_image == (Image *) NULL)
5823     return(MagickFalse);
5824   ReplaceImageInList(&wand->images,implode_image);
5825   return(MagickTrue);
5826 }
5827 \f
5828 /*
5829 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5830 %                                                                             %
5831 %                                                                             %
5832 %                                                                             %
5833 %   M a g i c k I m p o r t I m a g e P i x e l s                             %
5834 %                                                                             %
5835 %                                                                             %
5836 %                                                                             %
5837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5838 %
5839 %  MagickImportImagePixels() accepts pixel datand stores it in the image at the
5840 %  location you specify.  The method returns MagickFalse on success otherwise
5841 %  MagickTrue if an error is encountered.  The pixel data can be either char,
5842 %  short int, int, ssize_t, float, or double in the order specified by map.
5843 %
5844 %  Suppose your want to upload the first scanline of a 640x480 image from
5845 %  character data in red-green-blue order:
5846 %
5847 %      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
5848 %
5849 %  The format of the MagickImportImagePixels method is:
5850 %
5851 %      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5852 %        const ssize_t x,const ssize_t y,const size_t columns,
5853 %        const size_t rows,const char *map,const StorageType storage,
5854 %        const void *pixels)
5855 %
5856 %  A description of each parameter follows:
5857 %
5858 %    o wand: the magick wand.
5859 %
5860 %    o x, y, columns, rows:  These values define the perimeter of a region
5861 %      of pixels you want to define.
5862 %
5863 %    o map:  This string reflects the expected ordering of the pixel array.
5864 %      It can be any combination or order of R = red, G = green, B = blue,
5865 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
5866 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
5867 %      P = pad.
5868 %
5869 %    o storage: Define the data type of the pixels.  Float and double types are
5870 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
5871 %      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
5872 %      or DoublePixel.
5873 %
5874 %    o pixels: This array of values contain the pixel components as defined by
5875 %      map and type.  You must preallocate this array where the expected
5876 %      length varies depending on the values of width, height, map, and type.
5877 %
5878 */
5879 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
5880   const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
5881   const char *map,const StorageType storage,const void *pixels)
5882 {
5883   MagickBooleanType
5884     status;
5885
5886   assert(wand != (MagickWand *) NULL);
5887   assert(wand->signature == WandSignature);
5888   if (wand->debug != MagickFalse)
5889     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5890   if (wand->images == (Image *) NULL)
5891     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5892   status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels,
5893     wand->exception);
5894   return(status);
5895 }
5896 \f
5897 /*
5898 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5899 %                                                                             %
5900 %                                                                             %
5901 %                                                                             %
5902 %   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       %
5903 %                                                                             %
5904 %                                                                             %
5905 %                                                                             %
5906 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5907 %
5908 %  MagickInverseFourierTransformImage() implements the inverse discrete
5909 %  Fourier transform (DFT) of the image either as a magnitude / phase or real /
5910 %  imaginary image pair.
5911 %
5912 %  The format of the MagickInverseFourierTransformImage method is:
5913 %
5914 %      MagickBooleanType MagickInverseFourierTransformImage(
5915 %        MagickWand *magnitude_wand,MagickWand *phase_wand,
5916 %        const MagickBooleanType magnitude)
5917 %
5918 %  A description of each parameter follows:
5919 %
5920 %    o magnitude_wand: the magnitude or real wand.
5921 %
5922 %    o phase_wand: the phase or imaginary wand.
5923 %
5924 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
5925 %      imaginary image pair.
5926 %
5927 */
5928 WandExport MagickBooleanType MagickInverseFourierTransformImage(
5929   MagickWand *magnitude_wand,MagickWand *phase_wand,
5930   const MagickBooleanType magnitude)
5931 {
5932   Image
5933     *inverse_image;
5934
5935   MagickWand
5936     *wand;
5937
5938   assert(magnitude_wand != (MagickWand *) NULL);
5939   assert(magnitude_wand->signature == WandSignature);
5940   if (magnitude_wand->debug != MagickFalse)
5941     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
5942       magnitude_wand->name);
5943   wand=magnitude_wand;
5944   if (magnitude_wand->images == (Image *) NULL)
5945     ThrowWandException(WandError,"ContainsNoImages",
5946       magnitude_wand->name);
5947   assert(phase_wand != (MagickWand *) NULL);
5948   assert(phase_wand->signature == WandSignature);
5949   inverse_image=InverseFourierTransformImage(magnitude_wand->images,
5950     phase_wand->images,magnitude,wand->exception);
5951   if (inverse_image == (Image *) NULL)
5952     return(MagickFalse);
5953   ReplaceImageInList(&wand->images,inverse_image);
5954   return(MagickTrue);
5955 }
5956 \f
5957 /*
5958 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5959 %                                                                             %
5960 %                                                                             %
5961 %                                                                             %
5962 %   M a g i c k L a b e l I m a g e                                           %
5963 %                                                                             %
5964 %                                                                             %
5965 %                                                                             %
5966 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5967 %
5968 %  MagickLabelImage() adds a label to your image.
5969 %
5970 %  The format of the MagickLabelImage method is:
5971 %
5972 %      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
5973 %
5974 %  A description of each parameter follows:
5975 %
5976 %    o wand: the magick wand.
5977 %
5978 %    o label: the image label.
5979 %
5980 */
5981 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
5982   const char *label)
5983 {
5984   MagickBooleanType
5985     status;
5986
5987   assert(wand != (MagickWand *) NULL);
5988   assert(wand->signature == WandSignature);
5989   if (wand->debug != MagickFalse)
5990     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5991   if (wand->images == (Image *) NULL)
5992     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5993   status=SetImageProperty(wand->images,"label",label);
5994   if (status == MagickFalse)
5995     InheritException(wand->exception,&wand->images->exception);
5996   return(status);
5997 }
5998 \f
5999 /*
6000 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6001 %                                                                             %
6002 %                                                                             %
6003 %                                                                             %
6004 %   M a g i c k L e v e l I m a g e                                           %
6005 %                                                                             %
6006 %                                                                             %
6007 %                                                                             %
6008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6009 %
6010 %  MagickLevelImage() adjusts the levels of an image by scaling the colors
6011 %  falling between specified white and black points to the full available
6012 %  quantum range. The parameters provided represent the black, mid, and white
6013 %  points. The black point specifies the darkest color in the image. Colors
6014 %  darker than the black point are set to zero. Mid point specifies a gamma
6015 %  correction to apply to the image.  White point specifies the lightest color
6016 %  in the image. Colors brighter than the white point are set to the maximum
6017 %  quantum value.
6018 %
6019 %  The format of the MagickLevelImage method is:
6020 %
6021 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6022 %        const double black_point,const double gamma,const double white_point)
6023 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6024 %        const ChannelType channel,const double black_point,const double gamma,
6025 %        const double white_point)
6026 %
6027 %  A description of each parameter follows:
6028 %
6029 %    o wand: the magick wand.
6030 %
6031 %    o channel: Identify which channel to level: RedChannel, GreenChannel,
6032 %
6033 %    o black_point: the black point.
6034 %
6035 %    o gamma: the gamma.
6036 %
6037 %    o white_point: the white point.
6038 %
6039 */
6040 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6041   const double black_point,const double gamma,const double white_point)
6042 {
6043   MagickBooleanType
6044     status;
6045
6046   assert(wand != (MagickWand *) NULL);
6047   assert(wand->signature == WandSignature);
6048   if (wand->debug != MagickFalse)
6049     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6050   if (wand->images == (Image *) NULL)
6051     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6052   status=LevelImage(wand->images,black_point,white_point,gamma,
6053     &wand->images->exception);
6054   return(status);
6055 }
6056 \f
6057 /*
6058 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6059 %                                                                             %
6060 %                                                                             %
6061 %                                                                             %
6062 %   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6063 %                                                                             %
6064 %                                                                             %
6065 %                                                                             %
6066 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6067 %
6068 %  MagickLinearStretchImage() stretches with saturation the image intensity.
6069 %
6070 %  You can also reduce the influence of a particular channel with a gamma
6071 %  value of 0.
6072 %
6073 %  The format of the MagickLinearStretchImage method is:
6074 %
6075 %      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6076 %        const double black_point,const double white_point)
6077 %
6078 %  A description of each parameter follows:
6079 %
6080 %    o wand: the magick wand.
6081 %
6082 %    o black_point: the black point.
6083 %
6084 %    o white_point: the white point.
6085 %
6086 */
6087 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6088   const double black_point,const double white_point)
6089 {
6090   MagickBooleanType
6091     status;
6092
6093   assert(wand != (MagickWand *) NULL);
6094   assert(wand->signature == WandSignature);
6095   if (wand->debug != MagickFalse)
6096     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6097   if (wand->images == (Image *) NULL)
6098     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6099   status=LinearStretchImage(wand->images,black_point,white_point,
6100     &wand->images->exception);
6101   return(status);
6102 }
6103 \f
6104 /*
6105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6106 %                                                                             %
6107 %                                                                             %
6108 %                                                                             %
6109 %   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6110 %                                                                             %
6111 %                                                                             %
6112 %                                                                             %
6113 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6114 %
6115 %  MagickLiquidRescaleImage() rescales image with seam carving.
6116 %
6117 %      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6118 %        const size_t columns,const size_t rows,
6119 %        const double delta_x,const double rigidity)
6120 %
6121 %  A description of each parameter follows:
6122 %
6123 %    o wand: the magick wand.
6124 %
6125 %    o columns: the number of columns in the scaled image.
6126 %
6127 %    o rows: the number of rows in the scaled image.
6128 %
6129 %    o delta_x: maximum seam transversal step (0 means straight seams).
6130 %
6131 %    o rigidity: introduce a bias for non-straight seams (typically 0).
6132 %
6133 */
6134 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6135   const size_t columns,const size_t rows,const double delta_x,
6136   const double rigidity)
6137 {
6138   Image
6139     *rescale_image;
6140
6141   assert(wand != (MagickWand *) NULL);
6142   assert(wand->signature == WandSignature);
6143   if (wand->debug != MagickFalse)
6144     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6145   if (wand->images == (Image *) NULL)
6146     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6147   rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6148     rigidity,wand->exception);
6149   if (rescale_image == (Image *) NULL)
6150     return(MagickFalse);
6151   ReplaceImageInList(&wand->images,rescale_image);
6152   return(MagickTrue);
6153 }
6154 \f
6155 /*
6156 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6157 %                                                                             %
6158 %                                                                             %
6159 %                                                                             %
6160 %   M a g i c k M a g n i f y I m a g e                                       %
6161 %                                                                             %
6162 %                                                                             %
6163 %                                                                             %
6164 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6165 %
6166 %  MagickMagnifyImage() is a convenience method that scales an image
6167 %  proportionally to twice its original size.
6168 %
6169 %  The format of the MagickMagnifyImage method is:
6170 %
6171 %      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6172 %
6173 %  A description of each parameter follows:
6174 %
6175 %    o wand: the magick wand.
6176 %
6177 */
6178 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6179 {
6180   Image
6181     *magnify_image;
6182
6183   assert(wand != (MagickWand *) NULL);
6184   assert(wand->signature == WandSignature);
6185   if (wand->debug != MagickFalse)
6186     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6187   if (wand->images == (Image *) NULL)
6188     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6189   magnify_image=MagnifyImage(wand->images,wand->exception);
6190   if (magnify_image == (Image *) NULL)
6191     return(MagickFalse);
6192   ReplaceImageInList(&wand->images,magnify_image);
6193   return(MagickTrue);
6194 }
6195 \f
6196 /*
6197 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6198 %                                                                             %
6199 %                                                                             %
6200 %                                                                             %
6201 %   M a g i c k M e r g e I m a g e L a y e r s                               %
6202 %                                                                             %
6203 %                                                                             %
6204 %                                                                             %
6205 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6206 %
6207 %  MagickMergeImageLayers() composes all the image layers from the current
6208 %  given image onward to produce a single image of the merged layers.
6209 %
6210 %  The inital canvas's size depends on the given ImageLayerMethod, and is
6211 %  initialized using the first images background color.  The images
6212 %  are then compositied onto that image in sequence using the given
6213 %  composition that has been assigned to each individual image.
6214 %
6215 %  The format of the MagickMergeImageLayers method is:
6216 %
6217 %      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6218 %        const ImageLayerMethod method)
6219 %
6220 %  A description of each parameter follows:
6221 %
6222 %    o wand: the magick wand.
6223 %
6224 %    o method: the method of selecting the size of the initial canvas.
6225 %
6226 %        MergeLayer: Merge all layers onto a canvas just large enough
6227 %           to hold all the actual images. The virtual canvas of the
6228 %           first image is preserved but otherwise ignored.
6229 %
6230 %        FlattenLayer: Use the virtual canvas size of first image.
6231 %           Images which fall outside this canvas is clipped.
6232 %           This can be used to 'fill out' a given virtual canvas.
6233 %
6234 %        MosaicLayer: Start with the virtual canvas of the first image,
6235 %           enlarging left and right edges to contain all images.
6236 %           Images with negative offsets will be clipped.
6237 %
6238 */
6239 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6240   const ImageLayerMethod method)
6241 {
6242   Image
6243     *mosaic_image;
6244
6245   assert(wand != (MagickWand *) NULL);
6246   assert(wand->signature == WandSignature);
6247   if (wand->debug != MagickFalse)
6248     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6249   if (wand->images == (Image *) NULL)
6250     return((MagickWand *) NULL);
6251   mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6252   if (mosaic_image == (Image *) NULL)
6253     return((MagickWand *) NULL);
6254   return(CloneMagickWandFromImages(wand,mosaic_image));
6255 }
6256 \f
6257 /*
6258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6259 %                                                                             %
6260 %                                                                             %
6261 %                                                                             %
6262 %   M a g i c k M i n i f y I m a g e                                         %
6263 %                                                                             %
6264 %                                                                             %
6265 %                                                                             %
6266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6267 %
6268 %  MagickMinifyImage() is a convenience method that scales an image
6269 %  proportionally to one-half its original size
6270 %
6271 %  The format of the MagickMinifyImage method is:
6272 %
6273 %      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6274 %
6275 %  A description of each parameter follows:
6276 %
6277 %    o wand: the magick wand.
6278 %
6279 */
6280 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6281 {
6282   Image
6283     *minify_image;
6284
6285   assert(wand != (MagickWand *) NULL);
6286   assert(wand->signature == WandSignature);
6287   if (wand->debug != MagickFalse)
6288     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6289   if (wand->images == (Image *) NULL)
6290     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6291   minify_image=MinifyImage(wand->images,wand->exception);
6292   if (minify_image == (Image *) NULL)
6293     return(MagickFalse);
6294   ReplaceImageInList(&wand->images,minify_image);
6295   return(MagickTrue);
6296 }
6297 \f
6298 /*
6299 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6300 %                                                                             %
6301 %                                                                             %
6302 %                                                                             %
6303 %   M a g i c k M o d u l a t e I m a g e                                     %
6304 %                                                                             %
6305 %                                                                             %
6306 %                                                                             %
6307 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6308 %
6309 %  MagickModulateImage() lets you control the brightness, saturation, and hue
6310 %  of an image.  Hue is the percentage of absolute rotation from the current
6311 %  position.  For example 50 results in a counter-clockwise rotation of 90
6312 %  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6313 %  both resulting in a rotation of 180 degrees.
6314 %
6315 %  To increase the color brightness by 20% and decrease the color saturation by
6316 %  10% and leave the hue unchanged, use: 120,90,100.
6317 %
6318 %  The format of the MagickModulateImage method is:
6319 %
6320 %      MagickBooleanType MagickModulateImage(MagickWand *wand,
6321 %        const double brightness,const double saturation,const double hue)
6322 %
6323 %  A description of each parameter follows:
6324 %
6325 %    o wand: the magick wand.
6326 %
6327 %    o brightness: the percent change in brighness.
6328 %
6329 %    o saturation: the percent change in saturation.
6330 %
6331 %    o hue: the percent change in hue.
6332 %
6333 */
6334 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6335   const double brightness,const double saturation,const double hue)
6336 {
6337   char
6338     modulate[MaxTextExtent];
6339
6340   MagickBooleanType
6341     status;
6342
6343   assert(wand != (MagickWand *) NULL);
6344   assert(wand->signature == WandSignature);
6345   if (wand->debug != MagickFalse)
6346     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6347   if (wand->images == (Image *) NULL)
6348     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6349   (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g",
6350     brightness,saturation,hue);
6351   status=ModulateImage(wand->images,modulate,&wand->images->exception);
6352   return(status);
6353 }
6354 \f
6355 /*
6356 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6357 %                                                                             %
6358 %                                                                             %
6359 %                                                                             %
6360 %   M a g i c k M o n t a g e I m a g e                                       %
6361 %                                                                             %
6362 %                                                                             %
6363 %                                                                             %
6364 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6365 %
6366 %  MagickMontageImage() creates a composite image by combining several
6367 %  separate images. The images are tiled on the composite image with the name
6368 %  of the image optionally appearing just below the individual tile.
6369 %
6370 %  The format of the MagickMontageImage method is:
6371 %
6372 %      MagickWand *MagickMontageImage(MagickWand *wand,
6373 %        const DrawingWand drawing_wand,const char *tile_geometry,
6374 %        const char *thumbnail_geometry,const MontageMode mode,
6375 %        const char *frame)
6376 %
6377 %  A description of each parameter follows:
6378 %
6379 %    o wand: the magick wand.
6380 %
6381 %    o drawing_wand: the drawing wand.  The font name, size, and color are
6382 %      obtained from this wand.
6383 %
6384 %    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
6385 %
6386 %    o thumbnail_geometry: Preferred image size and border size of each
6387 %      thumbnail (e.g. 120x120+4+3>).
6388 %
6389 %    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
6390 %
6391 %    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
6392 %      The frame color is that of the thumbnail's matte color.
6393 %
6394 */
6395 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
6396   const DrawingWand *drawing_wand,const char *tile_geometry,
6397   const char *thumbnail_geometry,const MontageMode mode,const char *frame)
6398 {
6399   char
6400     *font;
6401
6402   Image
6403     *montage_image;
6404
6405   MontageInfo
6406     *montage_info;
6407
6408   PixelWand
6409     *pixel_wand;
6410
6411   assert(wand != (MagickWand *) NULL);
6412   assert(wand->signature == WandSignature);
6413   if (wand->debug != MagickFalse)
6414     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6415   if (wand->images == (Image *) NULL)
6416     return((MagickWand *) NULL);
6417   montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
6418   switch (mode)
6419   {
6420     case FrameMode:
6421     {
6422       (void) CloneString(&montage_info->frame,"15x15+3+3");
6423       montage_info->shadow=MagickTrue;
6424       break;
6425     }
6426     case UnframeMode:
6427     {
6428       montage_info->frame=(char *) NULL;
6429       montage_info->shadow=MagickFalse;
6430       montage_info->border_width=0;
6431       break;
6432     }
6433     case ConcatenateMode:
6434     {
6435       montage_info->frame=(char *) NULL;
6436       montage_info->shadow=MagickFalse;
6437       (void) CloneString(&montage_info->geometry,"+0+0");
6438       montage_info->border_width=0;
6439       break;
6440     }
6441     default:
6442       break;
6443   }
6444   font=DrawGetFont(drawing_wand);
6445   if (font != (char *) NULL)
6446     (void) CloneString(&montage_info->font,font);
6447   if (frame != (char *) NULL)
6448     (void) CloneString(&montage_info->frame,frame);
6449   montage_info->pointsize=DrawGetFontSize(drawing_wand);
6450   pixel_wand=NewPixelWand();
6451   DrawGetFillColor(drawing_wand,pixel_wand);
6452   PixelGetQuantumPacket(pixel_wand,&montage_info->fill);
6453   DrawGetStrokeColor(drawing_wand,pixel_wand);
6454   PixelGetQuantumPacket(pixel_wand,&montage_info->stroke);
6455   pixel_wand=DestroyPixelWand(pixel_wand);
6456   if (thumbnail_geometry != (char *) NULL)
6457     (void) CloneString(&montage_info->geometry,thumbnail_geometry);
6458   if (tile_geometry != (char *) NULL)
6459     (void) CloneString(&montage_info->tile,tile_geometry);
6460   montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
6461     wand->exception);
6462   montage_info=DestroyMontageInfo(montage_info);
6463   if (montage_image == (Image *) NULL)
6464     return((MagickWand *) NULL);
6465   return(CloneMagickWandFromImages(wand,montage_image));
6466 }
6467 \f
6468 /*
6469 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6470 %                                                                             %
6471 %                                                                             %
6472 %                                                                             %
6473 %   M a g i c k M o r p h I m a g e s                                         %
6474 %                                                                             %
6475 %                                                                             %
6476 %                                                                             %
6477 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6478 %
6479 %  MagickMorphImages() method morphs a set of images.  Both the image pixels
6480 %  and size are linearly interpolated to give the appearance of a
6481 %  meta-morphosis from one image to the next.
6482 %
6483 %  The format of the MagickMorphImages method is:
6484 %
6485 %      MagickWand *MagickMorphImages(MagickWand *wand,
6486 %        const size_t number_frames)
6487 %
6488 %  A description of each parameter follows:
6489 %
6490 %    o wand: the magick wand.
6491 %
6492 %    o number_frames: the number of in-between images to generate.
6493 %
6494 */
6495 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
6496   const size_t number_frames)
6497 {
6498   Image
6499     *morph_image;
6500
6501   assert(wand != (MagickWand *) NULL);
6502   assert(wand->signature == WandSignature);
6503   if (wand->debug != MagickFalse)
6504     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6505   if (wand->images == (Image *) NULL)
6506     return((MagickWand *) NULL);
6507   morph_image=MorphImages(wand->images,number_frames,wand->exception);
6508   if (morph_image == (Image *) NULL)
6509     return((MagickWand *) NULL);
6510   return(CloneMagickWandFromImages(wand,morph_image));
6511 }
6512 \f
6513 /*
6514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6515 %                                                                             %
6516 %                                                                             %
6517 %                                                                             %
6518 %   M a g i c k M o r p h o l o g y I m a g e                                 %
6519 %                                                                             %
6520 %                                                                             %
6521 %                                                                             %
6522 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6523 %
6524 %  MagickMorphologyImage() applies a user supplied kernel to the image
6525 %  according to the given mophology method.
6526 %
6527 %  The format of the MagickMorphologyImage method is:
6528 %
6529 %      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6530 %        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6531 %
6532 %  A description of each parameter follows:
6533 %
6534 %    o wand: the magick wand.
6535 %
6536 %    o method: the morphology method to be applied.
6537 %
6538 %    o iterations: apply the operation this many times (or no change).
6539 %      A value of -1 means loop until no change found.  How this is applied
6540 %      may depend on the morphology method.  Typically this is a value of 1.
6541 %
6542 %    o kernel: An array of doubles representing the morphology kernel.
6543 %
6544 */
6545 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
6546   MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
6547 {
6548   Image
6549     *morphology_image;
6550
6551   assert(wand != (MagickWand *) NULL);
6552   assert(wand->signature == WandSignature);
6553   if (wand->debug != MagickFalse)
6554     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6555   if (kernel == (const KernelInfo *) NULL)
6556     return(MagickFalse);
6557   if (wand->images == (Image *) NULL)
6558     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6559   morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
6560     wand->exception);
6561   if (morphology_image == (Image *) NULL)
6562     return(MagickFalse);
6563   ReplaceImageInList(&wand->images,morphology_image);
6564   return(MagickTrue);
6565 }
6566 \f
6567 /*
6568 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6569 %                                                                             %
6570 %                                                                             %
6571 %                                                                             %
6572 %   M a g i c k M o t i o n B l u r I m a g e                                 %
6573 %                                                                             %
6574 %                                                                             %
6575 %                                                                             %
6576 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6577 %
6578 %  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
6579 %  Gaussian operator of the given radius and standard deviation (sigma).
6580 %  For reasonable results, radius should be larger than sigma.  Use a
6581 %  radius of 0 and MotionBlurImage() selects a suitable radius for you.
6582 %  Angle gives the angle of the blurring motion.
6583 %
6584 %  The format of the MagickMotionBlurImage method is:
6585 %
6586 %      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6587 %        const double radius,const double sigma,const double angle,
6588 %        const double bias)
6589 %
6590 %  A description of each parameter follows:
6591 %
6592 %    o wand: the magick wand.
6593 %
6594 %    o radius: the radius of the Gaussian, in pixels, not counting
6595 %      the center pixel.
6596 %
6597 %    o sigma: the standard deviation of the Gaussian, in pixels.
6598 %
6599 %    o angle: Apply the effect along this angle.
6600 %
6601 */
6602 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
6603   const double radius,const double sigma,const double angle,const double bias)
6604 {
6605   Image
6606     *blur_image;
6607
6608   assert(wand != (MagickWand *) NULL);
6609   assert(wand->signature == WandSignature);
6610   if (wand->debug != MagickFalse)
6611     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6612   if (wand->images == (Image *) NULL)
6613     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6614   blur_image=MotionBlurImage(wand->images,radius,sigma,angle,bias,
6615     wand->exception);
6616   if (blur_image == (Image *) NULL)
6617     return(MagickFalse);
6618   ReplaceImageInList(&wand->images,blur_image);
6619   return(MagickTrue);
6620 }
6621 \f
6622 /*
6623 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6624 %                                                                             %
6625 %                                                                             %
6626 %                                                                             %
6627 %   M a g i c k N e g a t e I m a g e                                         %
6628 %                                                                             %
6629 %                                                                             %
6630 %                                                                             %
6631 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6632 %
6633 %  MagickNegateImage() negates the colors in the reference image.  The
6634 %  Grayscale option means that only grayscale values within the image are
6635 %  negated.
6636 %
6637 %  You can also reduce the influence of a particular channel with a gamma
6638 %  value of 0.
6639 %
6640 %  The format of the MagickNegateImage method is:
6641 %
6642 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
6643 %        const MagickBooleanType gray)
6644 %
6645 %  A description of each parameter follows:
6646 %
6647 %    o wand: the magick wand.
6648 %
6649 %    o gray: If MagickTrue, only negate grayscale pixels within the image.
6650 %
6651 */
6652 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
6653   const MagickBooleanType gray)
6654 {
6655   MagickBooleanType
6656     status;
6657
6658   assert(wand != (MagickWand *) NULL);
6659   assert(wand->signature == WandSignature);
6660   if (wand->debug != MagickFalse)
6661     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6662   if (wand->images == (Image *) NULL)
6663     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6664   status=NegateImage(wand->images,gray,wand->exception);
6665   return(status);
6666 }
6667 \f
6668 /*
6669 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6670 %                                                                             %
6671 %                                                                             %
6672 %                                                                             %
6673 %   M a g i c k N e w I m a g e                                               %
6674 %                                                                             %
6675 %                                                                             %
6676 %                                                                             %
6677 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6678 %
6679 %  MagickNewImage() adds a blank image canvas of the specified size and
6680 %  background color to the wand.
6681 %
6682 %  The format of the MagickNewImage method is:
6683 %
6684 %      MagickBooleanType MagickNewImage(MagickWand *wand,
6685 %        const size_t columns,const size_t rows,
6686 %        const PixelWand *background)
6687 %
6688 %  A description of each parameter follows:
6689 %
6690 %    o wand: the magick wand.
6691 %
6692 %    o width: the image width.
6693 %
6694 %    o height: the image height.
6695 %
6696 %    o background: the image color.
6697 %
6698 */
6699 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,
6700   const size_t width,const size_t height,
6701   const PixelWand *background)
6702 {
6703   Image
6704     *images;
6705
6706   PixelInfo
6707     pixel;
6708
6709   assert(wand != (MagickWand *) NULL);
6710   assert(wand->signature == WandSignature);
6711   if (wand->debug != MagickFalse)
6712     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6713   PixelGetMagickColor(background,&pixel);
6714   images=NewMagickImage(wand->image_info,width,height,&pixel);
6715   if (images == (Image *) NULL)
6716     return(MagickFalse);
6717   if (images->exception.severity != UndefinedException)
6718     InheritException(wand->exception,&images->exception);
6719   return(InsertImageInWand(wand,images));
6720 }
6721 \f
6722 /*
6723 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6724 %                                                                             %
6725 %                                                                             %
6726 %                                                                             %
6727 %   M a g i c k N e x t I m a g e                                             %
6728 %                                                                             %
6729 %                                                                             %
6730 %                                                                             %
6731 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6732 %
6733 %  MagickNextImage() associates the next image in the image list with a magick
6734 %  wand.
6735 %
6736 %  The format of the MagickNextImage method is:
6737 %
6738 %      MagickBooleanType MagickNextImage(MagickWand *wand)
6739 %
6740 %  A description of each parameter follows:
6741 %
6742 %    o wand: the magick wand.
6743 %
6744 */
6745 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
6746 {
6747   assert(wand != (MagickWand *) NULL);
6748   assert(wand->signature == WandSignature);
6749   if (wand->debug != MagickFalse)
6750     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6751   if (wand->images == (Image *) NULL)
6752     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6753   if (wand->pend != MagickFalse)
6754     {
6755       wand->pend=MagickFalse;
6756       return(MagickTrue);
6757     }
6758   if (GetNextImageInList(wand->images) == (Image *) NULL)
6759     {
6760       wand->pend=MagickTrue;
6761       return(MagickFalse);
6762     }
6763   wand->images=GetNextImageInList(wand->images);
6764   return(MagickTrue);
6765 }
6766 \f
6767 /*
6768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6769 %                                                                             %
6770 %                                                                             %
6771 %                                                                             %
6772 %   M a g i c k N o r m a l i z e I m a g e                                   %
6773 %                                                                             %
6774 %                                                                             %
6775 %                                                                             %
6776 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6777 %
6778 %  MagickNormalizeImage() enhances the contrast of a color image by adjusting
6779 %  the pixels color to span the entire range of colors available
6780 %
6781 %  You can also reduce the influence of a particular channel with a gamma
6782 %  value of 0.
6783 %
6784 %  The format of the MagickNormalizeImage method is:
6785 %
6786 %      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6787 %
6788 %  A description of each parameter follows:
6789 %
6790 %    o wand: the magick wand.
6791 %
6792 */
6793 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
6794 {
6795   MagickBooleanType
6796     status;
6797
6798   assert(wand != (MagickWand *) NULL);
6799   assert(wand->signature == WandSignature);
6800   if (wand->debug != MagickFalse)
6801     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6802   if (wand->images == (Image *) NULL)
6803     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6804   status=NormalizeImage(wand->images,&wand->images->exception);
6805   return(status);
6806 }
6807 \f
6808 /*
6809 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6810 %                                                                             %
6811 %                                                                             %
6812 %                                                                             %
6813 %   M a g i c k O i l P a i n t I m a g e                                     %
6814 %                                                                             %
6815 %                                                                             %
6816 %                                                                             %
6817 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6818 %
6819 %  MagickOilPaintImage() applies a special effect filter that simulates an oil
6820 %  painting.  Each pixel is replaced by the most frequent color occurring
6821 %  in a circular region defined by radius.
6822 %
6823 %  The format of the MagickOilPaintImage method is:
6824 %
6825 %      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6826 %        const double radius,const double sigma)
6827 %
6828 %  A description of each parameter follows:
6829 %
6830 %    o wand: the magick wand.
6831 %
6832 %    o radius: the radius of the circular neighborhood.
6833 %
6834 %    o sigma: the standard deviation of the Gaussian, in pixels.
6835 %
6836 */
6837 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
6838   const double radius,const double sigma)
6839 {
6840   Image
6841     *paint_image;
6842
6843   assert(wand != (MagickWand *) NULL);
6844   assert(wand->signature == WandSignature);
6845   if (wand->debug != MagickFalse)
6846     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6847   if (wand->images == (Image *) NULL)
6848     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6849   paint_image=OilPaintImage(wand->images,radius,sigma,wand->exception);
6850   if (paint_image == (Image *) NULL)
6851     return(MagickFalse);
6852   ReplaceImageInList(&wand->images,paint_image);
6853   return(MagickTrue);
6854 }
6855 \f
6856 /*
6857 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6858 %                                                                             %
6859 %                                                                             %
6860 %                                                                             %
6861 %   M a g i c k O p a q u e P a i n t I m a g e                               %
6862 %                                                                             %
6863 %                                                                             %
6864 %                                                                             %
6865 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6866 %
6867 %  MagickOpaquePaintImage() changes any pixel that matches color with the color
6868 %  defined by fill.
6869 %
6870 %  The format of the MagickOpaquePaintImage method is:
6871 %
6872 %      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6873 %        const PixelWand *target,const PixelWand *fill,const double fuzz,
6874 %        const MagickBooleanType invert)
6875 %
6876 %  A description of each parameter follows:
6877 %
6878 %    o wand: the magick wand.
6879 %
6880 %    o target: Change this target color to the fill color within the image.
6881 %
6882 %    o fill: the fill pixel wand.
6883 %
6884 %    o fuzz: By default target must match a particular pixel color
6885 %      exactly.  However, in many cases two colors may differ by a small amount.
6886 %      The fuzz member of image defines how much tolerance is acceptable to
6887 %      consider two colors as the same.  For example, set fuzz to 10 and the
6888 %      color red at intensities of 100 and 102 respectively are now interpreted
6889 %      as the same color for the purposes of the floodfill.
6890 %
6891 %    o invert: paint any pixel that does not match the target color.
6892 %
6893 */
6894 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
6895   const PixelWand *target,const PixelWand *fill,const double fuzz,
6896   const MagickBooleanType invert)
6897 {
6898   MagickBooleanType
6899     status;
6900
6901   PixelInfo
6902     fill_pixel,
6903     target_pixel;
6904
6905   assert(wand != (MagickWand *) NULL);
6906   assert(wand->signature == WandSignature);
6907   if (wand->debug != MagickFalse)
6908     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6909   if (wand->images == (Image *) NULL)
6910     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6911   PixelGetMagickColor(target,&target_pixel);
6912   PixelGetMagickColor(fill,&fill_pixel);
6913   wand->images->fuzz=fuzz;
6914   status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert,
6915     &wand->images->exception);
6916   return(status);
6917 }
6918 \f
6919 /*
6920 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6921 %                                                                             %
6922 %                                                                             %
6923 %                                                                             %
6924 %   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                         %
6925 %                                                                             %
6926 %                                                                             %
6927 %                                                                             %
6928 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6929 %
6930 %  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
6931 %  previous image in the sequence.  From this it attempts to select the
6932 %  smallest cropped image to replace each frame, while preserving the results
6933 %  of the animation.
6934 %
6935 %  The format of the MagickOptimizeImageLayers method is:
6936 %
6937 %      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6938 %
6939 %  A description of each parameter follows:
6940 %
6941 %    o wand: the magick wand.
6942 %
6943 */
6944 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
6945 {
6946   Image
6947     *optimize_image;
6948
6949   assert(wand != (MagickWand *) NULL);
6950   assert(wand->signature == WandSignature);
6951   if (wand->debug != MagickFalse)
6952     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6953   if (wand->images == (Image *) NULL)
6954     return((MagickWand *) NULL);
6955   optimize_image=OptimizeImageLayers(wand->images,wand->exception);
6956   if (optimize_image == (Image *) NULL)
6957     return((MagickWand *) NULL);
6958   return(CloneMagickWandFromImages(wand,optimize_image));
6959 }
6960 \f
6961 /*
6962 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6963 %                                                                             %
6964 %                                                                             %
6965 %                                                                             %
6966 %     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                   %
6967 %                                                                             %
6968 %                                                                             %
6969 %                                                                             %
6970 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6971 %
6972 %  MagickOrderedPosterizeImage() performs an ordered dither based on a number
6973 %  of pre-defined dithering threshold maps, but over multiple intensity levels,
6974 %  which can be different for different channels, according to the input
6975 %  arguments.
6976 %
6977 %  The format of the MagickOrderedPosterizeImage method is:
6978 %
6979 %      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
6980 %        const char *threshold_map)
6981 %
6982 %  A description of each parameter follows:
6983 %
6984 %    o image: the image.
6985 %
6986 %    o threshold_map: A string containing the name of the threshold dither
6987 %      map to use, followed by zero or more numbers representing the number of
6988 %      color levels tho dither between.
6989 %
6990 %      Any level number less than 2 is equivalent to 2, and means only binary
6991 %      dithering will be applied to each color channel.
6992 %
6993 %      No numbers also means a 2 level (bitmap) dither will be applied to all
6994 %      channels, while a single number is the number of levels applied to each
6995 %      channel in sequence.  More numbers will be applied in turn to each of
6996 %      the color channels.
6997 %
6998 %      For example: "o3x3,6" generates a 6 level posterization of the image
6999 %      with a ordered 3x3 diffused pixel dither being applied between each
7000 %      level. While checker,8,8,4 will produce a 332 colormaped image with
7001 %      only a single checkerboard hash pattern (50% grey) between each color
7002 %      level, to basically double the number of color levels with a bare
7003 %      minimim of dithering.
7004 %
7005 */
7006 WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7007   const char *threshold_map)
7008 {
7009   MagickBooleanType
7010     status;
7011
7012   assert(wand != (MagickWand *) NULL);
7013   assert(wand->signature == WandSignature);
7014   if (wand->debug != MagickFalse)
7015     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7016   if (wand->images == (Image *) NULL)
7017     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7018   status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception);
7019   return(status);
7020 }
7021 \f
7022 /*
7023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7024 %                                                                             %
7025 %                                                                             %
7026 %                                                                             %
7027 %   M a g i c k P i n g I m a g e                                             %
7028 %                                                                             %
7029 %                                                                             %
7030 %                                                                             %
7031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7032 %
7033 %  MagickPingImage() is like MagickReadImage() except the only valid
7034 %  information returned is the image width, height, size, and format.  It
7035 %  is designed to efficiently obtain this information from a file without
7036 %  reading the entire image sequence into memory.
7037 %
7038 %  The format of the MagickPingImage method is:
7039 %
7040 %      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7041 %
7042 %  A description of each parameter follows:
7043 %
7044 %    o wand: the magick wand.
7045 %
7046 %    o filename: the image filename.
7047 %
7048 */
7049 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7050   const char *filename)
7051 {
7052   Image
7053     *images;
7054
7055   ImageInfo
7056     *ping_info;
7057
7058   assert(wand != (MagickWand *) NULL);
7059   assert(wand->signature == WandSignature);
7060   if (wand->debug != MagickFalse)
7061     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7062   ping_info=CloneImageInfo(wand->image_info);
7063   if (filename != (const char *) NULL)
7064     (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7065   images=PingImage(ping_info,wand->exception);
7066   ping_info=DestroyImageInfo(ping_info);
7067   if (images == (Image *) NULL)
7068     return(MagickFalse);
7069   return(InsertImageInWand(wand,images));
7070 }
7071 \f
7072 /*
7073 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7074 %                                                                             %
7075 %                                                                             %
7076 %                                                                             %
7077 %   M a g i c k P i n g I m a g e B l o b                                     %
7078 %                                                                             %
7079 %                                                                             %
7080 %                                                                             %
7081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7082 %
7083 %  MagickPingImageBlob() pings an image or image sequence from a blob.
7084 %
7085 %  The format of the MagickPingImageBlob method is:
7086 %
7087 %      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7088 %        const void *blob,const size_t length)
7089 %
7090 %  A description of each parameter follows:
7091 %
7092 %    o wand: the magick wand.
7093 %
7094 %    o blob: the blob.
7095 %
7096 %    o length: the blob length.
7097 %
7098 */
7099 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7100   const void *blob,const size_t length)
7101 {
7102   Image
7103     *images;
7104
7105   ImageInfo
7106     *read_info;
7107
7108   assert(wand != (MagickWand *) NULL);
7109   assert(wand->signature == WandSignature);
7110   if (wand->debug != MagickFalse)
7111     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7112   read_info=CloneImageInfo(wand->image_info);
7113   SetImageInfoBlob(read_info,blob,length);
7114   images=PingImage(read_info,wand->exception);
7115   read_info=DestroyImageInfo(read_info);
7116   if (images == (Image *) NULL)
7117     return(MagickFalse);
7118   return(InsertImageInWand(wand,images));
7119 }
7120 \f
7121 /*
7122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7123 %                                                                             %
7124 %                                                                             %
7125 %                                                                             %
7126 %   M a g i c k P i n g I m a g e F i l e                                     %
7127 %                                                                             %
7128 %                                                                             %
7129 %                                                                             %
7130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7131 %
7132 %  MagickPingImageFile() pings an image or image sequence from an open file
7133 %  descriptor.
7134 %
7135 %  The format of the MagickPingImageFile method is:
7136 %
7137 %      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7138 %
7139 %  A description of each parameter follows:
7140 %
7141 %    o wand: the magick wand.
7142 %
7143 %    o file: the file descriptor.
7144 %
7145 */
7146 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7147 {
7148   Image
7149     *images;
7150
7151   ImageInfo
7152     *read_info;
7153
7154   assert(wand != (MagickWand *) NULL);
7155   assert(wand->signature == WandSignature);
7156   assert(file != (FILE *) NULL);
7157   if (wand->debug != MagickFalse)
7158     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7159   read_info=CloneImageInfo(wand->image_info);
7160   SetImageInfoFile(read_info,file);
7161   images=PingImage(read_info,wand->exception);
7162   read_info=DestroyImageInfo(read_info);
7163   if (images == (Image *) NULL)
7164     return(MagickFalse);
7165   return(InsertImageInWand(wand,images));
7166 }
7167 \f
7168 /*
7169 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7170 %                                                                             %
7171 %                                                                             %
7172 %                                                                             %
7173 %   M a g i c k P o l a r o i d I m a g e                                     %
7174 %                                                                             %
7175 %                                                                             %
7176 %                                                                             %
7177 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7178 %
7179 %  MagickPolaroidImage() simulates a Polaroid picture.
7180 %
7181 %  The format of the MagickPolaroidImage method is:
7182 %
7183 %      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7184 %        const DrawingWand *drawing_wand,const double angle,
7185 %        const PixelInterpolateMethod method)
7186 %
7187 %  A description of each parameter follows:
7188 %
7189 %    o wand: the magick wand.
7190 %
7191 %    o drawing_wand: the draw wand.
7192 %
7193 %    o angle: Apply the effect along this angle.
7194 %
7195 %    o method: the pixel interpolation method.
7196 %
7197 */
7198 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7199   const DrawingWand *drawing_wand,const double angle,
7200   const PixelInterpolateMethod method)
7201 {
7202   DrawInfo
7203     *draw_info;
7204
7205   Image
7206     *polaroid_image;
7207
7208   assert(wand != (MagickWand *) NULL);
7209   assert(wand->signature == WandSignature);
7210   if (wand->debug != MagickFalse)
7211     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7212   if (wand->images == (Image *) NULL)
7213     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7214   draw_info=PeekDrawingWand(drawing_wand);
7215   if (draw_info == (DrawInfo *) NULL)
7216     return(MagickFalse);
7217   polaroid_image=PolaroidImage(wand->images,draw_info,angle,method,
7218     wand->exception);
7219   if (polaroid_image == (Image *) NULL)
7220     return(MagickFalse);
7221   ReplaceImageInList(&wand->images,polaroid_image);
7222   return(MagickTrue);
7223 }
7224 \f
7225 /*
7226 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7227 %                                                                             %
7228 %                                                                             %
7229 %                                                                             %
7230 %   M a g i c k P o s t e r i z e I m a g e                                   %
7231 %                                                                             %
7232 %                                                                             %
7233 %                                                                             %
7234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7235 %
7236 %  MagickPosterizeImage() reduces the image to a limited number of color level.
7237 %
7238 %  The format of the MagickPosterizeImage method is:
7239 %
7240 %      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7241 %        const unsigned levels,const MagickBooleanType dither)
7242 %
7243 %  A description of each parameter follows:
7244 %
7245 %    o wand: the magick wand.
7246 %
7247 %    o levels: Number of color levels allowed in each channel.  Very low values
7248 %      (2, 3, or 4) have the most visible effect.
7249 %
7250 %    o dither: Set this integer value to something other than zero to dither
7251 %      the mapped image.
7252 %
7253 */
7254 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7255   const size_t levels,const MagickBooleanType dither)
7256 {
7257   MagickBooleanType
7258     status;
7259
7260   assert(wand != (MagickWand *) NULL);
7261   assert(wand->signature == WandSignature);
7262   if (wand->debug != MagickFalse)
7263     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7264   if (wand->images == (Image *) NULL)
7265     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7266   status=PosterizeImage(wand->images,levels,dither,wand->exception);
7267   return(status);
7268 }
7269 \f
7270 /*
7271 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7272 %                                                                             %
7273 %                                                                             %
7274 %                                                                             %
7275 %   M a g i c k P r e v i e w I m a g e s                                     %
7276 %                                                                             %
7277 %                                                                             %
7278 %                                                                             %
7279 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7280 %
7281 %  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
7282 %  image processing operation applied at varying strengths.  This helpful
7283 %  to quickly pin-point an appropriate parameter for an image processing
7284 %  operation.
7285 %
7286 %  The format of the MagickPreviewImages method is:
7287 %
7288 %      MagickWand *MagickPreviewImages(MagickWand *wand,
7289 %        const PreviewType preview)
7290 %
7291 %  A description of each parameter follows:
7292 %
7293 %    o wand: the magick wand.
7294 %
7295 %    o preview: the preview type.
7296 %
7297 */
7298 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
7299   const PreviewType preview)
7300 {
7301   Image
7302     *preview_image;
7303
7304   assert(wand != (MagickWand *) NULL);
7305   assert(wand->signature == WandSignature);
7306   if (wand->debug != MagickFalse)
7307     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7308   if (wand->images == (Image *) NULL)
7309     return((MagickWand *) NULL);
7310   preview_image=PreviewImage(wand->images,preview,wand->exception);
7311   if (preview_image == (Image *) NULL)
7312     return((MagickWand *) NULL);
7313   return(CloneMagickWandFromImages(wand,preview_image));
7314 }
7315 \f
7316 /*
7317 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7318 %                                                                             %
7319 %                                                                             %
7320 %                                                                             %
7321 %   M a g i c k P r e v i o u s I m a g e                                     %
7322 %                                                                             %
7323 %                                                                             %
7324 %                                                                             %
7325 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7326 %
7327 %  MagickPreviousImage() assocates the previous image in an image list with
7328 %  the magick wand.
7329 %
7330 %  The format of the MagickPreviousImage method is:
7331 %
7332 %      MagickBooleanType MagickPreviousImage(MagickWand *wand)
7333 %
7334 %  A description of each parameter follows:
7335 %
7336 %    o wand: the magick wand.
7337 %
7338 */
7339 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
7340 {
7341   assert(wand != (MagickWand *) NULL);
7342   assert(wand->signature == WandSignature);
7343   if (wand->debug != MagickFalse)
7344     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7345   if (wand->images == (Image *) NULL)
7346     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7347   if (wand->pend != MagickFalse)
7348     {
7349       wand->pend=MagickFalse;
7350       return(MagickTrue);
7351     }
7352   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
7353     {
7354       wand->pend=MagickTrue;
7355       return(MagickFalse);
7356     }
7357   wand->images=GetPreviousImageInList(wand->images);
7358   return(MagickTrue);
7359 }
7360 \f
7361 /*
7362 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7363 %                                                                             %
7364 %                                                                             %
7365 %                                                                             %
7366 %   M a g i c k Q u a n t i z e I m a g e                                     %
7367 %                                                                             %
7368 %                                                                             %
7369 %                                                                             %
7370 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7371 %
7372 %  MagickQuantizeImage() analyzes the colors within a reference image and
7373 %  chooses a fixed number of colors to represent the image.  The goal of the
7374 %  algorithm is to minimize the color difference between the input and output
7375 %  image while minimizing the processing time.
7376 %
7377 %  The format of the MagickQuantizeImage method is:
7378 %
7379 %      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7380 %        const size_t number_colors,const ColorspaceType colorspace,
7381 %        const size_t treedepth,const MagickBooleanType dither,
7382 %        const MagickBooleanType measure_error)
7383 %
7384 %  A description of each parameter follows:
7385 %
7386 %    o wand: the magick wand.
7387 %
7388 %    o number_colors: the number of colors.
7389 %
7390 %    o colorspace: Perform color reduction in this colorspace, typically
7391 %      RGBColorspace.
7392 %
7393 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7394 %      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
7395 %      reference image with the least amount of memory and the fastest
7396 %      computational speed.  In some cases, such as an image with low color
7397 %      dispersion (a few number of colors), a value other than
7398 %      Log4(number_colors) is required.  To expand the color tree completely,
7399 %      use a value of 8.
7400 %
7401 %    o dither: A value other than zero distributes the difference between an
7402 %      original image and the corresponding color reduced image to
7403 %      neighboring pixels along a Hilbert curve.
7404 %
7405 %    o measure_error: A value other than zero measures the difference between
7406 %      the original and quantized images.  This difference is the total
7407 %      quantization error.  The error is computed by summing over all pixels
7408 %      in an image the distance squared in RGB space between each reference
7409 %      pixel value and its quantized value.
7410 %
7411 */
7412 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
7413   const size_t number_colors,const ColorspaceType colorspace,
7414   const size_t treedepth,const MagickBooleanType dither,
7415   const MagickBooleanType measure_error)
7416 {
7417   MagickBooleanType
7418     status;
7419
7420   QuantizeInfo
7421     *quantize_info;
7422
7423   assert(wand != (MagickWand *) NULL);
7424   assert(wand->signature == WandSignature);
7425   if (wand->debug != MagickFalse)
7426     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7427   if (wand->images == (Image *) NULL)
7428     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7429   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7430   quantize_info->number_colors=number_colors;
7431   quantize_info->dither=dither;
7432   quantize_info->tree_depth=treedepth;
7433   quantize_info->colorspace=colorspace;
7434   quantize_info->measure_error=measure_error;
7435   status=QuantizeImage(quantize_info,wand->images,wand->exception);
7436   quantize_info=DestroyQuantizeInfo(quantize_info);
7437   return(status);
7438 }
7439 \f
7440 /*
7441 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7442 %                                                                             %
7443 %                                                                             %
7444 %                                                                             %
7445 %   M a g i c k Q u a n t i z e I m a g e s                                   %
7446 %                                                                             %
7447 %                                                                             %
7448 %                                                                             %
7449 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7450 %
7451 %  MagickQuantizeImages() analyzes the colors within a sequence of images and
7452 %  chooses a fixed number of colors to represent the image.  The goal of the
7453 %  algorithm is to minimize the color difference between the input and output
7454 %  image while minimizing the processing time.
7455 %
7456 %  The format of the MagickQuantizeImages method is:
7457 %
7458 %      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7459 %        const size_t number_colors,const ColorspaceType colorspace,
7460 %        const size_t treedepth,const MagickBooleanType dither,
7461 %        const MagickBooleanType measure_error)
7462 %
7463 %  A description of each parameter follows:
7464 %
7465 %    o wand: the magick wand.
7466 %
7467 %    o number_colors: the number of colors.
7468 %
7469 %    o colorspace: Perform color reduction in this colorspace, typically
7470 %      RGBColorspace.
7471 %
7472 %    o treedepth: Normally, this integer value is zero or one.  A zero or
7473 %      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
7474 %      reference image with the least amount of memory and the fastest
7475 %      computational speed.  In some cases, such as an image with low color
7476 %      dispersion (a few number of colors), a value other than
7477 %      Log4(number_colors) is required.  To expand the color tree completely,
7478 %      use a value of 8.
7479 %
7480 %    o dither: A value other than zero distributes the difference between an
7481 %      original image and the corresponding color reduced algorithm to
7482 %      neighboring pixels along a Hilbert curve.
7483 %
7484 %    o measure_error: A value other than zero measures the difference between
7485 %      the original and quantized images.  This difference is the total
7486 %      quantization error.  The error is computed by summing over all pixels
7487 %      in an image the distance squared in RGB space between each reference
7488 %      pixel value and its quantized value.
7489 %
7490 */
7491 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
7492   const size_t number_colors,const ColorspaceType colorspace,
7493   const size_t treedepth,const MagickBooleanType dither,
7494   const MagickBooleanType measure_error)
7495 {
7496   MagickBooleanType
7497     status;
7498
7499   QuantizeInfo
7500     *quantize_info;
7501
7502   assert(wand != (MagickWand *) NULL);
7503   assert(wand->signature == WandSignature);
7504   if (wand->debug != MagickFalse)
7505     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7506   if (wand->images == (Image *) NULL)
7507     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7508   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
7509   quantize_info->number_colors=number_colors;
7510   quantize_info->dither=dither;
7511   quantize_info->tree_depth=treedepth;
7512   quantize_info->colorspace=colorspace;
7513   quantize_info->measure_error=measure_error;
7514   status=QuantizeImages(quantize_info,wand->images,wand->exception);
7515   quantize_info=DestroyQuantizeInfo(quantize_info);
7516   return(status);
7517 }
7518 \f
7519 /*
7520 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7521 %                                                                             %
7522 %                                                                             %
7523 %                                                                             %
7524 %   M a g i c k R a d i a l B l u r I m a g e                                 %
7525 %                                                                             %
7526 %                                                                             %
7527 %                                                                             %
7528 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7529 %
7530 %  MagickRadialBlurImage() radial blurs an image.
7531 %
7532 %  The format of the MagickRadialBlurImage method is:
7533 %
7534 %      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7535 %        const double angle,const double bias)
7536 %
7537 %  A description of each parameter follows:
7538 %
7539 %    o wand: the magick wand.
7540 %
7541 %    o angle: the angle of the blur in degrees.
7542 %
7543 %    o bias: the bias.
7544 %
7545 */
7546 WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
7547   const double angle,const double bias)
7548 {
7549   Image
7550     *blur_image;
7551
7552   assert(wand != (MagickWand *) NULL);
7553   assert(wand->signature == WandSignature);
7554   if (wand->debug != MagickFalse)
7555     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7556   if (wand->images == (Image *) NULL)
7557     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7558   blur_image=RadialBlurImage(wand->images,angle,bias,wand->exception);
7559   if (blur_image == (Image *) NULL)
7560     return(MagickFalse);
7561   ReplaceImageInList(&wand->images,blur_image);
7562   return(MagickTrue);
7563 }
7564 \f
7565 /*
7566 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7567 %                                                                             %
7568 %                                                                             %
7569 %                                                                             %
7570 %   M a g i c k R a i s e I m a g e                                           %
7571 %                                                                             %
7572 %                                                                             %
7573 %                                                                             %
7574 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7575 %
7576 %  MagickRaiseImage() creates a simulated three-dimensional button-like effect
7577 %  by lightening and darkening the edges of the image.  Members width and
7578 %  height of raise_info define the width of the vertical and horizontal
7579 %  edge of the effect.
7580 %
7581 %  The format of the MagickRaiseImage method is:
7582 %
7583 %      MagickBooleanType MagickRaiseImage(MagickWand *wand,
7584 %        const size_t width,const size_t height,const ssize_t x,
7585 %        const ssize_t y,const MagickBooleanType raise)
7586 %
7587 %  A description of each parameter follows:
7588 %
7589 %    o wand: the magick wand.
7590 %
7591 %    o width,height,x,y:  Define the dimensions of the area to raise.
7592 %
7593 %    o raise: A value other than zero creates a 3-D raise effect,
7594 %      otherwise it has a lowered effect.
7595 %
7596 */
7597 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
7598   const size_t width,const size_t height,const ssize_t x,
7599   const ssize_t y,const MagickBooleanType raise)
7600 {
7601   MagickBooleanType
7602     status;
7603
7604   RectangleInfo
7605     raise_info;
7606
7607   assert(wand != (MagickWand *) NULL);
7608   assert(wand->signature == WandSignature);
7609   if (wand->debug != MagickFalse)
7610     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7611   if (wand->images == (Image *) NULL)
7612     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7613   raise_info.width=width;
7614   raise_info.height=height;
7615   raise_info.x=x;
7616   raise_info.y=y;
7617   status=RaiseImage(wand->images,&raise_info,raise,&wand->images->exception);
7618   return(status);
7619 }
7620 \f
7621 /*
7622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7623 %                                                                             %
7624 %                                                                             %
7625 %                                                                             %
7626 %   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                       %
7627 %                                                                             %
7628 %                                                                             %
7629 %                                                                             %
7630 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7631 %
7632 %  MagickRandomThresholdImage() changes the value of individual pixels based on
7633 %  the intensity of each pixel compared to threshold.  The result is a
7634 %  high-contrast, two color image.
7635 %
7636 %  The format of the MagickRandomThresholdImage method is:
7637 %
7638 %      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7639 %        const double low,const double high)
7640 %
7641 %  A description of each parameter follows:
7642 %
7643 %    o wand: the magick wand.
7644 %
7645 %    o low,high: Specify the high and low thresholds.  These values range from
7646 %      0 to QuantumRange.
7647 %
7648 */
7649 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
7650   const double low,const double high)
7651 {
7652   char
7653     threshold[MaxTextExtent];
7654
7655   MagickBooleanType
7656     status;
7657
7658   assert(wand != (MagickWand *) NULL);
7659   assert(wand->signature == WandSignature);
7660   if (wand->debug != MagickFalse)
7661     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7662   if (wand->images == (Image *) NULL)
7663     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7664   (void) FormatLocaleString(threshold,MaxTextExtent,"%gx%g",low,high);
7665   status=RandomThresholdImage(wand->images,threshold,wand->exception);
7666   if (status == MagickFalse)
7667     InheritException(wand->exception,&wand->images->exception);
7668   return(status);
7669 }
7670 \f
7671 /*
7672 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7673 %                                                                             %
7674 %                                                                             %
7675 %                                                                             %
7676 %   M a g i c k R e a d I m a g e                                             %
7677 %                                                                             %
7678 %                                                                             %
7679 %                                                                             %
7680 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7681 %
7682 %  MagickReadImage() reads an image or image sequence.  The images are inserted
7683 %  at the current image pointer position.   Use MagickSetFirstIterator(),
7684 %  MagickSetLastIterator, or MagickSetImageIndex() to specify the current
7685 %  image pointer position at the beginning of the image list, the end, or
7686 %  anywhere in-between respectively.
7687 %
7688 %  The format of the MagickReadImage method is:
7689 %
7690 %      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
7691 %
7692 %  A description of each parameter follows:
7693 %
7694 %    o wand: the magick wand.
7695 %
7696 %    o filename: the image filename.
7697 %
7698 */
7699 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
7700   const char *filename)
7701 {
7702   Image
7703     *images;
7704
7705   ImageInfo
7706     *read_info;
7707
7708   assert(wand != (MagickWand *) NULL);
7709   assert(wand->signature == WandSignature);
7710   if (wand->debug != MagickFalse)
7711     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7712   read_info=CloneImageInfo(wand->image_info);
7713   if (filename != (const char *) NULL)
7714     (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
7715   images=ReadImage(read_info,wand->exception);
7716   read_info=DestroyImageInfo(read_info);
7717   if (images == (Image *) NULL)
7718     return(MagickFalse);
7719   return(InsertImageInWand(wand,images));
7720 }
7721 \f
7722 /*
7723 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7724 %                                                                             %
7725 %                                                                             %
7726 %                                                                             %
7727 %   M a g i c k R e a d I m a g e B l o b                                     %
7728 %                                                                             %
7729 %                                                                             %
7730 %                                                                             %
7731 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7732 %
7733 %  MagickReadImageBlob() reads an image or image sequence from a blob.
7734 %
7735 %  The format of the MagickReadImageBlob method is:
7736 %
7737 %      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7738 %        const void *blob,const size_t length)
7739 %
7740 %  A description of each parameter follows:
7741 %
7742 %    o wand: the magick wand.
7743 %
7744 %    o blob: the blob.
7745 %
7746 %    o length: the blob length.
7747 %
7748 */
7749 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
7750   const void *blob,const size_t length)
7751 {
7752   Image
7753     *images;
7754
7755   assert(wand != (MagickWand *) NULL);
7756   assert(wand->signature == WandSignature);
7757   if (wand->debug != MagickFalse)
7758     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7759   images=BlobToImage(wand->image_info,blob,length,wand->exception);
7760   if (images == (Image *) NULL)
7761     return(MagickFalse);
7762   return(InsertImageInWand(wand,images));
7763 }
7764 \f
7765 /*
7766 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7767 %                                                                             %
7768 %                                                                             %
7769 %                                                                             %
7770 %   M a g i c k R e a d I m a g e F i l e                                     %
7771 %                                                                             %
7772 %                                                                             %
7773 %                                                                             %
7774 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7775 %
7776 %  MagickReadImageFile() reads an image or image sequence from an open file
7777 %  descriptor.
7778 %
7779 %  The format of the MagickReadImageFile method is:
7780 %
7781 %      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7782 %
7783 %  A description of each parameter follows:
7784 %
7785 %    o wand: the magick wand.
7786 %
7787 %    o file: the file descriptor.
7788 %
7789 */
7790 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
7791 {
7792   Image
7793     *images;
7794
7795   ImageInfo
7796     *read_info;
7797
7798   assert(wand != (MagickWand *) NULL);
7799   assert(wand->signature == WandSignature);
7800   assert(file != (FILE *) NULL);
7801   if (wand->debug != MagickFalse)
7802     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7803   read_info=CloneImageInfo(wand->image_info);
7804   SetImageInfoFile(read_info,file);
7805   images=ReadImage(read_info,wand->exception);
7806   read_info=DestroyImageInfo(read_info);
7807   if (images == (Image *) NULL)
7808     return(MagickFalse);
7809   return(InsertImageInWand(wand,images));
7810 }
7811 \f
7812 /*
7813 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7814 %                                                                             %
7815 %                                                                             %
7816 %                                                                             %
7817 %   M a g i c k R e m a p I m a g e                                           %
7818 %                                                                             %
7819 %                                                                             %
7820 %                                                                             %
7821 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7822 %
7823 %  MagickRemapImage() replaces the colors of an image with the closest color
7824 %  from a reference image.
7825 %
7826 %  The format of the MagickRemapImage method is:
7827 %
7828 %      MagickBooleanType MagickRemapImage(MagickWand *wand,
7829 %        const MagickWand *remap_wand,const DitherMethod method)
7830 %
7831 %  A description of each parameter follows:
7832 %
7833 %    o wand: the magick wand.
7834 %
7835 %    o affinity: the affinity wand.
7836 %
7837 %    o method: choose from these dither methods: NoDitherMethod,
7838 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
7839 %
7840 */
7841 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
7842   const MagickWand *remap_wand,const DitherMethod method)
7843 {
7844   MagickBooleanType
7845     status;
7846
7847   QuantizeInfo
7848     *quantize_info;
7849
7850   assert(wand != (MagickWand *) NULL);
7851   assert(wand->signature == WandSignature);
7852   if (wand->debug != MagickFalse)
7853     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7854   if ((wand->images == (Image *) NULL) ||
7855       (remap_wand->images == (Image *) NULL))
7856     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7857   quantize_info=AcquireQuantizeInfo(wand->image_info);
7858   quantize_info->dither_method=method;
7859   if (method == NoDitherMethod)
7860     quantize_info->dither=MagickFalse;
7861   status=RemapImage(quantize_info,wand->images,remap_wand->images,
7862     wand->exception);
7863   quantize_info=DestroyQuantizeInfo(quantize_info);
7864   return(status);
7865 }
7866 \f
7867 /*
7868 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7869 %                                                                             %
7870 %                                                                             %
7871 %                                                                             %
7872 %   M a g i c k R e m o v e I m a g e                                         %
7873 %                                                                             %
7874 %                                                                             %
7875 %                                                                             %
7876 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7877 %
7878 %  MagickRemoveImage() removes an image from the image list.
7879 %
7880 %  The format of the MagickRemoveImage method is:
7881 %
7882 %      MagickBooleanType MagickRemoveImage(MagickWand *wand)
7883 %
7884 %  A description of each parameter follows:
7885 %
7886 %    o wand: the magick wand.
7887 %
7888 %    o insert: the splice wand.
7889 %
7890 */
7891 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
7892 {
7893   assert(wand != (MagickWand *) NULL);
7894   assert(wand->signature == WandSignature);
7895   if (wand->debug != MagickFalse)
7896     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7897   if (wand->images == (Image *) NULL)
7898     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7899   DeleteImageFromList(&wand->images);
7900   return(MagickTrue);
7901 }
7902 \f
7903 /*
7904 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7905 %                                                                             %
7906 %                                                                             %
7907 %                                                                             %
7908 %   M a g i c k R e s a m p l e I m a g e                                     %
7909 %                                                                             %
7910 %                                                                             %
7911 %                                                                             %
7912 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7913 %
7914 %  MagickResampleImage() resample image to desired resolution.
7915 %
7916 %    Bessel   Blackman   Box
7917 %    Catrom   Cubic      Gaussian
7918 %    Hanning  Hermite    Lanczos
7919 %    Mitchell Point      Quandratic
7920 %    Sinc     Triangle
7921 %
7922 %  Most of the filters are FIR (finite impulse response), however, Bessel,
7923 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
7924 %  are windowed (brought down to zero) with the Blackman filter.
7925 %
7926 %  The format of the MagickResampleImage method is:
7927 %
7928 %      MagickBooleanType MagickResampleImage(MagickWand *wand,
7929 %        const double x_resolution,const double y_resolution,
7930 %        const FilterTypes filter,const double blur)
7931 %
7932 %  A description of each parameter follows:
7933 %
7934 %    o wand: the magick wand.
7935 %
7936 %    o x_resolution: the new image x resolution.
7937 %
7938 %    o y_resolution: the new image y resolution.
7939 %
7940 %    o filter: Image filter to use.
7941 %
7942 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
7943 %
7944 */
7945 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
7946   const double x_resolution,const double y_resolution,const FilterTypes filter,
7947   const double blur)
7948 {
7949   Image
7950     *resample_image;
7951
7952   assert(wand != (MagickWand *) NULL);
7953   assert(wand->signature == WandSignature);
7954   if (wand->debug != MagickFalse)
7955     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7956   if (wand->images == (Image *) NULL)
7957     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7958   resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
7959     blur,wand->exception);
7960   if (resample_image == (Image *) NULL)
7961     return(MagickFalse);
7962   ReplaceImageInList(&wand->images,resample_image);
7963   return(MagickTrue);
7964 }
7965 \f
7966 /*
7967 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7968 %                                                                             %
7969 %                                                                             %
7970 %                                                                             %
7971 %   M a g i c k R e s e t I m a g e P a g e                                   %
7972 %                                                                             %
7973 %                                                                             %
7974 %                                                                             %
7975 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7976 %
7977 %  MagickResetImagePage() resets the Wand page canvas and position.
7978 %
7979 %  The format of the MagickResetImagePage method is:
7980 %
7981 %      MagickBooleanType MagickResetImagePage(MagickWand *wand,
7982 %        const char *page)
7983 %
7984 %  A description of each parameter follows:
7985 %
7986 %    o wand: the magick wand.
7987 %
7988 %    o page: the relative page specification.
7989 %
7990 */
7991 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
7992   const char *page)
7993 {
7994   assert(wand != (MagickWand *) NULL);
7995   assert(wand->signature == WandSignature);
7996   if (wand->debug != MagickFalse)
7997     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7998   if (wand->images == (Image *) NULL)
7999     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8000   if ((page == (char *) NULL) || (*page == '\0'))
8001     {
8002       (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8003       return(MagickTrue);
8004     }
8005   return(ResetImagePage(wand->images,page));
8006 }
8007 \f
8008 /*
8009 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8010 %                                                                             %
8011 %                                                                             %
8012 %                                                                             %
8013 %   M a g i c k R e s i z e I m a g e                                         %
8014 %                                                                             %
8015 %                                                                             %
8016 %                                                                             %
8017 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8018 %
8019 %  MagickResizeImage() scales an image to the desired dimensions with one of
8020 %  these filters:
8021 %
8022 %    Bessel   Blackman   Box
8023 %    Catrom   Cubic      Gaussian
8024 %    Hanning  Hermite    Lanczos
8025 %    Mitchell Point      Quandratic
8026 %    Sinc     Triangle
8027 %
8028 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8029 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8030 %  are windowed (brought down to zero) with the Blackman filter.
8031 %
8032 %  The format of the MagickResizeImage method is:
8033 %
8034 %      MagickBooleanType MagickResizeImage(MagickWand *wand,
8035 %        const size_t columns,const size_t rows,
8036 %        const FilterTypes filter,const double blur)
8037 %
8038 %  A description of each parameter follows:
8039 %
8040 %    o wand: the magick wand.
8041 %
8042 %    o columns: the number of columns in the scaled image.
8043 %
8044 %    o rows: the number of rows in the scaled image.
8045 %
8046 %    o filter: Image filter to use.
8047 %
8048 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8049 %
8050 */
8051 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8052   const size_t columns,const size_t rows,const FilterTypes filter,
8053   const double blur)
8054 {
8055   Image
8056     *resize_image;
8057
8058   assert(wand != (MagickWand *) NULL);
8059   assert(wand->signature == WandSignature);
8060   if (wand->debug != MagickFalse)
8061     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8062   if (wand->images == (Image *) NULL)
8063     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8064   resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8065     wand->exception);
8066   if (resize_image == (Image *) NULL)
8067     return(MagickFalse);
8068   ReplaceImageInList(&wand->images,resize_image);
8069   return(MagickTrue);
8070 }
8071 \f
8072 /*
8073 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8074 %                                                                             %
8075 %                                                                             %
8076 %                                                                             %
8077 %   M a g i c k R o l l I m a g e                                             %
8078 %                                                                             %
8079 %                                                                             %
8080 %                                                                             %
8081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8082 %
8083 %  MagickRollImage() offsets an image as defined by x and y.
8084 %
8085 %  The format of the MagickRollImage method is:
8086 %
8087 %      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8088 %        const size_t y)
8089 %
8090 %  A description of each parameter follows:
8091 %
8092 %    o wand: the magick wand.
8093 %
8094 %    o x: the x offset.
8095 %
8096 %    o y: the y offset.
8097 %
8098 %
8099 */
8100 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8101   const ssize_t x,const ssize_t y)
8102 {
8103   Image
8104     *roll_image;
8105
8106   assert(wand != (MagickWand *) NULL);
8107   assert(wand->signature == WandSignature);
8108   if (wand->debug != MagickFalse)
8109     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8110   if (wand->images == (Image *) NULL)
8111     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8112   roll_image=RollImage(wand->images,x,y,wand->exception);
8113   if (roll_image == (Image *) NULL)
8114     return(MagickFalse);
8115   ReplaceImageInList(&wand->images,roll_image);
8116   return(MagickTrue);
8117 }
8118 \f
8119 /*
8120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8121 %                                                                             %
8122 %                                                                             %
8123 %                                                                             %
8124 %   M a g i c k R o t a t e I m a g e                                         %
8125 %                                                                             %
8126 %                                                                             %
8127 %                                                                             %
8128 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8129 %
8130 %  MagickRotateImage() rotates an image the specified number of degrees. Empty
8131 %  triangles left over from rotating the image are filled with the
8132 %  background color.
8133 %
8134 %  The format of the MagickRotateImage method is:
8135 %
8136 %      MagickBooleanType MagickRotateImage(MagickWand *wand,
8137 %        const PixelWand *background,const double degrees)
8138 %
8139 %  A description of each parameter follows:
8140 %
8141 %    o wand: the magick wand.
8142 %
8143 %    o background: the background pixel wand.
8144 %
8145 %    o degrees: the number of degrees to rotate the image.
8146 %
8147 %
8148 */
8149 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8150   const PixelWand *background,const double degrees)
8151 {
8152   Image
8153     *rotate_image;
8154
8155   assert(wand != (MagickWand *) NULL);
8156   assert(wand->signature == WandSignature);
8157   if (wand->debug != MagickFalse)
8158     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8159   if (wand->images == (Image *) NULL)
8160     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8161   PixelGetQuantumPacket(background,&wand->images->background_color);
8162   rotate_image=RotateImage(wand->images,degrees,wand->exception);
8163   if (rotate_image == (Image *) NULL)
8164     return(MagickFalse);
8165   ReplaceImageInList(&wand->images,rotate_image);
8166   return(MagickTrue);
8167 }
8168 \f
8169 /*
8170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8171 %                                                                             %
8172 %                                                                             %
8173 %                                                                             %
8174 %   M a g i c k S a m p l e I m a g e                                         %
8175 %                                                                             %
8176 %                                                                             %
8177 %                                                                             %
8178 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8179 %
8180 %  MagickSampleImage() scales an image to the desired dimensions with pixel
8181 %  sampling.  Unlike other scaling methods, this method does not introduce
8182 %  any additional color into the scaled image.
8183 %
8184 %  The format of the MagickSampleImage method is:
8185 %
8186 %      MagickBooleanType MagickSampleImage(MagickWand *wand,
8187 %        const size_t columns,const size_t rows)
8188 %
8189 %  A description of each parameter follows:
8190 %
8191 %    o wand: the magick wand.
8192 %
8193 %    o columns: the number of columns in the scaled image.
8194 %
8195 %    o rows: the number of rows in the scaled image.
8196 %
8197 %
8198 */
8199 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
8200   const size_t columns,const size_t rows)
8201 {
8202   Image
8203     *sample_image;
8204
8205   assert(wand != (MagickWand *) NULL);
8206   assert(wand->signature == WandSignature);
8207   if (wand->debug != MagickFalse)
8208     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8209   if (wand->images == (Image *) NULL)
8210     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8211   sample_image=SampleImage(wand->images,columns,rows,wand->exception);
8212   if (sample_image == (Image *) NULL)
8213     return(MagickFalse);
8214   ReplaceImageInList(&wand->images,sample_image);
8215   return(MagickTrue);
8216 }
8217 \f
8218 /*
8219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8220 %                                                                             %
8221 %                                                                             %
8222 %                                                                             %
8223 %   M a g i c k S c a l e I m a g e                                           %
8224 %                                                                             %
8225 %                                                                             %
8226 %                                                                             %
8227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8228 %
8229 %  MagickScaleImage() scales the size of an image to the given dimensions.
8230 %
8231 %  The format of the MagickScaleImage method is:
8232 %
8233 %      MagickBooleanType MagickScaleImage(MagickWand *wand,
8234 %        const size_t columns,const size_t rows)
8235 %
8236 %  A description of each parameter follows:
8237 %
8238 %    o wand: the magick wand.
8239 %
8240 %    o columns: the number of columns in the scaled image.
8241 %
8242 %    o rows: the number of rows in the scaled image.
8243 %
8244 %
8245 */
8246 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
8247   const size_t columns,const size_t rows)
8248 {
8249   Image
8250     *scale_image;
8251
8252   assert(wand != (MagickWand *) NULL);
8253   assert(wand->signature == WandSignature);
8254   if (wand->debug != MagickFalse)
8255     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8256   if (wand->images == (Image *) NULL)
8257     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8258   scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
8259   if (scale_image == (Image *) NULL)
8260     return(MagickFalse);
8261   ReplaceImageInList(&wand->images,scale_image);
8262   return(MagickTrue);
8263 }
8264 \f
8265 /*
8266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8267 %                                                                             %
8268 %                                                                             %
8269 %                                                                             %
8270 %   M a g i c k S e g m e n t I m a g e                                       %
8271 %                                                                             %
8272 %                                                                             %
8273 %                                                                             %
8274 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8275 %
8276 %  MagickSegmentImage() segments an image by analyzing the histograms of the
8277 %  color components and identifying units that are homogeneous with the fuzzy
8278 %  C-means technique.
8279 %
8280 %  The format of the SegmentImage method is:
8281 %
8282 %      MagickBooleanType MagickSegmentImage(MagickWand *wand,
8283 %        const ColorspaceType colorspace,const MagickBooleanType verbose,
8284 %        const double cluster_threshold,const double smooth_threshold)
8285 %
8286 %  A description of each parameter follows.
8287 %
8288 %    o wand: the wand.
8289 %
8290 %    o colorspace: the image colorspace.
8291 %
8292 %    o verbose:  Set to MagickTrue to print detailed information about the
8293 %      identified classes.
8294 %
8295 %    o cluster_threshold:  This represents the minimum number of pixels
8296 %      contained in a hexahedra before it can be considered valid (expressed as
8297 %      a percentage).
8298 %
8299 %    o smooth_threshold: the smoothing threshold eliminates noise in the second
8300 %      derivative of the histogram.  As the value is increased, you can expect a
8301 %      smoother second derivative.
8302 %
8303 */
8304 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
8305   const ColorspaceType colorspace,const MagickBooleanType verbose,
8306   const double cluster_threshold,const double smooth_threshold)
8307 {
8308   MagickBooleanType
8309     status;
8310
8311   assert(wand != (MagickWand *) NULL);
8312   assert(wand->signature == WandSignature);
8313   if (wand->debug != MagickFalse)
8314     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8315   if (wand->images == (Image *) NULL)
8316     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8317   status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
8318     smooth_threshold,wand->exception);
8319   return(status);
8320 }
8321 \f
8322 /*
8323 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8324 %                                                                             %
8325 %                                                                             %
8326 %                                                                             %
8327 %   M a g i c k S e l e c t i v e B l u r I m a g e                           %
8328 %                                                                             %
8329 %                                                                             %
8330 %                                                                             %
8331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8332 %
8333 %  MagickSelectiveBlurImage() selectively blur an image within a contrast
8334 %  threshold. It is similar to the unsharpen mask that sharpens everything with
8335 %  contrast above a certain threshold.
8336 %
8337 %  The format of the MagickSelectiveBlurImage method is:
8338 %
8339 %      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8340 %        const double radius,const double sigma,const double threshold,
8341 %        const double bias)
8342 %
8343 %  A description of each parameter follows:
8344 %
8345 %    o wand: the magick wand.
8346 %
8347 %    o radius: the radius of the gaussian, in pixels, not counting the center
8348 %      pixel.
8349 %
8350 %    o sigma: the standard deviation of the gaussian, in pixels.
8351 %
8352 %    o threshold: only pixels within this contrast threshold are included
8353 %      in the blur operation.
8354 %
8355 %    o bias: the bias.
8356 %
8357 */
8358 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
8359   const double radius,const double sigma,const double threshold,
8360   const double bias)
8361 {
8362   Image
8363     *blur_image;
8364
8365   assert(wand != (MagickWand *) NULL);
8366   assert(wand->signature == WandSignature);
8367   if (wand->debug != MagickFalse)
8368     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8369   if (wand->images == (Image *) NULL)
8370     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8371   blur_image=SelectiveBlurImage(wand->images,radius,sigma,threshold,bias,
8372     wand->exception);
8373   if (blur_image == (Image *) NULL)
8374     return(MagickFalse);
8375   ReplaceImageInList(&wand->images,blur_image);
8376   return(MagickTrue);
8377 }
8378 \f
8379 /*
8380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8381 %                                                                             %
8382 %                                                                             %
8383 %                                                                             %
8384 %   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                       %
8385 %                                                                             %
8386 %                                                                             %
8387 %                                                                             %
8388 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8389 %
8390 %  MagickSeparateImage() separates a channel from the image and returns a
8391 %  grayscale image.  A channel is a particular color component of each pixel
8392 %  in the image.
8393 %
8394 %  The format of the MagickSeparateImage method is:
8395 %
8396 %      MagickBooleanType MagickSeparateImage(MagickWand *wand)
8397 %
8398 %  A description of each parameter follows:
8399 %
8400 %    o wand: the magick wand.
8401 %
8402 */
8403 WandExport MagickBooleanType MagickSeparateImage(MagickWand *wand)
8404 {
8405   MagickBooleanType
8406     status;
8407
8408   assert(wand != (MagickWand *) NULL);
8409   assert(wand->signature == WandSignature);
8410   if (wand->debug != MagickFalse)
8411     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8412   if (wand->images == (Image *) NULL)
8413     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8414   status=SeparateImage(wand->images);
8415   if (status == MagickFalse)
8416     InheritException(wand->exception,&wand->images->exception);
8417   return(status);
8418 }
8419 \f
8420 /*
8421 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8422 %                                                                             %
8423 %                                                                             %
8424 %                                                                             %
8425 %     M a g i c k S e p i a T o n e I m a g e                                 %
8426 %                                                                             %
8427 %                                                                             %
8428 %                                                                             %
8429 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8430 %
8431 %  MagickSepiaToneImage() applies a special effect to the image, similar to the
8432 %  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
8433 %  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
8434 %  threshold of 80% is a good starting point for a reasonable tone.
8435 %
8436 %  The format of the MagickSepiaToneImage method is:
8437 %
8438 %      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8439 %        const double threshold)
8440 %
8441 %  A description of each parameter follows:
8442 %
8443 %    o wand: the magick wand.
8444 %
8445 %    o threshold:  Define the extent of the sepia toning.
8446 %
8447 */
8448 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
8449   const double threshold)
8450 {
8451   Image
8452     *sepia_image;
8453
8454   assert(wand != (MagickWand *) NULL);
8455   assert(wand->signature == WandSignature);
8456   if (wand->debug != MagickFalse)
8457     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8458   if (wand->images == (Image *) NULL)
8459     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8460   sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
8461   if (sepia_image == (Image *) NULL)
8462     return(MagickFalse);
8463   ReplaceImageInList(&wand->images,sepia_image);
8464   return(MagickTrue);
8465 }
8466 \f
8467 /*
8468 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8469 %                                                                             %
8470 %                                                                             %
8471 %                                                                             %
8472 %   M a g i c k S e t I m a g e                                               %
8473 %                                                                             %
8474 %                                                                             %
8475 %                                                                             %
8476 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8477 %
8478 %  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
8479 %  MagickNextImage(), MagickPreviousImage() with the images from the specified
8480 %  wand.
8481 %
8482 %  The format of the MagickSetImage method is:
8483 %
8484 %      MagickBooleanType MagickSetImage(MagickWand *wand,
8485 %        const MagickWand *set_wand)
8486 %
8487 %  A description of each parameter follows:
8488 %
8489 %    o wand: the magick wand.
8490 %
8491 %    o set_wand: the set_wand wand.
8492 %
8493 */
8494 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
8495   const MagickWand *set_wand)
8496 {
8497   Image
8498     *images;
8499
8500   assert(wand != (MagickWand *) NULL);
8501   assert(wand->signature == WandSignature);
8502   if (wand->debug != MagickFalse)
8503     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8504   assert(set_wand != (MagickWand *) NULL);
8505   assert(set_wand->signature == WandSignature);
8506   if (wand->debug != MagickFalse)
8507     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
8508   if (set_wand->images == (Image *) NULL)
8509     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8510   images=CloneImageList(set_wand->images,wand->exception);
8511   if (images == (Image *) NULL)
8512     return(MagickFalse);
8513   ReplaceImageInList(&wand->images,images);
8514   return(MagickTrue);
8515 }
8516 \f
8517 /*
8518 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8519 %                                                                             %
8520 %                                                                             %
8521 %                                                                             %
8522 %   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                       %
8523 %                                                                             %
8524 %                                                                             %
8525 %                                                                             %
8526 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8527 %
8528 %  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
8529 %  alpha channel.
8530 %
8531 %  The format of the MagickSetImageAlphaChannel method is:
8532 %
8533 %      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8534 %        const AlphaChannelType alpha_type)
8535 %
8536 %  A description of each parameter follows:
8537 %
8538 %    o wand: the magick wand.
8539 %
8540 %    o alpha_type: the alpha channel type: ActivateAlphaChannel,
8541 %      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
8542 %
8543 */
8544 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
8545   const AlphaChannelType alpha_type)
8546 {
8547   assert(wand != (MagickWand *) NULL);
8548   assert(wand->signature == WandSignature);
8549   if (wand->debug != MagickFalse)
8550     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8551   if (wand->images == (Image *) NULL)
8552     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8553   return(SetImageAlphaChannel(wand->images,alpha_type,&wand->images->exception));
8554 }
8555 \f
8556 /*
8557 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8558 %                                                                             %
8559 %                                                                             %
8560 %                                                                             %
8561 %   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                 %
8562 %                                                                             %
8563 %                                                                             %
8564 %                                                                             %
8565 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8566 %
8567 %  MagickSetImageBackgroundColor() sets the image background color.
8568 %
8569 %  The format of the MagickSetImageBackgroundColor method is:
8570 %
8571 %      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8572 %        const PixelWand *background)
8573 %
8574 %  A description of each parameter follows:
8575 %
8576 %    o wand: the magick wand.
8577 %
8578 %    o background: the background pixel wand.
8579 %
8580 */
8581 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
8582   const PixelWand *background)
8583 {
8584   assert(wand != (MagickWand *) NULL);
8585   assert(wand->signature == WandSignature);
8586   if (wand->debug != MagickFalse)
8587     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8588   if (wand->images == (Image *) NULL)
8589     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8590   PixelGetQuantumPacket(background,&wand->images->background_color);
8591   return(MagickTrue);
8592 }
8593 \f
8594 /*
8595 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8596 %                                                                             %
8597 %                                                                             %
8598 %                                                                             %
8599 %   M a g i c k S e t I m a g e B i a s                                       %
8600 %                                                                             %
8601 %                                                                             %
8602 %                                                                             %
8603 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8604 %
8605 %  MagickSetImageBias() sets the image bias for any method that convolves an
8606 %  image (e.g. MagickConvolveImage()).
8607 %
8608 %  The format of the MagickSetImageBias method is:
8609 %
8610 %      MagickBooleanType MagickSetImageBias(MagickWand *wand,
8611 %        const double bias)
8612 %
8613 %  A description of each parameter follows:
8614 %
8615 %    o wand: the magick wand.
8616 %
8617 %    o bias: the image bias.
8618 %
8619 */
8620 WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
8621   const double bias)
8622 {
8623   assert(wand != (MagickWand *) NULL);
8624   assert(wand->signature == WandSignature);
8625   if (wand->debug != MagickFalse)
8626     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8627   if (wand->images == (Image *) NULL)
8628     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8629   wand->images->bias=bias;
8630   return(MagickTrue);
8631 }
8632 \f
8633 /*
8634 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8635 %                                                                             %
8636 %                                                                             %
8637 %                                                                             %
8638 %   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                         %
8639 %                                                                             %
8640 %                                                                             %
8641 %                                                                             %
8642 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8643 %
8644 %  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
8645 %
8646 %  The format of the MagickSetImageBluePrimary method is:
8647 %
8648 %      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8649 %        const double x,const double y)
8650 %
8651 %  A description of each parameter follows:
8652 %
8653 %    o wand: the magick wand.
8654 %
8655 %    o x: the blue primary x-point.
8656 %
8657 %    o y: the blue primary y-point.
8658 %
8659 */
8660 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
8661   const double x,const double y)
8662 {
8663   assert(wand != (MagickWand *) NULL);
8664   assert(wand->signature == WandSignature);
8665   if (wand->debug != MagickFalse)
8666     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8667   if (wand->images == (Image *) NULL)
8668     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8669   wand->images->chromaticity.blue_primary.x=x;
8670   wand->images->chromaticity.blue_primary.y=y;
8671   return(MagickTrue);
8672 }
8673 \f
8674 /*
8675 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8676 %                                                                             %
8677 %                                                                             %
8678 %                                                                             %
8679 %   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                         %
8680 %                                                                             %
8681 %                                                                             %
8682 %                                                                             %
8683 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8684 %
8685 %  MagickSetImageBorderColor() sets the image border color.
8686 %
8687 %  The format of the MagickSetImageBorderColor method is:
8688 %
8689 %      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8690 %        const PixelWand *border)
8691 %
8692 %  A description of each parameter follows:
8693 %
8694 %    o wand: the magick wand.
8695 %
8696 %    o border: the border pixel wand.
8697 %
8698 */
8699 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
8700   const PixelWand *border)
8701 {
8702   assert(wand != (MagickWand *) NULL);
8703   assert(wand->signature == WandSignature);
8704   if (wand->debug != MagickFalse)
8705     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8706   if (wand->images == (Image *) NULL)
8707     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8708   PixelGetQuantumPacket(border,&wand->images->border_color);
8709   return(MagickTrue);
8710 }
8711 \f
8712 /*
8713 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8714 %                                                                             %
8715 %                                                                             %
8716 %                                                                             %
8717 %   M a g i c k S e t I m a g e C l i p M a s k                               %
8718 %                                                                             %
8719 %                                                                             %
8720 %                                                                             %
8721 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8722 %
8723 %  MagickSetImageClipMask() sets image clip mask.
8724 %
8725 %  The format of the MagickSetImageClipMask method is:
8726 %
8727 %      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8728 %        const MagickWand *clip_mask)
8729 %
8730 %  A description of each parameter follows:
8731 %
8732 %    o wand: the magick wand.
8733 %
8734 %    o clip_mask: the clip_mask wand.
8735 %
8736 */
8737 WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
8738   const MagickWand *clip_mask)
8739 {
8740   assert(wand != (MagickWand *) NULL);
8741   assert(wand->signature == WandSignature);
8742   if (wand->debug != MagickFalse)
8743     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8744   assert(clip_mask != (MagickWand *) NULL);
8745   assert(clip_mask->signature == WandSignature);
8746   if (wand->debug != MagickFalse)
8747     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
8748   if (clip_mask->images == (Image *) NULL)
8749     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8750   return(SetImageClipMask(wand->images,clip_mask->images,wand->exception));
8751 }
8752 \f
8753 /*
8754 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8755 %                                                                             %
8756 %                                                                             %
8757 %                                                                             %
8758 %   M a g i c k S e t I m a g e C o l o r                                     %
8759 %                                                                             %
8760 %                                                                             %
8761 %                                                                             %
8762 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8763 %
8764 %  MagickSetImageColor() set the entire wand canvas to the specified color.
8765 %
8766 %  The format of the MagickSetImageColor method is:
8767 %
8768 %      MagickBooleanType MagickSetImageColor(MagickWand *wand,
8769 %        const PixelWand *color)
8770 %
8771 %  A description of each parameter follows:
8772 %
8773 %    o wand: the magick wand.
8774 %
8775 %    o background: the image color.
8776 %
8777 */
8778 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
8779   const PixelWand *color)
8780 {
8781   MagickBooleanType
8782     status;
8783
8784   PixelInfo
8785     pixel;
8786
8787   assert(wand != (MagickWand *) NULL);
8788   assert(wand->signature == WandSignature);
8789   if (wand->debug != MagickFalse)
8790     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8791   PixelGetMagickColor(color,&pixel);
8792   status=SetImageColor(wand->images,&pixel);
8793   if (status == MagickFalse)
8794     InheritException(wand->exception,&wand->images->exception);
8795   return(status);
8796 }
8797 \f
8798 /*
8799 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8800 %                                                                             %
8801 %                                                                             %
8802 %                                                                             %
8803 %   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                     %
8804 %                                                                             %
8805 %                                                                             %
8806 %                                                                             %
8807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8808 %
8809 %  MagickSetImageColormapColor() sets the color of the specified colormap
8810 %  index.
8811 %
8812 %  The format of the MagickSetImageColormapColor method is:
8813 %
8814 %      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8815 %        const size_t index,const PixelWand *color)
8816 %
8817 %  A description of each parameter follows:
8818 %
8819 %    o wand: the magick wand.
8820 %
8821 %    o index: the offset into the image colormap.
8822 %
8823 %    o color: Return the colormap color in this wand.
8824 %
8825 */
8826 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
8827   const size_t index,const PixelWand *color)
8828 {
8829   assert(wand != (MagickWand *) NULL);
8830   assert(wand->signature == WandSignature);
8831   if (wand->debug != MagickFalse)
8832     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8833   if (wand->images == (Image *) NULL)
8834     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8835   if ((wand->images->colormap == (PixelPacket *) NULL) ||
8836       (index >= wand->images->colors))
8837     ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
8838   PixelGetQuantumPacket(color,wand->images->colormap+index);
8839   return(SyncImage(wand->images));
8840 }
8841 \f
8842 /*
8843 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8844 %                                                                             %
8845 %                                                                             %
8846 %                                                                             %
8847 %   M a g i c k S e t I m a g e C o l o r s p a c e                           %
8848 %                                                                             %
8849 %                                                                             %
8850 %                                                                             %
8851 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8852 %
8853 %  MagickSetImageColorspace() sets the image colorspace.
8854 %
8855 %  The format of the MagickSetImageColorspace method is:
8856 %
8857 %      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8858 %        const ColorspaceType colorspace)
8859 %
8860 %  A description of each parameter follows:
8861 %
8862 %    o wand: the magick wand.
8863 %
8864 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
8865 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
8866 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
8867 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
8868 %      HSLColorspace, or HWBColorspace.
8869 %
8870 */
8871 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
8872   const ColorspaceType colorspace)
8873 {
8874   assert(wand != (MagickWand *) NULL);
8875   assert(wand->signature == WandSignature);
8876   if (wand->debug != MagickFalse)
8877     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8878   if (wand->images == (Image *) NULL)
8879     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8880   return(SetImageColorspace(wand->images,colorspace,&wand->images->exception));
8881 }
8882 \f
8883 /*
8884 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8885 %                                                                             %
8886 %                                                                             %
8887 %                                                                             %
8888 %   M a g i c k S e t I m a g e C o m p o s e                                 %
8889 %                                                                             %
8890 %                                                                             %
8891 %                                                                             %
8892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8893 %
8894 %  MagickSetImageCompose() sets the image composite operator, useful for
8895 %  specifying how to composite the image thumbnail when using the
8896 %  MagickMontageImage() method.
8897 %
8898 %  The format of the MagickSetImageCompose method is:
8899 %
8900 %      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8901 %        const CompositeOperator compose)
8902 %
8903 %  A description of each parameter follows:
8904 %
8905 %    o wand: the magick wand.
8906 %
8907 %    o compose: the image composite operator.
8908 %
8909 */
8910 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
8911   const CompositeOperator compose)
8912 {
8913   assert(wand != (MagickWand *) NULL);
8914   assert(wand->signature == WandSignature);
8915   if (wand->debug != MagickFalse)
8916     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8917   if (wand->images == (Image *) NULL)
8918     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8919   wand->images->compose=compose;
8920   return(MagickTrue);
8921 }
8922 \f
8923 /*
8924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8925 %                                                                             %
8926 %                                                                             %
8927 %                                                                             %
8928 %   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                         %
8929 %                                                                             %
8930 %                                                                             %
8931 %                                                                             %
8932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8933 %
8934 %  MagickSetImageCompression() sets the image compression.
8935 %
8936 %  The format of the MagickSetImageCompression method is:
8937 %
8938 %      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8939 %        const CompressionType compression)
8940 %
8941 %  A description of each parameter follows:
8942 %
8943 %    o wand: the magick wand.
8944 %
8945 %    o compression: the image compression type.
8946 %
8947 */
8948 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
8949   const CompressionType compression)
8950 {
8951   assert(wand != (MagickWand *) NULL);
8952   assert(wand->signature == WandSignature);
8953   if (wand->debug != MagickFalse)
8954     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8955   if (wand->images == (Image *) NULL)
8956     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8957   wand->images->compression=compression;
8958   return(MagickTrue);
8959 }
8960 \f
8961 /*
8962 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8963 %                                                                             %
8964 %                                                                             %
8965 %                                                                             %
8966 %   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           %
8967 %                                                                             %
8968 %                                                                             %
8969 %                                                                             %
8970 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8971 %
8972 %  MagickSetImageCompressionQuality() sets the image compression quality.
8973 %
8974 %  The format of the MagickSetImageCompressionQuality method is:
8975 %
8976 %      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
8977 %        const size_t quality)
8978 %
8979 %  A description of each parameter follows:
8980 %
8981 %    o wand: the magick wand.
8982 %
8983 %    o quality: the image compression tlityype.
8984 %
8985 */
8986 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
8987   const size_t quality)
8988 {
8989   assert(wand != (MagickWand *) NULL);
8990   assert(wand->signature == WandSignature);
8991   if (wand->debug != MagickFalse)
8992     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8993   if (wand->images == (Image *) NULL)
8994     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8995   wand->images->quality=quality;
8996   return(MagickTrue);
8997 }
8998 \f
8999 /*
9000 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9001 %                                                                             %
9002 %                                                                             %
9003 %                                                                             %
9004 %   M a g i c k S e t I m a g e D e l a y                                     %
9005 %                                                                             %
9006 %                                                                             %
9007 %                                                                             %
9008 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9009 %
9010 %  MagickSetImageDelay() sets the image delay.
9011 %
9012 %  The format of the MagickSetImageDelay method is:
9013 %
9014 %      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9015 %        const size_t delay)
9016 %
9017 %  A description of each parameter follows:
9018 %
9019 %    o wand: the magick wand.
9020 %
9021 %    o delay: the image delay in ticks-per-second units.
9022 %
9023 */
9024 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9025   const size_t delay)
9026 {
9027   assert(wand != (MagickWand *) NULL);
9028   assert(wand->signature == WandSignature);
9029   if (wand->debug != MagickFalse)
9030     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9031   if (wand->images == (Image *) NULL)
9032     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9033   wand->images->delay=delay;
9034   return(MagickTrue);
9035 }
9036 \f
9037 /*
9038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9039 %                                                                             %
9040 %                                                                             %
9041 %                                                                             %
9042 %   M a g i c k S e t I m a g e D e p t h                                     %
9043 %                                                                             %
9044 %                                                                             %
9045 %                                                                             %
9046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9047 %
9048 %  MagickSetImageDepth() sets the image depth.
9049 %
9050 %  The format of the MagickSetImageDepth method is:
9051 %
9052 %      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9053 %        const size_t depth)
9054 %
9055 %  A description of each parameter follows:
9056 %
9057 %    o wand: the magick wand.
9058 %
9059 %    o depth: the image depth in bits: 8, 16, or 32.
9060 %
9061 */
9062 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9063   const size_t depth)
9064 {
9065   assert(wand != (MagickWand *) NULL);
9066   assert(wand->signature == WandSignature);
9067   if (wand->debug != MagickFalse)
9068     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9069   if (wand->images == (Image *) NULL)
9070     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9071   return(SetImageDepth(wand->images,depth));
9072 }
9073 \f
9074 /*
9075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9076 %                                                                             %
9077 %                                                                             %
9078 %                                                                             %
9079 %   M a g i c k S e t I m a g e D i s p o s e                                 %
9080 %                                                                             %
9081 %                                                                             %
9082 %                                                                             %
9083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9084 %
9085 %  MagickSetImageDispose() sets the image disposal method.
9086 %
9087 %  The format of the MagickSetImageDispose method is:
9088 %
9089 %      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9090 %        const DisposeType dispose)
9091 %
9092 %  A description of each parameter follows:
9093 %
9094 %    o wand: the magick wand.
9095 %
9096 %    o dispose: the image disposeal type.
9097 %
9098 */
9099 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9100   const DisposeType dispose)
9101 {
9102   assert(wand != (MagickWand *) NULL);
9103   assert(wand->signature == WandSignature);
9104   if (wand->debug != MagickFalse)
9105     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9106   if (wand->images == (Image *) NULL)
9107     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9108   wand->images->dispose=dispose;
9109   return(MagickTrue);
9110 }
9111 \f
9112 /*
9113 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9114 %                                                                             %
9115 %                                                                             %
9116 %                                                                             %
9117 %   M a g i c k S e t I m a g e E x t e n t                                   %
9118 %                                                                             %
9119 %                                                                             %
9120 %                                                                             %
9121 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9122 %
9123 %  MagickSetImageExtent() sets the image size (i.e. columns & rows).
9124 %
9125 %  The format of the MagickSetImageExtent method is:
9126 %
9127 %      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9128 %        const size_t columns,const unsigned rows)
9129 %
9130 %  A description of each parameter follows:
9131 %
9132 %    o wand: the magick wand.
9133 %
9134 %    o columns:  The image width in pixels.
9135 %
9136 %    o rows:  The image height in pixels.
9137 %
9138 */
9139 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
9140   const size_t columns,const size_t rows)
9141 {
9142   assert(wand != (MagickWand *) NULL);
9143   assert(wand->signature == WandSignature);
9144   if (wand->debug != MagickFalse)
9145     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9146   if (wand->images == (Image *) NULL)
9147     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9148   return(SetImageExtent(wand->images,columns,rows,&wand->images->exception));
9149 }
9150 \f
9151 /*
9152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9153 %                                                                             %
9154 %                                                                             %
9155 %                                                                             %
9156 %   M a g i c k S e t I m a g e F i l e n a m e                               %
9157 %                                                                             %
9158 %                                                                             %
9159 %                                                                             %
9160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9161 %
9162 %  MagickSetImageFilename() sets the filename of a particular image in a
9163 %  sequence.
9164 %
9165 %  The format of the MagickSetImageFilename method is:
9166 %
9167 %      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9168 %        const char *filename)
9169 %
9170 %  A description of each parameter follows:
9171 %
9172 %    o wand: the magick wand.
9173 %
9174 %    o filename: the image filename.
9175 %
9176 */
9177 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
9178   const char *filename)
9179 {
9180   assert(wand != (MagickWand *) NULL);
9181   assert(wand->signature == WandSignature);
9182   if (wand->debug != MagickFalse)
9183     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9184   if (wand->images == (Image *) NULL)
9185     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9186   if (filename != (const char *) NULL)
9187     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
9188   return(MagickTrue);
9189 }
9190 \f
9191 /*
9192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9193 %                                                                             %
9194 %                                                                             %
9195 %                                                                             %
9196 %   M a g i c k S e t I m a g e F o r m a t                                   %
9197 %                                                                             %
9198 %                                                                             %
9199 %                                                                             %
9200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9201 %
9202 %  MagickSetImageFormat() sets the format of a particular image in a
9203 %  sequence.
9204 %
9205 %  The format of the MagickSetImageFormat method is:
9206 %
9207 %      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9208 %        const char *format)
9209 %
9210 %  A description of each parameter follows:
9211 %
9212 %    o wand: the magick wand.
9213 %
9214 %    o format: the image format.
9215 %
9216 */
9217 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
9218   const char *format)
9219 {
9220   const MagickInfo
9221     *magick_info;
9222
9223   assert(wand != (MagickWand *) NULL);
9224   assert(wand->signature == WandSignature);
9225   if (wand->debug != MagickFalse)
9226     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9227   if (wand->images == (Image *) NULL)
9228     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9229   if ((format == (char *) NULL) || (*format == '\0'))
9230     {
9231       *wand->images->magick='\0';
9232       return(MagickTrue);
9233     }
9234   magick_info=GetMagickInfo(format,wand->exception);
9235   if (magick_info == (const MagickInfo *) NULL)
9236     return(MagickFalse);
9237   ClearMagickException(wand->exception);
9238   (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
9239   return(MagickTrue);
9240 }
9241 \f
9242 /*
9243 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9244 %                                                                             %
9245 %                                                                             %
9246 %                                                                             %
9247 %   M a g i c k S e t I m a g e F u z z                                       %
9248 %                                                                             %
9249 %                                                                             %
9250 %                                                                             %
9251 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9252 %
9253 %  MagickSetImageFuzz() sets the image fuzz.
9254 %
9255 %  The format of the MagickSetImageFuzz method is:
9256 %
9257 %      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9258 %        const double fuzz)
9259 %
9260 %  A description of each parameter follows:
9261 %
9262 %    o wand: the magick wand.
9263 %
9264 %    o fuzz: the image fuzz.
9265 %
9266 */
9267 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
9268   const double fuzz)
9269 {
9270   assert(wand != (MagickWand *) NULL);
9271   assert(wand->signature == WandSignature);
9272   if (wand->debug != MagickFalse)
9273     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9274   if (wand->images == (Image *) NULL)
9275     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9276   wand->images->fuzz=fuzz;
9277   return(MagickTrue);
9278 }
9279 \f
9280 /*
9281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9282 %                                                                             %
9283 %                                                                             %
9284 %                                                                             %
9285 %   M a g i c k S e t I m a g e G a m m a                                     %
9286 %                                                                             %
9287 %                                                                             %
9288 %                                                                             %
9289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9290 %
9291 %  MagickSetImageGamma() sets the image gamma.
9292 %
9293 %  The format of the MagickSetImageGamma method is:
9294 %
9295 %      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9296 %        const double gamma)
9297 %
9298 %  A description of each parameter follows:
9299 %
9300 %    o wand: the magick wand.
9301 %
9302 %    o gamma: the image gamma.
9303 %
9304 */
9305 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
9306   const double gamma)
9307 {
9308   assert(wand != (MagickWand *) NULL);
9309   assert(wand->signature == WandSignature);
9310   if (wand->debug != MagickFalse)
9311     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9312   if (wand->images == (Image *) NULL)
9313     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9314   wand->images->gamma=gamma;
9315   return(MagickTrue);
9316 }
9317 \f
9318 /*
9319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9320 %                                                                             %
9321 %                                                                             %
9322 %                                                                             %
9323 %   M a g i c k S e t I m a g e G r a v i t y                                 %
9324 %                                                                             %
9325 %                                                                             %
9326 %                                                                             %
9327 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9328 %
9329 %  MagickSetImageGravity() sets the image gravity type.
9330 %
9331 %  The format of the MagickSetImageGravity method is:
9332 %
9333 %      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9334 %        const GravityType gravity)
9335 %
9336 %  A description of each parameter follows:
9337 %
9338 %    o wand: the magick wand.
9339 %
9340 %    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
9341 %      PlaneInterlace, PartitionInterlace.
9342 %
9343 */
9344 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
9345   const GravityType gravity)
9346 {
9347   assert(wand != (MagickWand *) NULL);
9348   assert(wand->signature == WandSignature);
9349   if (wand->debug != MagickFalse)
9350     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9351   if (wand->images == (Image *) NULL)
9352     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9353   wand->images->gravity=gravity;
9354   return(MagickTrue);
9355 }
9356 \f
9357 /*
9358 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9359 %                                                                             %
9360 %                                                                             %
9361 %                                                                             %
9362 %   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                       %
9363 %                                                                             %
9364 %                                                                             %
9365 %                                                                             %
9366 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9367 %
9368 %  MagickSetImageGreenPrimary() sets the image chromaticity green primary
9369 %  point.
9370 %
9371 %  The format of the MagickSetImageGreenPrimary method is:
9372 %
9373 %      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9374 %        const double x,const double y)
9375 %
9376 %  A description of each parameter follows:
9377 %
9378 %    o wand: the magick wand.
9379 %
9380 %    o x: the green primary x-point.
9381 %
9382 %    o y: the green primary y-point.
9383 %
9384 %
9385 */
9386 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
9387   const double x,const double y)
9388 {
9389   assert(wand != (MagickWand *) NULL);
9390   assert(wand->signature == WandSignature);
9391   if (wand->debug != MagickFalse)
9392     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9393   if (wand->images == (Image *) NULL)
9394     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9395   wand->images->chromaticity.green_primary.x=x;
9396   wand->images->chromaticity.green_primary.y=y;
9397   return(MagickTrue);
9398 }
9399 \f
9400 /*
9401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9402 %                                                                             %
9403 %                                                                             %
9404 %                                                                             %
9405 %   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                 %
9406 %                                                                             %
9407 %                                                                             %
9408 %                                                                             %
9409 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9410 %
9411 %  MagickSetImageInterlaceScheme() sets the image interlace scheme.
9412 %
9413 %  The format of the MagickSetImageInterlaceScheme method is:
9414 %
9415 %      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9416 %        const InterlaceType interlace)
9417 %
9418 %  A description of each parameter follows:
9419 %
9420 %    o wand: the magick wand.
9421 %
9422 %    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
9423 %      PlaneInterlace, PartitionInterlace.
9424 %
9425 */
9426 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
9427   const InterlaceType interlace)
9428 {
9429   assert(wand != (MagickWand *) NULL);
9430   assert(wand->signature == WandSignature);
9431   if (wand->debug != MagickFalse)
9432     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9433   if (wand->images == (Image *) NULL)
9434     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9435   wand->images->interlace=interlace;
9436   return(MagickTrue);
9437 }
9438 \f
9439 /*
9440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9441 %                                                                             %
9442 %                                                                             %
9443 %                                                                             %
9444 %   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             %
9445 %                                                                             %
9446 %                                                                             %
9447 %                                                                             %
9448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9449 %
9450 %  MagickSetImagePixelInterpolateMethod() sets the image interpolate pixel method.
9451 %
9452 %  The format of the MagickSetImagePixelInterpolateMethod method is:
9453 %
9454 %      MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9455 %        const PixelInterpolateMethod method)
9456 %
9457 %  A description of each parameter follows:
9458 %
9459 %    o wand: the magick wand.
9460 %
9461 %    o method: the image interpole pixel methods: choose from Undefined,
9462 %      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
9463 %
9464 */
9465 WandExport MagickBooleanType MagickSetImagePixelInterpolateMethod(MagickWand *wand,
9466   const PixelInterpolateMethod method)
9467 {
9468   assert(wand != (MagickWand *) NULL);
9469   assert(wand->signature == WandSignature);
9470   if (wand->debug != MagickFalse)
9471     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9472   if (wand->images == (Image *) NULL)
9473     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9474   wand->images->interpolate=method;
9475   return(MagickTrue);
9476 }
9477 \f
9478 /*
9479 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9480 %                                                                             %
9481 %                                                                             %
9482 %                                                                             %
9483 %   M a g i c k S e t I m a g e I t e r a t i o n s                           %
9484 %                                                                             %
9485 %                                                                             %
9486 %                                                                             %
9487 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9488 %
9489 %  MagickSetImageIterations() sets the image iterations.
9490 %
9491 %  The format of the MagickSetImageIterations method is:
9492 %
9493 %      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9494 %        const size_t iterations)
9495 %
9496 %  A description of each parameter follows:
9497 %
9498 %    o wand: the magick wand.
9499 %
9500 %    o delay: the image delay in 1/100th of a second.
9501 %
9502 */
9503 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
9504   const size_t iterations)
9505 {
9506   assert(wand != (MagickWand *) NULL);
9507   assert(wand->signature == WandSignature);
9508   if (wand->debug != MagickFalse)
9509     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9510   if (wand->images == (Image *) NULL)
9511     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9512   wand->images->iterations=iterations;
9513   return(MagickTrue);
9514 }
9515 \f
9516 /*
9517 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9518 %                                                                             %
9519 %                                                                             %
9520 %                                                                             %
9521 %   M a g i c k S e t I m a g e M a t t e                                     %
9522 %                                                                             %
9523 %                                                                             %
9524 %                                                                             %
9525 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9526 %
9527 %  MagickSetImageMatte() sets the image matte channel.
9528 %
9529 %  The format of the MagickSetImageMatteColor method is:
9530 %
9531 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9532 %        const MagickBooleanType *matte)
9533 %
9534 %  A description of each parameter follows:
9535 %
9536 %    o wand: the magick wand.
9537 %
9538 %    o matte: Set to MagickTrue to enable the image matte channel otherwise
9539 %      MagickFalse.
9540 %
9541 */
9542 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
9543   const MagickBooleanType matte)
9544 {
9545   assert(wand != (MagickWand *) NULL);
9546   assert(wand->signature == WandSignature);
9547   if (wand->debug != MagickFalse)
9548     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9549   if (wand->images == (Image *) NULL)
9550     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9551   if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
9552     (void) SetImageOpacity(wand->images,OpaqueAlpha);
9553   wand->images->matte=matte;
9554   return(MagickTrue);
9555 }
9556 \f
9557 /*
9558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9559 %                                                                             %
9560 %                                                                             %
9561 %                                                                             %
9562 %   M a g i c k S e t I m a g e M a t t e C o l o r                           %
9563 %                                                                             %
9564 %                                                                             %
9565 %                                                                             %
9566 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9567 %
9568 %  MagickSetImageMatteColor() sets the image matte color.
9569 %
9570 %  The format of the MagickSetImageMatteColor method is:
9571 %
9572 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9573 %        const PixelWand *matte)
9574 %
9575 %  A description of each parameter follows:
9576 %
9577 %    o wand: the magick wand.
9578 %
9579 %    o matte: the matte pixel wand.
9580 %
9581 */
9582 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
9583   const PixelWand *matte)
9584 {
9585   assert(wand != (MagickWand *) NULL);
9586   assert(wand->signature == WandSignature);
9587   if (wand->debug != MagickFalse)
9588     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9589   if (wand->images == (Image *) NULL)
9590     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9591   PixelGetQuantumPacket(matte,&wand->images->matte_color);
9592   return(MagickTrue);
9593 }
9594 \f
9595 /*
9596 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9597 %                                                                             %
9598 %                                                                             %
9599 %                                                                             %
9600 %   M a g i c k S e t I m a g e O p a c i t y                                 %
9601 %                                                                             %
9602 %                                                                             %
9603 %                                                                             %
9604 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9605 %
9606 %  MagickSetImageOpacity() sets the image to the specified opacity level.
9607 %
9608 %  The format of the MagickSetImageOpacity method is:
9609 %
9610 %      MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
9611 %        const double alpha)
9612 %
9613 %  A description of each parameter follows:
9614 %
9615 %    o wand: the magick wand.
9616 %
9617 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
9618 %      transparent.
9619 %
9620 */
9621 WandExport MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
9622   const double alpha)
9623 {
9624   MagickBooleanType
9625     status;
9626
9627   assert(wand != (MagickWand *) NULL);
9628   assert(wand->signature == WandSignature);
9629   if (wand->debug != MagickFalse)
9630     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9631   if (wand->images == (Image *) NULL)
9632     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9633   status=SetImageOpacity(wand->images,ClampToQuantum(QuantumRange*alpha));
9634   if (status == MagickFalse)
9635     InheritException(wand->exception,&wand->images->exception);
9636   return(status);
9637 }
9638 \f
9639 /*
9640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9641 %                                                                             %
9642 %                                                                             %
9643 %                                                                             %
9644 %   M a g i c k S e t I m a g e O r i e n t a t i o n                         %
9645 %                                                                             %
9646 %                                                                             %
9647 %                                                                             %
9648 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9649 %
9650 %  MagickSetImageOrientation() sets the image orientation.
9651 %
9652 %  The format of the MagickSetImageOrientation method is:
9653 %
9654 %      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9655 %        const OrientationType orientation)
9656 %
9657 %  A description of each parameter follows:
9658 %
9659 %    o wand: the magick wand.
9660 %
9661 %    o orientation: the image orientation type.
9662 %
9663 */
9664 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
9665   const OrientationType orientation)
9666 {
9667   assert(wand != (MagickWand *) NULL);
9668   assert(wand->signature == WandSignature);
9669   if (wand->debug != MagickFalse)
9670     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9671   if (wand->images == (Image *) NULL)
9672     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9673   wand->images->orientation=orientation;
9674   return(MagickTrue);
9675 }
9676 \f
9677 /*
9678 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9679 %                                                                             %
9680 %                                                                             %
9681 %                                                                             %
9682 %   M a g i c k S e t I m a g e P a g e                                       %
9683 %                                                                             %
9684 %                                                                             %
9685 %                                                                             %
9686 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9687 %
9688 %  MagickSetImagePage() sets the page geometry of the image.
9689 %
9690 %  The format of the MagickSetImagePage method is:
9691 %
9692 %      MagickBooleanType MagickSetImagePage(MagickWand *wand,
9693 %        const size_t width,const size_t height,const ssize_t x,
9694 %        const ssize_t y)
9695 %
9696 %  A description of each parameter follows:
9697 %
9698 %    o wand: the magick wand.
9699 %
9700 %    o width: the page width.
9701 %
9702 %    o height: the page height.
9703 %
9704 %    o x: the page x-offset.
9705 %
9706 %    o y: the page y-offset.
9707 %
9708 */
9709 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
9710   const size_t width,const size_t height,const ssize_t x,
9711   const ssize_t y)
9712 {
9713   assert(wand != (MagickWand *) NULL);
9714   assert(wand->signature == WandSignature);
9715   if (wand->debug != MagickFalse)
9716     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9717   if (wand->images == (Image *) NULL)
9718     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9719   wand->images->page.width=width;
9720   wand->images->page.height=height;
9721   wand->images->page.x=x;
9722   wand->images->page.y=y;
9723   return(MagickTrue);
9724 }
9725 \f
9726 /*
9727 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9728 %                                                                             %
9729 %                                                                             %
9730 %                                                                             %
9731 %   M a g i c k S e t I m a g e P r o g r e s s M o n i t o r                 %
9732 %                                                                             %
9733 %                                                                             %
9734 %                                                                             %
9735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9736 %
9737 %  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
9738 %  specified method and returns the previous progress monitor if any.  The
9739 %  progress monitor method looks like this:
9740 %
9741 %    MagickBooleanType MagickProgressMonitor(const char *text,
9742 %      const MagickOffsetType offset,const MagickSizeType span,
9743 %      void *client_data)
9744 %
9745 %  If the progress monitor returns MagickFalse, the current operation is
9746 %  interrupted.
9747 %
9748 %  The format of the MagickSetImageProgressMonitor method is:
9749 %
9750 %      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
9751 %        const MagickProgressMonitor progress_monitor,void *client_data)
9752 %
9753 %  A description of each parameter follows:
9754 %
9755 %    o wand: the magick wand.
9756 %
9757 %    o progress_monitor: Specifies a pointer to a method to monitor progress
9758 %      of an image operation.
9759 %
9760 %    o client_data: Specifies a pointer to any client data.
9761 %
9762 */
9763 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
9764   const MagickProgressMonitor progress_monitor,void *client_data)
9765 {
9766   MagickProgressMonitor
9767     previous_monitor;
9768
9769   assert(wand != (MagickWand *) NULL);
9770   assert(wand->signature == WandSignature);
9771   if (wand->debug != MagickFalse)
9772     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9773   if (wand->images == (Image *) NULL)
9774     {
9775       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
9776         "ContainsNoImages","`%s'",wand->name);
9777       return((MagickProgressMonitor) NULL);
9778     }
9779   previous_monitor=SetImageProgressMonitor(wand->images,
9780     progress_monitor,client_data);
9781   return(previous_monitor);
9782 }
9783 \f
9784 /*
9785 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9786 %                                                                             %
9787 %                                                                             %
9788 %                                                                             %
9789 %   M a g i c k S e t I m a g e R e d P r i m a r y                           %
9790 %                                                                             %
9791 %                                                                             %
9792 %                                                                             %
9793 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9794 %
9795 %  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
9796 %
9797 %  The format of the MagickSetImageRedPrimary method is:
9798 %
9799 %      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9800 %        const double x,const double y)
9801 %
9802 %  A description of each parameter follows:
9803 %
9804 %    o wand: the magick wand.
9805 %
9806 %    o x: the red primary x-point.
9807 %
9808 %    o y: the red primary y-point.
9809 %
9810 */
9811 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
9812   const double x,const double y)
9813 {
9814   assert(wand != (MagickWand *) NULL);
9815   assert(wand->signature == WandSignature);
9816   if (wand->debug != MagickFalse)
9817     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9818   if (wand->images == (Image *) NULL)
9819     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9820   wand->images->chromaticity.red_primary.x=x;
9821   wand->images->chromaticity.red_primary.y=y;
9822   return(MagickTrue);
9823 }
9824 \f
9825 /*
9826 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9827 %                                                                             %
9828 %                                                                             %
9829 %                                                                             %
9830 %   M a g i c k S e t I m a g e R e n d e r i n g I n t e n t                 %
9831 %                                                                             %
9832 %                                                                             %
9833 %                                                                             %
9834 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9835 %
9836 %  MagickSetImageRenderingIntent() sets the image rendering intent.
9837 %
9838 %  The format of the MagickSetImageRenderingIntent method is:
9839 %
9840 %      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9841 %        const RenderingIntent rendering_intent)
9842 %
9843 %  A description of each parameter follows:
9844 %
9845 %    o wand: the magick wand.
9846 %
9847 %    o rendering_intent: the image rendering intent: UndefinedIntent,
9848 %      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
9849 %
9850 */
9851 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
9852   const RenderingIntent rendering_intent)
9853 {
9854   assert(wand != (MagickWand *) NULL);
9855   assert(wand->signature == WandSignature);
9856   if (wand->debug != MagickFalse)
9857     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9858   if (wand->images == (Image *) NULL)
9859     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9860   wand->images->rendering_intent=rendering_intent;
9861   return(MagickTrue);
9862 }
9863 \f
9864 /*
9865 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9866 %                                                                             %
9867 %                                                                             %
9868 %                                                                             %
9869 %   M a g i c k S e t I m a g e R e s o l u t i o n                           %
9870 %                                                                             %
9871 %                                                                             %
9872 %                                                                             %
9873 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9874 %
9875 %  MagickSetImageResolution() sets the image resolution.
9876 %
9877 %  The format of the MagickSetImageResolution method is:
9878 %
9879 %      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9880 %        const double x_resolution,const doubtl y_resolution)
9881 %
9882 %  A description of each parameter follows:
9883 %
9884 %    o wand: the magick wand.
9885 %
9886 %    o x_resolution: the image x resolution.
9887 %
9888 %    o y_resolution: the image y resolution.
9889 %
9890 */
9891 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
9892   const double x_resolution,const double y_resolution)
9893 {
9894   assert(wand != (MagickWand *) NULL);
9895   assert(wand->signature == WandSignature);
9896   if (wand->debug != MagickFalse)
9897     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9898   if (wand->images == (Image *) NULL)
9899     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9900   wand->images->x_resolution=x_resolution;
9901   wand->images->y_resolution=y_resolution;
9902   return(MagickTrue);
9903 }
9904 \f
9905 /*
9906 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9907 %                                                                             %
9908 %                                                                             %
9909 %                                                                             %
9910 %   M a g i c k S e t I m a g e S c e n e                                     %
9911 %                                                                             %
9912 %                                                                             %
9913 %                                                                             %
9914 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9915 %
9916 %  MagickSetImageScene() sets the image scene.
9917 %
9918 %  The format of the MagickSetImageScene method is:
9919 %
9920 %      MagickBooleanType MagickSetImageScene(MagickWand *wand,
9921 %        const size_t scene)
9922 %
9923 %  A description of each parameter follows:
9924 %
9925 %    o wand: the magick wand.
9926 %
9927 %    o delay: the image scene number.
9928 %
9929 */
9930 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
9931   const size_t scene)
9932 {
9933   assert(wand != (MagickWand *) NULL);
9934   assert(wand->signature == WandSignature);
9935   if (wand->debug != MagickFalse)
9936     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9937   if (wand->images == (Image *) NULL)
9938     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9939   wand->images->scene=scene;
9940   return(MagickTrue);
9941 }
9942 \f
9943 /*
9944 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9945 %                                                                             %
9946 %                                                                             %
9947 %                                                                             %
9948 %   M a g i c k S e t I m a g e T i c k s P e r S e c o n d                   %
9949 %                                                                             %
9950 %                                                                             %
9951 %                                                                             %
9952 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9953 %
9954 %  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
9955 %
9956 %  The format of the MagickSetImageTicksPerSecond method is:
9957 %
9958 %      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9959 %        const ssize_t ticks_per-second)
9960 %
9961 %  A description of each parameter follows:
9962 %
9963 %    o wand: the magick wand.
9964 %
9965 %    o ticks_per_second: the units to use for the image delay.
9966 %
9967 */
9968 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
9969   const ssize_t ticks_per_second)
9970 {
9971   assert(wand != (MagickWand *) NULL);
9972   assert(wand->signature == WandSignature);
9973   if (wand->debug != MagickFalse)
9974     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9975   if (wand->images == (Image *) NULL)
9976     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9977   wand->images->ticks_per_second=ticks_per_second;
9978   return(MagickTrue);
9979 }
9980 \f
9981 /*
9982 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9983 %                                                                             %
9984 %                                                                             %
9985 %                                                                             %
9986 %   M a g i c k S e t I m a g e T y p e                                       %
9987 %                                                                             %
9988 %                                                                             %
9989 %                                                                             %
9990 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9991 %
9992 %  MagickSetImageType() sets the image type.
9993 %
9994 %  The format of the MagickSetImageType method is:
9995 %
9996 %      MagickBooleanType MagickSetImageType(MagickWand *wand,
9997 %        const ImageType image_type)
9998 %
9999 %  A description of each parameter follows:
10000 %
10001 %    o wand: the magick wand.
10002 %
10003 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10004 %      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10005 %      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10006 %      or OptimizeType.
10007 %
10008 */
10009 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10010   const ImageType image_type)
10011 {
10012   assert(wand != (MagickWand *) NULL);
10013   assert(wand->signature == WandSignature);
10014   if (wand->debug != MagickFalse)
10015     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10016   if (wand->images == (Image *) NULL)
10017     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10018   return(SetImageType(wand->images,image_type,wand->exception));
10019 }
10020 \f
10021 /*
10022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10023 %                                                                             %
10024 %                                                                             %
10025 %                                                                             %
10026 %   M a g i c k S e t I m a g e U n i t s                                     %
10027 %                                                                             %
10028 %                                                                             %
10029 %                                                                             %
10030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10031 %
10032 %  MagickSetImageUnits() sets the image units of resolution.
10033 %
10034 %  The format of the MagickSetImageUnits method is:
10035 %
10036 %      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10037 %        const ResolutionType units)
10038 %
10039 %  A description of each parameter follows:
10040 %
10041 %    o wand: the magick wand.
10042 %
10043 %    o units: the image units of resolution : UndefinedResolution,
10044 %      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10045 %
10046 */
10047 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10048   const ResolutionType units)
10049 {
10050   assert(wand != (MagickWand *) NULL);
10051   assert(wand->signature == WandSignature);
10052   if (wand->debug != MagickFalse)
10053     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10054   if (wand->images == (Image *) NULL)
10055     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10056   wand->images->units=units;
10057   return(MagickTrue);
10058 }
10059 \f
10060 /*
10061 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10062 %                                                                             %
10063 %                                                                             %
10064 %                                                                             %
10065 %   M a g i c k S e t I m a g e V i r t u a l P i x e l M e t h o d           %
10066 %                                                                             %
10067 %                                                                             %
10068 %                                                                             %
10069 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10070 %
10071 %  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10072 %
10073 %  The format of the MagickSetImageVirtualPixelMethod method is:
10074 %
10075 %      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10076 %        const VirtualPixelMethod method)
10077 %
10078 %  A description of each parameter follows:
10079 %
10080 %    o wand: the magick wand.
10081 %
10082 %    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10083 %      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10084 %      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10085 %
10086 */
10087 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10088   const VirtualPixelMethod method)
10089 {
10090   assert(wand != (MagickWand *) NULL);
10091   assert(wand->signature == WandSignature);
10092   if (wand->debug != MagickFalse)
10093     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10094   if (wand->images == (Image *) NULL)
10095     return(UndefinedVirtualPixelMethod);
10096   return(SetImageVirtualPixelMethod(wand->images,method));
10097 }
10098 \f
10099 /*
10100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10101 %                                                                             %
10102 %                                                                             %
10103 %                                                                             %
10104 %   M a g i c k S e t I m a g e W h i t e P o i n t                           %
10105 %                                                                             %
10106 %                                                                             %
10107 %                                                                             %
10108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10109 %
10110 %  MagickSetImageWhitePoint() sets the image chromaticity white point.
10111 %
10112 %  The format of the MagickSetImageWhitePoint method is:
10113 %
10114 %      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10115 %        const double x,const double y)
10116 %
10117 %  A description of each parameter follows:
10118 %
10119 %    o wand: the magick wand.
10120 %
10121 %    o x: the white x-point.
10122 %
10123 %    o y: the white y-point.
10124 %
10125 */
10126 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
10127   const double x,const double y)
10128 {
10129   assert(wand != (MagickWand *) NULL);
10130   assert(wand->signature == WandSignature);
10131   if (wand->debug != MagickFalse)
10132     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10133   if (wand->images == (Image *) NULL)
10134     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10135   wand->images->chromaticity.white_point.x=x;
10136   wand->images->chromaticity.white_point.y=y;
10137   return(MagickTrue);
10138 }
10139 \f
10140 /*
10141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10142 %                                                                             %
10143 %                                                                             %
10144 %                                                                             %
10145 %   M a g i c k S h a d e I m a g e C h a n n e l                             %
10146 %                                                                             %
10147 %                                                                             %
10148 %                                                                             %
10149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10150 %
10151 %  MagickShadeImage() shines a distant light on an image to create a
10152 %  three-dimensional effect. You control the positioning of the light with
10153 %  azimuth and elevation; azimuth is measured in degrees off the x axis
10154 %  and elevation is measured in pixels above the Z axis.
10155 %
10156 %  The format of the MagickShadeImage method is:
10157 %
10158 %      MagickBooleanType MagickShadeImage(MagickWand *wand,
10159 %        const MagickBooleanType gray,const double azimuth,
10160 %        const double elevation)
10161 %
10162 %  A description of each parameter follows:
10163 %
10164 %    o wand: the magick wand.
10165 %
10166 %    o gray: A value other than zero shades the intensity of each pixel.
10167 %
10168 %    o azimuth, elevation:  Define the light source direction.
10169 %
10170 */
10171 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
10172   const MagickBooleanType gray,const double asimuth,const double elevation)
10173 {
10174   Image
10175     *shade_image;
10176
10177   assert(wand != (MagickWand *) NULL);
10178   assert(wand->signature == WandSignature);
10179   if (wand->debug != MagickFalse)
10180     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10181   if (wand->images == (Image *) NULL)
10182     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10183   shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
10184   if (shade_image == (Image *) NULL)
10185     return(MagickFalse);
10186   ReplaceImageInList(&wand->images,shade_image);
10187   return(MagickTrue);
10188 }
10189 \f
10190 /*
10191 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10192 %                                                                             %
10193 %                                                                             %
10194 %                                                                             %
10195 %   M a g i c k S h a d o w I m a g e                                         %
10196 %                                                                             %
10197 %                                                                             %
10198 %                                                                             %
10199 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10200 %
10201 %  MagickShadowImage() simulates an image shadow.
10202 %
10203 %  The format of the MagickShadowImage method is:
10204 %
10205 %      MagickBooleanType MagickShadowImage(MagickWand *wand,
10206 %        const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10207 %
10208 %  A description of each parameter follows:
10209 %
10210 %    o wand: the magick wand.
10211 %
10212 %    o opacity: percentage transparency.
10213 %
10214 %    o sigma: the standard deviation of the Gaussian, in pixels.
10215 %
10216 %    o x: the shadow x-offset.
10217 %
10218 %    o y: the shadow y-offset.
10219 %
10220 */
10221 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
10222   const double opacity,const double sigma,const ssize_t x,const ssize_t y)
10223 {
10224   Image
10225     *shadow_image;
10226
10227   assert(wand != (MagickWand *) NULL);
10228   assert(wand->signature == WandSignature);
10229   if (wand->debug != MagickFalse)
10230     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10231   if (wand->images == (Image *) NULL)
10232     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10233   shadow_image=ShadowImage(wand->images,opacity,sigma,x,y,wand->exception);
10234   if (shadow_image == (Image *) NULL)
10235     return(MagickFalse);
10236   ReplaceImageInList(&wand->images,shadow_image);
10237   return(MagickTrue);
10238 }
10239 \f
10240 /*
10241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10242 %                                                                             %
10243 %                                                                             %
10244 %                                                                             %
10245 %   M a g i c k S h a r p e n I m a g e                                       %
10246 %                                                                             %
10247 %                                                                             %
10248 %                                                                             %
10249 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10250 %
10251 %  MagickSharpenImage() sharpens an image.  We convolve the image with a
10252 %  Gaussian operator of the given radius and standard deviation (sigma).
10253 %  For reasonable results, the radius should be larger than sigma.  Use a
10254 %  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
10255 %
10256 %  The format of the MagickSharpenImage method is:
10257 %
10258 %      MagickBooleanType MagickSharpenImage(MagickWand *wand,
10259 %        const double radius,const double sigma,const double bias)
10260 %
10261 %  A description of each parameter follows:
10262 %
10263 %    o wand: the magick wand.
10264 %
10265 %    o radius: the radius of the Gaussian, in pixels, not counting the center
10266 %      pixel.
10267 %
10268 %    o sigma: the standard deviation of the Gaussian, in pixels.
10269 %
10270 %    o bias: the bias.
10271 %
10272 */
10273 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
10274   const double radius,const double sigma,const double bias)
10275 {
10276   Image
10277     *sharp_image;
10278
10279   assert(wand != (MagickWand *) NULL);
10280   assert(wand->signature == WandSignature);
10281   if (wand->debug != MagickFalse)
10282     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10283   if (wand->images == (Image *) NULL)
10284     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10285   sharp_image=SharpenImage(wand->images,radius,sigma,bias,wand->exception);
10286   if (sharp_image == (Image *) NULL)
10287     return(MagickFalse);
10288   ReplaceImageInList(&wand->images,sharp_image);
10289   return(MagickTrue);
10290 }
10291 \f
10292 /*
10293 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10294 %                                                                             %
10295 %                                                                             %
10296 %                                                                             %
10297 %   M a g i c k S h a v e I m a g e                                           %
10298 %                                                                             %
10299 %                                                                             %
10300 %                                                                             %
10301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10302 %
10303 %  MagickShaveImage() shaves pixels from the image edges.  It allocates the
10304 %  memory necessary for the new Image structure and returns a pointer to the
10305 %  new image.
10306 %
10307 %  The format of the MagickShaveImage method is:
10308 %
10309 %      MagickBooleanType MagickShaveImage(MagickWand *wand,
10310 %        const size_t columns,const size_t rows)
10311 %
10312 %  A description of each parameter follows:
10313 %
10314 %    o wand: the magick wand.
10315 %
10316 %    o columns: the number of columns in the scaled image.
10317 %
10318 %    o rows: the number of rows in the scaled image.
10319 %
10320 %
10321 */
10322 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
10323   const size_t columns,const size_t rows)
10324 {
10325   Image
10326     *shave_image;
10327
10328   RectangleInfo
10329     shave_info;
10330
10331   assert(wand != (MagickWand *) NULL);
10332   assert(wand->signature == WandSignature);
10333   if (wand->debug != MagickFalse)
10334     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10335   if (wand->images == (Image *) NULL)
10336     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10337   shave_info.width=columns;
10338   shave_info.height=rows;
10339   shave_info.x=0;
10340   shave_info.y=0;
10341   shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
10342   if (shave_image == (Image *) NULL)
10343     return(MagickFalse);
10344   ReplaceImageInList(&wand->images,shave_image);
10345   return(MagickTrue);
10346 }
10347 \f
10348 /*
10349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10350 %                                                                             %
10351 %                                                                             %
10352 %                                                                             %
10353 %   M a g i c k S h e a r I m a g e                                           %
10354 %                                                                             %
10355 %                                                                             %
10356 %                                                                             %
10357 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10358 %
10359 %  MagickShearImage() slides one edge of an image along the X or Y axis,
10360 %  creating a parallelogram.  An X direction shear slides an edge along the X
10361 %  axis, while a Y direction shear slides an edge along the Y axis.  The amount
10362 %  of the shear is controlled by a shear angle.  For X direction shears, x_shear
10363 %  is measured relative to the Y axis, and similarly, for Y direction shears
10364 %  y_shear is measured relative to the X axis.  Empty triangles left over from
10365 %  shearing the image are filled with the background color.
10366 %
10367 %  The format of the MagickShearImage method is:
10368 %
10369 %      MagickBooleanType MagickShearImage(MagickWand *wand,
10370 %        const PixelWand *background,const double x_shear,onst double y_shear)
10371 %
10372 %  A description of each parameter follows:
10373 %
10374 %    o wand: the magick wand.
10375 %
10376 %    o background: the background pixel wand.
10377 %
10378 %    o x_shear: the number of degrees to shear the image.
10379 %
10380 %    o y_shear: the number of degrees to shear the image.
10381 %
10382 */
10383 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
10384   const PixelWand *background,const double x_shear,const double y_shear)
10385 {
10386   Image
10387     *shear_image;
10388
10389   assert(wand != (MagickWand *) NULL);
10390   assert(wand->signature == WandSignature);
10391   if (wand->debug != MagickFalse)
10392     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10393   if (wand->images == (Image *) NULL)
10394     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10395   PixelGetQuantumPacket(background,&wand->images->background_color);
10396   shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
10397   if (shear_image == (Image *) NULL)
10398     return(MagickFalse);
10399   ReplaceImageInList(&wand->images,shear_image);
10400   return(MagickTrue);
10401 }
10402 \f
10403 /*
10404 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10405 %                                                                             %
10406 %                                                                             %
10407 %                                                                             %
10408 %   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                   %
10409 %                                                                             %
10410 %                                                                             %
10411 %                                                                             %
10412 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10413 %
10414 %  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
10415 %  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
10416 %  image using a sigmoidal transfer function without saturating highlights or
10417 %  shadows.  Contrast indicates how much to increase the contrast (0 is none;
10418 %  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
10419 %  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
10420 %  sharpen to MagickTrue to increase the image contrast otherwise the contrast
10421 %  is reduced.
10422 %
10423 %  The format of the MagickSigmoidalContrastImage method is:
10424 %
10425 %      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
10426 %        const MagickBooleanType sharpen,const double alpha,const double beta)
10427 %
10428 %  A description of each parameter follows:
10429 %
10430 %    o wand: the magick wand.
10431 %
10432 %    o sharpen: Increase or decrease image contrast.
10433 %
10434 %    o alpha: strength of the contrast, the larger the number the more
10435 %      'threshold-like' it becomes.
10436 %
10437 %    o beta: midpoint of the function as a color value 0 to QuantumRange.
10438 %
10439 */
10440 WandExport MagickBooleanType MagickSigmoidalContrastImage(
10441   MagickWand *wand,const MagickBooleanType sharpen,const double alpha,
10442   const double beta)
10443 {
10444   MagickBooleanType
10445     status;
10446
10447   assert(wand != (MagickWand *) NULL);
10448   assert(wand->signature == WandSignature);
10449   if (wand->debug != MagickFalse)
10450     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10451   if (wand->images == (Image *) NULL)
10452     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10453   status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta,
10454     &wand->images->exception);
10455   return(status);
10456 }
10457 \f
10458 /*
10459 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10460 %                                                                             %
10461 %                                                                             %
10462 %                                                                             %
10463 %   M a g i c k S i m i l a r i t y I m a g e                                 %
10464 %                                                                             %
10465 %                                                                             %
10466 %                                                                             %
10467 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10468 %
10469 %  MagickSimilarityImage() compares the reference image of the image and
10470 %  returns the best match offset.  In addition, it returns a similarity image
10471 %  such that an exact match location is completely white and if none of the
10472 %  pixels match, black, otherwise some gray level in-between.
10473 %
10474 %  The format of the MagickSimilarityImage method is:
10475 %
10476 %      MagickWand *MagickSimilarityImage(MagickWand *wand,
10477 %        const MagickWand *reference,RectangeInfo *offset,double *similarity)
10478 %
10479 %  A description of each parameter follows:
10480 %
10481 %    o wand: the magick wand.
10482 %
10483 %    o reference: the reference wand.
10484 %
10485 %    o offset: the best match offset of the reference image within the image.
10486 %
10487 %    o similarity: the computed similarity between the images.
10488 %
10489 */
10490 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
10491   const MagickWand *reference,RectangleInfo *offset,double *similarity)
10492 {
10493   Image
10494     *similarity_image;
10495
10496   assert(wand != (MagickWand *) NULL);
10497   assert(wand->signature == WandSignature);
10498   if (wand->debug != MagickFalse)
10499     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10500   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
10501     {
10502       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10503         "ContainsNoImages","`%s'",wand->name);
10504       return((MagickWand *) NULL);
10505     }
10506   similarity_image=SimilarityImage(wand->images,reference->images,offset,
10507     similarity,&wand->images->exception);
10508   if (similarity_image == (Image *) NULL)
10509     return((MagickWand *) NULL);
10510   return(CloneMagickWandFromImages(wand,similarity_image));
10511 }
10512 \f
10513 /*
10514 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10515 %                                                                             %
10516 %                                                                             %
10517 %                                                                             %
10518 %   M a g i c k S k e t c h I m a g e                                         %
10519 %                                                                             %
10520 %                                                                             %
10521 %                                                                             %
10522 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10523 %
10524 %  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
10525 %  a Gaussian operator of the given radius and standard deviation (sigma).
10526 %  For reasonable results, radius should be larger than sigma.  Use a
10527 %  radius of 0 and SketchImage() selects a suitable radius for you.
10528 %  Angle gives the angle of the blurring motion.
10529 %
10530 %  The format of the MagickSketchImage method is:
10531 %
10532 %      MagickBooleanType MagickSketchImage(MagickWand *wand,
10533 %        const double radius,const double sigma,const double angle,
10534 %        const double bias)
10535 %
10536 %  A description of each parameter follows:
10537 %
10538 %    o wand: the magick wand.
10539 %
10540 %    o radius: the radius of the Gaussian, in pixels, not counting
10541 %      the center pixel.
10542 %
10543 %    o sigma: the standard deviation of the Gaussian, in pixels.
10544 %
10545 %    o angle: apply the effect along this angle.
10546 %
10547 %    o bias: the bias.
10548 %
10549 */
10550 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
10551   const double radius,const double sigma,const double angle,const double bias)
10552 {
10553   Image
10554     *sketch_image;
10555
10556   assert(wand != (MagickWand *) NULL);
10557   assert(wand->signature == WandSignature);
10558   if (wand->debug != MagickFalse)
10559     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10560   if (wand->images == (Image *) NULL)
10561     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10562   sketch_image=SketchImage(wand->images,radius,sigma,angle,bias,
10563     wand->exception);
10564   if (sketch_image == (Image *) NULL)
10565     return(MagickFalse);
10566   ReplaceImageInList(&wand->images,sketch_image);
10567   return(MagickTrue);
10568 }
10569 \f
10570 /*
10571 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10572 %                                                                             %
10573 %                                                                             %
10574 %                                                                             %
10575 %   M a g i c k S m u s h I m a g e s                                         %
10576 %                                                                             %
10577 %                                                                             %
10578 %                                                                             %
10579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10580 %
10581 %  MagickSmushImages() takes all images from the current image pointer to the
10582 %  end of the image list and smushs them to each other top-to-bottom if the
10583 %  stack parameter is true, otherwise left-to-right.
10584 %
10585 %  The format of the MagickSmushImages method is:
10586 %
10587 %      MagickWand *MagickSmushImages(MagickWand *wand,
10588 %        const MagickBooleanType stack,const ssize_t offset)
10589 %
10590 %  A description of each parameter follows:
10591 %
10592 %    o wand: the magick wand.
10593 %
10594 %    o stack: By default, images are stacked left-to-right. Set stack to
10595 %      MagickTrue to stack them top-to-bottom.
10596 %
10597 %    o offset: minimum distance in pixels between images.
10598 %
10599 */
10600 WandExport MagickWand *MagickSmushImages(MagickWand *wand,
10601   const MagickBooleanType stack,const ssize_t offset)
10602 {
10603   Image
10604     *smush_image;
10605
10606   assert(wand != (MagickWand *) NULL);
10607   assert(wand->signature == WandSignature);
10608   if (wand->debug != MagickFalse)
10609     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10610   if (wand->images == (Image *) NULL)
10611     return((MagickWand *) NULL);
10612   smush_image=SmushImages(wand->images,stack,offset,wand->exception);
10613   if (smush_image == (Image *) NULL)
10614     return((MagickWand *) NULL);
10615   return(CloneMagickWandFromImages(wand,smush_image));
10616 }
10617 \f
10618 /*
10619 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10620 %                                                                             %
10621 %                                                                             %
10622 %                                                                             %
10623 %     M a g i c k S o l a r i z e I m a g e                                   %
10624 %                                                                             %
10625 %                                                                             %
10626 %                                                                             %
10627 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10628 %
10629 %  MagickSolarizeImage() applies a special effect to the image, similar to the
10630 %  effect achieved in a photo darkroom by selectively exposing areas of photo
10631 %  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
10632 %  measure of the extent of the solarization.
10633 %
10634 %  The format of the MagickSolarizeImage method is:
10635 %
10636 %      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10637 %        const double threshold)
10638 %
10639 %  A description of each parameter follows:
10640 %
10641 %    o wand: the magick wand.
10642 %
10643 %    o threshold:  Define the extent of the solarization.
10644 %
10645 */
10646 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
10647   const double threshold)
10648 {
10649   MagickBooleanType
10650     status;
10651
10652   assert(wand != (MagickWand *) NULL);
10653   assert(wand->signature == WandSignature);
10654   if (wand->debug != MagickFalse)
10655     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10656   if (wand->images == (Image *) NULL)
10657     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10658   status=SolarizeImage(wand->images,threshold,&wand->images->exception);
10659   return(status);
10660 }
10661 \f
10662 /*
10663 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10664 %                                                                             %
10665 %                                                                             %
10666 %                                                                             %
10667 %   M a g i c k S p a r s e C o l o r I m a g e                               %
10668 %                                                                             %
10669 %                                                                             %
10670 %                                                                             %
10671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10672 %
10673 %  MagickSparseColorImage(), given a set of coordinates, interpolates the
10674 %  colors found at those coordinates, across the whole image, using various
10675 %  methods.
10676 %
10677 %  The format of the MagickSparseColorImage method is:
10678 %
10679 %      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10680 %        const SparseColorMethod method,const size_t number_arguments,
10681 %        const double *arguments)
10682 %
10683 %  A description of each parameter follows:
10684 %
10685 %    o image: the image to be sparseed.
10686 %
10687 %    o method: the method of image sparseion.
10688 %
10689 %        ArcSparseColorion will always ignore source image offset, and always
10690 %        'bestfit' the destination image with the top left corner offset
10691 %        relative to the polar mapping center.
10692 %
10693 %        Bilinear has no simple inverse mapping so will not allow 'bestfit'
10694 %        style of image sparseion.
10695 %
10696 %        Affine, Perspective, and Bilinear, will do least squares fitting of
10697 %        the distrotion when more than the minimum number of control point
10698 %        pairs are provided.
10699 %
10700 %        Perspective, and Bilinear, will fall back to a Affine sparseion when
10701 %        less than 4 control point pairs are provided. While Affine sparseions
10702 %        will let you use any number of control point pairs, that is Zero pairs
10703 %        is a No-Op (viewport only) distrotion, one pair is a translation and
10704 %        two pairs of control points will do a scale-rotate-translate, without
10705 %        any shearing.
10706 %
10707 %    o number_arguments: the number of arguments given for this sparseion
10708 %      method.
10709 %
10710 %    o arguments: the arguments for this sparseion method.
10711 %
10712 */
10713 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
10714   const SparseColorMethod method,const size_t number_arguments,
10715   const double *arguments)
10716 {
10717   Image
10718     *sparse_image;
10719
10720   assert(wand != (MagickWand *) NULL);
10721   assert(wand->signature == WandSignature);
10722   if (wand->debug != MagickFalse)
10723     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10724   if (wand->images == (Image *) NULL)
10725     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10726   sparse_image=SparseColorImage(wand->images,method,number_arguments,arguments,
10727     wand->exception);
10728   if (sparse_image == (Image *) NULL)
10729     return(MagickFalse);
10730   ReplaceImageInList(&wand->images,sparse_image);
10731   return(MagickTrue);
10732 }
10733 \f
10734 /*
10735 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10736 %                                                                             %
10737 %                                                                             %
10738 %                                                                             %
10739 %   M a g i c k S p l i c e I m a g e                                         %
10740 %                                                                             %
10741 %                                                                             %
10742 %                                                                             %
10743 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10744 %
10745 %  MagickSpliceImage() splices a solid color into the image.
10746 %
10747 %  The format of the MagickSpliceImage method is:
10748 %
10749 %      MagickBooleanType MagickSpliceImage(MagickWand *wand,
10750 %        const size_t width,const size_t height,const ssize_t x,
10751 %        const ssize_t y)
10752 %
10753 %  A description of each parameter follows:
10754 %
10755 %    o wand: the magick wand.
10756 %
10757 %    o width: the region width.
10758 %
10759 %    o height: the region height.
10760 %
10761 %    o x: the region x offset.
10762 %
10763 %    o y: the region y offset.
10764 %
10765 */
10766 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
10767   const size_t width,const size_t height,const ssize_t x,
10768   const ssize_t y)
10769 {
10770   Image
10771     *splice_image;
10772
10773   RectangleInfo
10774     splice;
10775
10776   assert(wand != (MagickWand *) NULL);
10777   assert(wand->signature == WandSignature);
10778   if (wand->debug != MagickFalse)
10779     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10780   if (wand->images == (Image *) NULL)
10781     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10782   splice.width=width;
10783   splice.height=height;
10784   splice.x=x;
10785   splice.y=y;
10786   splice_image=SpliceImage(wand->images,&splice,wand->exception);
10787   if (splice_image == (Image *) NULL)
10788     return(MagickFalse);
10789   ReplaceImageInList(&wand->images,splice_image);
10790   return(MagickTrue);
10791 }
10792 \f
10793 /*
10794 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10795 %                                                                             %
10796 %                                                                             %
10797 %                                                                             %
10798 %   M a g i c k S p r e a d I m a g e                                         %
10799 %                                                                             %
10800 %                                                                             %
10801 %                                                                             %
10802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10803 %
10804 %  MagickSpreadImage() is a special effects method that randomly displaces each
10805 %  pixel in a block defined by the radius parameter.
10806 %
10807 %  The format of the MagickSpreadImage method is:
10808 %
10809 %      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius,
10810 %        const PixelInterpolateMethod method)
10811 %
10812 %  A description of each parameter follows:
10813 %
10814 %    o wand: the magick wand.
10815 %
10816 %    o radius:  Choose a random pixel in a neighborhood of this extent.
10817 %
10818 %    o method: the pixel interpolation method.
10819 %
10820 */
10821 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
10822   const double radius,const PixelInterpolateMethod method)
10823 {
10824   Image
10825     *spread_image;
10826
10827   assert(wand != (MagickWand *) NULL);
10828   assert(wand->signature == WandSignature);
10829   if (wand->debug != MagickFalse)
10830     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10831   if (wand->images == (Image *) NULL)
10832     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10833   spread_image=SpreadImage(wand->images,radius,method,wand->exception);
10834   if (spread_image == (Image *) NULL)
10835     return(MagickFalse);
10836   ReplaceImageInList(&wand->images,spread_image);
10837   return(MagickTrue);
10838 }
10839 \f
10840 /*
10841 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10842 %                                                                             %
10843 %                                                                             %
10844 %                                                                             %
10845 %   M a g i c k S t a t i s t i c I m a g e                                   %
10846 %                                                                             %
10847 %                                                                             %
10848 %                                                                             %
10849 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10850 %
10851 %  MagickStatisticImage() replace each pixel with corresponding statistic from
10852 %  the neighborhood of the specified width and height.
10853 %
10854 %  The format of the MagickStatisticImage method is:
10855 %
10856 %      MagickBooleanType MagickStatisticImage(MagickWand *wand,
10857 %        const StatisticType type,const double width,const size_t height)
10858 %
10859 %  A description of each parameter follows:
10860 %
10861 %    o wand: the magick wand.
10862 %
10863 %    o type: the statistic type (e.g. median, mode, etc.).
10864 %
10865 %    o width: the width of the pixel neighborhood.
10866 %
10867 %    o height: the height of the pixel neighborhood.
10868 %
10869 */
10870 WandExport MagickBooleanType MagickStatisticImage(MagickWand *wand,
10871   const StatisticType type,const size_t width,const size_t height)
10872 {
10873   Image
10874     *statistic_image;
10875
10876   assert(wand != (MagickWand *) NULL);
10877   assert(wand->signature == WandSignature);
10878   if (wand->debug != MagickFalse)
10879     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10880   if (wand->images == (Image *) NULL)
10881     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10882   statistic_image=StatisticImage(wand->images,type,width,height,
10883     wand->exception);
10884   if (statistic_image == (Image *) NULL)
10885     return(MagickFalse);
10886   ReplaceImageInList(&wand->images,statistic_image);
10887   return(MagickTrue);
10888 }
10889 \f
10890 /*
10891 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10892 %                                                                             %
10893 %                                                                             %
10894 %                                                                             %
10895 %   M a g i c k S t e g a n o I m a g e                                       %
10896 %                                                                             %
10897 %                                                                             %
10898 %                                                                             %
10899 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10900 %
10901 %  MagickSteganoImage() hides a digital watermark within the image.
10902 %  Recover the hidden watermark later to prove that the authenticity of
10903 %  an image.  Offset defines the start position within the image to hide
10904 %  the watermark.
10905 %
10906 %  The format of the MagickSteganoImage method is:
10907 %
10908 %      MagickWand *MagickSteganoImage(MagickWand *wand,
10909 %        const MagickWand *watermark_wand,const ssize_t offset)
10910 %
10911 %  A description of each parameter follows:
10912 %
10913 %    o wand: the magick wand.
10914 %
10915 %    o watermark_wand: the watermark wand.
10916 %
10917 %    o offset: Start hiding at this offset into the image.
10918 %
10919 */
10920 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
10921   const MagickWand *watermark_wand,const ssize_t offset)
10922 {
10923   Image
10924     *stegano_image;
10925
10926   assert(wand != (MagickWand *) NULL);
10927   assert(wand->signature == WandSignature);
10928   if (wand->debug != MagickFalse)
10929     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10930   if ((wand->images == (Image *) NULL) ||
10931       (watermark_wand->images == (Image *) NULL))
10932     {
10933       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10934         "ContainsNoImages","`%s'",wand->name);
10935       return((MagickWand *) NULL);
10936     }
10937   wand->images->offset=offset;
10938   stegano_image=SteganoImage(wand->images,watermark_wand->images,
10939     wand->exception);
10940   if (stegano_image == (Image *) NULL)
10941     return((MagickWand *) NULL);
10942   return(CloneMagickWandFromImages(wand,stegano_image));
10943 }
10944 \f
10945 /*
10946 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10947 %                                                                             %
10948 %                                                                             %
10949 %                                                                             %
10950 %   M a g i c k S t e r e o I m a g e                                         %
10951 %                                                                             %
10952 %                                                                             %
10953 %                                                                             %
10954 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10955 %
10956 %  MagickStereoImage() composites two images and produces a single image that
10957 %  is the composite of a left and right image of a stereo pair
10958 %
10959 %  The format of the MagickStereoImage method is:
10960 %
10961 %      MagickWand *MagickStereoImage(MagickWand *wand,
10962 %        const MagickWand *offset_wand)
10963 %
10964 %  A description of each parameter follows:
10965 %
10966 %    o wand: the magick wand.
10967 %
10968 %    o offset_wand: Another image wand.
10969 %
10970 */
10971 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
10972   const MagickWand *offset_wand)
10973 {
10974   Image
10975     *stereo_image;
10976
10977   assert(wand != (MagickWand *) NULL);
10978   assert(wand->signature == WandSignature);
10979   if (wand->debug != MagickFalse)
10980     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10981   if ((wand->images == (Image *) NULL) ||
10982       (offset_wand->images == (Image *) NULL))
10983     {
10984       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10985         "ContainsNoImages","`%s'",wand->name);
10986       return((MagickWand *) NULL);
10987     }
10988   stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
10989   if (stereo_image == (Image *) NULL)
10990     return((MagickWand *) NULL);
10991   return(CloneMagickWandFromImages(wand,stereo_image));
10992 }
10993 \f
10994 /*
10995 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10996 %                                                                             %
10997 %                                                                             %
10998 %                                                                             %
10999 %   M a g i c k S t r i p I m a g e                                           %
11000 %                                                                             %
11001 %                                                                             %
11002 %                                                                             %
11003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11004 %
11005 %  MagickStripImage() strips an image of all profiles and comments.
11006 %
11007 %  The format of the MagickStripImage method is:
11008 %
11009 %      MagickBooleanType MagickStripImage(MagickWand *wand)
11010 %
11011 %  A description of each parameter follows:
11012 %
11013 %    o wand: the magick wand.
11014 %
11015 */
11016 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11017 {
11018   MagickBooleanType
11019     status;
11020
11021   assert(wand != (MagickWand *) NULL);
11022   assert(wand->signature == WandSignature);
11023   if (wand->debug != MagickFalse)
11024     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11025   if (wand->images == (Image *) NULL)
11026     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11027   status=StripImage(wand->images);
11028   if (status == MagickFalse)
11029     InheritException(wand->exception,&wand->images->exception);
11030   return(status);
11031 }
11032 \f
11033 /*
11034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11035 %                                                                             %
11036 %                                                                             %
11037 %                                                                             %
11038 %   M a g i c k S w i r l I m a g e                                           %
11039 %                                                                             %
11040 %                                                                             %
11041 %                                                                             %
11042 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11043 %
11044 %  MagickSwirlImage() swirls the pixels about the center of the image, where
11045 %  degrees indicates the sweep of the arc through which each pixel is moved.
11046 %  You get a more dramatic effect as the degrees move from 1 to 360.
11047 %
11048 %  The format of the MagickSwirlImage method is:
11049 %
11050 %      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees,
11051 %        const PixelInterpolateMethod method)
11052 %
11053 %  A description of each parameter follows:
11054 %
11055 %    o wand: the magick wand.
11056 %
11057 %    o degrees: Define the tightness of the swirling effect.
11058 %
11059 %    o method: the pixel interpolation method.
11060 %
11061 */
11062 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11063   const double degrees,const PixelInterpolateMethod method)
11064 {
11065   Image
11066     *swirl_image;
11067
11068   assert(wand != (MagickWand *) NULL);
11069   assert(wand->signature == WandSignature);
11070   if (wand->debug != MagickFalse)
11071     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11072   if (wand->images == (Image *) NULL)
11073     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11074   swirl_image=SwirlImage(wand->images,degrees,method,wand->exception);
11075   if (swirl_image == (Image *) NULL)
11076     return(MagickFalse);
11077   ReplaceImageInList(&wand->images,swirl_image);
11078   return(MagickTrue);
11079 }
11080 \f
11081 /*
11082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11083 %                                                                             %
11084 %                                                                             %
11085 %                                                                             %
11086 %   M a g i c k T e x t u r e I m a g e                                       %
11087 %                                                                             %
11088 %                                                                             %
11089 %                                                                             %
11090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11091 %
11092 %  MagickTextureImage() repeatedly tiles the texture image across and down the
11093 %  image canvas.
11094 %
11095 %  The format of the MagickTextureImage method is:
11096 %
11097 %      MagickWand *MagickTextureImage(MagickWand *wand,
11098 %        const MagickWand *texture_wand)
11099 %
11100 %  A description of each parameter follows:
11101 %
11102 %    o wand: the magick wand.
11103 %
11104 %    o texture_wand: the texture wand
11105 %
11106 */
11107 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11108   const MagickWand *texture_wand)
11109 {
11110   Image
11111     *texture_image;
11112
11113   MagickBooleanType
11114     status;
11115
11116   assert(wand != (MagickWand *) NULL);
11117   assert(wand->signature == WandSignature);
11118   if (wand->debug != MagickFalse)
11119     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11120   if ((wand->images == (Image *) NULL) ||
11121       (texture_wand->images == (Image *) NULL))
11122     {
11123       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11124         "ContainsNoImages","`%s'",wand->name);
11125       return((MagickWand *) NULL);
11126     }
11127   texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11128   if (texture_image == (Image *) NULL)
11129     return((MagickWand *) NULL);
11130   status=TextureImage(texture_image,texture_wand->images);
11131   if (status == MagickFalse)
11132     {
11133       InheritException(wand->exception,&texture_image->exception);
11134       texture_image=DestroyImage(texture_image);
11135       return((MagickWand *) NULL);
11136     }
11137   return(CloneMagickWandFromImages(wand,texture_image));
11138 }
11139 \f
11140 /*
11141 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11142 %                                                                             %
11143 %                                                                             %
11144 %                                                                             %
11145 %   M a g i c k T h r e s h o l d I m a g e                                   %
11146 %                                                                             %
11147 %                                                                             %
11148 %                                                                             %
11149 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11150 %
11151 %  MagickThresholdImage() changes the value of individual pixels based on
11152 %  the intensity of each pixel compared to threshold.  The result is a
11153 %  high-contrast, two color image.
11154 %
11155 %  The format of the MagickThresholdImage method is:
11156 %
11157 %      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11158 %        const double threshold)
11159 %      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11160 %        const ChannelType channel,const double threshold)
11161 %
11162 %  A description of each parameter follows:
11163 %
11164 %    o wand: the magick wand.
11165 %
11166 %    o channel: the image channel(s).
11167 %
11168 %    o threshold: Define the threshold value.
11169 %
11170 */
11171 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
11172   const double threshold)
11173 {
11174   MagickBooleanType
11175     status;
11176
11177   status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
11178   return(status);
11179 }
11180
11181 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11182   const ChannelType channel,const double threshold)
11183 {
11184   MagickBooleanType
11185     status;
11186
11187   assert(wand != (MagickWand *) NULL);
11188   assert(wand->signature == WandSignature);
11189   if (wand->debug != MagickFalse)
11190     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11191   if (wand->images == (Image *) NULL)
11192     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11193   status=BilevelImage(wand->images,threshold);
11194   if (status == MagickFalse)
11195     InheritException(wand->exception,&wand->images->exception);
11196   return(status);
11197 }
11198 \f
11199 /*
11200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11201 %                                                                             %
11202 %                                                                             %
11203 %                                                                             %
11204 %   M a g i c k T h u m b n a i l I m a g e                                   %
11205 %                                                                             %
11206 %                                                                             %
11207 %                                                                             %
11208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11209 %
11210 %  MagickThumbnailImage()  changes the size of an image to the given dimensions
11211 %  and removes any associated profiles.  The goal is to produce small low cost
11212 %  thumbnail images suited for display on the Web.
11213 %
11214 %  The format of the MagickThumbnailImage method is:
11215 %
11216 %      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11217 %        const size_t columns,const size_t rows)
11218 %
11219 %  A description of each parameter follows:
11220 %
11221 %    o wand: the magick wand.
11222 %
11223 %    o columns: the number of columns in the scaled image.
11224 %
11225 %    o rows: the number of rows in the scaled image.
11226 %
11227 */
11228 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
11229   const size_t columns,const size_t rows)
11230 {
11231   Image
11232     *thumbnail_image;
11233
11234   assert(wand != (MagickWand *) NULL);
11235   assert(wand->signature == WandSignature);
11236   if (wand->debug != MagickFalse)
11237     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11238   if (wand->images == (Image *) NULL)
11239     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11240   thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
11241   if (thumbnail_image == (Image *) NULL)
11242     return(MagickFalse);
11243   ReplaceImageInList(&wand->images,thumbnail_image);
11244   return(MagickTrue);
11245 }
11246 \f
11247 /*
11248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11249 %                                                                             %
11250 %                                                                             %
11251 %                                                                             %
11252 %   M a g i c k T i n t I m a g e                                             %
11253 %                                                                             %
11254 %                                                                             %
11255 %                                                                             %
11256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11257 %
11258 %  MagickTintImage() applies a color vector to each pixel in the image.  The
11259 %  length of the vector is 0 for black and white and at its maximum for the
11260 %  midtones.  The vector weighting function is
11261 %  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
11262 %
11263 %  The format of the MagickTintImage method is:
11264 %
11265 %      MagickBooleanType MagickTintImage(MagickWand *wand,
11266 %        const PixelWand *tint,const PixelWand *opacity)
11267 %
11268 %  A description of each parameter follows:
11269 %
11270 %    o wand: the magick wand.
11271 %
11272 %    o tint: the tint pixel wand.
11273 %
11274 %    o opacity: the opacity pixel wand.
11275 %
11276 */
11277 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
11278   const PixelWand *tint,const PixelWand *opacity)
11279 {
11280   char
11281     percent_opaque[MaxTextExtent];
11282
11283   Image
11284     *tint_image;
11285
11286   PixelInfo
11287     target;
11288
11289   assert(wand != (MagickWand *) NULL);
11290   assert(wand->signature == WandSignature);
11291   if (wand->debug != MagickFalse)
11292     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11293   if (wand->images == (Image *) NULL)
11294     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11295   if (wand->images->colorspace != CMYKColorspace)
11296     (void) FormatLocaleString(percent_opaque,MaxTextExtent,
11297       "%g,%g,%g,%g",(double) (100.0*QuantumScale*
11298       PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
11299       PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
11300       PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
11301       PixelGetOpacityQuantum(opacity)));
11302   else
11303     (void) FormatLocaleString(percent_opaque,MaxTextExtent,
11304       "%g,%g,%g,%g,%g",(double) (100.0*QuantumScale*
11305       PixelGetCyanQuantum(opacity)),(double) (100.0*QuantumScale*
11306       PixelGetMagentaQuantum(opacity)),(double) (100.0*QuantumScale*
11307       PixelGetYellowQuantum(opacity)),(double) (100.0*QuantumScale*
11308       PixelGetBlackQuantum(opacity)),(double) (100.0*QuantumScale*
11309       PixelGetOpacityQuantum(opacity)));
11310   target=PixelGetPixel(tint);
11311   tint_image=TintImage(wand->images,percent_opaque,&target,wand->exception);
11312   if (tint_image == (Image *) NULL)
11313     return(MagickFalse);
11314   ReplaceImageInList(&wand->images,tint_image);
11315   return(MagickTrue);
11316 }
11317 \f
11318 /*
11319 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11320 %                                                                             %
11321 %                                                                             %
11322 %                                                                             %
11323 %   M a g i c k T r a n s f o r m I m a g e                                   %
11324 %                                                                             %
11325 %                                                                             %
11326 %                                                                             %
11327 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11328 %
11329 %  MagickTransformImage() is a convenience method that behaves like
11330 %  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
11331 %  information as a region geometry specification.  If the operation fails,
11332 %  a NULL image handle is returned.
11333 %
11334 %  The format of the MagickTransformImage method is:
11335 %
11336 %      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
11337 %        const char *geometry)
11338 %
11339 %  A description of each parameter follows:
11340 %
11341 %    o wand: the magick wand.
11342 %
11343 %    o crop: A crop geometry string.  This geometry defines a subregion of the
11344 %      image to crop.
11345 %
11346 %    o geometry: An image geometry string.  This geometry defines the final
11347 %      size of the image.
11348 %
11349 */
11350 WandExport MagickWand *MagickTransformImage(MagickWand *wand,
11351   const char *crop,const char *geometry)
11352 {
11353   Image
11354     *transform_image;
11355
11356   MagickBooleanType
11357     status;
11358
11359   assert(wand != (MagickWand *) NULL);
11360   assert(wand->signature == WandSignature);
11361   if (wand->debug != MagickFalse)
11362     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11363   if (wand->images == (Image *) NULL)
11364     return((MagickWand *) NULL);
11365   transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11366   if (transform_image == (Image *) NULL)
11367     return((MagickWand *) NULL);
11368   status=TransformImage(&transform_image,crop,geometry);
11369   if (status == MagickFalse)
11370     {
11371       InheritException(wand->exception,&transform_image->exception);
11372       transform_image=DestroyImage(transform_image);
11373       return((MagickWand *) NULL);
11374     }
11375   return(CloneMagickWandFromImages(wand,transform_image));
11376 }
11377 \f
11378 /*
11379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11380 %                                                                             %
11381 %                                                                             %
11382 %                                                                             %
11383 %   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               %
11384 %                                                                             %
11385 %                                                                             %
11386 %                                                                             %
11387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11388 %
11389 %  MagickTransformImageColorspace() transform the image colorspace.
11390 %
11391 %  The format of the MagickTransformImageColorspace method is:
11392 %
11393 %      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11394 %        const ColorspaceType colorspace)
11395 %
11396 %  A description of each parameter follows:
11397 %
11398 %    o wand: the magick wand.
11399 %
11400 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
11401 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
11402 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
11403 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
11404 %      HSLColorspace, or HWBColorspace.
11405 %
11406 */
11407 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
11408   const ColorspaceType colorspace)
11409 {
11410   assert(wand != (MagickWand *) NULL);
11411   assert(wand->signature == WandSignature);
11412   if (wand->debug != MagickFalse)
11413     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11414   if (wand->images == (Image *) NULL)
11415     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11416   return(TransformImageColorspace(wand->images,colorspace));
11417 }
11418 \f
11419 /*
11420 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11421 %                                                                             %
11422 %                                                                             %
11423 %                                                                             %
11424 %   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                     %
11425 %                                                                             %
11426 %                                                                             %
11427 %                                                                             %
11428 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11429 %
11430 %  MagickTransparentPaintImage() changes any pixel that matches color with the
11431 %  color defined by fill.
11432 %
11433 %  The format of the MagickTransparentPaintImage method is:
11434 %
11435 %      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11436 %        const PixelWand *target,const double alpha,const double fuzz,
11437 %        const MagickBooleanType invert)
11438 %
11439 %  A description of each parameter follows:
11440 %
11441 %    o wand: the magick wand.
11442 %
11443 %    o target: Change this target color to specified opacity value within
11444 %      the image.
11445 %
11446 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
11447 %      transparent.
11448 %
11449 %    o fuzz: By default target must match a particular pixel color
11450 %      exactly.  However, in many cases two colors may differ by a small amount.
11451 %      The fuzz member of image defines how much tolerance is acceptable to
11452 %      consider two colors as the same.  For example, set fuzz to 10 and the
11453 %      color red at intensities of 100 and 102 respectively are now interpreted
11454 %      as the same color for the purposes of the floodfill.
11455 %
11456 %    o invert: paint any pixel that does not match the target color.
11457 %
11458 */
11459 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
11460   const PixelWand *target,const double alpha,const double fuzz,
11461   const MagickBooleanType invert)
11462 {
11463   MagickBooleanType
11464     status;
11465
11466   PixelInfo
11467     target_pixel;
11468
11469   assert(wand != (MagickWand *) NULL);
11470   assert(wand->signature == WandSignature);
11471   if (wand->debug != MagickFalse)
11472     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11473   if (wand->images == (Image *) NULL)
11474     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11475   PixelGetMagickColor(target,&target_pixel);
11476   wand->images->fuzz=fuzz;
11477   status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
11478     QuantumRange*alpha),invert,&wand->images->exception);
11479   return(status);
11480 }
11481 \f
11482 /*
11483 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11484 %                                                                             %
11485 %                                                                             %
11486 %                                                                             %
11487 %   M a g i c k T r a n s p o s e I m a g e                                   %
11488 %                                                                             %
11489 %                                                                             %
11490 %                                                                             %
11491 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11492 %
11493 %  MagickTransposeImage() creates a vertical mirror image by reflecting the
11494 %  pixels around the central x-axis while rotating them 90-degrees.
11495 %
11496 %  The format of the MagickTransposeImage method is:
11497 %
11498 %      MagickBooleanType MagickTransposeImage(MagickWand *wand)
11499 %
11500 %  A description of each parameter follows:
11501 %
11502 %    o wand: the magick wand.
11503 %
11504 */
11505 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
11506 {
11507   Image
11508     *transpose_image;
11509
11510   assert(wand != (MagickWand *) NULL);
11511   assert(wand->signature == WandSignature);
11512   if (wand->debug != MagickFalse)
11513     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11514   if (wand->images == (Image *) NULL)
11515     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11516   transpose_image=TransposeImage(wand->images,wand->exception);
11517   if (transpose_image == (Image *) NULL)
11518     return(MagickFalse);
11519   ReplaceImageInList(&wand->images,transpose_image);
11520   return(MagickTrue);
11521 }
11522 \f
11523 /*
11524 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11525 %                                                                             %
11526 %                                                                             %
11527 %                                                                             %
11528 %   M a g i c k T r a n s v e r s e I m a g e                                 %
11529 %                                                                             %
11530 %                                                                             %
11531 %                                                                             %
11532 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11533 %
11534 %  MagickTransverseImage() creates a horizontal mirror image by reflecting the
11535 %  pixels around the central y-axis while rotating them 270-degrees.
11536 %
11537 %  The format of the MagickTransverseImage method is:
11538 %
11539 %      MagickBooleanType MagickTransverseImage(MagickWand *wand)
11540 %
11541 %  A description of each parameter follows:
11542 %
11543 %    o wand: the magick wand.
11544 %
11545 */
11546 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
11547 {
11548   Image
11549     *transverse_image;
11550
11551   assert(wand != (MagickWand *) NULL);
11552   assert(wand->signature == WandSignature);
11553   if (wand->debug != MagickFalse)
11554     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11555   if (wand->images == (Image *) NULL)
11556     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11557   transverse_image=TransverseImage(wand->images,wand->exception);
11558   if (transverse_image == (Image *) NULL)
11559     return(MagickFalse);
11560   ReplaceImageInList(&wand->images,transverse_image);
11561   return(MagickTrue);
11562 }
11563 \f
11564 /*
11565 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11566 %                                                                             %
11567 %                                                                             %
11568 %                                                                             %
11569 %   M a g i c k T r i m I m a g e                                             %
11570 %                                                                             %
11571 %                                                                             %
11572 %                                                                             %
11573 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11574 %
11575 %  MagickTrimImage() remove edges that are the background color from the image.
11576 %
11577 %  The format of the MagickTrimImage method is:
11578 %
11579 %      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11580 %
11581 %  A description of each parameter follows:
11582 %
11583 %    o wand: the magick wand.
11584 %
11585 %    o fuzz: By default target must match a particular pixel color
11586 %      exactly.  However, in many cases two colors may differ by a small amount.
11587 %      The fuzz member of image defines how much tolerance is acceptable to
11588 %      consider two colors as the same.  For example, set fuzz to 10 and the
11589 %      color red at intensities of 100 and 102 respectively are now interpreted
11590 %      as the same color for the purposes of the floodfill.
11591 %
11592 */
11593 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
11594 {
11595   Image
11596     *trim_image;
11597
11598   assert(wand != (MagickWand *) NULL);
11599   assert(wand->signature == WandSignature);
11600   if (wand->debug != MagickFalse)
11601     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11602   if (wand->images == (Image *) NULL)
11603     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11604   wand->images->fuzz=fuzz;
11605   trim_image=TrimImage(wand->images,wand->exception);
11606   if (trim_image == (Image *) NULL)
11607     return(MagickFalse);
11608   ReplaceImageInList(&wand->images,trim_image);
11609   return(MagickTrue);
11610 }
11611 \f
11612 /*
11613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11614 %                                                                             %
11615 %                                                                             %
11616 %                                                                             %
11617 %   M a g i c k U n i q u e I m a g e C o l o r s                             %
11618 %                                                                             %
11619 %                                                                             %
11620 %                                                                             %
11621 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11622 %
11623 %  MagickUniqueImageColors() discards all but one of any pixel color.
11624 %
11625 %  The format of the MagickUniqueImageColors method is:
11626 %
11627 %      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11628 %
11629 %  A description of each parameter follows:
11630 %
11631 %    o wand: the magick wand.
11632 %
11633 */
11634 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
11635 {
11636   Image
11637     *unique_image;
11638
11639   assert(wand != (MagickWand *) NULL);
11640   assert(wand->signature == WandSignature);
11641   if (wand->debug != MagickFalse)
11642     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11643   if (wand->images == (Image *) NULL)
11644     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11645   unique_image=UniqueImageColors(wand->images,wand->exception);
11646   if (unique_image == (Image *) NULL)
11647     return(MagickFalse);
11648   ReplaceImageInList(&wand->images,unique_image);
11649   return(MagickTrue);
11650 }
11651 \f
11652 /*
11653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11654 %                                                                             %
11655 %                                                                             %
11656 %                                                                             %
11657 %   M a g i c k U n s h a r p M a s k I m a g e                               %
11658 %                                                                             %
11659 %                                                                             %
11660 %                                                                             %
11661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11662 %
11663 %  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
11664 %  Gaussian operator of the given radius and standard deviation (sigma).
11665 %  For reasonable results, radius should be larger than sigma.  Use a radius
11666 %  of 0 and UnsharpMaskImage() selects a suitable radius for you.
11667 %
11668 %  The format of the MagickUnsharpMaskImage method is:
11669 %
11670 %      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11671 %        const double radius,const double sigma,const double amount,
11672 %        const double threshold)
11673 %
11674 %  A description of each parameter follows:
11675 %
11676 %    o wand: the magick wand.
11677 %
11678 %    o radius: the radius of the Gaussian, in pixels, not counting the center
11679 %      pixel.
11680 %
11681 %    o sigma: the standard deviation of the Gaussian, in pixels.
11682 %
11683 %    o amount: the percentage of the difference between the original and the
11684 %      blur image that is added back into the original.
11685 %
11686 %    o threshold: the threshold in pixels needed to apply the diffence amount.
11687 %
11688 */
11689 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
11690   const double radius,const double sigma,const double amount,
11691   const double threshold)
11692 {
11693   Image
11694     *unsharp_image;
11695
11696   assert(wand != (MagickWand *) NULL);
11697   assert(wand->signature == WandSignature);
11698   if (wand->debug != MagickFalse)
11699     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11700   if (wand->images == (Image *) NULL)
11701     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11702   unsharp_image=UnsharpMaskImage(wand->images,radius,sigma,amount,threshold,
11703     wand->exception);
11704   if (unsharp_image == (Image *) NULL)
11705     return(MagickFalse);
11706   ReplaceImageInList(&wand->images,unsharp_image);
11707   return(MagickTrue);
11708 }
11709 \f
11710 /*
11711 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11712 %                                                                             %
11713 %                                                                             %
11714 %                                                                             %
11715 %   M a g i c k V i g n e t t e I m a g e                                     %
11716 %                                                                             %
11717 %                                                                             %
11718 %                                                                             %
11719 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11720 %
11721 %  MagickVignetteImage() softens the edges of the image in vignette style.
11722 %
11723 %  The format of the MagickVignetteImage method is:
11724 %
11725 %      MagickBooleanType MagickVignetteImage(MagickWand *wand,
11726 %        const double black_point,const double white_point,const ssize_t x,
11727 %        const ssize_t y)
11728 %
11729 %  A description of each parameter follows:
11730 %
11731 %    o wand: the magick wand.
11732 %
11733 %    o black_point: the black point.
11734 %
11735 %    o white_point: the white point.
11736 %
11737 %    o x, y:  Define the x and y ellipse offset.
11738 %
11739 */
11740 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
11741   const double black_point,const double white_point,const ssize_t x,const ssize_t y)
11742 {
11743   Image
11744     *vignette_image;
11745
11746   assert(wand != (MagickWand *) NULL);
11747   assert(wand->signature == WandSignature);
11748   if (wand->debug != MagickFalse)
11749     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11750   if (wand->images == (Image *) NULL)
11751     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11752   vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
11753     wand->exception);
11754   if (vignette_image == (Image *) NULL)
11755     return(MagickFalse);
11756   ReplaceImageInList(&wand->images,vignette_image);
11757   return(MagickTrue);
11758 }
11759 \f
11760 /*
11761 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11762 %                                                                             %
11763 %                                                                             %
11764 %                                                                             %
11765 %   M a g i c k W a v e I m a g e                                             %
11766 %                                                                             %
11767 %                                                                             %
11768 %                                                                             %
11769 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11770 %
11771 %  MagickWaveImage()  creates a "ripple" effect in the image by shifting
11772 %  the pixels vertically along a sine wave whose amplitude and wavelength
11773 %  is specified by the given parameters.
11774 %
11775 %  The format of the MagickWaveImage method is:
11776 %
11777 %      MagickBooleanType MagickWaveImage(MagickWand *wand,
11778 %        const double amplitude,const double wave_length,
11779 %        const PixelInterpolateMethod method)
11780 %
11781 %  A description of each parameter follows:
11782 %
11783 %    o wand: the magick wand.
11784 %
11785 %    o amplitude, wave_length:  Define the amplitude and wave length of the
11786 %      sine wave.
11787 %
11788 %    o method: the pixel interpolation method.
11789 %
11790 */
11791 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
11792   const double amplitude,const double wave_length,
11793   const PixelInterpolateMethod method)
11794 {
11795   Image
11796     *wave_image;
11797
11798   assert(wand != (MagickWand *) NULL);
11799   assert(wand->signature == WandSignature);
11800   if (wand->debug != MagickFalse)
11801     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11802   if (wand->images == (Image *) NULL)
11803     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11804   wave_image=WaveImage(wand->images,amplitude,wave_length,method,
11805     wand->exception);
11806   if (wave_image == (Image *) NULL)
11807     return(MagickFalse);
11808   ReplaceImageInList(&wand->images,wave_image);
11809   return(MagickTrue);
11810 }
11811 \f
11812 /*
11813 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11814 %                                                                             %
11815 %                                                                             %
11816 %                                                                             %
11817 %   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                         %
11818 %                                                                             %
11819 %                                                                             %
11820 %                                                                             %
11821 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11822 %
11823 %  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
11824 %  above the threshold into white while leaving all pixels below the threshold
11825 %  unchanged.
11826 %
11827 %  The format of the MagickWhiteThresholdImage method is:
11828 %
11829 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11830 %        const PixelWand *threshold)
11831 %
11832 %  A description of each parameter follows:
11833 %
11834 %    o wand: the magick wand.
11835 %
11836 %    o threshold: the pixel wand.
11837 %
11838 */
11839 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
11840   const PixelWand *threshold)
11841 {
11842   char
11843     thresholds[MaxTextExtent];
11844
11845   MagickBooleanType
11846     status;
11847
11848   assert(wand != (MagickWand *) NULL);
11849   assert(wand->signature == WandSignature);
11850   if (wand->debug != MagickFalse)
11851     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11852   if (wand->images == (Image *) NULL)
11853     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11854   (void) FormatLocaleString(thresholds,MaxTextExtent,
11855     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
11856     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
11857     PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
11858   status=WhiteThresholdImage(wand->images,thresholds,&wand->images->exception);
11859   if (status == MagickFalse)
11860     InheritException(wand->exception,&wand->images->exception);
11861   return(status);
11862 }
11863 \f
11864 /*
11865 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11866 %                                                                             %
11867 %                                                                             %
11868 %                                                                             %
11869 %   M a g i c k W r i t e I m a g e                                           %
11870 %                                                                             %
11871 %                                                                             %
11872 %                                                                             %
11873 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11874 %
11875 %  MagickWriteImage() writes an image to the specified filename.  If the
11876 %  filename parameter is NULL, the image is written to the filename set
11877 %  by MagickReadImage() or MagickSetImageFilename().
11878 %
11879 %  The format of the MagickWriteImage method is:
11880 %
11881 %      MagickBooleanType MagickWriteImage(MagickWand *wand,
11882 %        const char *filename)
11883 %
11884 %  A description of each parameter follows:
11885 %
11886 %    o wand: the magick wand.
11887 %
11888 %    o filename: the image filename.
11889 %
11890 %
11891 */
11892 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
11893   const char *filename)
11894 {
11895   Image
11896     *image;
11897
11898   ImageInfo
11899     *write_info;
11900
11901   MagickBooleanType
11902     status;
11903
11904   assert(wand != (MagickWand *) NULL);
11905   assert(wand->signature == WandSignature);
11906   if (wand->debug != MagickFalse)
11907     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11908   if (wand->images == (Image *) NULL)
11909     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11910   if (filename != (const char *) NULL)
11911     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
11912   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11913   if (image == (Image *) NULL)
11914     return(MagickFalse);
11915   write_info=CloneImageInfo(wand->image_info);
11916   write_info->adjoin=MagickTrue;
11917   status=WriteImage(write_info,image,&image->exception);
11918   image=DestroyImage(image);
11919   write_info=DestroyImageInfo(write_info);
11920   return(status);
11921 }
11922 \f
11923 /*
11924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11925 %                                                                             %
11926 %                                                                             %
11927 %                                                                             %
11928 %   M a g i c k W r i t e I m a g e F i l e                                   %
11929 %                                                                             %
11930 %                                                                             %
11931 %                                                                             %
11932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11933 %
11934 %  MagickWriteImageFile() writes an image to an open file descriptor.
11935 %
11936 %  The format of the MagickWriteImageFile method is:
11937 %
11938 %      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11939 %
11940 %  A description of each parameter follows:
11941 %
11942 %    o wand: the magick wand.
11943 %
11944 %    o file: the file descriptor.
11945 %
11946 */
11947 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
11948 {
11949   Image
11950     *image;
11951
11952   ImageInfo
11953     *write_info;
11954
11955   MagickBooleanType
11956     status;
11957
11958   assert(wand != (MagickWand *) NULL);
11959   assert(wand->signature == WandSignature);
11960   assert(file != (FILE *) NULL);
11961   if (wand->debug != MagickFalse)
11962     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11963   if (wand->images == (Image *) NULL)
11964     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11965   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11966   if (image == (Image *) NULL)
11967     return(MagickFalse);
11968   write_info=CloneImageInfo(wand->image_info);
11969   SetImageInfoFile(write_info,file);
11970   write_info->adjoin=MagickTrue;
11971   status=WriteImage(write_info,image,&image->exception);
11972   write_info=DestroyImageInfo(write_info);
11973   image=DestroyImage(image);
11974   return(status);
11975 }
11976 \f
11977 /*
11978 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11979 %                                                                             %
11980 %                                                                             %
11981 %                                                                             %
11982 %   M a g i c k W r i t e I m a g e s                                         %
11983 %                                                                             %
11984 %                                                                             %
11985 %                                                                             %
11986 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11987 %
11988 %  MagickWriteImages() writes an image or image sequence.
11989 %
11990 %  The format of the MagickWriteImages method is:
11991 %
11992 %      MagickBooleanType MagickWriteImages(MagickWand *wand,
11993 %        const char *filename,const MagickBooleanType adjoin)
11994 %
11995 %  A description of each parameter follows:
11996 %
11997 %    o wand: the magick wand.
11998 %
11999 %    o filename: the image filename.
12000 %
12001 %    o adjoin: join images into a single multi-image file.
12002 %
12003 */
12004 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12005   const char *filename,const MagickBooleanType adjoin)
12006 {
12007   ImageInfo
12008     *write_info;
12009
12010   MagickBooleanType
12011     status;
12012
12013   assert(wand != (MagickWand *) NULL);
12014   assert(wand->signature == WandSignature);
12015   if (wand->debug != MagickFalse)
12016     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12017   if (wand->images == (Image *) NULL)
12018     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12019   write_info=CloneImageInfo(wand->image_info);
12020   write_info->adjoin=adjoin;
12021   status=WriteImages(write_info,wand->images,filename,wand->exception);
12022   if (status == MagickFalse)
12023     InheritException(wand->exception,&wand->images->exception);
12024   write_info=DestroyImageInfo(write_info);
12025   return(status);
12026 }
12027 \f
12028 /*
12029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12030 %                                                                             %
12031 %                                                                             %
12032 %                                                                             %
12033 %   M a g i c k W r i t e I m a g e s F i l e                                 %
12034 %                                                                             %
12035 %                                                                             %
12036 %                                                                             %
12037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12038 %
12039 %  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12040 %
12041 %  The format of the MagickWriteImagesFile method is:
12042 %
12043 %      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12044 %
12045 %  A description of each parameter follows:
12046 %
12047 %    o wand: the magick wand.
12048 %
12049 %    o file: the file descriptor.
12050 %
12051 */
12052 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12053 {
12054   ImageInfo
12055     *write_info;
12056
12057   MagickBooleanType
12058     status;
12059
12060   assert(wand != (MagickWand *) NULL);
12061   assert(wand->signature == WandSignature);
12062   if (wand->debug != MagickFalse)
12063     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12064   if (wand->images == (Image *) NULL)
12065     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12066   write_info=CloneImageInfo(wand->image_info);
12067   SetImageInfoFile(write_info,file);
12068   write_info->adjoin=MagickTrue;
12069   status=WriteImages(write_info,wand->images,(const char *) NULL,
12070     wand->exception);
12071   write_info=DestroyImageInfo(write_info);
12072   if (status == MagickFalse)
12073     InheritException(wand->exception,&wand->images->exception);
12074   return(status);
12075 }