]> granicus.if.org Git - imagemagick/blob - wand/magick-image.c
(no commit message)
[imagemagick] / wand / 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 "wand/studio.h"
50 #include "wand/MagickWand.h"
51 #include "wand/magick-wand-private.h"
52 #include "wand/wand.h"
53 #include "wand/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) FormatMagickString(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)
181 %      MagickBooleanType MagickAdaptiveBlurImageChannel(MagickWand *wand,
182 %        const ChannelType channel,const double radius,const double sigma)
183 %
184 %  A description of each parameter follows:
185 %
186 %    o wand: the magick wand.
187 %
188 %    o channel: the image channel(s).
189 %
190 %    o radius: the radius of the Gaussian, in pixels, not counting the center
191 %      pixel.
192 %
193 %    o sigma: the standard deviation of the Gaussian, in pixels.
194 %
195 */
196
197 WandExport MagickBooleanType MagickAdaptiveBlurImage(MagickWand *wand,
198   const double radius,const double sigma)
199 {
200   MagickBooleanType
201     status;
202
203   status=MagickAdaptiveBlurImageChannel(wand,DefaultChannels,radius,sigma);
204   return(status);
205 }
206
207 WandExport MagickBooleanType MagickAdaptiveBlurImageChannel(MagickWand *wand,
208   const ChannelType channel,const double radius,const double sigma)
209 {
210   Image
211     *sharp_image;
212
213   assert(wand != (MagickWand *) NULL);
214   assert(wand->signature == WandSignature);
215   if (wand->debug != MagickFalse)
216     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
217   if (wand->images == (Image *) NULL)
218     ThrowWandException(WandError,"ContainsNoImages",wand->name);
219   sharp_image=AdaptiveBlurImageChannel(wand->images,channel,radius,sigma,
220     wand->exception);
221   if (sharp_image == (Image *) NULL)
222     return(MagickFalse);
223   ReplaceImageInList(&wand->images,sharp_image);
224   return(MagickTrue);
225 }
226 \f
227 /*
228 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
229 %                                                                             %
230 %                                                                             %
231 %                                                                             %
232 %   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                         %
233 %                                                                             %
234 %                                                                             %
235 %                                                                             %
236 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
237 %
238 %  MagickAdaptiveResizeImage() adaptively resize image with data dependent
239 %  triangulation.
240 %
241 %      MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
242 %        const size_t columns,const size_t rows)
243 %
244 %  A description of each parameter follows:
245 %
246 %    o wand: the magick wand.
247 %
248 %    o columns: the number of columns in the scaled image.
249 %
250 %    o rows: the number of rows in the scaled image.
251 %
252 */
253 WandExport MagickBooleanType MagickAdaptiveResizeImage(MagickWand *wand,
254   const size_t columns,const size_t rows)
255 {
256   Image
257     *resize_image;
258
259   assert(wand != (MagickWand *) NULL);
260   assert(wand->signature == WandSignature);
261   if (wand->debug != MagickFalse)
262     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
263   if (wand->images == (Image *) NULL)
264     ThrowWandException(WandError,"ContainsNoImages",wand->name);
265   resize_image=AdaptiveResizeImage(wand->images,columns,rows,wand->exception);
266   if (resize_image == (Image *) NULL)
267     return(MagickFalse);
268   ReplaceImageInList(&wand->images,resize_image);
269   return(MagickTrue);
270 }
271 \f
272 /*
273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
274 %                                                                             %
275 %                                                                             %
276 %                                                                             %
277 %   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                       %
278 %                                                                             %
279 %                                                                             %
280 %                                                                             %
281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
282 %
283 %  MagickAdaptiveSharpenImage() adaptively sharpens the image by sharpening
284 %  more intensely near image edges and less intensely far from edges. We
285 %  sharpen the image with a Gaussian operator of the given radius and standard
286 %  deviation (sigma).  For reasonable results, radius should be larger than
287 %  sigma.  Use a radius of 0 and MagickAdaptiveSharpenImage() selects a
288 %  suitable radius for you.
289 %
290 %  The format of the MagickAdaptiveSharpenImage method is:
291 %
292 %      MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
293 %        const double radius,const double sigma)
294 %      MagickBooleanType MagickAdaptiveSharpenImageChannel(MagickWand *wand,
295 %        const ChannelType channel,const double radius,const double sigma)
296 %
297 %  A description of each parameter follows:
298 %
299 %    o wand: the magick wand.
300 %
301 %    o channel: the image channel(s).
302 %
303 %    o radius: the radius of the Gaussian, in pixels, not counting the center
304 %      pixel.
305 %
306 %    o sigma: the standard deviation of the Gaussian, in pixels.
307 %
308 */
309
310 WandExport MagickBooleanType MagickAdaptiveSharpenImage(MagickWand *wand,
311   const double radius,const double sigma)
312 {
313   MagickBooleanType
314     status;
315
316   status=MagickAdaptiveSharpenImageChannel(wand,DefaultChannels,radius,sigma);
317   return(status);
318 }
319
320 WandExport MagickBooleanType MagickAdaptiveSharpenImageChannel(MagickWand *wand,
321   const ChannelType channel,const double radius,const double sigma)
322 {
323   Image
324     *sharp_image;
325
326   assert(wand != (MagickWand *) NULL);
327   assert(wand->signature == WandSignature);
328   if (wand->debug != MagickFalse)
329     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
330   if (wand->images == (Image *) NULL)
331     ThrowWandException(WandError,"ContainsNoImages",wand->name);
332   sharp_image=AdaptiveSharpenImageChannel(wand->images,channel,radius,sigma,
333     wand->exception);
334   if (sharp_image == (Image *) NULL)
335     return(MagickFalse);
336   ReplaceImageInList(&wand->images,sharp_image);
337   return(MagickTrue);
338 }
339 \f
340 /*
341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
342 %                                                                             %
343 %                                                                             %
344 %                                                                             %
345 %   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                   %
346 %                                                                             %
347 %                                                                             %
348 %                                                                             %
349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
350 %
351 %  MagickAdaptiveThresholdImage() selects an individual threshold for each pixel
352 %  based on the range of intensity values in its local neighborhood.  This
353 %  allows for thresholding of an image whose global intensity histogram
354 %  doesn't contain distinctive peaks.
355 %
356 %  The format of the AdaptiveThresholdImage method is:
357 %
358 %      MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
359 %        const size_t width,const size_t height,const ssize_t offset)
360 %
361 %  A description of each parameter follows:
362 %
363 %    o wand: the magick wand.
364 %
365 %    o width: the width of the local neighborhood.
366 %
367 %    o height: the height of the local neighborhood.
368 %
369 %    o offset: the mean offset.
370 %
371 */
372 WandExport MagickBooleanType MagickAdaptiveThresholdImage(MagickWand *wand,
373   const size_t width,const size_t height,const ssize_t offset)
374 {
375   Image
376     *threshold_image;
377
378   assert(wand != (MagickWand *) NULL);
379   assert(wand->signature == WandSignature);
380   if (wand->debug != MagickFalse)
381     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
382   if (wand->images == (Image *) NULL)
383     ThrowWandException(WandError,"ContainsNoImages",wand->name);
384   threshold_image=AdaptiveThresholdImage(wand->images,width,height,offset,
385     wand->exception);
386   if (threshold_image == (Image *) NULL)
387     return(MagickFalse);
388   ReplaceImageInList(&wand->images,threshold_image);
389   return(MagickTrue);
390 }
391 \f
392 /*
393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
394 %                                                                             %
395 %                                                                             %
396 %                                                                             %
397 %   M a g i c k A d d I m a g e                                               %
398 %                                                                             %
399 %                                                                             %
400 %                                                                             %
401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
402 %
403 %  MagickAddImage() adds the specified images at the current image location.
404 %
405 %  The format of the MagickAddImage method is:
406 %
407 %      MagickBooleanType MagickAddImage(MagickWand *wand,
408 %        const MagickWand *add_wand)
409 %
410 %  A description of each parameter follows:
411 %
412 %    o wand: the magick wand.
413 %
414 %    o add_wand: A wand that contains images to add at the current image
415 %      location.
416 %
417 */
418
419 static inline MagickBooleanType InsertImageInWand(MagickWand *wand,
420   Image *images)
421 {
422   Image
423     *sentinel;
424
425   sentinel=wand->images;
426   if (sentinel == (Image *) NULL)
427     {
428       wand->images=GetFirstImageInList(images);
429       return(MagickTrue);
430     }
431   if (wand->active == MagickFalse)
432     {
433       if ((wand->pend != MagickFalse) && (sentinel->next == (Image *) NULL))
434         {
435           AppendImageToList(&sentinel,images);
436           wand->images=GetLastImageInList(images);
437           return(MagickTrue);
438         }
439       if ((wand->pend != MagickFalse) && (sentinel->previous == (Image *) NULL))
440         {
441           PrependImageToList(&sentinel,images);
442           wand->images=GetFirstImageInList(images);
443           return(MagickTrue);
444         }
445     }
446   if (sentinel->next == (Image *) NULL)
447     {
448       InsertImageInList(&sentinel,images);
449       wand->images=GetLastImageInList(images);
450       return(MagickTrue);
451     }
452   InsertImageInList(&sentinel,images);
453   wand->images=GetFirstImageInList(images);
454   return(MagickTrue);
455 }
456
457 WandExport MagickBooleanType MagickAddImage(MagickWand *wand,
458   const MagickWand *add_wand)
459 {
460   Image
461     *images;
462
463   assert(wand != (MagickWand *) NULL);
464   assert(wand->signature == WandSignature);
465   if (wand->debug != MagickFalse)
466     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
467   assert(add_wand != (MagickWand *) NULL);
468   assert(add_wand->signature == WandSignature);
469   if (add_wand->images == (Image *) NULL)
470     ThrowWandException(WandError,"ContainsNoImages",add_wand->name);
471   images=CloneImageList(add_wand->images,wand->exception);
472   if (images == (Image *) NULL)
473     return(MagickFalse);
474   return(InsertImageInWand(wand,images));
475 }
476 \f
477 /*
478 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
479 %                                                                             %
480 %                                                                             %
481 %                                                                             %
482 %     M a g i c k A d d N o i s e I m a g e                                   %
483 %                                                                             %
484 %                                                                             %
485 %                                                                             %
486 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
487 %
488 %  MagickAddNoiseImage() adds random noise to the image.
489 %
490 %  The format of the MagickAddNoiseImage method is:
491 %
492 %      MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
493 %        const NoiseType noise_type)
494 %      MagickBooleanType MagickAddNoiseImageChannel(MagickWand *wand,
495 %        const ChannelType channel,const NoiseType noise_type)
496 %
497 %  A description of each parameter follows:
498 %
499 %    o wand: the magick wand.
500 %
501 %    o channel: the image channel(s).
502 %
503 %    o noise_type:  The type of noise: Uniform, Gaussian, Multiplicative,
504 %      Impulse, Laplacian, or Poisson.
505 %
506 */
507
508 WandExport MagickBooleanType MagickAddNoiseImage(MagickWand *wand,
509   const NoiseType noise_type)
510 {
511   MagickBooleanType
512     status;
513
514   status=MagickAddNoiseImageChannel(wand,DefaultChannels,noise_type);
515   return(status);
516 }
517
518 WandExport MagickBooleanType MagickAddNoiseImageChannel(MagickWand *wand,
519   const ChannelType channel,const NoiseType noise_type)
520 {
521   Image
522     *noise_image;
523
524   assert(wand != (MagickWand *) NULL);
525   assert(wand->signature == WandSignature);
526   if (wand->debug != MagickFalse)
527     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
528   if (wand->images == (Image *) NULL)
529     ThrowWandException(WandError,"ContainsNoImages",wand->name);
530   noise_image=AddNoiseImageChannel(wand->images,channel,noise_type,
531     wand->exception);
532   if (noise_image == (Image *) NULL)
533     return(MagickFalse);
534   ReplaceImageInList(&wand->images,noise_image);
535   return(MagickTrue);
536 }
537 \f
538 /*
539 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
540 %                                                                             %
541 %                                                                             %
542 %                                                                             %
543 %   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                       %
544 %                                                                             %
545 %                                                                             %
546 %                                                                             %
547 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
548 %
549 %  MagickAffineTransformImage() transforms an image as dictated by the affine
550 %  matrix of the drawing wand.
551 %
552 %  The format of the MagickAffineTransformImage method is:
553 %
554 %      MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
555 %        const DrawingWand *drawing_wand)
556 %
557 %  A description of each parameter follows:
558 %
559 %    o wand: the magick wand.
560 %
561 %    o drawing_wand: the draw wand.
562 %
563 */
564 WandExport MagickBooleanType MagickAffineTransformImage(MagickWand *wand,
565   const DrawingWand *drawing_wand)
566 {
567   DrawInfo
568     *draw_info;
569
570   Image
571     *affine_image;
572
573   assert(wand != (MagickWand *) NULL);
574   assert(wand->signature == WandSignature);
575   if (wand->debug != MagickFalse)
576     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
577   if (wand->images == (Image *) NULL)
578     ThrowWandException(WandError,"ContainsNoImages",wand->name);
579   draw_info=PeekDrawingWand(drawing_wand);
580   if (draw_info == (DrawInfo *) NULL)
581     return(MagickFalse);
582   affine_image=AffineTransformImage(wand->images,&draw_info->affine,
583     wand->exception);
584   draw_info=DestroyDrawInfo(draw_info);
585   if (affine_image == (Image *) NULL)
586     return(MagickFalse);
587   ReplaceImageInList(&wand->images,affine_image);
588   return(MagickTrue);
589 }
590 \f
591 /*
592 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
593 %                                                                             %
594 %                                                                             %
595 %                                                                             %
596 %   M a g i c k A n n o t a t e I m a g e                                     %
597 %                                                                             %
598 %                                                                             %
599 %                                                                             %
600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
601 %
602 %  MagickAnnotateImage() annotates an image with text.
603 %
604 %  The format of the MagickAnnotateImage method is:
605 %
606 %      MagickBooleanType MagickAnnotateImage(MagickWand *wand,
607 %        const DrawingWand *drawing_wand,const double x,const double y,
608 %        const double angle,const char *text)
609 %
610 %  A description of each parameter follows:
611 %
612 %    o wand: the magick wand.
613 %
614 %    o drawing_wand: the draw wand.
615 %
616 %    o x: x ordinate to left of text
617 %
618 %    o y: y ordinate to text baseline
619 %
620 %    o angle: rotate text relative to this angle.
621 %
622 %    o text: text to draw
623 %
624 */
625 WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand,
626   const DrawingWand *drawing_wand,const double x,const double y,
627   const double angle,const char *text)
628 {
629   char
630     geometry[MaxTextExtent];
631
632   DrawInfo
633     *draw_info;
634
635   MagickBooleanType
636     status;
637
638   assert(wand != (MagickWand *) NULL);
639   assert(wand->signature == WandSignature);
640   if (wand->debug != MagickFalse)
641     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
642   if (wand->images == (Image *) NULL)
643     ThrowWandException(WandError,"ContainsNoImages",wand->name);
644   draw_info=PeekDrawingWand(drawing_wand);
645   if (draw_info == (DrawInfo *) NULL)
646     return(MagickFalse);
647   (void) CloneString(&draw_info->text,text);
648   (void) FormatMagickString(geometry,MaxTextExtent,"%+g%+g",x,y);
649   draw_info->affine.sx=cos(DegreesToRadians(fmod(angle,360.0)));
650   draw_info->affine.rx=sin(DegreesToRadians(fmod(angle,360.0)));
651   draw_info->affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0))));
652   draw_info->affine.sy=cos(DegreesToRadians(fmod(angle,360.0)));
653   (void) CloneString(&draw_info->geometry,geometry);
654   status=AnnotateImage(wand->images,draw_info);
655   draw_info=DestroyDrawInfo(draw_info);
656   if (status == MagickFalse)
657     InheritException(wand->exception,&wand->images->exception);
658   return(status);
659 }
660 \f
661 /*
662 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
663 %                                                                             %
664 %                                                                             %
665 %                                                                             %
666 %   M a g i c k A n i m a t e I m a g e s                                     %
667 %                                                                             %
668 %                                                                             %
669 %                                                                             %
670 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
671 %
672 %  MagickAnimateImages() animates an image or image sequence.
673 %
674 %  The format of the MagickAnimateImages method is:
675 %
676 %      MagickBooleanType MagickAnimateImages(MagickWand *wand,
677 %        const char *server_name)
678 %
679 %  A description of each parameter follows:
680 %
681 %    o wand: the magick wand.
682 %
683 %    o server_name: the X server name.
684 %
685 */
686 WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand,
687   const char *server_name)
688 {
689   MagickBooleanType
690     status;
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   (void) CloneString(&wand->image_info->server_name,server_name);
697   status=AnimateImages(wand->image_info,wand->images);
698   if (status == MagickFalse)
699     InheritException(wand->exception,&wand->images->exception);
700   return(status);
701 }
702 \f
703 /*
704 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
705 %                                                                             %
706 %                                                                             %
707 %                                                                             %
708 %   M a g i c k A p p e n d I m a g e s                                       %
709 %                                                                             %
710 %                                                                             %
711 %                                                                             %
712 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
713 %
714 %  MagickAppendImages() append a set of images.
715 %
716 %  The format of the MagickAppendImages method is:
717 %
718 %      MagickWand *MagickAppendImages(MagickWand *wand,
719 %        const MagickBooleanType stack)
720 %
721 %  A description of each parameter follows:
722 %
723 %    o wand: the magick wand.
724 %
725 %    o stack: By default, images are stacked left-to-right. Set stack to
726 %      MagickTrue to stack them top-to-bottom.
727 %
728 */
729 WandExport MagickWand *MagickAppendImages(MagickWand *wand,
730   const MagickBooleanType stack)
731 {
732   Image
733     *append_image;
734
735   assert(wand != (MagickWand *) NULL);
736   assert(wand->signature == WandSignature);
737   if (wand->debug != MagickFalse)
738     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
739   if (wand->images == (Image *) NULL)
740     return((MagickWand *) NULL);
741   append_image=AppendImages(wand->images,stack,wand->exception);
742   if (append_image == (Image *) NULL)
743     return((MagickWand *) NULL);
744   return(CloneMagickWandFromImages(wand,append_image));
745 }
746 \f
747 /*
748 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
749 %                                                                             %
750 %                                                                             %
751 %                                                                             %
752 %   M a g i c k A u t o G a m m a I m a g e                                   %
753 %                                                                             %
754 %                                                                             %
755 %                                                                             %
756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
757 %
758 %  MagickAutoGammaImage() extracts the 'mean' from the image and adjust the
759 %  image to try make set its gamma appropriatally.
760 %
761 %  The format of the MagickAutoGammaImage method is:
762 %
763 %      MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
764 %      MagickBooleanType MagickAutoGammaImageChannel(MagickWand *wand,
765 %        const ChannelType channel)
766 %
767 %  A description of each parameter follows:
768 %
769 %    o wand: the magick wand.
770 %
771 %    o channel: the image channel(s).
772 %
773 */
774 WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand)
775 {
776   MagickBooleanType
777     status;
778
779   status=MagickAutoGammaImageChannel(wand,DefaultChannels);
780   return(status);
781 }
782
783 WandExport MagickBooleanType MagickAutoGammaImageChannel(MagickWand *wand,
784   const ChannelType channel)
785 {
786   MagickBooleanType
787     status;
788
789   assert(wand != (MagickWand *) NULL);
790   assert(wand->signature == WandSignature);
791   if (wand->debug != MagickFalse)
792     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
793   if (wand->images == (Image *) NULL)
794     ThrowWandException(WandError,"ContainsNoImages",wand->name);
795   status=AutoGammaImageChannel(wand->images,channel);
796   if (status == MagickFalse)
797     InheritException(wand->exception,&wand->images->exception);
798   return(status);
799 }
800 \f
801 /*
802 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
803 %                                                                             %
804 %                                                                             %
805 %                                                                             %
806 %   M a g i c k A u t o L e v e l I m a g e                                   %
807 %                                                                             %
808 %                                                                             %
809 %                                                                             %
810 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
811 %
812 %  MagickAutoLevelImage() adjusts the levels of a particular image channel by
813 %  scaling the minimum and maximum values to the full quantum range.
814 %
815 %  The format of the MagickAutoLevelImage method is:
816 %
817 %      MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
818 %      MagickBooleanType MagickAutoLevelImageChannel(MagickWand *wand,
819 %        const ChannelType channel)
820 %
821 %  A description of each parameter follows:
822 %
823 %    o wand: the magick wand.
824 %
825 %    o channel: the image channel(s).
826 %
827 */
828 WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand)
829 {
830   MagickBooleanType
831     status;
832
833   status=MagickAutoLevelImageChannel(wand,DefaultChannels);
834   return(status);
835 }
836
837 WandExport MagickBooleanType MagickAutoLevelImageChannel(MagickWand *wand,
838   const ChannelType channel)
839 {
840   MagickBooleanType
841     status;
842
843   assert(wand != (MagickWand *) NULL);
844   assert(wand->signature == WandSignature);
845   if (wand->debug != MagickFalse)
846     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
847   if (wand->images == (Image *) NULL)
848     ThrowWandException(WandError,"ContainsNoImages",wand->name);
849   status=AutoLevelImageChannel(wand->images,channel);
850   if (status == MagickFalse)
851     InheritException(wand->exception,&wand->images->exception);
852   return(status);
853 }
854 \f
855 /*
856 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
857 %                                                                             %
858 %                                                                             %
859 %                                                                             %
860 %   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                         %
861 %                                                                             %
862 %                                                                             %
863 %                                                                             %
864 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
865 %
866 %  MagickBlackThresholdImage() is like MagickThresholdImage() but  forces all
867 %  pixels below the threshold into black while leaving all pixels above the
868 %  threshold unchanged.
869 %
870 %  The format of the MagickBlackThresholdImage method is:
871 %
872 %      MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
873 %        const PixelWand *threshold)
874 %
875 %  A description of each parameter follows:
876 %
877 %    o wand: the magick wand.
878 %
879 %    o threshold: the pixel wand.
880 %
881 */
882 WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand,
883   const PixelWand *threshold)
884 {
885   char
886     thresholds[MaxTextExtent];
887
888   MagickBooleanType
889     status;
890
891   assert(wand != (MagickWand *) NULL);
892   assert(wand->signature == WandSignature);
893   if (wand->debug != MagickFalse)
894     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
895   if (wand->images == (Image *) NULL)
896     ThrowWandException(WandError,"ContainsNoImages",wand->name);
897   (void) FormatMagickString(thresholds,MaxTextExtent,
898     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
899     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
900     PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
901   status=BlackThresholdImage(wand->images,thresholds);
902   if (status == MagickFalse)
903     InheritException(wand->exception,&wand->images->exception);
904   return(status);
905 }
906 \f
907 /*
908 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
909 %                                                                             %
910 %                                                                             %
911 %                                                                             %
912 %   M a g i c k B l u e S h i f t I m a g e                                   %
913 %                                                                             %
914 %                                                                             %
915 %                                                                             %
916 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
917 %
918 %  MagickBlueShiftImage() mutes the colors of the image to simulate a scene at
919 %  nighttime in the moonlight.
920 %
921 %  The format of the MagickBlueShiftImage method is:
922 %
923 %      MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
924 %        const double factor)
925 %
926 %  A description of each parameter follows:
927 %
928 %    o wand: the magick wand.
929 %
930 %    o factor: the blue shift factor (default 1.5)
931 %
932 */
933 WandExport MagickBooleanType MagickBlueShiftImage(MagickWand *wand,
934   const double factor)
935 {
936   Image
937     *shift_image;
938
939   assert(wand != (MagickWand *) NULL);
940   assert(wand->signature == WandSignature);
941   if (wand->debug != MagickFalse)
942     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
943   if (wand->images == (Image *) NULL)
944     ThrowWandException(WandError,"ContainsNoImages",wand->name);
945   shift_image=BlueShiftImage(wand->images,factor,wand->exception);
946   if (shift_image == (Image *) NULL)
947     return(MagickFalse);
948   ReplaceImageInList(&wand->images,shift_image);
949   return(MagickTrue);
950 }
951 \f
952 /*
953 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
954 %                                                                             %
955 %                                                                             %
956 %                                                                             %
957 %   M a g i c k B l u r I m a g e                                             %
958 %                                                                             %
959 %                                                                             %
960 %                                                                             %
961 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
962 %
963 %  MagickBlurImage() blurs an image.  We convolve the image with a
964 %  gaussian operator of the given radius and standard deviation (sigma).
965 %  For reasonable results, the radius should be larger than sigma.  Use a
966 %  radius of 0 and BlurImage() selects a suitable radius for you.
967 %
968 %  The format of the MagickBlurImage method is:
969 %
970 %      MagickBooleanType MagickBlurImage(MagickWand *wand,const double radius,
971 %        const double sigma)
972 %      MagickBooleanType MagickBlurImageChannel(MagickWand *wand,
973 %        const ChannelType channel,const double radius,const double sigma)
974 %
975 %  A description of each parameter follows:
976 %
977 %    o wand: the magick wand.
978 %
979 %    o channel: the image channel(s).
980 %
981 %    o radius: the radius of the , in pixels, not counting the center
982 %      pixel.
983 %
984 %    o sigma: the standard deviation of the , in pixels.
985 %
986 */
987
988 WandExport MagickBooleanType MagickBlurImage(MagickWand *wand,
989   const double radius,const double sigma)
990 {
991   MagickBooleanType
992     status;
993
994   status=MagickBlurImageChannel(wand,DefaultChannels,radius,sigma);
995   return(status);
996 }
997
998 WandExport MagickBooleanType MagickBlurImageChannel(MagickWand *wand,
999   const ChannelType channel,const double radius,const double sigma)
1000 {
1001   Image
1002     *blur_image;
1003
1004   assert(wand != (MagickWand *) NULL);
1005   assert(wand->signature == WandSignature);
1006   if (wand->debug != MagickFalse)
1007     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1008   if (wand->images == (Image *) NULL)
1009     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1010   blur_image=BlurImageChannel(wand->images,channel,radius,sigma,
1011     wand->exception);
1012   if (blur_image == (Image *) NULL)
1013     return(MagickFalse);
1014   ReplaceImageInList(&wand->images,blur_image);
1015   return(MagickTrue);
1016 }
1017 \f
1018 /*
1019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1020 %                                                                             %
1021 %                                                                             %
1022 %                                                                             %
1023 %   M a g i c k B o r d e r I m a g e                                         %
1024 %                                                                             %
1025 %                                                                             %
1026 %                                                                             %
1027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1028 %
1029 %  MagickBorderImage() surrounds the image with a border of the color defined
1030 %  by the bordercolor pixel wand.
1031 %
1032 %  The format of the MagickBorderImage method is:
1033 %
1034 %      MagickBooleanType MagickBorderImage(MagickWand *wand,
1035 %        const PixelWand *bordercolor,const size_t width,
1036 %        const size_t height)
1037 %
1038 %  A description of each parameter follows:
1039 %
1040 %    o wand: the magick wand.
1041 %
1042 %    o bordercolor: the border color pixel wand.
1043 %
1044 %    o width: the border width.
1045 %
1046 %    o height: the border height.
1047 %
1048 */
1049 WandExport MagickBooleanType MagickBorderImage(MagickWand *wand,
1050   const PixelWand *bordercolor,const size_t width,
1051   const size_t height)
1052 {
1053   Image
1054     *border_image;
1055
1056   RectangleInfo
1057     border_info;
1058
1059   assert(wand != (MagickWand *) NULL);
1060   assert(wand->signature == WandSignature);
1061   if (wand->debug != MagickFalse)
1062     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1063   if (wand->images == (Image *) NULL)
1064     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1065   border_info.width=width;
1066   border_info.height=height;
1067   border_info.x=0;
1068   border_info.y=0;
1069   PixelGetQuantumColor(bordercolor,&wand->images->border_color);
1070   border_image=BorderImage(wand->images,&border_info,wand->exception);
1071   if (border_image == (Image *) NULL)
1072     return(MagickFalse);
1073   ReplaceImageInList(&wand->images,border_image);
1074   return(MagickTrue);
1075 }
1076 \f
1077 /*
1078 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1079 %                                                                             %
1080 %                                                                             %
1081 %                                                                             %
1082 %   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   %
1083 %                                                                             %
1084 %                                                                             %
1085 %                                                                             %
1086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1087 %
1088 %  Use MagickBrightnessContrastImage() to change the brightness and/or contrast
1089 %  of an image.  It converts the brightness and contrast parameters into slope
1090 %  and intercept and calls a polynomical function to apply to the image.
1091
1092 %
1093 %  The format of the MagickBrightnessContrastImage method is:
1094 %
1095 %      MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1096 %        const double brightness,const double contrast)
1097 %      MagickBooleanType MagickBrightnessContrastImageChannel(MagickWand *wand,
1098 %        const ChannelType channel,const double brightness,
1099 %        const double contrast)
1100 %
1101 %  A description of each parameter follows:
1102 %
1103 %    o wand: the magick wand.
1104 %
1105 %    o channel: the image channel(s).
1106 %
1107 %    o brightness: the brightness percent (-100 .. 100).
1108 %
1109 %    o contrast: the contrast percent (-100 .. 100).
1110 %
1111 */
1112
1113 WandExport MagickBooleanType MagickBrightnessContrastImage(MagickWand *wand,
1114   const double brightness,const double contrast)
1115 {
1116   MagickBooleanType
1117     status;
1118
1119   status=MagickBrightnessContrastImageChannel(wand,DefaultChannels,brightness,
1120     contrast);
1121   return(status);
1122 }
1123
1124 WandExport MagickBooleanType MagickBrightnessContrastImageChannel(
1125   MagickWand *wand,const ChannelType channel,const double brightness,
1126   const double contrast)
1127 {
1128   MagickBooleanType
1129     status;
1130
1131   assert(wand != (MagickWand *) NULL);
1132   assert(wand->signature == WandSignature);
1133   if (wand->debug != MagickFalse)
1134     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1135   if (wand->images == (Image *) NULL)
1136     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1137   status=BrightnessContrastImageChannel(wand->images,channel,brightness,
1138     contrast);
1139   if (status == MagickFalse)
1140     InheritException(wand->exception,&wand->images->exception);
1141   return(status);
1142 }
1143 \f
1144 /*
1145 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1146 %                                                                             %
1147 %                                                                             %
1148 %                                                                             %
1149 %   M a g i c k C h a r c o a l I m a g e                                     %
1150 %                                                                             %
1151 %                                                                             %
1152 %                                                                             %
1153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1154 %
1155 %  MagickCharcoalImage() simulates a charcoal drawing.
1156 %
1157 %  The format of the MagickCharcoalImage method is:
1158 %
1159 %      MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1160 %        const double radius,const double sigma)
1161 %
1162 %  A description of each parameter follows:
1163 %
1164 %    o wand: the magick wand.
1165 %
1166 %    o radius: the radius of the Gaussian, in pixels, not counting the center
1167 %      pixel.
1168 %
1169 %    o sigma: the standard deviation of the Gaussian, in pixels.
1170 %
1171 */
1172 WandExport MagickBooleanType MagickCharcoalImage(MagickWand *wand,
1173   const double radius,const double sigma)
1174 {
1175   Image
1176     *charcoal_image;
1177
1178   assert(wand != (MagickWand *) NULL);
1179   assert(wand->signature == WandSignature);
1180   if (wand->debug != MagickFalse)
1181     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1182   if (wand->images == (Image *) NULL)
1183     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1184   charcoal_image=CharcoalImage(wand->images,radius,sigma,wand->exception);
1185   if (charcoal_image == (Image *) NULL)
1186     return(MagickFalse);
1187   ReplaceImageInList(&wand->images,charcoal_image);
1188   return(MagickTrue);
1189 }
1190 \f
1191 /*
1192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1193 %                                                                             %
1194 %                                                                             %
1195 %                                                                             %
1196 %   M a g i c k C h o p I m a g e                                             %
1197 %                                                                             %
1198 %                                                                             %
1199 %                                                                             %
1200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1201 %
1202 %  MagickChopImage() removes a region of an image and collapses the image to
1203 %  occupy the removed portion
1204 %
1205 %  The format of the MagickChopImage method is:
1206 %
1207 %      MagickBooleanType MagickChopImage(MagickWand *wand,
1208 %        const size_t width,const size_t height,const ssize_t x,
1209 %        const ssize_t y)
1210 %
1211 %  A description of each parameter follows:
1212 %
1213 %    o wand: the magick wand.
1214 %
1215 %    o width: the region width.
1216 %
1217 %    o height: the region height.
1218 %
1219 %    o x: the region x offset.
1220 %
1221 %    o y: the region y offset.
1222 %
1223 %
1224 */
1225 WandExport MagickBooleanType MagickChopImage(MagickWand *wand,
1226   const size_t width,const size_t height,const ssize_t x,
1227   const ssize_t y)
1228 {
1229   Image
1230     *chop_image;
1231
1232   RectangleInfo
1233     chop;
1234
1235   assert(wand != (MagickWand *) NULL);
1236   assert(wand->signature == WandSignature);
1237   if (wand->debug != MagickFalse)
1238     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1239   if (wand->images == (Image *) NULL)
1240     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1241   chop.width=width;
1242   chop.height=height;
1243   chop.x=x;
1244   chop.y=y;
1245   chop_image=ChopImage(wand->images,&chop,wand->exception);
1246   if (chop_image == (Image *) NULL)
1247     return(MagickFalse);
1248   ReplaceImageInList(&wand->images,chop_image);
1249   return(MagickTrue);
1250 }
1251 \f
1252 /*
1253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1254 %                                                                             %
1255 %                                                                             %
1256 %                                                                             %
1257 %   M a g i c k C l a m p I m a g e                                           %
1258 %                                                                             %
1259 %                                                                             %
1260 %                                                                             %
1261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1262 %
1263 %  MagickClampImage() restricts the color range from 0 to the quantum depth.
1264 %
1265 %  The format of the MagickClampImage method is:
1266 %
1267 %      MagickBooleanType MagickClampImage(MagickWand *wand)
1268 %      MagickBooleanType MagickClampImageChannel(MagickWand *wand,
1269 %        const ChannelType channel)
1270 %
1271 %  A description of each parameter follows:
1272 %
1273 %    o wand: the magick wand.
1274 %
1275 %    o channel: the channel.
1276 %
1277 */
1278
1279 WandExport MagickBooleanType MagickClampImage(MagickWand *wand)
1280 {
1281   MagickBooleanType
1282     status;
1283
1284   status=MagickClampImageChannel(wand,DefaultChannels);
1285   return(status);
1286 }
1287
1288 WandExport MagickBooleanType MagickClampImageChannel(MagickWand *wand,
1289   const ChannelType channel)
1290 {
1291   MagickBooleanType
1292     status;
1293
1294   assert(wand != (MagickWand *) NULL);
1295   assert(wand->signature == WandSignature);
1296   if (wand->debug != MagickFalse)
1297     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1298   if (wand->images == (Image *) NULL)
1299     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1300   status=ClampImageChannel(wand->images,channel);
1301   if (status == MagickFalse)
1302     InheritException(wand->exception,&wand->images->exception);
1303   return(status);
1304 }
1305 \f
1306 /*
1307 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1308 %                                                                             %
1309 %                                                                             %
1310 %                                                                             %
1311 %   M a g i c k C l i p I m a g e                                             %
1312 %                                                                             %
1313 %                                                                             %
1314 %                                                                             %
1315 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1316 %
1317 %  MagickClipImage() clips along the first path from the 8BIM profile, if
1318 %  present.
1319 %
1320 %  The format of the MagickClipImage method is:
1321 %
1322 %      MagickBooleanType MagickClipImage(MagickWand *wand)
1323 %
1324 %  A description of each parameter follows:
1325 %
1326 %    o wand: the magick wand.
1327 %
1328 */
1329 WandExport MagickBooleanType MagickClipImage(MagickWand *wand)
1330 {
1331   MagickBooleanType
1332     status;
1333
1334   assert(wand != (MagickWand *) NULL);
1335   assert(wand->signature == WandSignature);
1336   if (wand->debug != MagickFalse)
1337     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1338   if (wand->images == (Image *) NULL)
1339     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1340   status=ClipImage(wand->images);
1341   if (status == MagickFalse)
1342     InheritException(wand->exception,&wand->images->exception);
1343   return(status);
1344 }
1345 \f
1346 /*
1347 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1348 %                                                                             %
1349 %                                                                             %
1350 %                                                                             %
1351 %   M a g i c k C l i p I m a g e P a t h                                     %
1352 %                                                                             %
1353 %                                                                             %
1354 %                                                                             %
1355 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1356 %
1357 %  MagickClipImagePath() clips along the named paths from the 8BIM profile, if
1358 %  present. Later operations take effect inside the path.  Id may be a number
1359 %  if preceded with #, to work on a numbered path, e.g., "#1" to use the first
1360 %  path.
1361 %
1362 %  The format of the MagickClipImagePath method is:
1363 %
1364 %      MagickBooleanType MagickClipImagePath(MagickWand *wand,
1365 %        const char *pathname,const MagickBooleanType inside)
1366 %
1367 %  A description of each parameter follows:
1368 %
1369 %    o wand: the magick wand.
1370 %
1371 %    o pathname: name of clipping path resource. If name is preceded by #, use
1372 %      clipping path numbered by name.
1373 %
1374 %    o inside: if non-zero, later operations take effect inside clipping path.
1375 %      Otherwise later operations take effect outside clipping path.
1376 %
1377 */
1378 WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand,
1379   const char *pathname,const MagickBooleanType inside)
1380 {
1381   MagickBooleanType
1382     status;
1383
1384   assert(wand != (MagickWand *) NULL);
1385   assert(wand->signature == WandSignature);
1386   if (wand->debug != MagickFalse)
1387     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1388   if (wand->images == (Image *) NULL)
1389     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1390   status=ClipImagePath(wand->images,pathname,inside);
1391   if (status == MagickFalse)
1392     InheritException(wand->exception,&wand->images->exception);
1393   return(status);
1394 }
1395 \f
1396 /*
1397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1398 %                                                                             %
1399 %                                                                             %
1400 %                                                                             %
1401 %   M a g i c k C l u t I m a g e                                             %
1402 %                                                                             %
1403 %                                                                             %
1404 %                                                                             %
1405 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1406 %
1407 %  MagickClutImage() replaces colors in the image from a color lookup table.
1408 %
1409 %  The format of the MagickClutImage method is:
1410 %
1411 %      MagickBooleanType MagickClutImage(MagickWand *wand,
1412 %        const MagickWand *clut_wand)
1413 %      MagickBooleanType MagickClutImageChannel(MagickWand *wand,
1414 %        const ChannelType channel,const MagickWand *clut_wand)
1415 %
1416 %  A description of each parameter follows:
1417 %
1418 %    o wand: the magick wand.
1419 %
1420 %    o clut_image: the clut image.
1421 %
1422 */
1423
1424 WandExport MagickBooleanType MagickClutImage(MagickWand *wand,
1425   const MagickWand *clut_wand)
1426 {
1427   MagickBooleanType
1428     status;
1429
1430   status=MagickClutImageChannel(wand,DefaultChannels,clut_wand);
1431   return(status);
1432 }
1433
1434 WandExport MagickBooleanType MagickClutImageChannel(MagickWand *wand,
1435   const ChannelType channel,const MagickWand *clut_wand)
1436 {
1437   MagickBooleanType
1438     status;
1439
1440   assert(wand != (MagickWand *) NULL);
1441   assert(wand->signature == WandSignature);
1442   if (wand->debug != MagickFalse)
1443     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1444   if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL))
1445     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1446   status=ClutImageChannel(wand->images,channel,clut_wand->images);
1447   if (status == MagickFalse)
1448     InheritException(wand->exception,&wand->images->exception);
1449   return(status);
1450 }
1451 \f
1452 /*
1453 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1454 %                                                                             %
1455 %                                                                             %
1456 %                                                                             %
1457 %   M a g i c k C o a l e s c e I m a g e s                                   %
1458 %                                                                             %
1459 %                                                                             %
1460 %                                                                             %
1461 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1462 %
1463 %  MagickCoalesceImages() composites a set of images while respecting any page
1464 %  offsets and disposal methods.  GIF, MIFF, and MNG animation sequences
1465 %  typically start with an image background and each subsequent image
1466 %  varies in size and offset.  MagickCoalesceImages() returns a new sequence
1467 %  where each image in the sequence is the same size as the first and
1468 %  composited with the next image in the sequence.
1469 %
1470 %  The format of the MagickCoalesceImages method is:
1471 %
1472 %      MagickWand *MagickCoalesceImages(MagickWand *wand)
1473 %
1474 %  A description of each parameter follows:
1475 %
1476 %    o wand: the magick wand.
1477 %
1478 */
1479 WandExport MagickWand *MagickCoalesceImages(MagickWand *wand)
1480 {
1481   Image
1482     *coalesce_image;
1483
1484   assert(wand != (MagickWand *) NULL);
1485   assert(wand->signature == WandSignature);
1486   if (wand->debug != MagickFalse)
1487     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1488   if (wand->images == (Image *) NULL)
1489     return((MagickWand *) NULL);
1490   coalesce_image=CoalesceImages(wand->images,wand->exception);
1491   if (coalesce_image == (Image *) NULL)
1492     return((MagickWand *) NULL);
1493   return(CloneMagickWandFromImages(wand,coalesce_image));
1494 }
1495 \f
1496 /*
1497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1498 %                                                                             %
1499 %                                                                             %
1500 %                                                                             %
1501 %   M a g i c k C o l o r D e c i s i o n I m a g e                           %
1502 %                                                                             %
1503 %                                                                             %
1504 %                                                                             %
1505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1506 %
1507 %  MagickColorDecisionListImage() accepts a lightweight Color Correction
1508 %  Collection (CCC) file which solely contains one or more color corrections
1509 %  and applies the color correction to the image.  Here is a sample CCC file:
1510 %
1511 %    <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
1512 %          <ColorCorrection id="cc03345">
1513 %                <SOPNode>
1514 %                     <Slope> 0.9 1.2 0.5 </Slope>
1515 %                     <Offset> 0.4 -0.5 0.6 </Offset>
1516 %                     <Power> 1.0 0.8 1.5 </Power>
1517 %                </SOPNode>
1518 %                <SATNode>
1519 %                     <Saturation> 0.85 </Saturation>
1520 %                </SATNode>
1521 %          </ColorCorrection>
1522 %    </ColorCorrectionCollection>
1523 %
1524 %  which includes the offset, slope, and power for each of the RGB channels
1525 %  as well as the saturation.
1526 %
1527 %  The format of the MagickColorDecisionListImage method is:
1528 %
1529 %      MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1530 %        const double gamma)
1531 %
1532 %  A description of each parameter follows:
1533 %
1534 %    o wand: the magick wand.
1535 %
1536 %    o color_correction_collection: the color correction collection in XML.
1537 %
1538 */
1539 WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand,
1540   const char *color_correction_collection)
1541 {
1542   MagickBooleanType
1543     status;
1544
1545   assert(wand != (MagickWand *) NULL);
1546   assert(wand->signature == WandSignature);
1547   if (wand->debug != MagickFalse)
1548     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1549   if (wand->images == (Image *) NULL)
1550     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1551   status=ColorDecisionListImage(wand->images,color_correction_collection);
1552   if (status == MagickFalse)
1553     InheritException(wand->exception,&wand->images->exception);
1554   return(status);
1555 }
1556 \f
1557 /*
1558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1559 %                                                                             %
1560 %                                                                             %
1561 %                                                                             %
1562 %   M a g i c k C o l o r i z e I m a g e                                     %
1563 %                                                                             %
1564 %                                                                             %
1565 %                                                                             %
1566 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1567 %
1568 %  MagickColorizeImage() blends the fill color with each pixel in the image.
1569 %
1570 %  The format of the MagickColorizeImage method is:
1571 %
1572 %      MagickBooleanType MagickColorizeImage(MagickWand *wand,
1573 %        const PixelWand *colorize,const PixelWand *opacity)
1574 %
1575 %  A description of each parameter follows:
1576 %
1577 %    o wand: the magick wand.
1578 %
1579 %    o colorize: the colorize pixel wand.
1580 %
1581 %    o opacity: the opacity pixel wand.
1582 %
1583 */
1584 WandExport MagickBooleanType MagickColorizeImage(MagickWand *wand,
1585   const PixelWand *colorize,const PixelWand *opacity)
1586 {
1587   char
1588     percent_opaque[MaxTextExtent];
1589
1590   Image
1591     *colorize_image;
1592
1593   PixelPacket
1594     target;
1595
1596   assert(wand != (MagickWand *) NULL);
1597   assert(wand->signature == WandSignature);
1598   if (wand->debug != MagickFalse)
1599     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1600   if (wand->images == (Image *) NULL)
1601     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1602   (void) FormatMagickString(percent_opaque,MaxTextExtent,
1603     "%g,%g,%g,%g",(double) (100.0*QuantumScale*
1604     PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
1605     PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
1606     PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
1607     PixelGetOpacityQuantum(opacity)));
1608   PixelGetQuantumColor(colorize,&target);
1609   colorize_image=ColorizeImage(wand->images,percent_opaque,target,
1610     wand->exception);
1611   if (colorize_image == (Image *) NULL)
1612     return(MagickFalse);
1613   ReplaceImageInList(&wand->images,colorize_image);
1614   return(MagickTrue);
1615 }
1616 \f
1617 /*
1618 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1619 %                                                                             %
1620 %                                                                             %
1621 %                                                                             %
1622 %   M a g i c k C o l o r M a t r i x I m a g e                               %
1623 %                                                                             %
1624 %                                                                             %
1625 %                                                                             %
1626 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1627 %
1628 %  MagickColorMatrixImage() apply color transformation to an image. The method
1629 %  permits saturation changes, hue rotation, luminance to alpha, and various
1630 %  other effects.  Although variable-sized transformation matrices can be used,
1631 %  typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA
1632 %  (or RGBA with offsets).  The matrix is similar to those used by Adobe Flash
1633 %  except offsets are in column 6 rather than 5 (in support of CMYKA images)
1634 %  and offsets are normalized (divide Flash offset by 255).
1635 %
1636 %  The format of the MagickColorMatrixImage method is:
1637 %
1638 %      MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1639 %        const KernelInfo *color_matrix)
1640 %
1641 %  A description of each parameter follows:
1642 %
1643 %    o wand: the magick wand.
1644 %
1645 %    o color_matrix:  the color matrix.
1646 %
1647 */
1648 WandExport MagickBooleanType MagickColorMatrixImage(MagickWand *wand,
1649   const KernelInfo *color_matrix)
1650 {
1651   Image
1652     *color_image;
1653
1654   assert(wand != (MagickWand *) NULL);
1655   assert(wand->signature == WandSignature);
1656   if (wand->debug != MagickFalse)
1657     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1658   if (color_matrix == (const KernelInfo *) NULL)
1659     return(MagickFalse);
1660   if (wand->images == (Image *) NULL)
1661     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1662   color_image=ColorMatrixImage(wand->images,color_matrix,wand->exception);
1663   if (color_image == (Image *) NULL)
1664     return(MagickFalse);
1665   ReplaceImageInList(&wand->images,color_image);
1666   return(MagickTrue);
1667 }
1668 \f
1669 /*
1670 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1671 %                                                                             %
1672 %                                                                             %
1673 %                                                                             %
1674 %   M a g i c k C o m b i n e I m a g e s                                     %
1675 %                                                                             %
1676 %                                                                             %
1677 %                                                                             %
1678 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1679 %
1680 %  MagickCombineImages() combines one or more images into a single image.  The
1681 %  grayscale value of the pixels of each image in the sequence is assigned in
1682 %  order to the specified  hannels of the combined image.   The typical
1683 %  ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc.
1684 %
1685 %  The format of the MagickCombineImages method is:
1686 %
1687 %      MagickWand *MagickCombineImages(MagickWand *wand,
1688 %        const ChannelType channel)
1689 %
1690 %  A description of each parameter follows:
1691 %
1692 %    o wand: the magick wand.
1693 %
1694 %    o channel: the channel.
1695 %
1696 */
1697 WandExport MagickWand *MagickCombineImages(MagickWand *wand,
1698   const ChannelType channel)
1699 {
1700   Image
1701     *combine_image;
1702
1703   assert(wand != (MagickWand *) NULL);
1704   assert(wand->signature == WandSignature);
1705   if (wand->debug != MagickFalse)
1706     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1707   if (wand->images == (Image *) NULL)
1708     return((MagickWand *) NULL);
1709   combine_image=CombineImages(wand->images,channel,wand->exception);
1710   if (combine_image == (Image *) NULL)
1711     return((MagickWand *) NULL);
1712   return(CloneMagickWandFromImages(wand,combine_image));
1713 }
1714 \f
1715 /*
1716 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1717 %                                                                             %
1718 %                                                                             %
1719 %                                                                             %
1720 %   M a g i c k C o m m e n t I m a g e                                       %
1721 %                                                                             %
1722 %                                                                             %
1723 %                                                                             %
1724 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1725 %
1726 %  MagickCommentImage() adds a comment to your image.
1727 %
1728 %  The format of the MagickCommentImage method is:
1729 %
1730 %      MagickBooleanType MagickCommentImage(MagickWand *wand,
1731 %        const char *comment)
1732 %
1733 %  A description of each parameter follows:
1734 %
1735 %    o wand: the magick wand.
1736 %
1737 %    o comment: the image comment.
1738 %
1739 */
1740 WandExport MagickBooleanType MagickCommentImage(MagickWand *wand,
1741   const char *comment)
1742 {
1743   MagickBooleanType
1744     status;
1745
1746   assert(wand != (MagickWand *) NULL);
1747   assert(wand->signature == WandSignature);
1748   if (wand->debug != MagickFalse)
1749     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1750   if (wand->images == (Image *) NULL)
1751     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1752   status=SetImageProperty(wand->images,"comment",comment);
1753   if (status == MagickFalse)
1754     InheritException(wand->exception,&wand->images->exception);
1755   return(status);
1756 }
1757 \f
1758 /*
1759 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1760 %                                                                             %
1761 %                                                                             %
1762 %                                                                             %
1763 %   M a g i c k C o m p a r e I m a g e C h a n n e l s                       %
1764 %                                                                             %
1765 %                                                                             %
1766 %                                                                             %
1767 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1768 %
1769 %  MagickCompareImageChannels() compares one or more image channels of an image
1770 %  to a reconstructed image and returns the difference image.
1771 %
1772 %  The format of the MagickCompareImageChannels method is:
1773 %
1774 %      MagickWand *MagickCompareImageChannels(MagickWand *wand,
1775 %        const MagickWand *reference,const ChannelType channel,
1776 %        const MetricType metric,double *distortion)
1777 %
1778 %  A description of each parameter follows:
1779 %
1780 %    o wand: the magick wand.
1781 %
1782 %    o reference: the reference wand.
1783 %
1784 %    o channel: the channel.
1785 %
1786 %    o metric: the metric.
1787 %
1788 %    o distortion: the computed distortion between the images.
1789 %
1790 */
1791 WandExport MagickWand *MagickCompareImageChannels(MagickWand *wand,
1792   const MagickWand *reference,const ChannelType channel,const MetricType metric,
1793   double *distortion)
1794 {
1795   Image
1796     *compare_image;
1797
1798   assert(wand != (MagickWand *) NULL);
1799   assert(wand->signature == WandSignature);
1800   if (wand->debug != MagickFalse)
1801     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1802   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1803     {
1804       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1805         "ContainsNoImages","`%s'",wand->name);
1806       return((MagickWand *) NULL);
1807     }
1808   compare_image=CompareImageChannels(wand->images,reference->images,channel,
1809     metric,distortion,&wand->images->exception);
1810   if (compare_image == (Image *) NULL)
1811     return((MagickWand *) NULL);
1812   return(CloneMagickWandFromImages(wand,compare_image));
1813 }
1814 \f
1815 /*
1816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1817 %                                                                             %
1818 %                                                                             %
1819 %                                                                             %
1820 %   M a g i c k C o m p a r e I m a g e L a y e r s                           %
1821 %                                                                             %
1822 %                                                                             %
1823 %                                                                             %
1824 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1825 %
1826 %  MagickCompareImageLayers() compares each image with the next in a sequence
1827 %  and returns the maximum bounding region of any pixel differences it
1828 %  discovers.
1829 %
1830 %  The format of the MagickCompareImageLayers method is:
1831 %
1832 %      MagickWand *MagickCompareImageLayers(MagickWand *wand,
1833 %        const ImageLayerMethod method)
1834 %
1835 %  A description of each parameter follows:
1836 %
1837 %    o wand: the magick wand.
1838 %
1839 %    o method: the compare method.
1840 %
1841 */
1842 WandExport MagickWand *MagickCompareImageLayers(MagickWand *wand,
1843   const ImageLayerMethod method)
1844 {
1845   Image
1846     *layers_image;
1847
1848   assert(wand != (MagickWand *) NULL);
1849   assert(wand->signature == WandSignature);
1850   if (wand->debug != MagickFalse)
1851     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1852   if (wand->images == (Image *) NULL)
1853     return((MagickWand *) NULL);
1854   layers_image=CompareImageLayers(wand->images,method,wand->exception);
1855   if (layers_image == (Image *) NULL)
1856     return((MagickWand *) NULL);
1857   return(CloneMagickWandFromImages(wand,layers_image));
1858 }
1859 \f
1860 /*
1861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1862 %                                                                             %
1863 %                                                                             %
1864 %                                                                             %
1865 %   M a g i c k C o m p a r e I m a g e s                                     %
1866 %                                                                             %
1867 %                                                                             %
1868 %                                                                             %
1869 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1870 %
1871 %  MagickCompareImages() compares an image to a reconstructed image and returns
1872 %  the specified difference image.
1873 %
1874 %  The format of the MagickCompareImages method is:
1875 %
1876 %      MagickWand *MagickCompareImages(MagickWand *wand,
1877 %        const MagickWand *reference,const MetricType metric,
1878 %        double *distortion)
1879 %
1880 %  A description of each parameter follows:
1881 %
1882 %    o wand: the magick wand.
1883 %
1884 %    o reference: the reference wand.
1885 %
1886 %    o metric: the metric.
1887 %
1888 %    o distortion: the computed distortion between the images.
1889 %
1890 */
1891 WandExport MagickWand *MagickCompareImages(MagickWand *wand,
1892   const MagickWand *reference,const MetricType metric,double *distortion)
1893 {
1894   Image
1895     *compare_image;
1896
1897
1898   assert(wand != (MagickWand *) NULL);
1899   assert(wand->signature == WandSignature);
1900   if (wand->debug != MagickFalse)
1901     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1902   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
1903     {
1904       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
1905         "ContainsNoImages","`%s'",wand->name);
1906       return((MagickWand *) NULL);
1907     }
1908   compare_image=CompareImages(wand->images,reference->images,metric,distortion,
1909     &wand->images->exception);
1910   if (compare_image == (Image *) NULL)
1911     return((MagickWand *) NULL);
1912   return(CloneMagickWandFromImages(wand,compare_image));
1913 }
1914 \f
1915 /*
1916 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1917 %                                                                             %
1918 %                                                                             %
1919 %                                                                             %
1920 %   M a g i c k C o m p o s i t e I m a g e                                   %
1921 %                                                                             %
1922 %                                                                             %
1923 %                                                                             %
1924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1925 %
1926 %  MagickCompositeImage() composite one image onto another at the specified
1927 %  offset.
1928 %
1929 %  The format of the MagickCompositeImage method is:
1930 %
1931 %      MagickBooleanType MagickCompositeImage(MagickWand *wand,
1932 %        const MagickWand *composite_wand,const CompositeOperator compose,
1933 %        const ssize_t x,const ssize_t y)
1934 %      MagickBooleanType MagickCompositeImageChannel(MagickWand *wand,
1935 %        const ChannelType channel,const MagickWand *composite_wand,
1936 %        const CompositeOperator compose,const ssize_t x,const ssize_t y)
1937 %
1938 %  A description of each parameter follows:
1939 %
1940 %    o wand: the magick wand.
1941 %
1942 %    o composite_image: the composite image.
1943 %
1944 %    o compose: This operator affects how the composite is applied to the
1945 %      image.  The default is Over.  Choose from these operators:
1946 %
1947 %        OverCompositeOp       InCompositeOp         OutCompositeOp
1948 %        AtopCompositeOp       XorCompositeOp        PlusCompositeOp
1949 %        MinusCompositeOp      AddCompositeOp        SubtractCompositeOp
1950 %        DifferenceCompositeOp BumpmapCompositeOp    CopyCompositeOp
1951 %        DisplaceCompositeOp
1952 %
1953 %    o x: the column offset of the composited image.
1954 %
1955 %    o y: the row offset of the composited image.
1956 %
1957 */
1958
1959 WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand,
1960   const MagickWand *composite_wand,const CompositeOperator compose,const ssize_t x,
1961   const ssize_t y)
1962 {
1963   MagickBooleanType
1964     status;
1965
1966   status=MagickCompositeImageChannel(wand,DefaultChannels,composite_wand,
1967     compose,x,y);
1968   return(status);
1969 }
1970
1971 WandExport MagickBooleanType MagickCompositeImageChannel(MagickWand *wand,
1972   const ChannelType channel,const MagickWand *composite_wand,
1973   const CompositeOperator compose,const ssize_t x,const ssize_t y)
1974 {
1975   MagickBooleanType
1976     status;
1977
1978   assert(wand != (MagickWand *) NULL);
1979   assert(wand->signature == WandSignature);
1980   if (wand->debug != MagickFalse)
1981     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
1982   if ((wand->images == (Image *) NULL) ||
1983       (composite_wand->images == (Image *) NULL))
1984     ThrowWandException(WandError,"ContainsNoImages",wand->name);
1985   status=CompositeImageChannel(wand->images,channel,compose,
1986     composite_wand->images,x,y);
1987   if (status == MagickFalse)
1988     InheritException(wand->exception,&wand->images->exception);
1989   return(status);
1990 }
1991 \f
1992 /*
1993 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1994 %                                                                             %
1995 %                                                                             %
1996 %                                                                             %
1997 %   M a g i c k C o n t r a s t I m a g e                                     %
1998 %                                                                             %
1999 %                                                                             %
2000 %                                                                             %
2001 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2002 %
2003 %  MagickContrastImage() enhances the intensity differences between the lighter
2004 %  and darker elements of the image.  Set sharpen to a value other than 0 to
2005 %  increase the image contrast otherwise the contrast is reduced.
2006 %
2007 %  The format of the MagickContrastImage method is:
2008 %
2009 %      MagickBooleanType MagickContrastImage(MagickWand *wand,
2010 %        const MagickBooleanType sharpen)
2011 %
2012 %  A description of each parameter follows:
2013 %
2014 %    o wand: the magick wand.
2015 %
2016 %    o sharpen: Increase or decrease image contrast.
2017 %
2018 %
2019 */
2020 WandExport MagickBooleanType MagickContrastImage(MagickWand *wand,
2021   const MagickBooleanType sharpen)
2022 {
2023   MagickBooleanType
2024     status;
2025
2026   assert(wand != (MagickWand *) NULL);
2027   assert(wand->signature == WandSignature);
2028   if (wand->debug != MagickFalse)
2029     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2030   if (wand->images == (Image *) NULL)
2031     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2032   status=ContrastImage(wand->images,sharpen);
2033   if (status == MagickFalse)
2034     InheritException(wand->exception,&wand->images->exception);
2035   return(status);
2036 }
2037 \f
2038 /*
2039 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2040 %                                                                             %
2041 %                                                                             %
2042 %                                                                             %
2043 %   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                       %
2044 %                                                                             %
2045 %                                                                             %
2046 %                                                                             %
2047 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2048 %
2049 %  MagickContrastStretchImage() enhances the contrast of a color image by
2050 %  adjusting the pixels color to span the entire range of colors available.
2051 %  You can also reduce the influence of a particular channel with a gamma
2052 %  value of 0.
2053 %
2054 %  The format of the MagickContrastStretchImage method is:
2055 %
2056 %      MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2057 %        const double black_point,const double white_point)
2058 %      MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
2059 %        const ChannelType channel,const double black_point,
2060 %        const double white_point)
2061 %
2062 %  A description of each parameter follows:
2063 %
2064 %    o wand: the magick wand.
2065 %
2066 %    o channel: the image channel(s).
2067 %
2068 %    o black_point: the black point.
2069 %
2070 %    o white_point: the white point.
2071 %
2072 */
2073
2074 WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand,
2075   const double black_point,const double white_point)
2076 {
2077   MagickBooleanType
2078     status;
2079
2080   status=MagickContrastStretchImageChannel(wand,DefaultChannels,black_point,
2081     white_point);
2082   return(status);
2083 }
2084
2085 WandExport MagickBooleanType MagickContrastStretchImageChannel(MagickWand *wand,
2086   const ChannelType channel,const double black_point,const double white_point)
2087 {
2088   MagickBooleanType
2089     status;
2090
2091   assert(wand != (MagickWand *) NULL);
2092   assert(wand->signature == WandSignature);
2093   if (wand->debug != MagickFalse)
2094     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2095   if (wand->images == (Image *) NULL)
2096     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2097   status=ContrastStretchImageChannel(wand->images,channel,black_point,
2098     white_point);
2099   if (status == MagickFalse)
2100     InheritException(wand->exception,&wand->images->exception);
2101   return(status);
2102 }
2103 \f
2104 /*
2105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2106 %                                                                             %
2107 %                                                                             %
2108 %                                                                             %
2109 %   M a g i c k C o n v o l v e I m a g e                                     %
2110 %                                                                             %
2111 %                                                                             %
2112 %                                                                             %
2113 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2114 %
2115 %  MagickConvolveImage() applies a custom convolution kernel to the image.
2116 %
2117 %  The format of the MagickConvolveImage method is:
2118 %
2119 %      MagickBooleanType MagickConvolveImage(MagickWand *wand,
2120 %        const size_t order,const double *kernel)
2121 %      MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
2122 %        const ChannelType channel,const size_t order,
2123 %        const double *kernel)
2124 %
2125 %  A description of each parameter follows:
2126 %
2127 %    o wand: the magick wand.
2128 %
2129 %    o channel: the image channel(s).
2130 %
2131 %    o order: the number of columns and rows in the filter kernel.
2132 %
2133 %    o kernel: An array of doubles representing the convolution kernel.
2134 %
2135 */
2136
2137 WandExport MagickBooleanType MagickConvolveImage(MagickWand *wand,
2138   const size_t order,const double *kernel)
2139 {
2140   MagickBooleanType
2141     status;
2142
2143   status=MagickConvolveImageChannel(wand,DefaultChannels,order,kernel);
2144   return(status);
2145 }
2146
2147 WandExport MagickBooleanType MagickConvolveImageChannel(MagickWand *wand,
2148   const ChannelType channel,const size_t order,const double *kernel)
2149 {
2150   Image
2151     *convolve_image;
2152
2153   assert(wand != (MagickWand *) NULL);
2154   assert(wand->signature == WandSignature);
2155   if (wand->debug != MagickFalse)
2156     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2157   if (kernel == (const double *) NULL)
2158     return(MagickFalse);
2159   if (wand->images == (Image *) NULL)
2160     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2161   convolve_image=ConvolveImageChannel(wand->images,channel,order,kernel,
2162     wand->exception);
2163   if (convolve_image == (Image *) NULL)
2164     return(MagickFalse);
2165   ReplaceImageInList(&wand->images,convolve_image);
2166   return(MagickTrue);
2167 }
2168 \f
2169 /*
2170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2171 %                                                                             %
2172 %                                                                             %
2173 %                                                                             %
2174 %   M a g i c k C r o p I m a g e                                             %
2175 %                                                                             %
2176 %                                                                             %
2177 %                                                                             %
2178 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2179 %
2180 %  MagickCropImage() extracts a region of the image.
2181 %
2182 %  The format of the MagickCropImage method is:
2183 %
2184 %      MagickBooleanType MagickCropImage(MagickWand *wand,
2185 %        const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2186 %
2187 %  A description of each parameter follows:
2188 %
2189 %    o wand: the magick wand.
2190 %
2191 %    o width: the region width.
2192 %
2193 %    o height: the region height.
2194 %
2195 %    o x: the region x-offset.
2196 %
2197 %    o y: the region y-offset.
2198 %
2199 */
2200 WandExport MagickBooleanType MagickCropImage(MagickWand *wand,
2201   const size_t width,const size_t height,const ssize_t x,const ssize_t y)
2202 {
2203   Image
2204     *crop_image;
2205
2206   RectangleInfo
2207     crop;
2208
2209   assert(wand != (MagickWand *) NULL);
2210   assert(wand->signature == WandSignature);
2211   if (wand->debug != MagickFalse)
2212     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2213   if (wand->images == (Image *) NULL)
2214     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2215   crop.width=width;
2216   crop.height=height;
2217   crop.x=x;
2218   crop.y=y;
2219   crop_image=CropImage(wand->images,&crop,wand->exception);
2220   if (crop_image == (Image *) NULL)
2221     return(MagickFalse);
2222   ReplaceImageInList(&wand->images,crop_image);
2223   return(MagickTrue);
2224 }
2225 \f
2226 /*
2227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2228 %                                                                             %
2229 %                                                                             %
2230 %                                                                             %
2231 %   M a g i c k C y c l e C o l o r m a p I m a g e                           %
2232 %                                                                             %
2233 %                                                                             %
2234 %                                                                             %
2235 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2236 %
2237 %  MagickCycleColormapImage() displaces an image's colormap by a given number
2238 %  of positions.  If you cycle the colormap a number of times you can produce
2239 %  a psychodelic effect.
2240 %
2241 %  The format of the MagickCycleColormapImage method is:
2242 %
2243 %      MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2244 %        const ssize_t displace)
2245 %
2246 %  A description of each parameter follows:
2247 %
2248 %    o wand: the magick wand.
2249 %
2250 %    o pixel_wand: the pixel wand.
2251 %
2252 */
2253 WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand,
2254   const ssize_t displace)
2255 {
2256   MagickBooleanType
2257     status;
2258
2259   assert(wand != (MagickWand *) NULL);
2260   assert(wand->signature == WandSignature);
2261   if (wand->debug != MagickFalse)
2262     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2263   if (wand->images == (Image *) NULL)
2264     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2265   status=CycleColormapImage(wand->images,displace);
2266   if (status == MagickFalse)
2267     InheritException(wand->exception,&wand->images->exception);
2268   return(status);
2269 }
2270 \f
2271 /*
2272 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2273 %                                                                             %
2274 %                                                                             %
2275 %                                                                             %
2276 %   M a g i c k C o n s t i t u t e I m a g e                                 %
2277 %                                                                             %
2278 %                                                                             %
2279 %                                                                             %
2280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2281 %
2282 %  MagickConstituteImage() adds an image to the wand comprised of the pixel
2283 %  data you supply.  The pixel data must be in scanline order top-to-bottom.
2284 %  The data can be char, short int, int, float, or double.  Float and double
2285 %  require the pixels to be normalized [0..1], otherwise [0..Max],  where Max
2286 %  is the maximum value the type can accomodate (e.g. 255 for char).  For
2287 %  example, to create a 640x480 image from unsigned red-green-blue character
2288 %  data, use
2289 %
2290 %      MagickConstituteImage(wand,640,640,"RGB",CharPixel,pixels);
2291 %
2292 %  The format of the MagickConstituteImage method is:
2293 %
2294 %      MagickBooleanType MagickConstituteImage(MagickWand *wand,
2295 %        const size_t columns,const size_t rows,const char *map,
2296 %        const StorageType storage,void *pixels)
2297 %
2298 %  A description of each parameter follows:
2299 %
2300 %    o wand: the magick wand.
2301 %
2302 %    o columns: width in pixels of the image.
2303 %
2304 %    o rows: height in pixels of the image.
2305 %
2306 %    o map:  This string reflects the expected ordering of the pixel array.
2307 %      It can be any combination or order of R = red, G = green, B = blue,
2308 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
2309 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
2310 %      P = pad.
2311 %
2312 %    o storage: Define the data type of the pixels.  Float and double types are
2313 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
2314 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
2315 %      LongPixel, QuantumPixel, or ShortPixel.
2316 %
2317 %    o pixels: This array of values contain the pixel components as defined by
2318 %      map and type.  You must preallocate this array where the expected
2319 %      length varies depending on the values of width, height, map, and type.
2320 %
2321 %
2322 */
2323 WandExport MagickBooleanType MagickConstituteImage(MagickWand *wand,
2324   const size_t columns,const size_t rows,const char *map,
2325   const StorageType storage,const void *pixels)
2326 {
2327   Image
2328     *images;
2329
2330   assert(wand != (MagickWand *) NULL);
2331   assert(wand->signature == WandSignature);
2332   if (wand->debug != MagickFalse)
2333     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2334   images=ConstituteImage(columns,rows,map,storage,pixels,wand->exception);
2335   if (images == (Image *) NULL)
2336     return(MagickFalse);
2337   return(InsertImageInWand(wand,images));
2338 }
2339 \f
2340 /*
2341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2342 %                                                                             %
2343 %                                                                             %
2344 %                                                                             %
2345 %   M a g i c k D e c i p h e r I m a g e                                     %
2346 %                                                                             %
2347 %                                                                             %
2348 %                                                                             %
2349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2350 %
2351 %  MagickDecipherImage() converts cipher pixels to plain pixels.
2352 %
2353 %  The format of the MagickDecipherImage method is:
2354 %
2355 %      MagickBooleanType MagickDecipherImage(MagickWand *wand,
2356 %        const char *passphrase)
2357 %
2358 %  A description of each parameter follows:
2359 %
2360 %    o wand: the magick wand.
2361 %
2362 %    o passphrase: the passphrase.
2363 %
2364 */
2365 WandExport MagickBooleanType MagickDecipherImage(MagickWand *wand,
2366   const char *passphrase)
2367 {
2368   assert(wand != (MagickWand *) NULL);
2369   assert(wand->signature == WandSignature);
2370   if (wand->debug != MagickFalse)
2371     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2372   if (wand->images == (Image *) NULL)
2373     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2374   return(DecipherImage(wand->images,passphrase,&wand->images->exception));
2375 }
2376 \f
2377 /*
2378 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2379 %                                                                             %
2380 %                                                                             %
2381 %                                                                             %
2382 %   M a g i c k D e c o n s t r u c t I m a g e s                             %
2383 %                                                                             %
2384 %                                                                             %
2385 %                                                                             %
2386 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2387 %
2388 %  MagickDeconstructImages() compares each image with the next in a sequence
2389 %  and returns the maximum bounding region of any pixel differences it
2390 %  discovers.
2391 %
2392 %  The format of the MagickDeconstructImages method is:
2393 %
2394 %      MagickWand *MagickDeconstructImages(MagickWand *wand)
2395 %
2396 %  A description of each parameter follows:
2397 %
2398 %    o wand: the magick wand.
2399 %
2400 */
2401 WandExport MagickWand *MagickDeconstructImages(MagickWand *wand)
2402 {
2403   Image
2404     *deconstruct_image;
2405
2406   assert(wand != (MagickWand *) NULL);
2407   assert(wand->signature == WandSignature);
2408   if (wand->debug != MagickFalse)
2409     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2410   if (wand->images == (Image *) NULL)
2411     return((MagickWand *) NULL);
2412   deconstruct_image=DeconstructImages(wand->images,wand->exception);
2413   if (deconstruct_image == (Image *) NULL)
2414     return((MagickWand *) NULL);
2415   return(CloneMagickWandFromImages(wand,deconstruct_image));
2416 }
2417 \f
2418 /*
2419 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2420 %                                                                             %
2421 %                                                                             %
2422 %                                                                             %
2423 %     M a g i c k D e s k e w I m a g e                                       %
2424 %                                                                             %
2425 %                                                                             %
2426 %                                                                             %
2427 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2428 %
2429 %  MagickDeskewImage() removes skew from the image.  Skew is an artifact that
2430 %  occurs in scanned images because of the camera being misaligned,
2431 %  imperfections in the scanning or surface, or simply because the paper was
2432 %  not placed completely flat when scanned.
2433 %
2434 %  The format of the MagickDeskewImage method is:
2435 %
2436 %      MagickBooleanType MagickDeskewImage(MagickWand *wand,
2437 %        const double threshold)
2438 %
2439 %  A description of each parameter follows:
2440 %
2441 %    o wand: the magick wand.
2442 %
2443 %    o threshold: separate background from foreground.
2444 %
2445 */
2446 WandExport MagickBooleanType MagickDeskewImage(MagickWand *wand,
2447   const double threshold)
2448 {
2449   Image
2450     *sepia_image;
2451
2452   assert(wand != (MagickWand *) NULL);
2453   assert(wand->signature == WandSignature);
2454   if (wand->debug != MagickFalse)
2455     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2456   if (wand->images == (Image *) NULL)
2457     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2458   sepia_image=DeskewImage(wand->images,threshold,wand->exception);
2459   if (sepia_image == (Image *) NULL)
2460     return(MagickFalse);
2461   ReplaceImageInList(&wand->images,sepia_image);
2462   return(MagickTrue);
2463 }
2464 \f
2465 /*
2466 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2467 %                                                                             %
2468 %                                                                             %
2469 %                                                                             %
2470 %     M a g i c k D e s p e c k l e I m a g e                                 %
2471 %                                                                             %
2472 %                                                                             %
2473 %                                                                             %
2474 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2475 %
2476 %  MagickDespeckleImage() reduces the speckle noise in an image while
2477 %  perserving the edges of the original image.
2478 %
2479 %  The format of the MagickDespeckleImage method is:
2480 %
2481 %      MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2482 %
2483 %  A description of each parameter follows:
2484 %
2485 %    o wand: the magick wand.
2486 %
2487 */
2488 WandExport MagickBooleanType MagickDespeckleImage(MagickWand *wand)
2489 {
2490   Image
2491     *despeckle_image;
2492
2493   assert(wand != (MagickWand *) NULL);
2494   assert(wand->signature == WandSignature);
2495   if (wand->debug != MagickFalse)
2496     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2497   if (wand->images == (Image *) NULL)
2498     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2499   despeckle_image=DespeckleImage(wand->images,wand->exception);
2500   if (despeckle_image == (Image *) NULL)
2501     return(MagickFalse);
2502   ReplaceImageInList(&wand->images,despeckle_image);
2503   return(MagickTrue);
2504 }
2505 \f
2506 /*
2507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2508 %                                                                             %
2509 %                                                                             %
2510 %                                                                             %
2511 %   M a g i c k D e s t r o y I m a g e                                       %
2512 %                                                                             %
2513 %                                                                             %
2514 %                                                                             %
2515 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2516 %
2517 %  MagickDestroyImage() dereferences an image, deallocating memory associated
2518 %  with the image if the reference count becomes zero.
2519 %
2520 %  The format of the MagickDestroyImage method is:
2521 %
2522 %      Image *MagickDestroyImage(Image *image)
2523 %
2524 %  A description of each parameter follows:
2525 %
2526 %    o image: the image.
2527 %
2528 */
2529 WandExport Image *MagickDestroyImage(Image *image)
2530 {
2531   return(DestroyImage(image));
2532 }
2533 \f
2534 /*
2535 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2536 %                                                                             %
2537 %                                                                             %
2538 %                                                                             %
2539 %   M a g i c k D i s p l a y I m a g e                                       %
2540 %                                                                             %
2541 %                                                                             %
2542 %                                                                             %
2543 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2544 %
2545 %  MagickDisplayImage() displays an image.
2546 %
2547 %  The format of the MagickDisplayImage method is:
2548 %
2549 %      MagickBooleanType MagickDisplayImage(MagickWand *wand,
2550 %        const char *server_name)
2551 %
2552 %  A description of each parameter follows:
2553 %
2554 %    o wand: the magick wand.
2555 %
2556 %    o server_name: the X server name.
2557 %
2558 */
2559 WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand,
2560   const char *server_name)
2561 {
2562   Image
2563     *image;
2564
2565   MagickBooleanType
2566     status;
2567
2568   assert(wand != (MagickWand *) NULL);
2569   assert(wand->signature == WandSignature);
2570   if (wand->debug != MagickFalse)
2571     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2572   if (wand->images == (Image *) NULL)
2573     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2574   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
2575   if (image == (Image *) NULL)
2576     return(MagickFalse);
2577   (void) CloneString(&wand->image_info->server_name,server_name);
2578   status=DisplayImages(wand->image_info,image);
2579   if (status == MagickFalse)
2580     InheritException(wand->exception,&image->exception);
2581   image=DestroyImage(image);
2582   return(status);
2583 }
2584 \f
2585 /*
2586 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2587 %                                                                             %
2588 %                                                                             %
2589 %                                                                             %
2590 %   M a g i c k D i s p l a y I m a g e s                                     %
2591 %                                                                             %
2592 %                                                                             %
2593 %                                                                             %
2594 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2595 %
2596 %  MagickDisplayImages() displays an image or image sequence.
2597 %
2598 %  The format of the MagickDisplayImages method is:
2599 %
2600 %      MagickBooleanType MagickDisplayImages(MagickWand *wand,
2601 %        const char *server_name)
2602 %
2603 %  A description of each parameter follows:
2604 %
2605 %    o wand: the magick wand.
2606 %
2607 %    o server_name: the X server name.
2608 %
2609 */
2610 WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand,
2611   const char *server_name)
2612 {
2613   MagickBooleanType
2614     status;
2615
2616   assert(wand != (MagickWand *) NULL);
2617   assert(wand->signature == WandSignature);
2618   if (wand->debug != MagickFalse)
2619     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2620   (void) CloneString(&wand->image_info->server_name,server_name);
2621   status=DisplayImages(wand->image_info,wand->images);
2622   if (status == MagickFalse)
2623     InheritException(wand->exception,&wand->images->exception);
2624   return(status);
2625 }
2626 \f
2627 /*
2628 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2629 %                                                                             %
2630 %                                                                             %
2631 %                                                                             %
2632 %   M a g i c k D i s t o r t I m a g e                                       %
2633 %                                                                             %
2634 %                                                                             %
2635 %                                                                             %
2636 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2637 %
2638 %  MagickDistortImage() distorts an image using various distortion methods, by
2639 %  mapping color lookups of the source image to a new destination image
2640 %  usally of the same size as the source image, unless 'bestfit' is set to
2641 %  true.
2642 %
2643 %  If 'bestfit' is enabled, and distortion allows it, the destination image is
2644 %  adjusted to ensure the whole source 'image' will just fit within the final
2645 %  destination image, which will be sized and offset accordingly.  Also in
2646 %  many cases the virtual offset of the source image will be taken into
2647 %  account in the mapping.
2648 %
2649 %  The format of the MagickDistortImage method is:
2650 %
2651 %      MagickBooleanType MagickDistortImage(MagickWand *wand,
2652 %        const DistortImageMethod method,const size_t number_arguments,
2653 %        const double *arguments,const MagickBooleanType bestfit)
2654 %
2655 %  A description of each parameter follows:
2656 %
2657 %    o image: the image to be distorted.
2658 %
2659 %    o method: the method of image distortion.
2660 %
2661 %        ArcDistortion always ignores the source image offset, and always
2662 %        'bestfit' the destination image with the top left corner offset
2663 %        relative to the polar mapping center.
2664 %
2665 %        Bilinear has no simple inverse mapping so it does not allow 'bestfit'
2666 %        style of image distortion.
2667 %
2668 %        Affine, Perspective, and Bilinear, do least squares fitting of the
2669 %        distortion when more than the minimum number of control point pairs
2670 %        are provided.
2671 %
2672 %        Perspective, and Bilinear, falls back to a Affine distortion when less
2673 %        that 4 control point pairs are provided. While Affine distortions let
2674 %        you use any number of control point pairs, that is Zero pairs is a
2675 %        no-Op (viewport only) distrotion, one pair is a translation and two
2676 %        pairs of control points do a scale-rotate-translate, without any
2677 %        shearing.
2678 %
2679 %    o number_arguments: the number of arguments given for this distortion
2680 %      method.
2681 %
2682 %    o arguments: the arguments for this distortion method.
2683 %
2684 %    o bestfit: Attempt to resize destination to fit distorted source.
2685 %
2686 */
2687 WandExport MagickBooleanType MagickDistortImage(MagickWand *wand,
2688   const DistortImageMethod method,const size_t number_arguments,
2689   const double *arguments,const MagickBooleanType bestfit)
2690 {
2691   Image
2692     *distort_image;
2693
2694   assert(wand != (MagickWand *) NULL);
2695   assert(wand->signature == WandSignature);
2696   if (wand->debug != MagickFalse)
2697     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2698   if (wand->images == (Image *) NULL)
2699     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2700   distort_image=DistortImage(wand->images,method,number_arguments,arguments,
2701     bestfit,wand->exception);
2702   if (distort_image == (Image *) NULL)
2703     return(MagickFalse);
2704   ReplaceImageInList(&wand->images,distort_image);
2705   return(MagickTrue);
2706 }
2707 \f
2708 /*
2709 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2710 %                                                                             %
2711 %                                                                             %
2712 %                                                                             %
2713 %   M a g i c k D r a w I m a g e                                             %
2714 %                                                                             %
2715 %                                                                             %
2716 %                                                                             %
2717 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2718 %
2719 %  MagickDrawImage() renders the drawing wand on the current image.
2720 %
2721 %  The format of the MagickDrawImage method is:
2722 %
2723 %      MagickBooleanType MagickDrawImage(MagickWand *wand,
2724 %        const DrawingWand *drawing_wand)
2725 %
2726 %  A description of each parameter follows:
2727 %
2728 %    o wand: the magick wand.
2729 %
2730 %    o drawing_wand: the draw wand.
2731 %
2732 */
2733 WandExport MagickBooleanType MagickDrawImage(MagickWand *wand,
2734   const DrawingWand *drawing_wand)
2735 {
2736   char
2737     *primitive;
2738
2739   DrawInfo
2740     *draw_info;
2741
2742   MagickBooleanType
2743     status;
2744
2745   assert(wand != (MagickWand *) NULL);
2746   assert(wand->signature == WandSignature);
2747   if (wand->debug != MagickFalse)
2748     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2749   if (wand->images == (Image *) NULL)
2750     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2751   draw_info=PeekDrawingWand(drawing_wand);
2752   if ((draw_info == (DrawInfo *) NULL) ||
2753       (draw_info->primitive == (char *) NULL))
2754     return(MagickFalse);
2755   primitive=AcquireString(draw_info->primitive);
2756   draw_info=DestroyDrawInfo(draw_info);
2757   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
2758   draw_info->primitive=primitive;
2759   status=DrawImage(wand->images,draw_info);
2760   if (status == MagickFalse)
2761     InheritException(wand->exception,&wand->images->exception);
2762   draw_info=DestroyDrawInfo(draw_info);
2763   return(status);
2764 }
2765 \f
2766 /*
2767 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2768 %                                                                             %
2769 %                                                                             %
2770 %                                                                             %
2771 %   M a g i c k E d g e I m a g e                                             %
2772 %                                                                             %
2773 %                                                                             %
2774 %                                                                             %
2775 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2776 %
2777 %  MagickEdgeImage() enhance edges within the image with a convolution filter
2778 %  of the given radius.  Use a radius of 0 and Edge() selects a suitable
2779 %  radius for you.
2780 %
2781 %  The format of the MagickEdgeImage method is:
2782 %
2783 %      MagickBooleanType MagickEdgeImage(MagickWand *wand,const double radius)
2784 %
2785 %  A description of each parameter follows:
2786 %
2787 %    o wand: the magick wand.
2788 %
2789 %    o radius: the radius of the pixel neighborhood.
2790 %
2791 */
2792 WandExport MagickBooleanType MagickEdgeImage(MagickWand *wand,
2793   const double radius)
2794 {
2795   Image
2796     *edge_image;
2797
2798   assert(wand != (MagickWand *) NULL);
2799   assert(wand->signature == WandSignature);
2800   if (wand->debug != MagickFalse)
2801     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2802   if (wand->images == (Image *) NULL)
2803     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2804   edge_image=EdgeImage(wand->images,radius,wand->exception);
2805   if (edge_image == (Image *) NULL)
2806     return(MagickFalse);
2807   ReplaceImageInList(&wand->images,edge_image);
2808   return(MagickTrue);
2809 }
2810 \f
2811 /*
2812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2813 %                                                                             %
2814 %                                                                             %
2815 %                                                                             %
2816 %   M a g i c k E m b o s s I m a g e                                         %
2817 %                                                                             %
2818 %                                                                             %
2819 %                                                                             %
2820 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2821 %
2822 %  MagickEmbossImage() returns a grayscale image with a three-dimensional
2823 %  effect.  We convolve the image with a Gaussian operator of the given radius
2824 %  and standard deviation (sigma).  For reasonable results, radius should be
2825 %  larger than sigma.  Use a radius of 0 and Emboss() selects a suitable
2826 %  radius for you.
2827 %
2828 %  The format of the MagickEmbossImage method is:
2829 %
2830 %      MagickBooleanType MagickEmbossImage(MagickWand *wand,const double radius,
2831 %        const double sigma)
2832 %
2833 %  A description of each parameter follows:
2834 %
2835 %    o wand: the magick wand.
2836 %
2837 %    o radius: the radius of the Gaussian, in pixels, not counting the center
2838 %      pixel.
2839 %
2840 %    o sigma: the standard deviation of the Gaussian, in pixels.
2841 %
2842 */
2843 WandExport MagickBooleanType MagickEmbossImage(MagickWand *wand,
2844   const double radius,const double sigma)
2845 {
2846   Image
2847     *emboss_image;
2848
2849   assert(wand != (MagickWand *) NULL);
2850   assert(wand->signature == WandSignature);
2851   if (wand->debug != MagickFalse)
2852     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2853   if (wand->images == (Image *) NULL)
2854     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2855   emboss_image=EmbossImage(wand->images,radius,sigma,wand->exception);
2856   if (emboss_image == (Image *) NULL)
2857     return(MagickFalse);
2858   ReplaceImageInList(&wand->images,emboss_image);
2859   return(MagickTrue);
2860 }
2861 \f
2862 /*
2863 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2864 %                                                                             %
2865 %                                                                             %
2866 %                                                                             %
2867 %   M a g i c k E n c i p h e r I m a g e                                     %
2868 %                                                                             %
2869 %                                                                             %
2870 %                                                                             %
2871 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2872 %
2873 %  MagickEncipherImage() converts plaint pixels to cipher pixels.
2874 %
2875 %  The format of the MagickEncipherImage method is:
2876 %
2877 %      MagickBooleanType MagickEncipherImage(MagickWand *wand,
2878 %        const char *passphrase)
2879 %
2880 %  A description of each parameter follows:
2881 %
2882 %    o wand: the magick wand.
2883 %
2884 %    o passphrase: the passphrase.
2885 %
2886 */
2887 WandExport MagickBooleanType MagickEncipherImage(MagickWand *wand,
2888   const char *passphrase)
2889 {
2890   assert(wand != (MagickWand *) NULL);
2891   assert(wand->signature == WandSignature);
2892   if (wand->debug != MagickFalse)
2893     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2894   if (wand->images == (Image *) NULL)
2895     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2896   return(EncipherImage(wand->images,passphrase,&wand->images->exception));
2897 }
2898 \f
2899 /*
2900 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2901 %                                                                             %
2902 %                                                                             %
2903 %                                                                             %
2904 %   M a g i c k E n h a n c e I m a g e                                       %
2905 %                                                                             %
2906 %                                                                             %
2907 %                                                                             %
2908 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2909 %
2910 %  MagickEnhanceImage() applies a digital filter that improves the quality of a
2911 %  noisy image.
2912 %
2913 %  The format of the MagickEnhanceImage method is:
2914 %
2915 %      MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2916 %
2917 %  A description of each parameter follows:
2918 %
2919 %    o wand: the magick wand.
2920 %
2921 */
2922 WandExport MagickBooleanType MagickEnhanceImage(MagickWand *wand)
2923 {
2924   Image
2925     *enhance_image;
2926
2927   assert(wand != (MagickWand *) NULL);
2928   assert(wand->signature == WandSignature);
2929   if (wand->debug != MagickFalse)
2930     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2931   if (wand->images == (Image *) NULL)
2932     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2933   enhance_image=EnhanceImage(wand->images,wand->exception);
2934   if (enhance_image == (Image *) NULL)
2935     return(MagickFalse);
2936   ReplaceImageInList(&wand->images,enhance_image);
2937   return(MagickTrue);
2938 }
2939 \f
2940 /*
2941 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2942 %                                                                             %
2943 %                                                                             %
2944 %                                                                             %
2945 %   M a g i c k E q u a l i z e I m a g e                                     %
2946 %                                                                             %
2947 %                                                                             %
2948 %                                                                             %
2949 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2950 %
2951 %  MagickEqualizeImage() equalizes the image histogram.
2952 %
2953 %  The format of the MagickEqualizeImage method is:
2954 %
2955 %      MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2956 %      MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
2957 %        const ChannelType channel)
2958 %
2959 %  A description of each parameter follows:
2960 %
2961 %    o wand: the magick wand.
2962 %
2963 %    o channel: the image channel(s).
2964 %
2965 */
2966
2967 WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand)
2968 {
2969   MagickBooleanType
2970     status;
2971
2972   status=MagickEqualizeImageChannel(wand,DefaultChannels);
2973   return(status);
2974 }
2975
2976 WandExport MagickBooleanType MagickEqualizeImageChannel(MagickWand *wand,
2977   const ChannelType channel)
2978 {
2979   MagickBooleanType
2980     status;
2981
2982   assert(wand != (MagickWand *) NULL);
2983   assert(wand->signature == WandSignature);
2984   if (wand->debug != MagickFalse)
2985     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
2986   if (wand->images == (Image *) NULL)
2987     ThrowWandException(WandError,"ContainsNoImages",wand->name);
2988   status=EqualizeImageChannel(wand->images,channel);
2989   if (status == MagickFalse)
2990     InheritException(wand->exception,&wand->images->exception);
2991   return(status);
2992 }
2993 \f
2994 /*
2995 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2996 %                                                                             %
2997 %                                                                             %
2998 %                                                                             %
2999 %   M a g i c k E v a l u a t e I m a g e                                     %
3000 %                                                                             %
3001 %                                                                             %
3002 %                                                                             %
3003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3004 %
3005 %  MagickEvaluateImage() applys an arithmetic, relational, or logical
3006 %  expression to an image.  Use these operators to lighten or darken an image,
3007 %  to increase or decrease contrast in an image, or to produce the "negative"
3008 %  of an image.
3009 %
3010 %  The format of the MagickEvaluateImage method is:
3011 %
3012 %      MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3013 %        const MagickEvaluateOperator operator,const double value)
3014 %      MagickBooleanType MagickEvaluateImages(MagickWand *wand,
3015 %        const MagickEvaluateOperator operator)
3016 %      MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
3017 %        const ChannelType channel,const MagickEvaluateOperator op,
3018 %        const double value)
3019 %
3020 %  A description of each parameter follows:
3021 %
3022 %    o wand: the magick wand.
3023 %
3024 %    o channel: the channel(s).
3025 %
3026 %    o op: A channel operator.
3027 %
3028 %    o value: A value value.
3029 %
3030 */
3031
3032 WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand,
3033   const MagickEvaluateOperator op,const double value)
3034 {
3035   MagickBooleanType
3036     status;
3037
3038   assert(wand != (MagickWand *) NULL);
3039   assert(wand->signature == WandSignature);
3040   if (wand->debug != MagickFalse)
3041     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3042   if (wand->images == (Image *) NULL)
3043     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3044   status=EvaluateImage(wand->images,op,value,&wand->images->exception);
3045   if (status == MagickFalse)
3046     InheritException(wand->exception,&wand->images->exception);
3047   return(status);
3048 }
3049
3050 WandExport MagickWand *MagickEvaluateImages(MagickWand *wand,
3051   const MagickEvaluateOperator op)
3052 {
3053   Image
3054     *evaluate_image;
3055
3056   assert(wand != (MagickWand *) NULL);
3057   assert(wand->signature == WandSignature);
3058   if (wand->debug != MagickFalse)
3059     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3060   if (wand->images == (Image *) NULL)
3061     return((MagickWand *) NULL);
3062   evaluate_image=EvaluateImages(wand->images,op,wand->exception);
3063   if (evaluate_image == (Image *) NULL)
3064     return((MagickWand *) NULL);
3065   return(CloneMagickWandFromImages(wand,evaluate_image));
3066 }
3067
3068 WandExport MagickBooleanType MagickEvaluateImageChannel(MagickWand *wand,
3069   const ChannelType channel,const MagickEvaluateOperator op,const double value)
3070 {
3071   MagickBooleanType
3072     status;
3073
3074   assert(wand != (MagickWand *) NULL);
3075   assert(wand->signature == WandSignature);
3076   if (wand->debug != MagickFalse)
3077     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3078   if (wand->images == (Image *) NULL)
3079     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3080   status=EvaluateImageChannel(wand->images,channel,op,value,
3081     &wand->images->exception);
3082   return(status);
3083 }
3084 \f
3085 /*
3086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3087 %                                                                             %
3088 %                                                                             %
3089 %                                                                             %
3090 %   M a g i c k E x p o r t I m a g e P i x e l s                             %
3091 %                                                                             %
3092 %                                                                             %
3093 %                                                                             %
3094 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3095 %
3096 %  MagickExportImagePixels() extracts pixel data from an image and returns it
3097 %  to you.  The method returns MagickTrue on success otherwise MagickFalse if
3098 %  an error is encountered.  The data is returned as char, short int, int,
3099 %  ssize_t, float, or double in the order specified by map.
3100 %
3101 %  Suppose you want to extract the first scanline of a 640x480 image as
3102 %  character data in red-green-blue order:
3103 %
3104 %      MagickExportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
3105 %
3106 %  The format of the MagickExportImagePixels method is:
3107 %
3108 %      MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3109 %        const ssize_t x,const ssize_t y,const size_t columns,
3110 %        const size_t rows,const char *map,const StorageType storage,
3111 %        void *pixels)
3112 %
3113 %  A description of each parameter follows:
3114 %
3115 %    o wand: the magick wand.
3116 %
3117 %    o x, y, columns, rows:  These values define the perimeter
3118 %      of a region of pixels you want to extract.
3119 %
3120 %    o map:  This string reflects the expected ordering of the pixel array.
3121 %      It can be any combination or order of R = red, G = green, B = blue,
3122 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
3123 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
3124 %      P = pad.
3125 %
3126 %    o storage: Define the data type of the pixels.  Float and double types are
3127 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
3128 %      these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel,
3129 %      LongPixel, QuantumPixel, or ShortPixel.
3130 %
3131 %    o pixels: This array of values contain the pixel components as defined by
3132 %      map and type.  You must preallocate this array where the expected
3133 %      length varies depending on the values of width, height, map, and type.
3134 %
3135 */
3136 WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand,
3137   const ssize_t x,const ssize_t y,const size_t columns,
3138   const size_t rows,const char *map,const StorageType storage,
3139   void *pixels)
3140 {
3141   MagickBooleanType
3142     status;
3143
3144   assert(wand != (MagickWand *) NULL);
3145   assert(wand->signature == WandSignature);
3146   if (wand->debug != MagickFalse)
3147     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3148   if (wand->images == (Image *) NULL)
3149     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3150   status=ExportImagePixels(wand->images,x,y,columns,rows,map,
3151     storage,pixels,wand->exception);
3152   if (status == MagickFalse)
3153     InheritException(wand->exception,&wand->images->exception);
3154   return(status);
3155 }
3156 \f
3157 /*
3158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3159 %                                                                             %
3160 %                                                                             %
3161 %                                                                             %
3162 %   M a g i c k E x t e n t I m a g e                                         %
3163 %                                                                             %
3164 %                                                                             %
3165 %                                                                             %
3166 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3167 %
3168 %  MagickExtentImage() extends the image as defined by the geometry, gravity,
3169 %  and wand background color.  Set the (x,y) offset of the geometry to move
3170 %  the original wand relative to the extended wand.
3171 %
3172 %  The format of the MagickExtentImage method is:
3173 %
3174 %      MagickBooleanType MagickExtentImage(MagickWand *wand,
3175 %        const size_t width,const size_t height,const ssize_t x,
3176 %        const ssize_t y)
3177 %
3178 %  A description of each parameter follows:
3179 %
3180 %    o wand: the magick wand.
3181 %
3182 %    o width: the region width.
3183 %
3184 %    o height: the region height.
3185 %
3186 %    o x: the region x offset.
3187 %
3188 %    o y: the region y offset.
3189 %
3190 */
3191 WandExport MagickBooleanType MagickExtentImage(MagickWand *wand,
3192   const size_t width,const size_t height,const ssize_t x,
3193   const ssize_t y)
3194 {
3195   Image
3196     *extent_image;
3197
3198   RectangleInfo
3199     extent;
3200
3201   assert(wand != (MagickWand *) NULL);
3202   assert(wand->signature == WandSignature);
3203   if (wand->debug != MagickFalse)
3204     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3205   if (wand->images == (Image *) NULL)
3206     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3207   extent.width=width;
3208   extent.height=height;
3209   extent.x=x;
3210   extent.y=y;
3211   extent_image=ExtentImage(wand->images,&extent,wand->exception);
3212   if (extent_image == (Image *) NULL)
3213     return(MagickFalse);
3214   ReplaceImageInList(&wand->images,extent_image);
3215   return(MagickTrue);
3216 }
3217 \f
3218 /*
3219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3220 %                                                                             %
3221 %                                                                             %
3222 %                                                                             %
3223 %   M a g i c k F i l t e r I m a g e                                         %
3224 %                                                                             %
3225 %                                                                             %
3226 %                                                                             %
3227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3228 %
3229 %  MagickFilterImage() applies a custom convolution kernel to the image.
3230 %
3231 %  The format of the MagickFilterImage method is:
3232 %
3233 %      MagickBooleanType MagickFilterImage(MagickWand *wand,
3234 %        const KernelInfo *kernel)
3235 %      MagickBooleanType MagickFilterImageChannel(MagickWand *wand,
3236 %        const ChannelType channel,const KernelInfo *kernel)
3237 %
3238 %  A description of each parameter follows:
3239 %
3240 %    o wand: the magick wand.
3241 %
3242 %    o channel: the image channel(s).
3243 %
3244 %    o kernel: An array of doubles representing the convolution kernel.
3245 %
3246 */
3247
3248 WandExport MagickBooleanType MagickFilterImage(MagickWand *wand,
3249   const KernelInfo *kernel)
3250 {
3251   MagickBooleanType
3252     status;
3253
3254   status=MagickFilterImageChannel(wand,DefaultChannels,kernel);
3255   return(status);
3256 }
3257
3258 WandExport MagickBooleanType MagickFilterImageChannel(MagickWand *wand,
3259   const ChannelType channel,const KernelInfo *kernel)
3260 {
3261   Image
3262     *filter_image;
3263
3264   assert(wand != (MagickWand *) NULL);
3265   assert(wand->signature == WandSignature);
3266   if (wand->debug != MagickFalse)
3267     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3268   if (kernel == (const KernelInfo *) NULL)
3269     return(MagickFalse);
3270   if (wand->images == (Image *) NULL)
3271     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3272   filter_image=FilterImageChannel(wand->images,channel,kernel,wand->exception);
3273   if (filter_image == (Image *) NULL)
3274     return(MagickFalse);
3275   ReplaceImageInList(&wand->images,filter_image);
3276   return(MagickTrue);
3277 }
3278 \f
3279 /*
3280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3281 %                                                                             %
3282 %                                                                             %
3283 %                                                                             %
3284 %   M a g i c k F l i p I m a g e                                             %
3285 %                                                                             %
3286 %                                                                             %
3287 %                                                                             %
3288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3289 %
3290 %  MagickFlipImage() creates a vertical mirror image by reflecting the pixels
3291 %  around the central x-axis.
3292 %
3293 %  The format of the MagickFlipImage method is:
3294 %
3295 %      MagickBooleanType MagickFlipImage(MagickWand *wand)
3296 %
3297 %  A description of each parameter follows:
3298 %
3299 %    o wand: the magick wand.
3300 %
3301 */
3302 WandExport MagickBooleanType MagickFlipImage(MagickWand *wand)
3303 {
3304   Image
3305     *flip_image;
3306
3307   assert(wand != (MagickWand *) NULL);
3308   assert(wand->signature == WandSignature);
3309   if (wand->debug != MagickFalse)
3310     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3311   if (wand->images == (Image *) NULL)
3312     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3313   flip_image=FlipImage(wand->images,wand->exception);
3314   if (flip_image == (Image *) NULL)
3315     return(MagickFalse);
3316   ReplaceImageInList(&wand->images,flip_image);
3317   return(MagickTrue);
3318 }
3319 \f
3320 /*
3321 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3322 %                                                                             %
3323 %                                                                             %
3324 %                                                                             %
3325 %   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                         %
3326 %                                                                             %
3327 %                                                                             %
3328 %                                                                             %
3329 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3330 %
3331 %  MagickFloodfillPaintImage() changes the color value of any pixel that matches
3332 %  target and is an immediate neighbor.  If the method FillToBorderMethod is
3333 %  specified, the color value is changed for any neighbor pixel that does not
3334 %  match the bordercolor member of image.
3335 %
3336 %  The format of the MagickFloodfillPaintImage method is:
3337 %
3338 %      MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3339 %        const ChannelType channel,const PixelWand *fill,const double fuzz,
3340 %        const PixelWand *bordercolor,const ssize_t x,const ssize_t y,
3341 %        const MagickBooleanType invert)
3342 %
3343 %  A description of each parameter follows:
3344 %
3345 %    o wand: the magick wand.
3346 %
3347 %    o channel: the channel(s).
3348 %
3349 %    o fill: the floodfill color pixel wand.
3350 %
3351 %    o fuzz: By default target must match a particular pixel color
3352 %      exactly.  However, in many cases two colors may differ by a small amount.
3353 %      The fuzz member of image defines how much tolerance is acceptable to
3354 %      consider two colors as the same.  For example, set fuzz to 10 and the
3355 %      color red at intensities of 100 and 102 respectively are now interpreted
3356 %      as the same color for the purposes of the floodfill.
3357 %
3358 %    o bordercolor: the border color pixel wand.
3359 %
3360 %    o x,y: the starting location of the operation.
3361 %
3362 %    o invert: paint any pixel that does not match the target color.
3363 %
3364 */
3365 WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand,
3366   const ChannelType channel,const PixelWand *fill,const double fuzz,
3367   const PixelWand *bordercolor,const ssize_t x,const ssize_t y,
3368   const MagickBooleanType invert)
3369 {
3370   DrawInfo
3371     *draw_info;
3372
3373   MagickBooleanType
3374     status;
3375
3376   MagickPixelPacket
3377     target;
3378
3379   assert(wand != (MagickWand *) NULL);
3380   assert(wand->signature == WandSignature);
3381   if (wand->debug != MagickFalse)
3382     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3383   if (wand->images == (Image *) NULL)
3384     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3385   draw_info=CloneDrawInfo(wand->image_info,(DrawInfo *) NULL);
3386   PixelGetQuantumColor(fill,&draw_info->fill);
3387   (void) GetOneVirtualMagickPixel(wand->images,x % wand->images->columns,
3388     y % wand->images->rows,&target,wand->exception);
3389   if (bordercolor != (PixelWand *) NULL)
3390     PixelGetMagickColor(bordercolor,&target);
3391   wand->images->fuzz=fuzz;
3392   status=FloodfillPaintImage(wand->images,channel,draw_info,&target,x,y,
3393     invert);
3394   if (status == MagickFalse)
3395     InheritException(wand->exception,&wand->images->exception);
3396   draw_info=DestroyDrawInfo(draw_info);
3397   return(status);
3398 }
3399 \f
3400 /*
3401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3402 %                                                                             %
3403 %                                                                             %
3404 %                                                                             %
3405 %   M a g i c k F l o p I m a g e                                             %
3406 %                                                                             %
3407 %                                                                             %
3408 %                                                                             %
3409 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3410 %
3411 %  MagickFlopImage() creates a horizontal mirror image by reflecting the pixels
3412 %  around the central y-axis.
3413 %
3414 %  The format of the MagickFlopImage method is:
3415 %
3416 %      MagickBooleanType MagickFlopImage(MagickWand *wand)
3417 %
3418 %  A description of each parameter follows:
3419 %
3420 %    o wand: the magick wand.
3421 %
3422 */
3423 WandExport MagickBooleanType MagickFlopImage(MagickWand *wand)
3424 {
3425   Image
3426     *flop_image;
3427
3428   assert(wand != (MagickWand *) NULL);
3429   assert(wand->signature == WandSignature);
3430   if (wand->debug != MagickFalse)
3431     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3432   if (wand->images == (Image *) NULL)
3433     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3434   flop_image=FlopImage(wand->images,wand->exception);
3435   if (flop_image == (Image *) NULL)
3436     return(MagickFalse);
3437   ReplaceImageInList(&wand->images,flop_image);
3438   return(MagickTrue);
3439 }
3440 \f
3441 /*
3442 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3443 %                                                                             %
3444 %                                                                             %
3445 %                                                                             %
3446 %   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                     %
3447 %                                                                             %
3448 %                                                                             %
3449 %                                                                             %
3450 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3451 %
3452 %  MagickForwardFourierTransformImage() implements the discrete Fourier
3453 %  transform (DFT) of the image either as a magnitude / phase or real /
3454 %  imaginary image pair.
3455 %
3456 %  The format of the MagickForwardFourierTransformImage method is:
3457 %
3458 %      MagickBooleanType MagickForwardFourierTransformImage(MagickWand *wand,
3459 %        const MagickBooleanType magnitude)
3460 %
3461 %  A description of each parameter follows:
3462 %
3463 %    o wand: the magick wand.
3464 %
3465 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
3466 %      imaginary image pair.
3467 %
3468 */
3469 WandExport MagickBooleanType MagickForwardFourierTransformImage(
3470   MagickWand *wand,const MagickBooleanType magnitude)
3471 {
3472   Image
3473     *forward_image;
3474
3475   assert(wand != (MagickWand *) NULL);
3476   assert(wand->signature == WandSignature);
3477   if (wand->debug != MagickFalse)
3478     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3479   if (wand->images == (Image *) NULL)
3480     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3481   forward_image=ForwardFourierTransformImage(wand->images,magnitude,
3482     wand->exception);
3483   if (forward_image == (Image *) NULL)
3484     return(MagickFalse);
3485   ReplaceImageInList(&wand->images,forward_image);
3486   return(MagickTrue);
3487 }
3488 \f
3489 /*
3490 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3491 %                                                                             %
3492 %                                                                             %
3493 %                                                                             %
3494 %   M a g i c k F r a m e I m a g e                                           %
3495 %                                                                             %
3496 %                                                                             %
3497 %                                                                             %
3498 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3499 %
3500 %  MagickFrameImage() adds a simulated three-dimensional border around the
3501 %  image.  The width and height specify the border width of the vertical and
3502 %  horizontal sides of the frame.  The inner and outer bevels indicate the
3503 %  width of the inner and outer shadows of the frame.
3504 %
3505 %  The format of the MagickFrameImage method is:
3506 %
3507 %      MagickBooleanType MagickFrameImage(MagickWand *wand,
3508 %        const PixelWand *matte_color,const size_t width,
3509 %        const size_t height,const ssize_t inner_bevel,
3510 %        const ssize_t outer_bevel)
3511 %
3512 %  A description of each parameter follows:
3513 %
3514 %    o wand: the magick wand.
3515 %
3516 %    o matte_color: the frame color pixel wand.
3517 %
3518 %    o width: the border width.
3519 %
3520 %    o height: the border height.
3521 %
3522 %    o inner_bevel: the inner bevel width.
3523 %
3524 %    o outer_bevel: the outer bevel width.
3525 %
3526 */
3527 WandExport MagickBooleanType MagickFrameImage(MagickWand *wand,
3528   const PixelWand *matte_color,const size_t width,
3529   const size_t height,const ssize_t inner_bevel,const ssize_t outer_bevel)
3530 {
3531   Image
3532     *frame_image;
3533
3534   FrameInfo
3535     frame_info;
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   (void) ResetMagickMemory(&frame_info,0,sizeof(frame_info));
3544   frame_info.width=wand->images->columns+2*width;
3545   frame_info.height=wand->images->rows+2*height;
3546   frame_info.x=(ssize_t) width;
3547   frame_info.y=(ssize_t) height;
3548   frame_info.inner_bevel=inner_bevel;
3549   frame_info.outer_bevel=outer_bevel;
3550   PixelGetQuantumColor(matte_color,&wand->images->matte_color);
3551   frame_image=FrameImage(wand->images,&frame_info,wand->exception);
3552   if (frame_image == (Image *) NULL)
3553     return(MagickFalse);
3554   ReplaceImageInList(&wand->images,frame_image);
3555   return(MagickTrue);
3556 }
3557 \f
3558 /*
3559 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3560 %                                                                             %
3561 %                                                                             %
3562 %                                                                             %
3563 %   M a g i c k F u n c t i o n I m a g e                                     %
3564 %                                                                             %
3565 %                                                                             %
3566 %                                                                             %
3567 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3568 %
3569 %  MagickFunctionImage() applys an arithmetic, relational, or logical
3570 %  expression to an image.  Use these operators to lighten or darken an image,
3571 %  to increase or decrease contrast in an image, or to produce the "negative"
3572 %  of an image.
3573 %
3574 %  The format of the MagickFunctionImage method is:
3575 %
3576 %      MagickBooleanType MagickFunctionImage(MagickWand *wand,
3577 %        const MagickFunction function,const size_t number_arguments,
3578 %        const double *arguments)
3579 %      MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
3580 %        const ChannelType channel,const MagickFunction function,
3581 %        const size_t number_arguments,const double *arguments)
3582 %
3583 %  A description of each parameter follows:
3584 %
3585 %    o wand: the magick wand.
3586 %
3587 %    o channel: the channel(s).
3588 %
3589 %    o function: the image function.
3590 %
3591 %    o number_arguments: the number of function arguments.
3592 %
3593 %    o arguments: the function arguments.
3594 %
3595 */
3596
3597 WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand,
3598   const MagickFunction function,const size_t number_arguments,
3599   const double *arguments)
3600 {
3601   MagickBooleanType
3602     status;
3603
3604   assert(wand != (MagickWand *) NULL);
3605   assert(wand->signature == WandSignature);
3606   if (wand->debug != MagickFalse)
3607     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3608   if (wand->images == (Image *) NULL)
3609     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3610   status=FunctionImage(wand->images,function,number_arguments,arguments,
3611     &wand->images->exception);
3612   if (status == MagickFalse)
3613     InheritException(wand->exception,&wand->images->exception);
3614   return(status);
3615 }
3616
3617 WandExport MagickBooleanType MagickFunctionImageChannel(MagickWand *wand,
3618   const ChannelType channel,const MagickFunction function,
3619   const size_t number_arguments,const double *arguments)
3620 {
3621   MagickBooleanType
3622     status;
3623
3624   assert(wand != (MagickWand *) NULL);
3625   assert(wand->signature == WandSignature);
3626   if (wand->debug != MagickFalse)
3627     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3628   if (wand->images == (Image *) NULL)
3629     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3630   status=FunctionImageChannel(wand->images,channel,function,number_arguments,
3631     arguments,&wand->images->exception);
3632   return(status);
3633 }
3634 \f
3635 /*
3636 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3637 %                                                                             %
3638 %                                                                             %
3639 %                                                                             %
3640 %   M a g i c k F x I m a g e                                                 %
3641 %                                                                             %
3642 %                                                                             %
3643 %                                                                             %
3644 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3645 %
3646 %  MagickFxImage() evaluate expression for each pixel in the image.
3647 %
3648 %  The format of the MagickFxImage method is:
3649 %
3650 %      MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3651 %      MagickWand *MagickFxImageChannel(MagickWand *wand,
3652 %        const ChannelType channel,const char *expression)
3653 %
3654 %  A description of each parameter follows:
3655 %
3656 %    o wand: the magick wand.
3657 %
3658 %    o channel: the image channel(s).
3659 %
3660 %    o expression: the expression.
3661 %
3662 */
3663
3664 WandExport MagickWand *MagickFxImage(MagickWand *wand,const char *expression)
3665 {
3666   MagickWand
3667     *fx_wand;
3668
3669   fx_wand=MagickFxImageChannel(wand,DefaultChannels,expression);
3670   return(fx_wand);
3671 }
3672
3673 WandExport MagickWand *MagickFxImageChannel(MagickWand *wand,
3674   const ChannelType channel,const char *expression)
3675 {
3676   Image
3677     *fx_image;
3678
3679   assert(wand != (MagickWand *) NULL);
3680   assert(wand->signature == WandSignature);
3681   if (wand->debug != MagickFalse)
3682     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3683   if (wand->images == (Image *) NULL)
3684     return((MagickWand *) NULL);
3685   fx_image=FxImageChannel(wand->images,channel,expression,wand->exception);
3686   if (fx_image == (Image *) NULL)
3687     return((MagickWand *) NULL);
3688   return(CloneMagickWandFromImages(wand,fx_image));
3689 }
3690 \f
3691 /*
3692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3693 %                                                                             %
3694 %                                                                             %
3695 %                                                                             %
3696 %   M a g i c k G a m m a I m a g e                                           %
3697 %                                                                             %
3698 %                                                                             %
3699 %                                                                             %
3700 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3701 %
3702 %  MagickGammaImage() gamma-corrects an image.  The same image viewed on
3703 %  different devices will have perceptual differences in the way the image's
3704 %  intensities are represented on the screen.  Specify individual gamma levels
3705 %  for the red, green, and blue channels, or adjust all three with the gamma
3706 %  parameter.  Values typically range from 0.8 to 2.3.
3707 %
3708 %  You can also reduce the influence of a particular channel with a gamma
3709 %  value of 0.
3710 %
3711 %  The format of the MagickGammaImage method is:
3712 %
3713 %      MagickBooleanType MagickGammaImage(MagickWand *wand,const double gamma)
3714 %      MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
3715 %        const ChannelType channel,const double gamma)
3716 %
3717 %  A description of each parameter follows:
3718 %
3719 %    o wand: the magick wand.
3720 %
3721 %    o channel: the channel.
3722 %
3723 %    o level: Define the level of gamma correction.
3724 %
3725 */
3726
3727 WandExport MagickBooleanType MagickGammaImage(MagickWand *wand,
3728   const double gamma)
3729 {
3730   MagickBooleanType
3731     status;
3732
3733   status=MagickGammaImageChannel(wand,DefaultChannels,gamma);
3734   return(status);
3735 }
3736
3737 WandExport MagickBooleanType MagickGammaImageChannel(MagickWand *wand,
3738   const ChannelType channel,const double gamma)
3739 {
3740   MagickBooleanType
3741     status;
3742
3743   assert(wand != (MagickWand *) NULL);
3744   assert(wand->signature == WandSignature);
3745   if (wand->debug != MagickFalse)
3746     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3747   if (wand->images == (Image *) NULL)
3748     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3749   status=GammaImageChannel(wand->images,channel,gamma);
3750   if (status == MagickFalse)
3751     InheritException(wand->exception,&wand->images->exception);
3752   return(status);
3753 }
3754 \f
3755 /*
3756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3757 %                                                                             %
3758 %                                                                             %
3759 %                                                                             %
3760 %   M a g i c k G a u s s i a n B l u r I m a g e                             %
3761 %                                                                             %
3762 %                                                                             %
3763 %                                                                             %
3764 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3765 %
3766 %  MagickGaussianBlurImage() blurs an image.  We convolve the image with a
3767 %  Gaussian operator of the given radius and standard deviation (sigma).
3768 %  For reasonable results, the radius should be larger than sigma.  Use a
3769 %  radius of 0 and MagickGaussianBlurImage() selects a suitable radius for you.
3770 %
3771 %  The format of the MagickGaussianBlurImage method is:
3772 %
3773 %      MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3774 %        const double radius,const double sigma)
3775 %      MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
3776 %        const ChannelType channel,const double radius,const double sigma)
3777 %
3778 %  A description of each parameter follows:
3779 %
3780 %    o wand: the magick wand.
3781 %
3782 %    o channel: the image channel(s).
3783 %
3784 %    o radius: the radius of the Gaussian, in pixels, not counting the center
3785 %      pixel.
3786 %
3787 %    o sigma: the standard deviation of the Gaussian, in pixels.
3788 %
3789 */
3790
3791 WandExport MagickBooleanType MagickGaussianBlurImage(MagickWand *wand,
3792   const double radius,const double sigma)
3793 {
3794   MagickBooleanType
3795     status;
3796
3797   status=MagickGaussianBlurImageChannel(wand,DefaultChannels,radius,sigma);
3798   return(status);
3799 }
3800
3801 WandExport MagickBooleanType MagickGaussianBlurImageChannel(MagickWand *wand,
3802   const ChannelType channel,const double radius,const double sigma)
3803 {
3804   Image
3805     *blur_image;
3806
3807   assert(wand != (MagickWand *) NULL);
3808   assert(wand->signature == WandSignature);
3809   if (wand->debug != MagickFalse)
3810     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3811   if (wand->images == (Image *) NULL)
3812     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3813   blur_image=GaussianBlurImageChannel(wand->images,channel,radius,sigma,
3814     wand->exception);
3815   if (blur_image == (Image *) NULL)
3816     return(MagickFalse);
3817   ReplaceImageInList(&wand->images,blur_image);
3818   return(MagickTrue);
3819 }
3820 \f
3821 /*
3822 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3823 %                                                                             %
3824 %                                                                             %
3825 %                                                                             %
3826 %   M a g i c k G e t I m a g e                                               %
3827 %                                                                             %
3828 %                                                                             %
3829 %                                                                             %
3830 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3831 %
3832 %  MagickGetImage() gets the image at the current image index.
3833 %
3834 %  The format of the MagickGetImage method is:
3835 %
3836 %      MagickWand *MagickGetImage(MagickWand *wand)
3837 %
3838 %  A description of each parameter follows:
3839 %
3840 %    o wand: the magick wand.
3841 %
3842 */
3843 WandExport MagickWand *MagickGetImage(MagickWand *wand)
3844 {
3845   Image
3846     *image;
3847
3848   assert(wand != (MagickWand *) NULL);
3849   assert(wand->signature == WandSignature);
3850   if (wand->debug != MagickFalse)
3851     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3852   if (wand->images == (Image *) NULL)
3853     {
3854       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3855         "ContainsNoImages","`%s'",wand->name);
3856       return((MagickWand *) NULL);
3857     }
3858   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
3859   if (image == (Image *) NULL)
3860     return((MagickWand *) NULL);
3861   return(CloneMagickWandFromImages(wand,image));
3862 }
3863 \f
3864 /*
3865 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3866 %                                                                             %
3867 %                                                                             %
3868 %                                                                             %
3869 %   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                       %
3870 %                                                                             %
3871 %                                                                             %
3872 %                                                                             %
3873 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3874 %
3875 %  MagickGetImageAlphaChannel() returns MagickFalse if the image alpha channel
3876 %  is not activated.  That is, the image is RGB rather than RGBA or CMYK rather
3877 %  than CMYKA.
3878 %
3879 %  The format of the MagickGetImageAlphaChannel method is:
3880 %
3881 %      size_t MagickGetImageAlphaChannel(MagickWand *wand)
3882 %
3883 %  A description of each parameter follows:
3884 %
3885 %    o wand: the magick wand.
3886 %
3887 */
3888 WandExport MagickBooleanType MagickGetImageAlphaChannel(MagickWand *wand)
3889 {
3890   assert(wand != (MagickWand *) NULL);
3891   assert(wand->signature == WandSignature);
3892   if (wand->debug != MagickFalse)
3893     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3894   if (wand->images == (Image *) NULL)
3895     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3896   return(GetImageAlphaChannel(wand->images));
3897 }
3898 \f
3899 /*
3900 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3901 %                                                                             %
3902 %                                                                             %
3903 %                                                                             %
3904 %   M a g i c k G e t I m a g e C l i p M a s k                               %
3905 %                                                                             %
3906 %                                                                             %
3907 %                                                                             %
3908 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3909 %
3910 %  MagickGetImageClipMask() gets the image clip mask at the current image index.
3911 %
3912 %  The format of the MagickGetImageClipMask method is:
3913 %
3914 %      MagickWand *MagickGetImageClipMask(MagickWand *wand)
3915 %
3916 %  A description of each parameter follows:
3917 %
3918 %    o wand: the magick wand.
3919 %
3920 */
3921 WandExport MagickWand *MagickGetImageClipMask(MagickWand *wand)
3922 {
3923   Image
3924     *image;
3925
3926   assert(wand != (MagickWand *) NULL);
3927   assert(wand->signature == WandSignature);
3928   if (wand->debug != MagickFalse)
3929     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3930   if (wand->images == (Image *) NULL)
3931     {
3932       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
3933         "ContainsNoImages","`%s'",wand->name);
3934       return((MagickWand *) NULL);
3935     }
3936   image=GetImageClipMask(wand->images,wand->exception);
3937   if (image == (Image *) NULL)
3938     return((MagickWand *) NULL);
3939   return(CloneMagickWandFromImages(wand,image));
3940 }
3941 \f
3942 /*
3943 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3944 %                                                                             %
3945 %                                                                             %
3946 %                                                                             %
3947 %   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                 %
3948 %                                                                             %
3949 %                                                                             %
3950 %                                                                             %
3951 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3952 %
3953 %  MagickGetImageBackgroundColor() returns the image background color.
3954 %
3955 %  The format of the MagickGetImageBackgroundColor method is:
3956 %
3957 %      MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3958 %        PixelWand *background_color)
3959 %
3960 %  A description of each parameter follows:
3961 %
3962 %    o wand: the magick wand.
3963 %
3964 %    o background_color: Return the background color.
3965 %
3966 */
3967 WandExport MagickBooleanType MagickGetImageBackgroundColor(MagickWand *wand,
3968   PixelWand *background_color)
3969 {
3970   assert(wand != (MagickWand *) NULL);
3971   assert(wand->signature == WandSignature);
3972   if (wand->debug != MagickFalse)
3973     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
3974   if (wand->images == (Image *) NULL)
3975     ThrowWandException(WandError,"ContainsNoImages",wand->name);
3976   PixelSetQuantumColor(background_color,&wand->images->background_color);
3977   return(MagickTrue);
3978 }
3979 \f
3980 /*
3981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3982 %                                                                             %
3983 %                                                                             %
3984 %                                                                             %
3985 %   M a g i c k G e t I m a g e B l o b                                       %
3986 %                                                                             %
3987 %                                                                             %
3988 %                                                                             %
3989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3990 %
3991 %  MagickGetImageBlob() implements direct to memory image formats.  It
3992 %  returns the image as a blob and its length.   Use MagickSetFormat() to
3993 %  set the format of the returned blob (GIF, JPEG,  PNG, etc.).
3994 %
3995 %  Use MagickRelinquishMemory() to free the blob when you are done with it.
3996 %
3997 %  The format of the MagickGetImageBlob method is:
3998 %
3999 %      unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
4000 %
4001 %  A description of each parameter follows:
4002 %
4003 %    o wand: the magick wand.
4004 %
4005 %    o length: the length of the blob.
4006 %
4007 */
4008 WandExport unsigned char *MagickGetImageBlob(MagickWand *wand,size_t *length)
4009 {
4010   assert(wand != (MagickWand *) NULL);
4011   assert(wand->signature == WandSignature);
4012   if (wand->debug != MagickFalse)
4013     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4014   if (wand->images == (Image *) NULL)
4015     {
4016       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4017         "ContainsNoImages","`%s'",wand->name);
4018       return((unsigned char *) NULL);
4019     }
4020   return(ImageToBlob(wand->image_info,wand->images,length,wand->exception));
4021 }
4022 \f
4023 /*
4024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4025 %                                                                             %
4026 %                                                                             %
4027 %                                                                             %
4028 %   M a g i c k G e t I m a g e s B l o b                                     %
4029 %                                                                             %
4030 %                                                                             %
4031 %                                                                             %
4032 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4033 %
4034 %  MagickGetImageBlob() implements direct to memory image formats.  It
4035 %  returns the image sequence as a blob and its length.  The format of the image
4036 %  determines the format of the returned blob (GIF, JPEG,  PNG, etc.).  To
4037 %  return a different image format, use MagickSetImageFormat().
4038 %
4039 %  Note, some image formats do not permit multiple images to the same image
4040 %  stream (e.g. JPEG).  in this instance, just the first image of the
4041 %  sequence is returned as a blob.
4042 %
4043 %  The format of the MagickGetImagesBlob method is:
4044 %
4045 %      unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
4046 %
4047 %  A description of each parameter follows:
4048 %
4049 %    o wand: the magick wand.
4050 %
4051 %    o length: the length of the blob.
4052 %
4053 */
4054 WandExport unsigned char *MagickGetImagesBlob(MagickWand *wand,size_t *length)
4055 {
4056   unsigned char
4057     *blob;
4058
4059   assert(wand != (MagickWand *) NULL);
4060   assert(wand->signature == WandSignature);
4061   if (wand->debug != MagickFalse)
4062     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4063   if (wand->images == (Image *) NULL)
4064     {
4065       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4066         "ContainsNoImages","`%s'",wand->name);
4067       return((unsigned char *) NULL);
4068     }
4069   blob=ImagesToBlob(wand->image_info,GetFirstImageInList(wand->images),length,
4070     wand->exception);
4071   return(blob);
4072 }
4073 \f
4074 /*
4075 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4076 %                                                                             %
4077 %                                                                             %
4078 %                                                                             %
4079 %   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                         %
4080 %                                                                             %
4081 %                                                                             %
4082 %                                                                             %
4083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4084 %
4085 %  MagickGetImageBluePrimary() returns the chromaticy blue primary point for the
4086 %  image.
4087 %
4088 %  The format of the MagickGetImageBluePrimary method is:
4089 %
4090 %      MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,double *x,
4091 %        double *y)
4092 %
4093 %  A description of each parameter follows:
4094 %
4095 %    o wand: the magick wand.
4096 %
4097 %    o x: the chromaticity blue primary x-point.
4098 %
4099 %    o y: the chromaticity blue primary y-point.
4100 %
4101 */
4102 WandExport MagickBooleanType MagickGetImageBluePrimary(MagickWand *wand,
4103   double *x,double *y)
4104 {
4105   assert(wand != (MagickWand *) NULL);
4106   assert(wand->signature == WandSignature);
4107   if (wand->debug != MagickFalse)
4108     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4109   if (wand->images == (Image *) NULL)
4110     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4111   *x=wand->images->chromaticity.blue_primary.x;
4112   *y=wand->images->chromaticity.blue_primary.y;
4113   return(MagickTrue);
4114 }
4115 \f
4116 /*
4117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4118 %                                                                             %
4119 %                                                                             %
4120 %                                                                             %
4121 %   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                         %
4122 %                                                                             %
4123 %                                                                             %
4124 %                                                                             %
4125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4126 %
4127 %  MagickGetImageBorderColor() returns the image border color.
4128 %
4129 %  The format of the MagickGetImageBorderColor method is:
4130 %
4131 %      MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4132 %        PixelWand *border_color)
4133 %
4134 %  A description of each parameter follows:
4135 %
4136 %    o wand: the magick wand.
4137 %
4138 %    o border_color: Return the border color.
4139 %
4140 */
4141 WandExport MagickBooleanType MagickGetImageBorderColor(MagickWand *wand,
4142   PixelWand *border_color)
4143 {
4144   assert(wand != (MagickWand *) NULL);
4145   assert(wand->signature == WandSignature);
4146   if (wand->debug != MagickFalse)
4147     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4148   if (wand->images == (Image *) NULL)
4149     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4150   PixelSetQuantumColor(border_color,&wand->images->border_color);
4151   return(MagickTrue);
4152 }
4153 \f
4154 /*
4155 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4156 %                                                                             %
4157 %                                                                             %
4158 %                                                                             %
4159 %   M a g i c k G e t I m a g e C h a n n e l D e p t h                       %
4160 %                                                                             %
4161 %                                                                             %
4162 %                                                                             %
4163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4164 %
4165 %  MagickGetImageChannelDepth() gets the depth for one or more image channels.
4166 %
4167 %  The format of the MagickGetImageChannelDepth method is:
4168 %
4169 %      size_t MagickGetImageChannelDepth(MagickWand *wand,
4170 %        const ChannelType channel)
4171 %
4172 %  A description of each parameter follows:
4173 %
4174 %    o wand: the magick wand.
4175 %
4176 %    o channel: the image channel(s).
4177 %
4178 */
4179 WandExport size_t MagickGetImageChannelDepth(MagickWand *wand,
4180   const ChannelType channel)
4181 {
4182   assert(wand != (MagickWand *) NULL);
4183   assert(wand->signature == WandSignature);
4184   if (wand->debug != MagickFalse)
4185     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4186   if (wand->images == (Image *) NULL)
4187     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4188   return(GetImageChannelDepth(wand->images,channel,wand->exception));
4189 }
4190 \f
4191 /*
4192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4193 %                                                                             %
4194 %                                                                             %
4195 %                                                                             %
4196 %   M a g i c k G e t I m a g e C h a n n e l D i s t o r t i o n             %
4197 %                                                                             %
4198 %                                                                             %
4199 %                                                                             %
4200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4201 %
4202 %  MagickGetImageChannelDistortion() compares one or more image channels of an
4203 %  image to a reconstructed image and returns the specified distortion metric.
4204 %
4205 %  The format of the MagickGetImageChannelDistortion method is:
4206 %
4207 %      MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
4208 %        const MagickWand *reference,const ChannelType channel,
4209 %        const MetricType metric,double *distortion)
4210 %
4211 %  A description of each parameter follows:
4212 %
4213 %    o wand: the magick wand.
4214 %
4215 %    o reference: the reference wand.
4216 %
4217 %    o channel: the channel.
4218 %
4219 %    o metric: the metric.
4220 %
4221 %    o distortion: the computed distortion between the images.
4222 %
4223 */
4224 WandExport MagickBooleanType MagickGetImageChannelDistortion(MagickWand *wand,
4225   const MagickWand *reference,const ChannelType channel,const MetricType metric,
4226   double *distortion)
4227 {
4228   MagickBooleanType
4229     status;
4230
4231   assert(wand != (MagickWand *) NULL);
4232   assert(wand->signature == WandSignature);
4233   if (wand->debug != MagickFalse)
4234     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4235   assert(reference != (MagickWand *) NULL);
4236   assert(reference->signature == WandSignature);
4237   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4238     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4239   status=GetImageChannelDistortion(wand->images,reference->images,channel,
4240     metric,distortion,&wand->images->exception);
4241   return(status);
4242 }
4243 \f
4244 /*
4245 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4246 %                                                                             %
4247 %                                                                             %
4248 %                                                                             %
4249 %   M a g i c k G e t I m a g e C h a n n e l D i s t o r t i o n s           %
4250 %                                                                             %
4251 %                                                                             %
4252 %                                                                             %
4253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4254 %
4255 %  MagickGetImageChannelDistortions() compares one or more image channels of an
4256 %  image to a reconstructed image and returns the specified distortion metrics.
4257 %
4258 %  Use MagickRelinquishMemory() to free the metrics when you are done with them.
4259 %
4260 %  The format of the MagickGetImageChannelDistortion method is:
4261 %
4262 %      double *MagickGetImageChannelDistortion(MagickWand *wand,
4263 %        const MagickWand *reference,const MetricType metric)
4264 %
4265 %  A description of each parameter follows:
4266 %
4267 %    o wand: the magick wand.
4268 %
4269 %    o reference: the reference wand.
4270 %
4271 %    o metric: the metric.
4272 %
4273 */
4274 WandExport double *MagickGetImageChannelDistortions(MagickWand *wand,
4275   const MagickWand *reference,const MetricType metric)
4276 {
4277   double
4278     *channel_distortion;
4279
4280   assert(wand != (MagickWand *) NULL);
4281   assert(wand->signature == WandSignature);
4282   if (wand->debug != MagickFalse)
4283     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4284   assert(reference != (MagickWand *) NULL);
4285   assert(reference->signature == WandSignature);
4286   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4287     {
4288       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4289         "ContainsNoImages","`%s'",wand->name);
4290       return((double *) NULL);
4291     }
4292   channel_distortion=GetImageChannelDistortions(wand->images,reference->images,
4293     metric,&wand->images->exception);
4294   return(channel_distortion);
4295 }
4296 \f
4297 /*
4298 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4299 %                                                                             %
4300 %                                                                             %
4301 %                                                                             %
4302 %   M a g i c k G e t I m a g e C h a n n e l F e a t u r e s                 %
4303 %                                                                             %
4304 %                                                                             %
4305 %                                                                             %
4306 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4307 %
4308 %  MagickGetImageChannelFeatures() returns features for each channel in the
4309 %  image in each of four directions (horizontal, vertical, left and right
4310 %  diagonals) for the specified distance.  The features include the angular
4311 %  second moment, contrast, correlation, sum of squares: variance, inverse
4312 %  difference moment, sum average, sum varience, sum entropy, entropy,
4313 %  difference variance, difference entropy, information measures of
4314 %  correlation 1, information measures of correlation 2, and maximum
4315 %  correlation coefficient.  You can access the red channel contrast, for
4316 %  example, like this:
4317 %
4318 %      channel_features=MagickGetImageChannelFeatures(wand,1);
4319 %      contrast=channel_features[RedChannel].contrast[0];
4320 %
4321 %  Use MagickRelinquishMemory() to free the statistics buffer.
4322 %
4323 %  The format of the MagickGetImageChannelFeatures method is:
4324 %
4325 %      ChannelFeatures *MagickGetImageChannelFeatures(MagickWand *wand,
4326 %        const size_t distance)
4327 %
4328 %  A description of each parameter follows:
4329 %
4330 %    o wand: the magick wand.
4331 %
4332 %    o distance: the distance.
4333 %
4334 */
4335 WandExport ChannelFeatures *MagickGetImageChannelFeatures(MagickWand *wand,
4336   const size_t distance)
4337 {
4338   assert(wand != (MagickWand *) NULL);
4339   assert(wand->signature == WandSignature);
4340   if (wand->debug != MagickFalse)
4341     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4342   if (wand->images == (Image *) NULL)
4343     {
4344       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4345         "ContainsNoImages","`%s'",wand->name);
4346       return((ChannelFeatures *) NULL);
4347     }
4348   return(GetImageChannelFeatures(wand->images,distance,wand->exception));
4349 }
4350 \f
4351 /*
4352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4353 %                                                                             %
4354 %                                                                             %
4355 %                                                                             %
4356 %   M a g i c k G e t I m a g e C h a n n e l K u r t o s i s                 %
4357 %                                                                             %
4358 %                                                                             %
4359 %                                                                             %
4360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4361 %
4362 %  MagickGetImageChannelKurtosis() gets the kurtosis and skewness of one or
4363 %  more image channels.
4364 %
4365 %  The format of the MagickGetImageChannelKurtosis method is:
4366 %
4367 %      MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
4368 %        const ChannelType channel,double *kurtosis,double *skewness)
4369 %
4370 %  A description of each parameter follows:
4371 %
4372 %    o wand: the magick wand.
4373 %
4374 %    o channel: the image channel(s).
4375 %
4376 %    o kurtosis:  The kurtosis for the specified channel(s).
4377 %
4378 %    o skewness:  The skewness for the specified channel(s).
4379 %
4380 */
4381 WandExport MagickBooleanType MagickGetImageChannelKurtosis(MagickWand *wand,
4382   const ChannelType channel,double *kurtosis,double *skewness)
4383 {
4384   MagickBooleanType
4385     status;
4386
4387   assert(wand != (MagickWand *) NULL);
4388   assert(wand->signature == WandSignature);
4389   if (wand->debug != MagickFalse)
4390     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4391   if (wand->images == (Image *) NULL)
4392     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4393   status=GetImageChannelKurtosis(wand->images,channel,kurtosis,skewness,
4394     wand->exception);
4395   return(status);
4396 }
4397 \f
4398 /*
4399 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4400 %                                                                             %
4401 %                                                                             %
4402 %                                                                             %
4403 %   M a g i c k G e t I m a g e C h a n n e l M e a n                         %
4404 %                                                                             %
4405 %                                                                             %
4406 %                                                                             %
4407 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4408 %
4409 %  MagickGetImageChannelMean() gets the mean and standard deviation of one or
4410 %  more image channels.
4411 %
4412 %  The format of the MagickGetImageChannelMean method is:
4413 %
4414 %      MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
4415 %        const ChannelType channel,double *mean,double *standard_deviation)
4416 %
4417 %  A description of each parameter follows:
4418 %
4419 %    o wand: the magick wand.
4420 %
4421 %    o channel: the image channel(s).
4422 %
4423 %    o mean:  The mean pixel value for the specified channel(s).
4424 %
4425 %    o standard_deviation:  The standard deviation for the specified channel(s).
4426 %
4427 */
4428 WandExport MagickBooleanType MagickGetImageChannelMean(MagickWand *wand,
4429   const ChannelType channel,double *mean,double *standard_deviation)
4430 {
4431   MagickBooleanType
4432     status;
4433
4434   assert(wand != (MagickWand *) NULL);
4435   assert(wand->signature == WandSignature);
4436   if (wand->debug != MagickFalse)
4437     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4438   if (wand->images == (Image *) NULL)
4439     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4440   status=GetImageChannelMean(wand->images,channel,mean,standard_deviation,
4441     wand->exception);
4442   return(status);
4443 }
4444 \f
4445 /*
4446 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4447 %                                                                             %
4448 %                                                                             %
4449 %                                                                             %
4450 %   M a g i c k G e t I m a g e C h a n n e l R a n g e                       %
4451 %                                                                             %
4452 %                                                                             %
4453 %                                                                             %
4454 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4455 %
4456 %  MagickGetImageChannelRange() gets the range for one or more image channels.
4457 %
4458 %  The format of the MagickGetImageChannelRange method is:
4459 %
4460 %      MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
4461 %        const ChannelType channel,double *minima,double *maxima)
4462 %
4463 %  A description of each parameter follows:
4464 %
4465 %    o wand: the magick wand.
4466 %
4467 %    o channel: the image channel(s).
4468 %
4469 %    o minima:  The minimum pixel value for the specified channel(s).
4470 %
4471 %    o maxima:  The maximum pixel value for the specified channel(s).
4472 %
4473 */
4474 WandExport MagickBooleanType MagickGetImageChannelRange(MagickWand *wand,
4475   const ChannelType channel,double *minima,double *maxima)
4476 {
4477   MagickBooleanType
4478     status;
4479
4480   assert(wand != (MagickWand *) NULL);
4481   assert(wand->signature == WandSignature);
4482   if (wand->debug != MagickFalse)
4483     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4484   if (wand->images == (Image *) NULL)
4485     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4486   status=GetImageChannelRange(wand->images,channel,minima,maxima,
4487     wand->exception);
4488   return(status);
4489 }
4490 \f
4491 /*
4492 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4493 %                                                                             %
4494 %                                                                             %
4495 %                                                                             %
4496 %   M a g i c k G e t I m a g e C h a n n e l S t a t i s t i c s             %
4497 %                                                                             %
4498 %                                                                             %
4499 %                                                                             %
4500 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4501 %
4502 %  MagickGetImageChannelStatistics() returns statistics for each channel in the
4503 %  image.  The statistics include the channel depth, its minima and
4504 %  maxima, the mean, the standard deviation, the kurtosis and the skewness.
4505 %  You can access the red channel mean, for example, like this:
4506 %
4507 %      channel_statistics=MagickGetImageChannelStatistics(wand);
4508 %      red_mean=channel_statistics[RedChannel].mean;
4509 %
4510 %  Use MagickRelinquishMemory() to free the statistics buffer.
4511 %
4512 %  The format of the MagickGetImageChannelStatistics method is:
4513 %
4514 %      ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
4515 %
4516 %  A description of each parameter follows:
4517 %
4518 %    o wand: the magick wand.
4519 %
4520 */
4521 WandExport ChannelStatistics *MagickGetImageChannelStatistics(MagickWand *wand)
4522 {
4523   assert(wand != (MagickWand *) NULL);
4524   assert(wand->signature == WandSignature);
4525   if (wand->debug != MagickFalse)
4526     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4527   if (wand->images == (Image *) NULL)
4528     {
4529       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4530         "ContainsNoImages","`%s'",wand->name);
4531       return((ChannelStatistics *) NULL);
4532     }
4533   return(GetImageChannelStatistics(wand->images,wand->exception));
4534 }
4535 \f
4536 /*
4537 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4538 %                                                                             %
4539 %                                                                             %
4540 %                                                                             %
4541 %   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                     %
4542 %                                                                             %
4543 %                                                                             %
4544 %                                                                             %
4545 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4546 %
4547 %  MagickGetImageColormapColor() returns the color of the specified colormap
4548 %  index.
4549 %
4550 %  The format of the MagickGetImageColormapColor method is:
4551 %
4552 %      MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4553 %        const size_t index,PixelWand *color)
4554 %
4555 %  A description of each parameter follows:
4556 %
4557 %    o wand: the magick wand.
4558 %
4559 %    o index: the offset into the image colormap.
4560 %
4561 %    o color: Return the colormap color in this wand.
4562 %
4563 */
4564 WandExport MagickBooleanType MagickGetImageColormapColor(MagickWand *wand,
4565   const size_t index,PixelWand *color)
4566 {
4567   assert(wand != (MagickWand *) NULL);
4568   assert(wand->signature == WandSignature);
4569   if (wand->debug != MagickFalse)
4570     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4571   if (wand->images == (Image *) NULL)
4572     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4573   if ((wand->images->colormap == (PixelPacket *) NULL) ||
4574       (index >= wand->images->colors))
4575     {
4576       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4577         "InvalidColormapIndex","`%s'",wand->name);
4578       return(MagickFalse);
4579     }
4580   PixelSetQuantumColor(color,wand->images->colormap+index);
4581   return(MagickTrue);
4582 }
4583 \f
4584 /*
4585 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4586 %                                                                             %
4587 %                                                                             %
4588 %                                                                             %
4589 %   M a g i c k G e t I m a g e C o l o r s                                   %
4590 %                                                                             %
4591 %                                                                             %
4592 %                                                                             %
4593 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4594 %
4595 %  MagickGetImageColors() gets the number of unique colors in the image.
4596 %
4597 %  The format of the MagickGetImageColors method is:
4598 %
4599 %      size_t MagickGetImageColors(MagickWand *wand)
4600 %
4601 %  A description of each parameter follows:
4602 %
4603 %    o wand: the magick wand.
4604 %
4605 */
4606 WandExport size_t MagickGetImageColors(MagickWand *wand)
4607 {
4608   assert(wand != (MagickWand *) NULL);
4609   assert(wand->signature == WandSignature);
4610   if (wand->debug != MagickFalse)
4611     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4612   if (wand->images == (Image *) NULL)
4613     {
4614       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4615         "ContainsNoImages","`%s'",wand->name);
4616       return(0);
4617     }
4618   return(GetNumberColors(wand->images,(FILE *) NULL,wand->exception));
4619 }
4620 \f
4621 /*
4622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4623 %                                                                             %
4624 %                                                                             %
4625 %                                                                             %
4626 %   M a g i c k G e t I m a g e C o l o r s p a c e                           %
4627 %                                                                             %
4628 %                                                                             %
4629 %                                                                             %
4630 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4631 %
4632 %  MagickGetImageColorspace() gets the image colorspace.
4633 %
4634 %  The format of the MagickGetImageColorspace method is:
4635 %
4636 %      ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4637 %
4638 %  A description of each parameter follows:
4639 %
4640 %    o wand: the magick wand.
4641 %
4642 */
4643 WandExport ColorspaceType MagickGetImageColorspace(MagickWand *wand)
4644 {
4645   assert(wand != (MagickWand *) NULL);
4646   assert(wand->signature == WandSignature);
4647   if (wand->debug != MagickFalse)
4648     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4649   if (wand->images == (Image *) NULL)
4650     {
4651       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4652         "ContainsNoImages","`%s'",wand->name);
4653       return(UndefinedColorspace);
4654     }
4655   return(wand->images->colorspace);
4656 }
4657 \f
4658 /*
4659 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4660 %                                                                             %
4661 %                                                                             %
4662 %                                                                             %
4663 %   M a g i c k G e t I m a g e C o m p o s e                                 %
4664 %                                                                             %
4665 %                                                                             %
4666 %                                                                             %
4667 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4668 %
4669 %  MagickGetImageCompose() returns the composite operator associated with the
4670 %  image.
4671 %
4672 %  The format of the MagickGetImageCompose method is:
4673 %
4674 %      CompositeOperator MagickGetImageCompose(MagickWand *wand)
4675 %
4676 %  A description of each parameter follows:
4677 %
4678 %    o wand: the magick wand.
4679 %
4680 */
4681 WandExport CompositeOperator MagickGetImageCompose(MagickWand *wand)
4682 {
4683   assert(wand != (MagickWand *) NULL);
4684   assert(wand->signature == WandSignature);
4685   if (wand->debug != MagickFalse)
4686     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4687   if (wand->images == (Image *) NULL)
4688     {
4689       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4690         "ContainsNoImages","`%s'",wand->name);
4691       return(UndefinedCompositeOp);
4692     }
4693   return(wand->images->compose);
4694 }
4695 \f
4696 /*
4697 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4698 %                                                                             %
4699 %                                                                             %
4700 %                                                                             %
4701 %   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                         %
4702 %                                                                             %
4703 %                                                                             %
4704 %                                                                             %
4705 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4706 %
4707 %  MagickGetImageCompression() gets the image compression.
4708 %
4709 %  The format of the MagickGetImageCompression method is:
4710 %
4711 %      CompressionType MagickGetImageCompression(MagickWand *wand)
4712 %
4713 %  A description of each parameter follows:
4714 %
4715 %    o wand: the magick wand.
4716 %
4717 */
4718 WandExport CompressionType MagickGetImageCompression(MagickWand *wand)
4719 {
4720   assert(wand != (MagickWand *) NULL);
4721   assert(wand->signature == WandSignature);
4722   if (wand->debug != MagickFalse)
4723     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4724   if (wand->images == (Image *) NULL)
4725     {
4726       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4727         "ContainsNoImages","`%s'",wand->name);
4728       return(UndefinedCompression);
4729     }
4730   return(wand->images->compression);
4731 }
4732 \f
4733 /*
4734 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4735 %                                                                             %
4736 %                                                                             %
4737 %                                                                             %
4738 %   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           %
4739 %                                                                             %
4740 %                                                                             %
4741 %                                                                             %
4742 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4743 %
4744 %  MagickGetImageCompression() gets the image compression quality.
4745 %
4746 %  The format of the MagickGetImageCompression method is:
4747 %
4748 %      size_t MagickGetImageCompression(MagickWand *wand)
4749 %
4750 %  A description of each parameter follows:
4751 %
4752 %    o wand: the magick wand.
4753 %
4754 */
4755 WandExport size_t MagickGetImageCompressionQuality(MagickWand *wand)
4756 {
4757   assert(wand != (MagickWand *) NULL);
4758   assert(wand->signature == WandSignature);
4759   if (wand->debug != MagickFalse)
4760     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4761   if (wand->images == (Image *) NULL)
4762     {
4763       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4764         "ContainsNoImages","`%s'",wand->name);
4765       return(0UL);
4766     }
4767   return(wand->images->quality);
4768 }
4769 \f
4770 /*
4771 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4772 %                                                                             %
4773 %                                                                             %
4774 %                                                                             %
4775 %   M a g i c k G e t I m a g e D e l a y                                     %
4776 %                                                                             %
4777 %                                                                             %
4778 %                                                                             %
4779 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4780 %
4781 %  MagickGetImageDelay() gets the image delay.
4782 %
4783 %  The format of the MagickGetImageDelay method is:
4784 %
4785 %      size_t MagickGetImageDelay(MagickWand *wand)
4786 %
4787 %  A description of each parameter follows:
4788 %
4789 %    o wand: the magick wand.
4790 %
4791 */
4792 WandExport size_t MagickGetImageDelay(MagickWand *wand)
4793 {
4794   assert(wand != (MagickWand *) NULL);
4795   assert(wand->signature == WandSignature);
4796   if (wand->debug != MagickFalse)
4797     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4798   if (wand->images == (Image *) NULL)
4799     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4800   return(wand->images->delay);
4801 }
4802 \f
4803 /*
4804 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4805 %                                                                             %
4806 %                                                                             %
4807 %                                                                             %
4808 %   M a g i c k G e t I m a g e D e p t h                                     %
4809 %                                                                             %
4810 %                                                                             %
4811 %                                                                             %
4812 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4813 %
4814 %  MagickGetImageDepth() gets the image depth.
4815 %
4816 %  The format of the MagickGetImageDepth method is:
4817 %
4818 %      size_t MagickGetImageDepth(MagickWand *wand)
4819 %
4820 %  A description of each parameter follows:
4821 %
4822 %    o wand: the magick wand.
4823 %
4824 */
4825 WandExport size_t MagickGetImageDepth(MagickWand *wand)
4826 {
4827   assert(wand != (MagickWand *) NULL);
4828   assert(wand->signature == WandSignature);
4829   if (wand->debug != MagickFalse)
4830     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4831   if (wand->images == (Image *) NULL)
4832     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4833   return(wand->images->depth);
4834 }
4835 \f
4836 /*
4837 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4838 %                                                                             %
4839 %                                                                             %
4840 %                                                                             %
4841 %   M a g i c k G e t I m a g e D i s t o r t i o n                           %
4842 %                                                                             %
4843 %                                                                             %
4844 %                                                                             %
4845 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4846 %
4847 %  MagickGetImageDistortion() compares an image to a reconstructed image and
4848 %  returns the specified distortion metric.
4849 %
4850 %  The format of the MagickGetImageDistortion method is:
4851 %
4852 %      MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4853 %        const MagickWand *reference,const MetricType metric,
4854 %        double *distortion)
4855 %
4856 %  A description of each parameter follows:
4857 %
4858 %    o wand: the magick wand.
4859 %
4860 %    o reference: the reference wand.
4861 %
4862 %    o metric: the metric.
4863 %
4864 %    o distortion: the computed distortion between the images.
4865 %
4866 */
4867 WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand,
4868   const MagickWand *reference,const MetricType metric,double *distortion)
4869 {
4870   MagickBooleanType
4871     status;
4872
4873
4874   assert(wand != (MagickWand *) NULL);
4875   assert(wand->signature == WandSignature);
4876   if (wand->debug != MagickFalse)
4877     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4878   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
4879     ThrowWandException(WandError,"ContainsNoImages",wand->name);
4880   status=GetImageDistortion(wand->images,reference->images,metric,distortion,
4881     &wand->images->exception);
4882   return(status);
4883 }
4884 \f
4885 /*
4886 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4887 %                                                                             %
4888 %                                                                             %
4889 %                                                                             %
4890 %   M a g i c k G e t I m a g e D i s p o s e                                 %
4891 %                                                                             %
4892 %                                                                             %
4893 %                                                                             %
4894 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4895 %
4896 %  MagickGetImageDispose() gets the image disposal method.
4897 %
4898 %  The format of the MagickGetImageDispose method is:
4899 %
4900 %      DisposeType MagickGetImageDispose(MagickWand *wand)
4901 %
4902 %  A description of each parameter follows:
4903 %
4904 %    o wand: the magick wand.
4905 %
4906 */
4907 WandExport DisposeType MagickGetImageDispose(MagickWand *wand)
4908 {
4909   assert(wand != (MagickWand *) NULL);
4910   assert(wand->signature == WandSignature);
4911   if (wand->debug != MagickFalse)
4912     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4913   if (wand->images == (Image *) NULL)
4914     {
4915       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4916         "ContainsNoImages","`%s'",wand->name);
4917       return(UndefinedDispose);
4918     }
4919   return((DisposeType) wand->images->dispose);
4920 }
4921 \f
4922 /*
4923 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4924 %                                                                             %
4925 %                                                                             %
4926 %                                                                             %
4927 %   M a g i c k G e t I m a g e F i l e n a m e                               %
4928 %                                                                             %
4929 %                                                                             %
4930 %                                                                             %
4931 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4932 %
4933 %  MagickGetImageFilename() returns the filename of a particular image in a
4934 %  sequence.
4935 %
4936 %  The format of the MagickGetImageFilename method is:
4937 %
4938 %      char *MagickGetImageFilename(MagickWand *wand)
4939 %
4940 %  A description of each parameter follows:
4941 %
4942 %    o wand: the magick wand.
4943 %
4944 */
4945 WandExport char *MagickGetImageFilename(MagickWand *wand)
4946 {
4947   assert(wand != (MagickWand *) NULL);
4948   assert(wand->signature == WandSignature);
4949   if (wand->debug != MagickFalse)
4950     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4951   if (wand->images == (Image *) NULL)
4952     {
4953       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4954         "ContainsNoImages","`%s'",wand->name);
4955       return((char *) NULL);
4956     }
4957   return(AcquireString(wand->images->filename));
4958 }
4959 \f
4960 /*
4961 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4962 %                                                                             %
4963 %                                                                             %
4964 %                                                                             %
4965 %   M a g i c k G e t I m a g e F o r m a t                                   %
4966 %                                                                             %
4967 %                                                                             %
4968 %                                                                             %
4969 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4970 %
4971 %  MagickGetImageFormat() returns the format of a particular image in a
4972 %  sequence.
4973 %
4974 %  The format of the MagickGetImageFormat method is:
4975 %
4976 %      const char *MagickGetImageFormat(MagickWand *wand)
4977 %
4978 %  A description of each parameter follows:
4979 %
4980 %    o wand: the magick wand.
4981 %
4982 */
4983 WandExport char *MagickGetImageFormat(MagickWand *wand)
4984 {
4985   assert(wand != (MagickWand *) NULL);
4986   assert(wand->signature == WandSignature);
4987   if (wand->debug != MagickFalse)
4988     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
4989   if (wand->images == (Image *) NULL)
4990     {
4991       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
4992         "ContainsNoImages","`%s'",wand->name);
4993       return((char *) NULL);
4994     }
4995   return(AcquireString(wand->images->magick));
4996 }
4997 \f
4998 /*
4999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5000 %                                                                             %
5001 %                                                                             %
5002 %                                                                             %
5003 %   M a g i c k G e t I m a g e F u z z                                       %
5004 %                                                                             %
5005 %                                                                             %
5006 %                                                                             %
5007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5008 %
5009 %  MagickGetImageFuzz() gets the image fuzz.
5010 %
5011 %  The format of the MagickGetImageFuzz method is:
5012 %
5013 %      double MagickGetImageFuzz(MagickWand *wand)
5014 %
5015 %  A description of each parameter follows:
5016 %
5017 %    o wand: the magick wand.
5018 %
5019 */
5020 WandExport double MagickGetImageFuzz(MagickWand *wand)
5021 {
5022   assert(wand != (MagickWand *) NULL);
5023   assert(wand->signature == WandSignature);
5024   if (wand->debug != MagickFalse)
5025     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5026   if (wand->images == (Image *) NULL)
5027     {
5028       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5029         "ContainsNoImages","`%s'",wand->name);
5030       return(0.0);
5031     }
5032   return(wand->images->fuzz);
5033 }
5034 \f
5035 /*
5036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5037 %                                                                             %
5038 %                                                                             %
5039 %                                                                             %
5040 %   M a g i c k G e t I m a g e G a m m a                                     %
5041 %                                                                             %
5042 %                                                                             %
5043 %                                                                             %
5044 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5045 %
5046 %  MagickGetImageGamma() gets the image gamma.
5047 %
5048 %  The format of the MagickGetImageGamma method is:
5049 %
5050 %      double MagickGetImageGamma(MagickWand *wand)
5051 %
5052 %  A description of each parameter follows:
5053 %
5054 %    o wand: the magick wand.
5055 %
5056 */
5057 WandExport double MagickGetImageGamma(MagickWand *wand)
5058 {
5059   assert(wand != (MagickWand *) NULL);
5060   assert(wand->signature == WandSignature);
5061   if (wand->debug != MagickFalse)
5062     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5063   if (wand->images == (Image *) NULL)
5064     {
5065       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5066         "ContainsNoImages","`%s'",wand->name);
5067       return(0.0);
5068     }
5069   return(wand->images->gamma);
5070 }
5071 \f
5072 /*
5073 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5074 %                                                                             %
5075 %                                                                             %
5076 %                                                                             %
5077 %   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                 %
5078 %                                                                             %
5079 %                                                                             %
5080 %                                                                             %
5081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5082 %
5083 %  MagickGetImageGravity() gets the image gravity.
5084 %
5085 %  The format of the MagickGetImageGravity method is:
5086 %
5087 %      GravityType MagickGetImageGravity(MagickWand *wand)
5088 %
5089 %  A description of each parameter follows:
5090 %
5091 %    o wand: the magick wand.
5092 %
5093 */
5094 WandExport GravityType MagickGetImageGravity(MagickWand *wand)
5095 {
5096   assert(wand != (MagickWand *) NULL);
5097   assert(wand->signature == WandSignature);
5098   if (wand->debug != MagickFalse)
5099     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5100   if (wand->images == (Image *) NULL)
5101     {
5102       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5103         "ContainsNoImages","`%s'",wand->name);
5104       return(UndefinedGravity);
5105     }
5106   return(wand->images->gravity);
5107 }
5108 \f
5109 /*
5110 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5111 %                                                                             %
5112 %                                                                             %
5113 %                                                                             %
5114 %   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                       %
5115 %                                                                             %
5116 %                                                                             %
5117 %                                                                             %
5118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5119 %
5120 %  MagickGetImageGreenPrimary() returns the chromaticy green primary point.
5121 %
5122 %  The format of the MagickGetImageGreenPrimary method is:
5123 %
5124 %      MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,double *x,
5125 %        double *y)
5126 %
5127 %  A description of each parameter follows:
5128 %
5129 %    o wand: the magick wand.
5130 %
5131 %    o x: the chromaticity green primary x-point.
5132 %
5133 %    o y: the chromaticity green primary y-point.
5134 %
5135 */
5136 WandExport MagickBooleanType MagickGetImageGreenPrimary(MagickWand *wand,
5137   double *x,double *y)
5138 {
5139   assert(wand != (MagickWand *) NULL);
5140   assert(wand->signature == WandSignature);
5141   if (wand->debug != MagickFalse)
5142     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5143   if (wand->images == (Image *) NULL)
5144     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5145   *x=wand->images->chromaticity.green_primary.x;
5146   *y=wand->images->chromaticity.green_primary.y;
5147   return(MagickTrue);
5148 }
5149 \f
5150 /*
5151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5152 %                                                                             %
5153 %                                                                             %
5154 %                                                                             %
5155 %   M a g i c k G e t I m a g e H e i g h t                                   %
5156 %                                                                             %
5157 %                                                                             %
5158 %                                                                             %
5159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5160 %
5161 %  MagickGetImageHeight() returns the image height.
5162 %
5163 %  The format of the MagickGetImageHeight method is:
5164 %
5165 %      size_t MagickGetImageHeight(MagickWand *wand)
5166 %
5167 %  A description of each parameter follows:
5168 %
5169 %    o wand: the magick wand.
5170 %
5171 */
5172 WandExport size_t MagickGetImageHeight(MagickWand *wand)
5173 {
5174   assert(wand != (MagickWand *) NULL);
5175   assert(wand->signature == WandSignature);
5176   if (wand->debug != MagickFalse)
5177     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5178   if (wand->images == (Image *) NULL)
5179     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5180   return(wand->images->rows);
5181 }
5182 \f
5183 /*
5184 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5185 %                                                                             %
5186 %                                                                             %
5187 %                                                                             %
5188 %   M a g i c k G e t I m a g e H i s t o g r a m                             %
5189 %                                                                             %
5190 %                                                                             %
5191 %                                                                             %
5192 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5193 %
5194 %  MagickGetImageHistogram() returns the image histogram as an array of
5195 %  PixelWand wands.
5196 %
5197 %  The format of the MagickGetImageHistogram method is:
5198 %
5199 %      PixelWand **MagickGetImageHistogram(MagickWand *wand,
5200 %        size_t *number_colors)
5201 %
5202 %  A description of each parameter follows:
5203 %
5204 %    o wand: the magick wand.
5205 %
5206 %    o number_colors: the number of unique colors in the image and the number
5207 %      of pixel wands returned.
5208 %
5209 */
5210 WandExport PixelWand **MagickGetImageHistogram(MagickWand *wand,
5211   size_t *number_colors)
5212 {
5213   ColorPacket
5214     *histogram;
5215
5216   PixelWand
5217     **pixel_wands;
5218
5219   register ssize_t
5220     i;
5221
5222   assert(wand != (MagickWand *) NULL);
5223   assert(wand->signature == WandSignature);
5224   if (wand->debug != MagickFalse)
5225     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5226   if (wand->images == (Image *) NULL)
5227     {
5228       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5229         "ContainsNoImages","`%s'",wand->name);
5230       return((PixelWand **) NULL);
5231     }
5232   histogram=GetImageHistogram(wand->images,number_colors,wand->exception);
5233   if (histogram == (ColorPacket *) NULL)
5234     return((PixelWand **) NULL);
5235   pixel_wands=NewPixelWands(*number_colors);
5236   for (i=0; i < (ssize_t) *number_colors; i++)
5237   {
5238     PixelSetQuantumColor(pixel_wands[i],&histogram[i].pixel);
5239     PixelSetIndex(pixel_wands[i],histogram[i].index);
5240     PixelSetColorCount(pixel_wands[i],(size_t) histogram[i].count);
5241   }
5242   histogram=(ColorPacket *) RelinquishMagickMemory(histogram);
5243   return(pixel_wands);
5244 }
5245 \f
5246 /*
5247 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5248 %                                                                             %
5249 %                                                                             %
5250 %                                                                             %
5251 %   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                 %
5252 %                                                                             %
5253 %                                                                             %
5254 %                                                                             %
5255 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5256 %
5257 %  MagickGetImageInterlaceScheme() gets the image interlace scheme.
5258 %
5259 %  The format of the MagickGetImageInterlaceScheme method is:
5260 %
5261 %      InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5262 %
5263 %  A description of each parameter follows:
5264 %
5265 %    o wand: the magick wand.
5266 %
5267 */
5268 WandExport InterlaceType MagickGetImageInterlaceScheme(MagickWand *wand)
5269 {
5270   assert(wand != (MagickWand *) NULL);
5271   assert(wand->signature == WandSignature);
5272   if (wand->debug != MagickFalse)
5273     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5274   if (wand->images == (Image *) NULL)
5275     {
5276       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5277         "ContainsNoImages","`%s'",wand->name);
5278       return(UndefinedInterlace);
5279     }
5280   return(wand->images->interlace);
5281 }
5282 \f
5283 /*
5284 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5285 %                                                                             %
5286 %                                                                             %
5287 %                                                                             %
5288 %   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             %
5289 %                                                                             %
5290 %                                                                             %
5291 %                                                                             %
5292 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5293 %
5294 %  MagickGetImageInterpolateMethod() returns the interpolation method for the
5295 %  sepcified image.
5296 %
5297 %  The format of the MagickGetImageInterpolateMethod method is:
5298 %
5299 %      InterpolatePixelMethod MagickGetImageInterpolateMethod(MagickWand *wand)
5300 %
5301 %  A description of each parameter follows:
5302 %
5303 %    o wand: the magick wand.
5304 %
5305 */
5306 WandExport InterpolatePixelMethod MagickGetImageInterpolateMethod(
5307   MagickWand *wand)
5308 {
5309   assert(wand != (MagickWand *) NULL);
5310   assert(wand->signature == WandSignature);
5311   if (wand->debug != MagickFalse)
5312     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5313   if (wand->images == (Image *) NULL)
5314     {
5315       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5316         "ContainsNoImages","`%s'",wand->name);
5317       return(UndefinedInterpolatePixel);
5318     }
5319   return(wand->images->interpolate);
5320 }
5321 \f
5322 /*
5323 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5324 %                                                                             %
5325 %                                                                             %
5326 %                                                                             %
5327 %   M a g i c k G e t I m a g e I t e r a t i o n s                           %
5328 %                                                                             %
5329 %                                                                             %
5330 %                                                                             %
5331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5332 %
5333 %  MagickGetImageIterations() gets the image iterations.
5334 %
5335 %  The format of the MagickGetImageIterations method is:
5336 %
5337 %      size_t MagickGetImageIterations(MagickWand *wand)
5338 %
5339 %  A description of each parameter follows:
5340 %
5341 %    o wand: the magick wand.
5342 %
5343 */
5344 WandExport size_t MagickGetImageIterations(MagickWand *wand)
5345 {
5346   assert(wand != (MagickWand *) NULL);
5347   assert(wand->signature == WandSignature);
5348   if (wand->debug != MagickFalse)
5349     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5350   if (wand->images == (Image *) NULL)
5351     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5352   return(wand->images->iterations);
5353 }
5354 \f
5355 /*
5356 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5357 %                                                                             %
5358 %                                                                             %
5359 %                                                                             %
5360 %   M a g i c k G e t I m a g e L e n g t h                                   %
5361 %                                                                             %
5362 %                                                                             %
5363 %                                                                             %
5364 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5365 %
5366 %  MagickGetImageLength() returns the image length in bytes.
5367 %
5368 %  The format of the MagickGetImageLength method is:
5369 %
5370 %      MagickBooleanType MagickGetImageLength(MagickWand *wand,
5371 %        MagickSizeType *length)
5372 %
5373 %  A description of each parameter follows:
5374 %
5375 %    o wand: the magick wand.
5376 %
5377 %    o length: the image length in bytes.
5378 %
5379 */
5380 WandExport MagickBooleanType MagickGetImageLength(MagickWand *wand,
5381   MagickSizeType *length)
5382 {
5383   assert(wand != (MagickWand *) NULL);
5384   assert(wand->signature == WandSignature);
5385   if (wand->debug != MagickFalse)
5386     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5387   if (wand->images == (Image *) NULL)
5388     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5389   *length=GetBlobSize(wand->images);
5390   return(MagickTrue);
5391 }
5392 \f
5393 /*
5394 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5395 %                                                                             %
5396 %                                                                             %
5397 %                                                                             %
5398 %   M a g i c k G e t I m a g e M a t t e C o l o r                           %
5399 %                                                                             %
5400 %                                                                             %
5401 %                                                                             %
5402 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5403 %
5404 %  MagickGetImageMatteColor() returns the image matte color.
5405 %
5406 %  The format of the MagickGetImageMatteColor method is:
5407 %
5408 %      MagickBooleanType MagickGetImagematteColor(MagickWand *wand,
5409 %        PixelWand *matte_color)
5410 %
5411 %  A description of each parameter follows:
5412 %
5413 %    o wand: the magick wand.
5414 %
5415 %    o matte_color: Return the matte color.
5416 %
5417 */
5418 WandExport MagickBooleanType MagickGetImageMatteColor(MagickWand *wand,
5419   PixelWand *matte_color)
5420 {
5421   assert(wand != (MagickWand *) NULL);
5422   assert(wand->signature == WandSignature);
5423   if (wand->debug != MagickFalse)
5424     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5425   if (wand->images == (Image *) NULL)
5426     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5427   PixelSetQuantumColor(matte_color,&wand->images->matte_color);
5428   return(MagickTrue);
5429 }
5430 \f
5431 /*
5432 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5433 %                                                                             %
5434 %                                                                             %
5435 %                                                                             %
5436 %   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                         %
5437 %                                                                             %
5438 %                                                                             %
5439 %                                                                             %
5440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5441 %
5442 %  MagickGetImageOrientation() returns the image orientation.
5443 %
5444 %  The format of the MagickGetImageOrientation method is:
5445 %
5446 %      OrientationType MagickGetImageOrientation(MagickWand *wand)
5447 %
5448 %  A description of each parameter follows:
5449 %
5450 %    o wand: the magick wand.
5451 %
5452 */
5453 WandExport OrientationType MagickGetImageOrientation(MagickWand *wand)
5454 {
5455   assert(wand != (MagickWand *) NULL);
5456   assert(wand->signature == WandSignature);
5457   if (wand->debug != MagickFalse)
5458     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5459   if (wand->images == (Image *) NULL)
5460     {
5461       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5462         "ContainsNoImages","`%s'",wand->name);
5463       return(UndefinedOrientation);
5464     }
5465   return(wand->images->orientation);
5466 }
5467 \f
5468 /*
5469 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5470 %                                                                             %
5471 %                                                                             %
5472 %                                                                             %
5473 %   M a g i c k G e t I m a g e P a g e                                       %
5474 %                                                                             %
5475 %                                                                             %
5476 %                                                                             %
5477 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5478 %
5479 %  MagickGetImagePage() returns the page geometry associated with the image.
5480 %
5481 %  The format of the MagickGetImagePage method is:
5482 %
5483 %      MagickBooleanType MagickGetImagePage(MagickWand *wand,
5484 %        size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5485 %
5486 %  A description of each parameter follows:
5487 %
5488 %    o wand: the magick wand.
5489 %
5490 %    o width: the page width.
5491 %
5492 %    o height: the page height.
5493 %
5494 %    o x: the page x-offset.
5495 %
5496 %    o y: the page y-offset.
5497 %
5498 */
5499 WandExport MagickBooleanType MagickGetImagePage(MagickWand *wand,
5500   size_t *width,size_t *height,ssize_t *x,ssize_t *y)
5501 {
5502   assert(wand != (const MagickWand *) NULL);
5503   assert(wand->signature == WandSignature);
5504   if (wand->debug != MagickFalse)
5505     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5506   if (wand->images == (Image *) NULL)
5507     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5508   *width=wand->images->page.width;
5509   *height=wand->images->page.height;
5510   *x=wand->images->page.x;
5511   *y=wand->images->page.y;
5512   return(MagickTrue);
5513 }
5514 \f
5515 /*
5516 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5517 %                                                                             %
5518 %                                                                             %
5519 %                                                                             %
5520 %   M a g i c k G e t I m a g e P i x e l C o l o r                           %
5521 %                                                                             %
5522 %                                                                             %
5523 %                                                                             %
5524 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5525 %
5526 %  MagickGetImagePixelColor() returns the color of the specified pixel.
5527 %
5528 %  The format of the MagickGetImagePixelColor method is:
5529 %
5530 %      MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5531 %        const ssize_t x,const ssize_t y,PixelWand *color)
5532 %
5533 %  A description of each parameter follows:
5534 %
5535 %    o wand: the magick wand.
5536 %
5537 %    o x,y: the pixel offset into the image.
5538 %
5539 %    o color: Return the colormap color in this wand.
5540 %
5541 */
5542 WandExport MagickBooleanType MagickGetImagePixelColor(MagickWand *wand,
5543   const ssize_t x,const ssize_t y,PixelWand *color)
5544 {
5545   IndexPacket
5546     *indexes;
5547
5548   register const PixelPacket
5549     *p;
5550
5551   CacheView
5552     *image_view;
5553
5554   assert(wand != (MagickWand *) NULL);
5555   assert(wand->signature == WandSignature);
5556   if (wand->debug != MagickFalse)
5557     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5558   if (wand->images == (Image *) NULL)
5559     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5560   image_view=AcquireCacheView(wand->images);
5561   p=GetCacheViewVirtualPixels(image_view,x,y,1,1,wand->exception);
5562   if (p == (const PixelPacket *) NULL)
5563     {
5564       image_view=DestroyCacheView(image_view);
5565       return(MagickFalse);
5566     }
5567   indexes=GetCacheViewAuthenticIndexQueue(image_view);
5568   PixelSetQuantumColor(color,p);
5569   if (GetCacheViewColorspace(image_view) == CMYKColorspace)
5570     PixelSetBlackQuantum(color,*indexes);
5571   else
5572     if (GetCacheViewStorageClass(image_view) == PseudoClass)
5573       PixelSetIndex(color,*indexes);
5574   image_view=DestroyCacheView(image_view);
5575   return(MagickTrue);
5576 }
5577 \f
5578 /*
5579 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5580 %                                                                             %
5581 %                                                                             %
5582 %                                                                             %
5583 +   M a g i c k G e t I m a g e R a n g e                                     %
5584 %                                                                             %
5585 %                                                                             %
5586 %                                                                             %
5587 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5588 %
5589 %  MagickGetImageRange() gets the pixel range for the image.
5590 %
5591 %  The format of the MagickGetImageRange method is:
5592 %
5593 %      MagickBooleanType MagickGetImageRange(MagickWand *wand,double *minima,
5594 %        double *maxima)
5595 %
5596 %  A description of each parameter follows:
5597 %
5598 %    o wand: the magick wand.
5599 %
5600 %    o minima:  The minimum pixel value for the specified channel(s).
5601 %
5602 %    o maxima:  The maximum pixel value for the specified channel(s).
5603 %
5604 */
5605 WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand,
5606   double *minima,double *maxima)
5607 {
5608   MagickBooleanType
5609     status;
5610
5611   assert(wand != (MagickWand *) NULL);
5612   assert(wand->signature == WandSignature);
5613   if (wand->debug != MagickFalse)
5614     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5615   if (wand->images == (Image *) NULL)
5616     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5617   status=GetImageRange(wand->images,minima,maxima,wand->exception);
5618   return(status);
5619 }
5620 \f
5621 /*
5622 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5623 %                                                                             %
5624 %                                                                             %
5625 %                                                                             %
5626 %   M a g i c k G e t I m a g e R e d P r i m a r y                           %
5627 %                                                                             %
5628 %                                                                             %
5629 %                                                                             %
5630 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5631 %
5632 %  MagickGetImageRedPrimary() returns the chromaticy red primary point.
5633 %
5634 %  The format of the MagickGetImageRedPrimary method is:
5635 %
5636 %      MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,double *x,
5637 %        double *y)
5638 %
5639 %  A description of each parameter follows:
5640 %
5641 %    o wand: the magick wand.
5642 %
5643 %    o x: the chromaticity red primary x-point.
5644 %
5645 %    o y: the chromaticity red primary y-point.
5646 %
5647 */
5648 WandExport MagickBooleanType MagickGetImageRedPrimary(MagickWand *wand,
5649   double *x,double *y)
5650 {
5651   assert(wand != (MagickWand *) NULL);
5652   assert(wand->signature == WandSignature);
5653   if (wand->debug != MagickFalse)
5654     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5655   if (wand->images == (Image *) NULL)
5656     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5657   *x=wand->images->chromaticity.red_primary.x;
5658   *y=wand->images->chromaticity.red_primary.y;
5659   return(MagickTrue);
5660 }
5661 \f
5662 /*
5663 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5664 %                                                                             %
5665 %                                                                             %
5666 %                                                                             %
5667 %   M a g i c k G e t I m a g e R e g i o n                                   %
5668 %                                                                             %
5669 %                                                                             %
5670 %                                                                             %
5671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5672 %
5673 %  MagickGetImageRegion() extracts a region of the image and returns it as a
5674 %  a new wand.
5675 %
5676 %  The format of the MagickGetImageRegion method is:
5677 %
5678 %      MagickWand *MagickGetImageRegion(MagickWand *wand,
5679 %        const size_t width,const size_t height,const ssize_t x,
5680 %        const ssize_t y)
5681 %
5682 %  A description of each parameter follows:
5683 %
5684 %    o wand: the magick wand.
5685 %
5686 %    o width: the region width.
5687 %
5688 %    o height: the region height.
5689 %
5690 %    o x: the region x offset.
5691 %
5692 %    o y: the region y offset.
5693 %
5694 */
5695 WandExport MagickWand *MagickGetImageRegion(MagickWand *wand,
5696   const size_t width,const size_t height,const ssize_t x,
5697   const ssize_t y)
5698 {
5699   Image
5700     *region_image;
5701
5702   RectangleInfo
5703     region;
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     return((MagickWand *) NULL);
5711   region.width=width;
5712   region.height=height;
5713   region.x=x;
5714   region.y=y;
5715   region_image=CropImage(wand->images,&region,wand->exception);
5716   if (region_image == (Image *) NULL)
5717     return((MagickWand *) NULL);
5718   return(CloneMagickWandFromImages(wand,region_image));
5719 }
5720 \f
5721 /*
5722 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5723 %                                                                             %
5724 %                                                                             %
5725 %                                                                             %
5726 %   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                 %
5727 %                                                                             %
5728 %                                                                             %
5729 %                                                                             %
5730 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5731 %
5732 %  MagickGetImageRenderingIntent() gets the image rendering intent.
5733 %
5734 %  The format of the MagickGetImageRenderingIntent method is:
5735 %
5736 %      RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5737 %
5738 %  A description of each parameter follows:
5739 %
5740 %    o wand: the magick wand.
5741 %
5742 */
5743 WandExport RenderingIntent MagickGetImageRenderingIntent(MagickWand *wand)
5744 {
5745   assert(wand != (MagickWand *) NULL);
5746   assert(wand->signature == WandSignature);
5747   if (wand->debug != MagickFalse)
5748     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5749   if (wand->images == (Image *) NULL)
5750     {
5751       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5752         "ContainsNoImages","`%s'",wand->name);
5753       return(UndefinedIntent);
5754     }
5755   return((RenderingIntent) wand->images->rendering_intent);
5756 }
5757 \f
5758 /*
5759 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5760 %                                                                             %
5761 %                                                                             %
5762 %                                                                             %
5763 %   M a g i c k G e t I m a g e R e s o l u t i o n                           %
5764 %                                                                             %
5765 %                                                                             %
5766 %                                                                             %
5767 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5768 %
5769 %  MagickGetImageResolution() gets the image X and Y resolution.
5770 %
5771 %  The format of the MagickGetImageResolution method is:
5772 %
5773 %      MagickBooleanType MagickGetImageResolution(MagickWand *wand,double *x,
5774 %        double *y)
5775 %
5776 %  A description of each parameter follows:
5777 %
5778 %    o wand: the magick wand.
5779 %
5780 %    o x: the image x-resolution.
5781 %
5782 %    o y: the image y-resolution.
5783 %
5784 */
5785 WandExport MagickBooleanType MagickGetImageResolution(MagickWand *wand,
5786   double *x,double *y)
5787 {
5788   assert(wand != (MagickWand *) NULL);
5789   assert(wand->signature == WandSignature);
5790   if (wand->debug != MagickFalse)
5791     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5792   if (wand->images == (Image *) NULL)
5793     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5794   *x=wand->images->x_resolution;
5795   *y=wand->images->y_resolution;
5796   return(MagickTrue);
5797 }
5798 \f
5799 /*
5800 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5801 %                                                                             %
5802 %                                                                             %
5803 %                                                                             %
5804 %   M a g i c k G e t I m a g e S c e n e                                     %
5805 %                                                                             %
5806 %                                                                             %
5807 %                                                                             %
5808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5809 %
5810 %  MagickGetImageScene() gets the image scene.
5811 %
5812 %  The format of the MagickGetImageScene method is:
5813 %
5814 %      size_t MagickGetImageScene(MagickWand *wand)
5815 %
5816 %  A description of each parameter follows:
5817 %
5818 %    o wand: the magick wand.
5819 %
5820 */
5821 WandExport size_t MagickGetImageScene(MagickWand *wand)
5822 {
5823   assert(wand != (MagickWand *) NULL);
5824   assert(wand->signature == WandSignature);
5825   if (wand->debug != MagickFalse)
5826     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5827   if (wand->images == (Image *) NULL)
5828     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5829   return(wand->images->scene);
5830 }
5831 \f
5832 /*
5833 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5834 %                                                                             %
5835 %                                                                             %
5836 %                                                                             %
5837 %   M a g i c k G e t I m a g e S i g n a t u r e                             %
5838 %                                                                             %
5839 %                                                                             %
5840 %                                                                             %
5841 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5842 %
5843 %  MagickGetImageSignature() generates an SHA-256 message digest for the image
5844 %  pixel stream.
5845 %
5846 %  The format of the MagickGetImageSignature method is:
5847 %
5848 %      const char MagickGetImageSignature(MagickWand *wand)
5849 %
5850 %  A description of each parameter follows:
5851 %
5852 %    o wand: the magick wand.
5853 %
5854 */
5855 WandExport char *MagickGetImageSignature(MagickWand *wand)
5856 {
5857   const char
5858     *value;
5859
5860   MagickBooleanType
5861     status;
5862
5863   assert(wand != (MagickWand *) NULL);
5864   assert(wand->signature == WandSignature);
5865   if (wand->debug != MagickFalse)
5866     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5867   if (wand->images == (Image *) NULL)
5868     {
5869       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5870         "ContainsNoImages","`%s'",wand->name);
5871       return((char *) NULL);
5872     }
5873   status=SignatureImage(wand->images);
5874   if (status == MagickFalse)
5875     InheritException(wand->exception,&wand->images->exception);
5876   value=GetImageProperty(wand->images,"signature");
5877   if (value != (const char *) NULL)
5878     return(AcquireString(value));
5879   InheritException(wand->exception,&wand->images->exception);
5880   return((char *) NULL);
5881 }
5882 \f
5883 /*
5884 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5885 %                                                                             %
5886 %                                                                             %
5887 %                                                                             %
5888 %   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                   %
5889 %                                                                             %
5890 %                                                                             %
5891 %                                                                             %
5892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5893 %
5894 %  MagickGetImageTicksPerSecond() gets the image ticks-per-second.
5895 %
5896 %  The format of the MagickGetImageTicksPerSecond method is:
5897 %
5898 %      size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5899 %
5900 %  A description of each parameter follows:
5901 %
5902 %    o wand: the magick wand.
5903 %
5904 */
5905 WandExport size_t MagickGetImageTicksPerSecond(MagickWand *wand)
5906 {
5907   assert(wand != (MagickWand *) NULL);
5908   assert(wand->signature == WandSignature);
5909   if (wand->debug != MagickFalse)
5910     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5911   if (wand->images == (Image *) NULL)
5912     ThrowWandException(WandError,"ContainsNoImages",wand->name);
5913   return((size_t) wand->images->ticks_per_second);
5914 }
5915 \f
5916 /*
5917 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5918 %                                                                             %
5919 %                                                                             %
5920 %                                                                             %
5921 %   M a g i c k G e t I m a g e T y p e                                       %
5922 %                                                                             %
5923 %                                                                             %
5924 %                                                                             %
5925 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5926 %
5927 %  MagickGetImageType() gets the potential image type:
5928 %
5929 %        Bilevel        Grayscale       GrayscaleMatte
5930 %        Palette        PaletteMatte    TrueColor
5931 %        TrueColorMatte ColorSeparation ColorSeparationMatte
5932 %
5933 %  To ensure the image type matches its potential, use MagickSetImageType():
5934 %
5935 %    (void) MagickSetImageType(wand,MagickGetImageType(wand));
5936 %
5937 %  The format of the MagickGetImageType method is:
5938 %
5939 %      ImageType MagickGetImageType(MagickWand *wand)
5940 %
5941 %  A description of each parameter follows:
5942 %
5943 %    o wand: the magick wand.
5944 %
5945 */
5946 WandExport ImageType MagickGetImageType(MagickWand *wand)
5947 {
5948   assert(wand != (MagickWand *) NULL);
5949   assert(wand->signature == WandSignature);
5950   if (wand->debug != MagickFalse)
5951     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5952   if (wand->images == (Image *) NULL)
5953     {
5954       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5955         "ContainsNoImages","`%s'",wand->name);
5956       return(UndefinedType);
5957     }
5958   return(GetImageType(wand->images,wand->exception));
5959 }
5960 \f
5961 /*
5962 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5963 %                                                                             %
5964 %                                                                             %
5965 %                                                                             %
5966 %   M a g i c k G e t I m a g e U n i t s                                     %
5967 %                                                                             %
5968 %                                                                             %
5969 %                                                                             %
5970 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5971 %
5972 %  MagickGetImageUnits() gets the image units of resolution.
5973 %
5974 %  The format of the MagickGetImageUnits method is:
5975 %
5976 %      ResolutionType MagickGetImageUnits(MagickWand *wand)
5977 %
5978 %  A description of each parameter follows:
5979 %
5980 %    o wand: the magick wand.
5981 %
5982 */
5983 WandExport ResolutionType MagickGetImageUnits(MagickWand *wand)
5984 {
5985   assert(wand != (MagickWand *) NULL);
5986   assert(wand->signature == WandSignature);
5987   if (wand->debug != MagickFalse)
5988     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
5989   if (wand->images == (Image *) NULL)
5990     {
5991       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
5992         "ContainsNoImages","`%s'",wand->name);
5993       return(UndefinedResolution);
5994     }
5995   return(wand->images->units);
5996 }
5997 \f
5998 /*
5999 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6000 %                                                                             %
6001 %                                                                             %
6002 %                                                                             %
6003 %   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           %
6004 %                                                                             %
6005 %                                                                             %
6006 %                                                                             %
6007 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6008 %
6009 %  MagickGetImageVirtualPixelMethod() returns the virtual pixel method for the
6010 %  sepcified image.
6011 %
6012 %  The format of the MagickGetImageVirtualPixelMethod method is:
6013 %
6014 %      VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
6015 %
6016 %  A description of each parameter follows:
6017 %
6018 %    o wand: the magick wand.
6019 %
6020 */
6021 WandExport VirtualPixelMethod MagickGetImageVirtualPixelMethod(MagickWand *wand)
6022 {
6023   assert(wand != (MagickWand *) NULL);
6024   assert(wand->signature == WandSignature);
6025   if (wand->debug != MagickFalse)
6026     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6027   if (wand->images == (Image *) NULL)
6028     {
6029       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6030         "ContainsNoImages","`%s'",wand->name);
6031       return(UndefinedVirtualPixelMethod);
6032     }
6033   return(GetImageVirtualPixelMethod(wand->images));
6034 }
6035 \f
6036 /*
6037 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6038 %                                                                             %
6039 %                                                                             %
6040 %                                                                             %
6041 %   M a g i c k G e t I m a g e W h i t e P o i n t                           %
6042 %                                                                             %
6043 %                                                                             %
6044 %                                                                             %
6045 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6046 %
6047 %  MagickGetImageWhitePoint() returns the chromaticy white point.
6048 %
6049 %  The format of the MagickGetImageWhitePoint method is:
6050 %
6051 %      MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,double *x,
6052 %        double *y)
6053 %
6054 %  A description of each parameter follows:
6055 %
6056 %    o wand: the magick wand.
6057 %
6058 %    o x: the chromaticity white x-point.
6059 %
6060 %    o y: the chromaticity white y-point.
6061 %
6062 */
6063 WandExport MagickBooleanType MagickGetImageWhitePoint(MagickWand *wand,
6064   double *x,double *y)
6065 {
6066   assert(wand != (MagickWand *) NULL);
6067   assert(wand->signature == WandSignature);
6068   if (wand->debug != MagickFalse)
6069     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6070   if (wand->images == (Image *) NULL)
6071     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6072   *x=wand->images->chromaticity.white_point.x;
6073   *y=wand->images->chromaticity.white_point.y;
6074   return(MagickTrue);
6075 }
6076 \f
6077 /*
6078 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6079 %                                                                             %
6080 %                                                                             %
6081 %                                                                             %
6082 %   M a g i c k G e t I m a g e W i d t h                                     %
6083 %                                                                             %
6084 %                                                                             %
6085 %                                                                             %
6086 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6087 %
6088 %  MagickGetImageWidth() returns the image width.
6089 %
6090 %  The format of the MagickGetImageWidth method is:
6091 %
6092 %      size_t MagickGetImageWidth(MagickWand *wand)
6093 %
6094 %  A description of each parameter follows:
6095 %
6096 %    o wand: the magick wand.
6097 %
6098 */
6099 WandExport size_t MagickGetImageWidth(MagickWand *wand)
6100 {
6101   assert(wand != (MagickWand *) NULL);
6102   assert(wand->signature == WandSignature);
6103   if (wand->debug != MagickFalse)
6104     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6105   if (wand->images == (Image *) NULL)
6106     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6107   return(wand->images->columns);
6108 }
6109 \f
6110 /*
6111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6112 %                                                                             %
6113 %                                                                             %
6114 %                                                                             %
6115 %   M a g i c k G e t N u m b e r I m a g e s                                 %
6116 %                                                                             %
6117 %                                                                             %
6118 %                                                                             %
6119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6120 %
6121 %  MagickGetNumberImages() returns the number of images associated with a
6122 %  magick wand.
6123 %
6124 %  The format of the MagickGetNumberImages method is:
6125 %
6126 %      size_t MagickGetNumberImages(MagickWand *wand)
6127 %
6128 %  A description of each parameter follows:
6129 %
6130 %    o wand: the magick wand.
6131 %
6132 */
6133 WandExport size_t MagickGetNumberImages(MagickWand *wand)
6134 {
6135   assert(wand != (MagickWand *) NULL);
6136   assert(wand->signature == WandSignature);
6137   if (wand->debug != MagickFalse)
6138     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6139   return(GetImageListLength(wand->images));
6140 }
6141 \f
6142 /*
6143 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6144 %                                                                             %
6145 %                                                                             %
6146 %                                                                             %
6147 %   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                 %
6148 %                                                                             %
6149 %                                                                             %
6150 %                                                                             %
6151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6152 %
6153 %  MagickGetImageTotalInkDensity() gets the image total ink density.
6154 %
6155 %  The format of the MagickGetImageTotalInkDensity method is:
6156 %
6157 %      double MagickGetImageTotalInkDensity(MagickWand *wand)
6158 %
6159 %  A description of each parameter follows:
6160 %
6161 %    o wand: the magick wand.
6162 %
6163 */
6164 WandExport double MagickGetImageTotalInkDensity(MagickWand *wand)
6165 {
6166   assert(wand != (MagickWand *) NULL);
6167   assert(wand->signature == WandSignature);
6168   if (wand->debug != MagickFalse)
6169     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6170   if (wand->images == (Image *) NULL)
6171     {
6172       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6173         "ContainsNoImages","`%s'",wand->name);
6174       return(0.0);
6175     }
6176   return(GetImageTotalInkDensity(wand->images));
6177 }
6178 \f
6179 /*
6180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6181 %                                                                             %
6182 %                                                                             %
6183 %                                                                             %
6184 %   M a g i c k H a l d C l u t I m a g e                                     %
6185 %                                                                             %
6186 %                                                                             %
6187 %                                                                             %
6188 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6189 %
6190 %  MagickHaldClutImage() replaces colors in the image from a Hald color lookup
6191 %  table.   A Hald color lookup table is a 3-dimensional color cube mapped to 2
6192 %  dimensions.  Create it with the HALD coder.  You can apply any color
6193 %  transformation to the Hald image and then use this method to apply the
6194 %  transform to the image.
6195 %
6196 %  The format of the MagickHaldClutImage method is:
6197 %
6198 %      MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6199 %        const MagickWand *hald_wand)
6200 %      MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
6201 %        const ChannelType channel,const MagickWand *hald_wand)
6202 %
6203 %  A description of each parameter follows:
6204 %
6205 %    o wand: the magick wand.
6206 %
6207 %    o hald_image: the hald CLUT image.
6208 %
6209 */
6210
6211 WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand,
6212   const MagickWand *hald_wand)
6213 {
6214   MagickBooleanType
6215     status;
6216
6217   status=MagickHaldClutImageChannel(wand,DefaultChannels,hald_wand);
6218   return(status);
6219 }
6220
6221 WandExport MagickBooleanType MagickHaldClutImageChannel(MagickWand *wand,
6222   const ChannelType channel,const MagickWand *hald_wand)
6223 {
6224   MagickBooleanType
6225     status;
6226
6227   assert(wand != (MagickWand *) NULL);
6228   assert(wand->signature == WandSignature);
6229   if (wand->debug != MagickFalse)
6230     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6231   if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL))
6232     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6233   status=HaldClutImageChannel(wand->images,channel,hald_wand->images);
6234   if (status == MagickFalse)
6235     InheritException(wand->exception,&wand->images->exception);
6236   return(status);
6237 }
6238 \f
6239 /*
6240 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6241 %                                                                             %
6242 %                                                                             %
6243 %                                                                             %
6244 %   M a g i c k H a s N e x t I m a g e                                       %
6245 %                                                                             %
6246 %                                                                             %
6247 %                                                                             %
6248 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6249 %
6250 %  MagickHasNextImage() returns MagickTrue if the wand has more images when
6251 %  traversing the list in the forward direction
6252 %
6253 %  The format of the MagickHasNextImage method is:
6254 %
6255 %      MagickBooleanType MagickHasNextImage(MagickWand *wand)
6256 %
6257 %  A description of each parameter follows:
6258 %
6259 %    o wand: the magick wand.
6260 %
6261 */
6262 WandExport MagickBooleanType MagickHasNextImage(MagickWand *wand)
6263 {
6264   assert(wand != (MagickWand *) NULL);
6265   assert(wand->signature == WandSignature);
6266   if (wand->debug != MagickFalse)
6267     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6268   if (wand->images == (Image *) NULL)
6269     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6270   if (GetNextImageInList(wand->images) == (Image *) NULL)
6271     return(MagickFalse);
6272   return(MagickTrue);
6273 }
6274 \f
6275 /*
6276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6277 %                                                                             %
6278 %                                                                             %
6279 %                                                                             %
6280 %   M a g i c k H a s P r e v i o u s I m a g e                               %
6281 %                                                                             %
6282 %                                                                             %
6283 %                                                                             %
6284 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6285 %
6286 %  MagickHasPreviousImage() returns MagickTrue if the wand has more images when
6287 %  traversing the list in the reverse direction
6288 %
6289 %  The format of the MagickHasPreviousImage method is:
6290 %
6291 %      MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6292 %
6293 %  A description of each parameter follows:
6294 %
6295 %    o wand: the magick wand.
6296 %
6297 */
6298 WandExport MagickBooleanType MagickHasPreviousImage(MagickWand *wand)
6299 {
6300   assert(wand != (MagickWand *) NULL);
6301   assert(wand->signature == WandSignature);
6302   if (wand->debug != MagickFalse)
6303     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6304   if (wand->images == (Image *) NULL)
6305     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6306   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
6307     return(MagickFalse);
6308   return(MagickTrue);
6309 }
6310 \f
6311 /*
6312 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6313 %                                                                             %
6314 %                                                                             %
6315 %                                                                             %
6316 %   M a g i c k I d e n t i f y I m a g e                                     %
6317 %                                                                             %
6318 %                                                                             %
6319 %                                                                             %
6320 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6321 %
6322 %  MagickIdentifyImage() identifies an image by printing its attributes to the
6323 %  file.  Attributes include the image width, height, size, and others.
6324 %
6325 %  The format of the MagickIdentifyImage method is:
6326 %
6327 %      const char *MagickIdentifyImage(MagickWand *wand)
6328 %
6329 %  A description of each parameter follows:
6330 %
6331 %    o wand: the magick wand.
6332 %
6333 */
6334 WandExport char *MagickIdentifyImage(MagickWand *wand)
6335 {
6336   char
6337     *description,
6338     filename[MaxTextExtent];
6339
6340   FILE
6341     *file;
6342
6343   int
6344     unique_file;
6345
6346   assert(wand != (MagickWand *) NULL);
6347   assert(wand->signature == WandSignature);
6348   if (wand->debug != MagickFalse)
6349     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6350   if (wand->images == (Image *) NULL)
6351     {
6352       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6353         "ContainsNoImages","`%s'",wand->name);
6354       return((char *) NULL);
6355     }
6356   description=(char *) NULL;
6357   unique_file=AcquireUniqueFileResource(filename);
6358   file=(FILE *) NULL;
6359   if (unique_file != -1)
6360     file=fdopen(unique_file,"wb");
6361   if ((unique_file == -1) || (file == (FILE *) NULL))
6362     {
6363       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
6364         "UnableToCreateTemporaryFile","`%s'",wand->name);
6365       return((char *) NULL);
6366     }
6367   (void) IdentifyImage(wand->images,file,MagickTrue);
6368   (void) fclose(file);
6369   description=FileToString(filename,~0,wand->exception);
6370   (void) RelinquishUniqueFileResource(filename);
6371   return(description);
6372 }
6373 \f
6374 /*
6375 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6376 %                                                                             %
6377 %                                                                             %
6378 %                                                                             %
6379 %   M a g i c k I m p l o d e I m a g e                                       %
6380 %                                                                             %
6381 %                                                                             %
6382 %                                                                             %
6383 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6384 %
6385 %  MagickImplodeImage() creates a new image that is a copy of an existing
6386 %  one with the image pixels "implode" by the specified percentage.  It
6387 %  allocates the memory necessary for the new Image structure and returns a
6388 %  pointer to the new image.
6389 %
6390 %  The format of the MagickImplodeImage method is:
6391 %
6392 %      MagickBooleanType MagickImplodeImage(MagickWand *wand,
6393 %        const double radius)
6394 %
6395 %  A description of each parameter follows:
6396 %
6397 %    o wand: the magick wand.
6398 %
6399 %    o amount: Define the extent of the implosion.
6400 %
6401 */
6402 WandExport MagickBooleanType MagickImplodeImage(MagickWand *wand,
6403   const double amount)
6404 {
6405   Image
6406     *implode_image;
6407
6408   assert(wand != (MagickWand *) NULL);
6409   assert(wand->signature == WandSignature);
6410   if (wand->debug != MagickFalse)
6411     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6412   if (wand->images == (Image *) NULL)
6413     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6414   implode_image=ImplodeImage(wand->images,amount,wand->exception);
6415   if (implode_image == (Image *) NULL)
6416     return(MagickFalse);
6417   ReplaceImageInList(&wand->images,implode_image);
6418   return(MagickTrue);
6419 }
6420 \f
6421 /*
6422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6423 %                                                                             %
6424 %                                                                             %
6425 %                                                                             %
6426 %   M a g i c k I m p o r t I m a g e P i x e l s                             %
6427 %                                                                             %
6428 %                                                                             %
6429 %                                                                             %
6430 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6431 %
6432 %  MagickImportImagePixels() accepts pixel datand stores it in the image at the
6433 %  location you specify.  The method returns MagickFalse on success otherwise
6434 %  MagickTrue if an error is encountered.  The pixel data can be either char,
6435 %  short int, int, ssize_t, float, or double in the order specified by map.
6436 %
6437 %  Suppose your want to upload the first scanline of a 640x480 image from
6438 %  character data in red-green-blue order:
6439 %
6440 %      MagickImportImagePixels(wand,0,0,640,1,"RGB",CharPixel,pixels);
6441 %
6442 %  The format of the MagickImportImagePixels method is:
6443 %
6444 %      MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6445 %        const ssize_t x,const ssize_t y,const size_t columns,
6446 %        const size_t rows,const char *map,const StorageType storage,
6447 %        const void *pixels)
6448 %
6449 %  A description of each parameter follows:
6450 %
6451 %    o wand: the magick wand.
6452 %
6453 %    o x, y, columns, rows:  These values define the perimeter of a region
6454 %      of pixels you want to define.
6455 %
6456 %    o map:  This string reflects the expected ordering of the pixel array.
6457 %      It can be any combination or order of R = red, G = green, B = blue,
6458 %      A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan,
6459 %      Y = yellow, M = magenta, K = black, I = intensity (for grayscale),
6460 %      P = pad.
6461 %
6462 %    o storage: Define the data type of the pixels.  Float and double types are
6463 %      expected to be normalized [0..1] otherwise [0..QuantumRange].  Choose from
6464 %      these types: CharPixel, ShortPixel, IntegerPixel, LongPixel, FloatPixel,
6465 %      or DoublePixel.
6466 %
6467 %    o pixels: This array of values contain the pixel components as defined by
6468 %      map and type.  You must preallocate this array where the expected
6469 %      length varies depending on the values of width, height, map, and type.
6470 %
6471 */
6472 WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand,
6473   const ssize_t x,const ssize_t y,const size_t columns,
6474   const size_t rows,const char *map,const StorageType storage,
6475   const void *pixels)
6476 {
6477   MagickBooleanType
6478     status;
6479
6480   assert(wand != (MagickWand *) NULL);
6481   assert(wand->signature == WandSignature);
6482   if (wand->debug != MagickFalse)
6483     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6484   if (wand->images == (Image *) NULL)
6485     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6486   status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels);
6487   if (status == MagickFalse)
6488     InheritException(wand->exception,&wand->images->exception);
6489   return(status);
6490 }
6491 \f
6492 /*
6493 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6494 %                                                                             %
6495 %                                                                             %
6496 %                                                                             %
6497 %   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       %
6498 %                                                                             %
6499 %                                                                             %
6500 %                                                                             %
6501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6502 %
6503 %  MagickInverseFourierTransformImage() implements the inverse discrete
6504 %  Fourier transform (DFT) of the image either as a magnitude / phase or real /
6505 %  imaginary image pair.
6506 %
6507 %  The format of the MagickInverseFourierTransformImage method is:
6508 %
6509 %      MagickBooleanType MagickInverseFourierTransformImage(
6510 %        MagickWand *magnitude_wand,MagickWand *phase_wand,
6511 %        const MagickBooleanType magnitude)
6512 %
6513 %  A description of each parameter follows:
6514 %
6515 %    o magnitude_wand: the magnitude or real wand.
6516 %
6517 %    o phase_wand: the phase or imaginary wand.
6518 %
6519 %    o magnitude: if true, return as magnitude / phase pair otherwise a real /
6520 %      imaginary image pair.
6521 %
6522 */
6523 WandExport MagickBooleanType MagickInverseFourierTransformImage(
6524   MagickWand *magnitude_wand,MagickWand *phase_wand,
6525   const MagickBooleanType magnitude)
6526 {
6527   Image
6528     *inverse_image;
6529
6530   MagickWand
6531     *wand;
6532
6533   assert(magnitude_wand != (MagickWand *) NULL);
6534   assert(magnitude_wand->signature == WandSignature);
6535   if (magnitude_wand->debug != MagickFalse)
6536     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",
6537       magnitude_wand->name);
6538   wand=magnitude_wand;
6539   if (magnitude_wand->images == (Image *) NULL)
6540     ThrowWandException(WandError,"ContainsNoImages",
6541       magnitude_wand->name);
6542   assert(phase_wand != (MagickWand *) NULL);
6543   assert(phase_wand->signature == WandSignature);
6544   inverse_image=InverseFourierTransformImage(magnitude_wand->images,
6545     phase_wand->images,magnitude,wand->exception);
6546   if (inverse_image == (Image *) NULL)
6547     return(MagickFalse);
6548   ReplaceImageInList(&wand->images,inverse_image);
6549   return(MagickTrue);
6550 }
6551 \f
6552 /*
6553 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6554 %                                                                             %
6555 %                                                                             %
6556 %                                                                             %
6557 %   M a g i c k L a b e l I m a g e                                           %
6558 %                                                                             %
6559 %                                                                             %
6560 %                                                                             %
6561 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6562 %
6563 %  MagickLabelImage() adds a label to your image.
6564 %
6565 %  The format of the MagickLabelImage method is:
6566 %
6567 %      MagickBooleanType MagickLabelImage(MagickWand *wand,const char *label)
6568 %
6569 %  A description of each parameter follows:
6570 %
6571 %    o wand: the magick wand.
6572 %
6573 %    o label: the image label.
6574 %
6575 */
6576 WandExport MagickBooleanType MagickLabelImage(MagickWand *wand,
6577   const char *label)
6578 {
6579   MagickBooleanType
6580     status;
6581
6582   assert(wand != (MagickWand *) NULL);
6583   assert(wand->signature == WandSignature);
6584   if (wand->debug != MagickFalse)
6585     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6586   if (wand->images == (Image *) NULL)
6587     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6588   status=SetImageProperty(wand->images,"label",label);
6589   if (status == MagickFalse)
6590     InheritException(wand->exception,&wand->images->exception);
6591   return(status);
6592 }
6593 \f
6594 /*
6595 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6596 %                                                                             %
6597 %                                                                             %
6598 %                                                                             %
6599 %   M a g i c k L e v e l I m a g e                                           %
6600 %                                                                             %
6601 %                                                                             %
6602 %                                                                             %
6603 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6604 %
6605 %  MagickLevelImage() adjusts the levels of an image by scaling the colors
6606 %  falling between specified white and black points to the full available
6607 %  quantum range. The parameters provided represent the black, mid, and white
6608 %  points. The black point specifies the darkest color in the image. Colors
6609 %  darker than the black point are set to zero. Mid point specifies a gamma
6610 %  correction to apply to the image.  White point specifies the lightest color
6611 %  in the image. Colors brighter than the white point are set to the maximum
6612 %  quantum value.
6613 %
6614 %  The format of the MagickLevelImage method is:
6615 %
6616 %      MagickBooleanType MagickLevelImage(MagickWand *wand,
6617 %        const double black_point,const double gamma,const double white_point)
6618 %      MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
6619 %        const ChannelType channel,const double black_point,const double gamma,
6620 %        const double white_point)
6621 %
6622 %  A description of each parameter follows:
6623 %
6624 %    o wand: the magick wand.
6625 %
6626 %    o channel: Identify which channel to level: RedChannel, GreenChannel,
6627 %
6628 %    o black_point: the black point.
6629 %
6630 %    o gamma: the gamma.
6631 %
6632 %    o white_point: the white point.
6633 %
6634 */
6635
6636 WandExport MagickBooleanType MagickLevelImage(MagickWand *wand,
6637   const double black_point,const double gamma,const double white_point)
6638 {
6639   MagickBooleanType
6640     status;
6641
6642   status=MagickLevelImageChannel(wand,DefaultChannels,black_point,gamma,
6643     white_point);
6644   return(status);
6645 }
6646
6647 WandExport MagickBooleanType MagickLevelImageChannel(MagickWand *wand,
6648   const ChannelType channel,const double black_point,const double gamma,
6649   const double white_point)
6650 {
6651   MagickBooleanType
6652     status;
6653
6654   assert(wand != (MagickWand *) NULL);
6655   assert(wand->signature == WandSignature);
6656   if (wand->debug != MagickFalse)
6657     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6658   if (wand->images == (Image *) NULL)
6659     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6660   status=LevelImageChannel(wand->images,channel,black_point,white_point,gamma);
6661   if (status == MagickFalse)
6662     InheritException(wand->exception,&wand->images->exception);
6663   return(status);
6664 }
6665 \f
6666 /*
6667 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6668 %                                                                             %
6669 %                                                                             %
6670 %                                                                             %
6671 %   M a g i c k L i n e a r S t r e t c h I m a g e                           %
6672 %                                                                             %
6673 %                                                                             %
6674 %                                                                             %
6675 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6676 %
6677 %  MagickLinearStretchImage() stretches with saturation the image intensity.
6678 %
6679 %  You can also reduce the influence of a particular channel with a gamma
6680 %  value of 0.
6681 %
6682 %  The format of the MagickLinearStretchImage method is:
6683 %
6684 %      MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6685 %        const double black_point,const double white_point)
6686 %
6687 %  A description of each parameter follows:
6688 %
6689 %    o wand: the magick wand.
6690 %
6691 %    o black_point: the black point.
6692 %
6693 %    o white_point: the white point.
6694 %
6695 */
6696 WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand,
6697   const double black_point,const double white_point)
6698 {
6699   MagickBooleanType
6700     status;
6701
6702   assert(wand != (MagickWand *) NULL);
6703   assert(wand->signature == WandSignature);
6704   if (wand->debug != MagickFalse)
6705     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6706   if (wand->images == (Image *) NULL)
6707     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6708   status=LinearStretchImage(wand->images,black_point,white_point);
6709   if (status == MagickFalse)
6710     InheritException(wand->exception,&wand->images->exception);
6711   return(status);
6712 }
6713 \f
6714 /*
6715 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6716 %                                                                             %
6717 %                                                                             %
6718 %                                                                             %
6719 %   M a g i c k L i q u i d R e s c a l e I m a g e                           %
6720 %                                                                             %
6721 %                                                                             %
6722 %                                                                             %
6723 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6724 %
6725 %  MagickLiquidRescaleImage() rescales image with seam carving.
6726 %
6727 %      MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6728 %        const size_t columns,const size_t rows,
6729 %        const double delta_x,const double rigidity)
6730 %
6731 %  A description of each parameter follows:
6732 %
6733 %    o wand: the magick wand.
6734 %
6735 %    o columns: the number of columns in the scaled image.
6736 %
6737 %    o rows: the number of rows in the scaled image.
6738 %
6739 %    o delta_x: maximum seam transversal step (0 means straight seams).
6740 %
6741 %    o rigidity: introduce a bias for non-straight seams (typically 0).
6742 %
6743 */
6744 WandExport MagickBooleanType MagickLiquidRescaleImage(MagickWand *wand,
6745   const size_t columns,const size_t rows,const double delta_x,
6746   const double rigidity)
6747 {
6748   Image
6749     *rescale_image;
6750
6751   assert(wand != (MagickWand *) NULL);
6752   assert(wand->signature == WandSignature);
6753   if (wand->debug != MagickFalse)
6754     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6755   if (wand->images == (Image *) NULL)
6756     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6757   rescale_image=LiquidRescaleImage(wand->images,columns,rows,delta_x,
6758     rigidity,wand->exception);
6759   if (rescale_image == (Image *) NULL)
6760     return(MagickFalse);
6761   ReplaceImageInList(&wand->images,rescale_image);
6762   return(MagickTrue);
6763 }
6764 \f
6765 /*
6766 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6767 %                                                                             %
6768 %                                                                             %
6769 %                                                                             %
6770 %   M a g i c k M a g n i f y I m a g e                                       %
6771 %                                                                             %
6772 %                                                                             %
6773 %                                                                             %
6774 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6775 %
6776 %  MagickMagnifyImage() is a convenience method that scales an image
6777 %  proportionally to twice its original size.
6778 %
6779 %  The format of the MagickMagnifyImage method is:
6780 %
6781 %      MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6782 %
6783 %  A description of each parameter follows:
6784 %
6785 %    o wand: the magick wand.
6786 %
6787 */
6788 WandExport MagickBooleanType MagickMagnifyImage(MagickWand *wand)
6789 {
6790   Image
6791     *magnify_image;
6792
6793   assert(wand != (MagickWand *) NULL);
6794   assert(wand->signature == WandSignature);
6795   if (wand->debug != MagickFalse)
6796     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6797   if (wand->images == (Image *) NULL)
6798     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6799   magnify_image=MagnifyImage(wand->images,wand->exception);
6800   if (magnify_image == (Image *) NULL)
6801     return(MagickFalse);
6802   ReplaceImageInList(&wand->images,magnify_image);
6803   return(MagickTrue);
6804 }
6805 \f
6806 /*
6807 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6808 %                                                                             %
6809 %                                                                             %
6810 %                                                                             %
6811 %   M a g i c k M e d i a n F i l t e r I m a g e                             %
6812 %                                                                             %
6813 %                                                                             %
6814 %                                                                             %
6815 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6816 %
6817 %  MagickMedianFilterImage() applies a digital filter that improves the quality
6818 %  of a noisy image.  Each pixel is replaced by the median in a set of
6819 %  neighboring pixels as defined by radius.
6820 %
6821 %  The format of the MagickMedianFilterImage method is:
6822 %
6823 %      MagickBooleanType MagickMedianFilterImage(MagickWand *wand,
6824 %        const double radius)
6825 %
6826 %  A description of each parameter follows:
6827 %
6828 %    o wand: the magick wand.
6829 %
6830 %    o radius: the radius of the pixel neighborhood.
6831 %
6832 */
6833 WandExport MagickBooleanType MagickMedianFilterImage(MagickWand *wand,
6834   const double radius)
6835 {
6836   Image
6837     *median_image;
6838
6839   assert(wand != (MagickWand *) NULL);
6840   assert(wand->signature == WandSignature);
6841   if (wand->debug != MagickFalse)
6842     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6843   if (wand->images == (Image *) NULL)
6844     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6845   median_image=MedianFilterImage(wand->images,radius,wand->exception);
6846   if (median_image == (Image *) NULL)
6847     return(MagickFalse);
6848   ReplaceImageInList(&wand->images,median_image);
6849   return(MagickTrue);
6850 }
6851 \f
6852 /*
6853 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6854 %                                                                             %
6855 %                                                                             %
6856 %                                                                             %
6857 %   M a g i c k M e r g e I m a g e L a y e r s                               %
6858 %                                                                             %
6859 %                                                                             %
6860 %                                                                             %
6861 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6862 %
6863 %  MagickMergeImageLayers() composes all the image layers from the current given
6864 %  image onward to produce a single image of the merged layers.
6865 %
6866 %  The inital canvas's size depends on the given ImageLayerMethod, and is
6867 %  initialized using the first images background color.  The images
6868 %  are then compositied onto that image in sequence using the given
6869 %  composition that has been assigned to each individual image.
6870 %
6871 %  The format of the MagickMergeImageLayers method is:
6872 %
6873 %      MagickWand *MagickMergeImageLayers(MagickWand *wand,
6874 %        const ImageLayerMethod method)
6875 %
6876 %  A description of each parameter follows:
6877 %
6878 %    o wand: the magick wand.
6879 %
6880 %    o method: the method of selecting the size of the initial canvas.
6881 %
6882 %        MergeLayer: Merge all layers onto a canvas just large enough
6883 %           to hold all the actual images. The virtual canvas of the
6884 %           first image is preserved but otherwise ignored.
6885 %
6886 %        FlattenLayer: Use the virtual canvas size of first image.
6887 %           Images which fall outside this canvas is clipped.
6888 %           This can be used to 'fill out' a given virtual canvas.
6889 %
6890 %        MosaicLayer: Start with the virtual canvas of the first image,
6891 %           enlarging left and right edges to contain all images.
6892 %           Images with negative offsets will be clipped.
6893 %
6894 */
6895 WandExport MagickWand *MagickMergeImageLayers(MagickWand *wand,
6896   const ImageLayerMethod method)
6897 {
6898   Image
6899     *mosaic_image;
6900
6901   assert(wand != (MagickWand *) NULL);
6902   assert(wand->signature == WandSignature);
6903   if (wand->debug != MagickFalse)
6904     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6905   if (wand->images == (Image *) NULL)
6906     return((MagickWand *) NULL);
6907   mosaic_image=MergeImageLayers(wand->images,method,wand->exception);
6908   if (mosaic_image == (Image *) NULL)
6909     return((MagickWand *) NULL);
6910   return(CloneMagickWandFromImages(wand,mosaic_image));
6911 }
6912 \f
6913 /*
6914 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6915 %                                                                             %
6916 %                                                                             %
6917 %                                                                             %
6918 %   M a g i c k M i n i f y I m a g e                                         %
6919 %                                                                             %
6920 %                                                                             %
6921 %                                                                             %
6922 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6923 %
6924 %  MagickMinifyImage() is a convenience method that scales an image
6925 %  proportionally to one-half its original size
6926 %
6927 %  The format of the MagickMinifyImage method is:
6928 %
6929 %      MagickBooleanType MagickMinifyImage(MagickWand *wand)
6930 %
6931 %  A description of each parameter follows:
6932 %
6933 %    o wand: the magick wand.
6934 %
6935 */
6936 WandExport MagickBooleanType MagickMinifyImage(MagickWand *wand)
6937 {
6938   Image
6939     *minify_image;
6940
6941   assert(wand != (MagickWand *) NULL);
6942   assert(wand->signature == WandSignature);
6943   if (wand->debug != MagickFalse)
6944     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
6945   if (wand->images == (Image *) NULL)
6946     ThrowWandException(WandError,"ContainsNoImages",wand->name);
6947   minify_image=MinifyImage(wand->images,wand->exception);
6948   if (minify_image == (Image *) NULL)
6949     return(MagickFalse);
6950   ReplaceImageInList(&wand->images,minify_image);
6951   return(MagickTrue);
6952 }
6953 \f
6954 /*
6955 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6956 %                                                                             %
6957 %                                                                             %
6958 %                                                                             %
6959 %   M a g i c k M o d u l a t e I m a g e                                     %
6960 %                                                                             %
6961 %                                                                             %
6962 %                                                                             %
6963 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6964 %
6965 %  MagickModulateImage() lets you control the brightness, saturation, and hue
6966 %  of an image.  Hue is the percentage of absolute rotation from the current
6967 %  position.  For example 50 results in a counter-clockwise rotation of 90
6968 %  degrees, 150 results in a clockwise rotation of 90 degrees, with 0 and 200
6969 %  both resulting in a rotation of 180 degrees.
6970 %
6971 %  To increase the color brightness by 20% and decrease the color saturation by
6972 %  10% and leave the hue unchanged, use: 120,90,100.
6973 %
6974 %  The format of the MagickModulateImage method is:
6975 %
6976 %      MagickBooleanType MagickModulateImage(MagickWand *wand,
6977 %        const double brightness,const double saturation,const double hue)
6978 %
6979 %  A description of each parameter follows:
6980 %
6981 %    o wand: the magick wand.
6982 %
6983 %    o brightness: the percent change in brighness.
6984 %
6985 %    o saturation: the percent change in saturation.
6986 %
6987 %    o hue: the percent change in hue.
6988 %
6989 */
6990 WandExport MagickBooleanType MagickModulateImage(MagickWand *wand,
6991   const double brightness,const double saturation,const double hue)
6992 {
6993   char
6994     modulate[MaxTextExtent];
6995
6996   MagickBooleanType
6997     status;
6998
6999   assert(wand != (MagickWand *) NULL);
7000   assert(wand->signature == WandSignature);
7001   if (wand->debug != MagickFalse)
7002     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7003   if (wand->images == (Image *) NULL)
7004     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7005   (void) FormatMagickString(modulate,MaxTextExtent,"%g,%g,%g",
7006     brightness,saturation,hue);
7007   status=ModulateImage(wand->images,modulate);
7008   if (status == MagickFalse)
7009     InheritException(wand->exception,&wand->images->exception);
7010   return(status);
7011 }
7012 \f
7013 /*
7014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7015 %                                                                             %
7016 %                                                                             %
7017 %                                                                             %
7018 %   M a g i c k M o n t a g e I m a g e                                       %
7019 %                                                                             %
7020 %                                                                             %
7021 %                                                                             %
7022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7023 %
7024 %  MagickMontageImage() creates a composite image by combining several
7025 %  separate images. The images are tiled on the composite image with the name
7026 %  of the image optionally appearing just below the individual tile.
7027 %
7028 %  The format of the MagickMontageImage method is:
7029 %
7030 %      MagickWand *MagickMontageImage(MagickWand *wand,
7031 %        const DrawingWand drawing_wand,const char *tile_geometry,
7032 %        const char *thumbnail_geometry,const MontageMode mode,
7033 %        const char *frame)
7034 %
7035 %  A description of each parameter follows:
7036 %
7037 %    o wand: the magick wand.
7038 %
7039 %    o drawing_wand: the drawing wand.  The font name, size, and color are
7040 %      obtained from this wand.
7041 %
7042 %    o tile_geometry: the number of tiles per row and page (e.g. 6x4+0+0).
7043 %
7044 %    o thumbnail_geometry: Preferred image size and border size of each
7045 %      thumbnail (e.g. 120x120+4+3>).
7046 %
7047 %    o mode: Thumbnail framing mode: Frame, Unframe, or Concatenate.
7048 %
7049 %    o frame: Surround the image with an ornamental border (e.g. 15x15+3+3).
7050 %      The frame color is that of the thumbnail's matte color.
7051 %
7052 */
7053 WandExport MagickWand *MagickMontageImage(MagickWand *wand,
7054   const DrawingWand *drawing_wand,const char *tile_geometry,
7055   const char *thumbnail_geometry,const MontageMode mode,const char *frame)
7056 {
7057   char
7058     *font;
7059
7060   Image
7061     *montage_image;
7062
7063   MontageInfo
7064     *montage_info;
7065
7066   PixelWand
7067     *pixel_wand;
7068
7069   assert(wand != (MagickWand *) NULL);
7070   assert(wand->signature == WandSignature);
7071   if (wand->debug != MagickFalse)
7072     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7073   if (wand->images == (Image *) NULL)
7074     return((MagickWand *) NULL);
7075   montage_info=CloneMontageInfo(wand->image_info,(MontageInfo *) NULL);
7076   switch (mode)
7077   {
7078     case FrameMode:
7079     {
7080       (void) CloneString(&montage_info->frame,"15x15+3+3");
7081       montage_info->shadow=MagickTrue;
7082       break;
7083     }
7084     case UnframeMode:
7085     {
7086       montage_info->frame=(char *) NULL;
7087       montage_info->shadow=MagickFalse;
7088       montage_info->border_width=0;
7089       break;
7090     }
7091     case ConcatenateMode:
7092     {
7093       montage_info->frame=(char *) NULL;
7094       montage_info->shadow=MagickFalse;
7095       (void) CloneString(&montage_info->geometry,"+0+0");
7096       montage_info->border_width=0;
7097       break;
7098     }
7099     default:
7100       break;
7101   }
7102   font=DrawGetFont(drawing_wand);
7103   if (font != (char *) NULL)
7104     (void) CloneString(&montage_info->font,font);
7105   if (frame != (char *) NULL)
7106     (void) CloneString(&montage_info->frame,frame);
7107   montage_info->pointsize=DrawGetFontSize(drawing_wand);
7108   pixel_wand=NewPixelWand();
7109   DrawGetFillColor(drawing_wand,pixel_wand);
7110   PixelGetQuantumColor(pixel_wand,&montage_info->fill);
7111   DrawGetStrokeColor(drawing_wand,pixel_wand);
7112   PixelGetQuantumColor(pixel_wand,&montage_info->stroke);
7113   pixel_wand=DestroyPixelWand(pixel_wand);
7114   if (thumbnail_geometry != (char *) NULL)
7115     (void) CloneString(&montage_info->geometry,thumbnail_geometry);
7116   if (tile_geometry != (char *) NULL)
7117     (void) CloneString(&montage_info->tile,tile_geometry);
7118   montage_image=MontageImageList(wand->image_info,montage_info,wand->images,
7119     wand->exception);
7120   montage_info=DestroyMontageInfo(montage_info);
7121   if (montage_image == (Image *) NULL)
7122     return((MagickWand *) NULL);
7123   return(CloneMagickWandFromImages(wand,montage_image));
7124 }
7125 \f
7126 /*
7127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7128 %                                                                             %
7129 %                                                                             %
7130 %                                                                             %
7131 %   M a g i c k M o r p h I m a g e s                                         %
7132 %                                                                             %
7133 %                                                                             %
7134 %                                                                             %
7135 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7136 %
7137 %  MagickMorphImages() method morphs a set of images.  Both the image pixels
7138 %  and size are linearly interpolated to give the appearance of a
7139 %  meta-morphosis from one image to the next.
7140 %
7141 %  The format of the MagickMorphImages method is:
7142 %
7143 %      MagickWand *MagickMorphImages(MagickWand *wand,
7144 %        const size_t number_frames)
7145 %
7146 %  A description of each parameter follows:
7147 %
7148 %    o wand: the magick wand.
7149 %
7150 %    o number_frames: the number of in-between images to generate.
7151 %
7152 */
7153 WandExport MagickWand *MagickMorphImages(MagickWand *wand,
7154   const size_t number_frames)
7155 {
7156   Image
7157     *morph_image;
7158
7159   assert(wand != (MagickWand *) NULL);
7160   assert(wand->signature == WandSignature);
7161   if (wand->debug != MagickFalse)
7162     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7163   if (wand->images == (Image *) NULL)
7164     return((MagickWand *) NULL);
7165   morph_image=MorphImages(wand->images,number_frames,wand->exception);
7166   if (morph_image == (Image *) NULL)
7167     return((MagickWand *) NULL);
7168   return(CloneMagickWandFromImages(wand,morph_image));
7169 }
7170 \f
7171 /*
7172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7173 %                                                                             %
7174 %                                                                             %
7175 %                                                                             %
7176 %   M a g i c k M o r p h o l o g y I m a g e                                 %
7177 %                                                                             %
7178 %                                                                             %
7179 %                                                                             %
7180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7181 %
7182 %  MagickMorphologyImage() applies a user supplied kernel to the image
7183 %  according to the given mophology method.
7184 %
7185 %  The format of the MagickMorphologyImage method is:
7186 %
7187 %      MagickBooleanType MagickMorphologyImage(MagickWand *wand,
7188 %        MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
7189 %      MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand,
7190 %        ChannelType channel,MorphologyMethod method,const ssize_t iterations,
7191 %        KernelInfo *kernel)
7192 %
7193 %  A description of each parameter follows:
7194 %
7195 %    o wand: the magick wand.
7196 %
7197 %    o channel: the image channel(s).
7198 %
7199 %    o method: the morphology method to be applied.
7200 %
7201 %    o iterations: apply the operation this many times (or no change).
7202 %      A value of -1 means loop until no change found.  How this is applied
7203 %      may depend on the morphology method.  Typically this is a value of 1.
7204 %
7205 %    o kernel: An array of doubles representing the morphology kernel.
7206 %
7207 */
7208
7209 WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
7210   MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
7211 {
7212   MagickBooleanType
7213     status;
7214
7215   status=MagickMorphologyImageChannel(wand,DefaultChannels,method,iterations,
7216     kernel);
7217   return(status);
7218 }
7219
7220 WandExport MagickBooleanType MagickMorphologyImageChannel(MagickWand *wand,
7221   const ChannelType channel,MorphologyMethod method,const ssize_t iterations,
7222   KernelInfo *kernel)
7223 {
7224   Image
7225     *morphology_image;
7226
7227   assert(wand != (MagickWand *) NULL);
7228   assert(wand->signature == WandSignature);
7229   if (wand->debug != MagickFalse)
7230     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7231   if (kernel == (const KernelInfo *) NULL)
7232     return(MagickFalse);
7233   if (wand->images == (Image *) NULL)
7234     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7235   morphology_image=MorphologyImageChannel(wand->images,channel,method,
7236     iterations,kernel,wand->exception);
7237   if (morphology_image == (Image *) NULL)
7238     return(MagickFalse);
7239   ReplaceImageInList(&wand->images,morphology_image);
7240   return(MagickTrue);
7241 }
7242 \f
7243 /*
7244 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7245 %                                                                             %
7246 %                                                                             %
7247 %                                                                             %
7248 %   M a g i c k M o t i o n B l u r I m a g e                                 %
7249 %                                                                             %
7250 %                                                                             %
7251 %                                                                             %
7252 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7253 %
7254 %  MagickMotionBlurImage() simulates motion blur.  We convolve the image with a
7255 %  Gaussian operator of the given radius and standard deviation (sigma).
7256 %  For reasonable results, radius should be larger than sigma.  Use a
7257 %  radius of 0 and MotionBlurImage() selects a suitable radius for you.
7258 %  Angle gives the angle of the blurring motion.
7259 %
7260 %  The format of the MagickMotionBlurImage method is:
7261 %
7262 %      MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7263 %        const double radius,const double sigma,const double angle)
7264 %      MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
7265 %        const ChannelType channel,const double radius,const double sigma,
7266 %        const double angle)
7267 %
7268 %  A description of each parameter follows:
7269 %
7270 %    o wand: the magick wand.
7271 %
7272 %    o channel: the image channel(s).
7273 %
7274 %    o radius: the radius of the Gaussian, in pixels, not counting
7275 %      the center pixel.
7276 %
7277 %    o sigma: the standard deviation of the Gaussian, in pixels.
7278 %
7279 %    o angle: Apply the effect along this angle.
7280 %
7281 */
7282
7283 WandExport MagickBooleanType MagickMotionBlurImage(MagickWand *wand,
7284   const double radius,const double sigma,const double angle)
7285 {
7286   MagickBooleanType
7287     status;
7288
7289   status=MagickMotionBlurImageChannel(wand,DefaultChannels,radius,sigma,angle);
7290   return(status);
7291 }
7292
7293 WandExport MagickBooleanType MagickMotionBlurImageChannel(MagickWand *wand,
7294   const ChannelType channel,const double radius,const double sigma,
7295   const double angle)
7296 {
7297   Image
7298     *blur_image;
7299
7300   assert(wand != (MagickWand *) NULL);
7301   assert(wand->signature == WandSignature);
7302   if (wand->debug != MagickFalse)
7303     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7304   if (wand->images == (Image *) NULL)
7305     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7306   blur_image=MotionBlurImageChannel(wand->images,channel,radius,sigma,angle,
7307     wand->exception);
7308   if (blur_image == (Image *) NULL)
7309     return(MagickFalse);
7310   ReplaceImageInList(&wand->images,blur_image);
7311   return(MagickTrue);
7312 }
7313 \f
7314 /*
7315 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7316 %                                                                             %
7317 %                                                                             %
7318 %                                                                             %
7319 %   M a g i c k N e g a t e I m a g e                                         %
7320 %                                                                             %
7321 %                                                                             %
7322 %                                                                             %
7323 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7324 %
7325 %  MagickNegateImage() negates the colors in the reference image.  The
7326 %  Grayscale option means that only grayscale values within the image are
7327 %  negated.
7328 %
7329 %  You can also reduce the influence of a particular channel with a gamma
7330 %  value of 0.
7331 %
7332 %  The format of the MagickNegateImage method is:
7333 %
7334 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
7335 %        const MagickBooleanType gray)
7336 %      MagickBooleanType MagickNegateImage(MagickWand *wand,
7337 %        const ChannelType channel,const MagickBooleanType gray)
7338 %
7339 %  A description of each parameter follows:
7340 %
7341 %    o wand: the magick wand.
7342 %
7343 %    o channel: the image channel(s).
7344 %
7345 %    o gray: If MagickTrue, only negate grayscale pixels within the image.
7346 %
7347 */
7348
7349 WandExport MagickBooleanType MagickNegateImage(MagickWand *wand,
7350   const MagickBooleanType gray)
7351 {
7352   MagickBooleanType
7353     status;
7354
7355   status=MagickNegateImageChannel(wand,DefaultChannels,gray);
7356   return(status);
7357 }
7358
7359 WandExport MagickBooleanType MagickNegateImageChannel(MagickWand *wand,
7360   const ChannelType channel,const MagickBooleanType gray)
7361 {
7362   MagickBooleanType
7363     status;
7364
7365   assert(wand != (MagickWand *) NULL);
7366   assert(wand->signature == WandSignature);
7367   if (wand->debug != MagickFalse)
7368     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7369   if (wand->images == (Image *) NULL)
7370     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7371   status=NegateImageChannel(wand->images,channel,gray);
7372   if (status == MagickFalse)
7373     InheritException(wand->exception,&wand->images->exception);
7374   return(status);
7375 }
7376 \f
7377 /*
7378 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7379 %                                                                             %
7380 %                                                                             %
7381 %                                                                             %
7382 %   M a g i c k N e w I m a g e                                               %
7383 %                                                                             %
7384 %                                                                             %
7385 %                                                                             %
7386 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7387 %
7388 %  MagickNewImage() adds a blank image canvas of the specified size and
7389 %  background color to the wand.
7390 %
7391 %  The format of the MagickNewImage method is:
7392 %
7393 %      MagickBooleanType MagickNewImage(MagickWand *wand,
7394 %        const size_t columns,const size_t rows,
7395 %        const PixelWand *background)
7396 %
7397 %  A description of each parameter follows:
7398 %
7399 %    o wand: the magick wand.
7400 %
7401 %    o width: the image width.
7402 %
7403 %    o height: the image height.
7404 %
7405 %    o background: the image color.
7406 %
7407 */
7408 WandExport MagickBooleanType MagickNewImage(MagickWand *wand,
7409   const size_t width,const size_t height,
7410   const PixelWand *background)
7411 {
7412   Image
7413     *images;
7414
7415   MagickPixelPacket
7416     pixel;
7417
7418   assert(wand != (MagickWand *) NULL);
7419   assert(wand->signature == WandSignature);
7420   if (wand->debug != MagickFalse)
7421     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7422   PixelGetMagickColor(background,&pixel);
7423   images=NewMagickImage(wand->image_info,width,height,&pixel);
7424   if (images == (Image *) NULL)
7425     return(MagickFalse);
7426   if (images->exception.severity != UndefinedException)
7427     InheritException(wand->exception,&images->exception);
7428   return(InsertImageInWand(wand,images));
7429 }
7430 \f
7431 /*
7432 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7433 %                                                                             %
7434 %                                                                             %
7435 %                                                                             %
7436 %   M a g i c k N e x t I m a g e                                             %
7437 %                                                                             %
7438 %                                                                             %
7439 %                                                                             %
7440 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7441 %
7442 %  MagickNextImage() associates the next image in the image list with a magick
7443 %  wand.
7444 %
7445 %  The format of the MagickNextImage method is:
7446 %
7447 %      MagickBooleanType MagickNextImage(MagickWand *wand)
7448 %
7449 %  A description of each parameter follows:
7450 %
7451 %    o wand: the magick wand.
7452 %
7453 */
7454 WandExport MagickBooleanType MagickNextImage(MagickWand *wand)
7455 {
7456   assert(wand != (MagickWand *) NULL);
7457   assert(wand->signature == WandSignature);
7458   if (wand->debug != MagickFalse)
7459     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7460   if (wand->images == (Image *) NULL)
7461     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7462   if (wand->pend != MagickFalse)
7463     {
7464       wand->pend=MagickFalse;
7465       return(MagickTrue);
7466     }
7467   if (GetNextImageInList(wand->images) == (Image *) NULL)
7468     {
7469       wand->pend=MagickTrue;
7470       return(MagickFalse);
7471     }
7472   wand->images=GetNextImageInList(wand->images);
7473   return(MagickTrue);
7474 }
7475 \f
7476 /*
7477 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7478 %                                                                             %
7479 %                                                                             %
7480 %                                                                             %
7481 %   M a g i c k N o r m a l i z e I m a g e                                   %
7482 %                                                                             %
7483 %                                                                             %
7484 %                                                                             %
7485 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7486 %
7487 %  MagickNormalizeImage() enhances the contrast of a color image by adjusting
7488 %  the pixels color to span the entire range of colors available
7489 %
7490 %  You can also reduce the influence of a particular channel with a gamma
7491 %  value of 0.
7492 %
7493 %  The format of the MagickNormalizeImage method is:
7494 %
7495 %      MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7496 %      MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
7497 %        const ChannelType channel)
7498 %
7499 %  A description of each parameter follows:
7500 %
7501 %    o wand: the magick wand.
7502 %
7503 %    o channel: the image channel(s).
7504 %
7505 */
7506
7507 WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand)
7508 {
7509   MagickBooleanType
7510     status;
7511
7512   status=MagickNormalizeImageChannel(wand,DefaultChannels);
7513   return(status);
7514 }
7515
7516 WandExport MagickBooleanType MagickNormalizeImageChannel(MagickWand *wand,
7517   const ChannelType channel)
7518 {
7519   MagickBooleanType
7520     status;
7521
7522   assert(wand != (MagickWand *) NULL);
7523   assert(wand->signature == WandSignature);
7524   if (wand->debug != MagickFalse)
7525     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7526   if (wand->images == (Image *) NULL)
7527     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7528   status=NormalizeImageChannel(wand->images,channel);
7529   if (status == MagickFalse)
7530     InheritException(wand->exception,&wand->images->exception);
7531   return(status);
7532 }
7533 \f
7534 /*
7535 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7536 %                                                                             %
7537 %                                                                             %
7538 %                                                                             %
7539 %   M a g i c k O i l P a i n t I m a g e                                     %
7540 %                                                                             %
7541 %                                                                             %
7542 %                                                                             %
7543 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7544 %
7545 %  MagickOilPaintImage() applies a special effect filter that simulates an oil
7546 %  painting.  Each pixel is replaced by the most frequent color occurring
7547 %  in a circular region defined by radius.
7548 %
7549 %  The format of the MagickOilPaintImage method is:
7550 %
7551 %      MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7552 %        const double radius)
7553 %
7554 %  A description of each parameter follows:
7555 %
7556 %    o wand: the magick wand.
7557 %
7558 %    o radius: the radius of the circular neighborhood.
7559 %
7560 */
7561 WandExport MagickBooleanType MagickOilPaintImage(MagickWand *wand,
7562   const double radius)
7563 {
7564   Image
7565     *paint_image;
7566
7567   assert(wand != (MagickWand *) NULL);
7568   assert(wand->signature == WandSignature);
7569   if (wand->debug != MagickFalse)
7570     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7571   if (wand->images == (Image *) NULL)
7572     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7573   paint_image=OilPaintImage(wand->images,radius,wand->exception);
7574   if (paint_image == (Image *) NULL)
7575     return(MagickFalse);
7576   ReplaceImageInList(&wand->images,paint_image);
7577   return(MagickTrue);
7578 }
7579 \f
7580 /*
7581 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7582 %                                                                             %
7583 %                                                                             %
7584 %                                                                             %
7585 %   M a g i c k O p a q u e P a i n t I m a g e                               %
7586 %                                                                             %
7587 %                                                                             %
7588 %                                                                             %
7589 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7590 %
7591 %  MagickOpaquePaintImage() changes any pixel that matches color with the color
7592 %  defined by fill.
7593 %
7594 %  The format of the MagickOpaquePaintImage method is:
7595 %
7596 %      MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7597 %        const PixelWand *target,const PixelWand *fill,const double fuzz,
7598 %        const MagickBooleanType invert)
7599 %      MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
7600 %        const ChannelType channel,const PixelWand *target,
7601 %        const PixelWand *fill,const double fuzz,const MagickBooleanType invert)
7602 %
7603 %  A description of each parameter follows:
7604 %
7605 %    o wand: the magick wand.
7606 %
7607 %    o channel: the channel(s).
7608 %
7609 %    o target: Change this target color to the fill color within the image.
7610 %
7611 %    o fill: the fill pixel wand.
7612 %
7613 %    o fuzz: By default target must match a particular pixel color
7614 %      exactly.  However, in many cases two colors may differ by a small amount.
7615 %      The fuzz member of image defines how much tolerance is acceptable to
7616 %      consider two colors as the same.  For example, set fuzz to 10 and the
7617 %      color red at intensities of 100 and 102 respectively are now interpreted
7618 %      as the same color for the purposes of the floodfill.
7619 %
7620 %    o invert: paint any pixel that does not match the target color.
7621 %
7622 */
7623
7624 WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand,
7625   const PixelWand *target,const PixelWand *fill,const double fuzz,
7626   const MagickBooleanType invert)
7627 {
7628   MagickBooleanType
7629     status;
7630
7631   status=MagickOpaquePaintImageChannel(wand,DefaultChannels,target,fill,fuzz,
7632     invert);
7633   return(status);
7634 }
7635
7636 WandExport MagickBooleanType MagickOpaquePaintImageChannel(MagickWand *wand,
7637   const ChannelType channel,const PixelWand *target,const PixelWand *fill,
7638   const double fuzz,const MagickBooleanType invert)
7639 {
7640   MagickBooleanType
7641     status;
7642
7643   MagickPixelPacket
7644     fill_pixel,
7645     target_pixel;
7646
7647   assert(wand != (MagickWand *) NULL);
7648   assert(wand->signature == WandSignature);
7649   if (wand->debug != MagickFalse)
7650     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7651   if (wand->images == (Image *) NULL)
7652     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7653   PixelGetMagickColor(target,&target_pixel);
7654   PixelGetMagickColor(fill,&fill_pixel);
7655   wand->images->fuzz=fuzz;
7656   status=OpaquePaintImageChannel(wand->images,channel,&target_pixel,
7657     &fill_pixel,invert);
7658   if (status == MagickFalse)
7659     InheritException(wand->exception,&wand->images->exception);
7660   return(status);
7661 }
7662 \f
7663 /*
7664 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7665 %                                                                             %
7666 %                                                                             %
7667 %                                                                             %
7668 %   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                         %
7669 %                                                                             %
7670 %                                                                             %
7671 %                                                                             %
7672 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7673 %
7674 %  MagickOptimizeImageLayers() compares each image the GIF disposed forms of the
7675 %  previous image in the sequence.  From this it attempts to select the
7676 %  smallest cropped image to replace each frame, while preserving the results
7677 %  of the animation.
7678 %
7679 %  The format of the MagickOptimizeImageLayers method is:
7680 %
7681 %      MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7682 %
7683 %  A description of each parameter follows:
7684 %
7685 %    o wand: the magick wand.
7686 %
7687 */
7688 WandExport MagickWand *MagickOptimizeImageLayers(MagickWand *wand)
7689 {
7690   Image
7691     *optimize_image;
7692
7693   assert(wand != (MagickWand *) NULL);
7694   assert(wand->signature == WandSignature);
7695   if (wand->debug != MagickFalse)
7696     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7697   if (wand->images == (Image *) NULL)
7698     return((MagickWand *) NULL);
7699   optimize_image=OptimizeImageLayers(wand->images,wand->exception);
7700   if (optimize_image == (Image *) NULL)
7701     return((MagickWand *) NULL);
7702   return(CloneMagickWandFromImages(wand,optimize_image));
7703 }
7704 \f
7705 /*
7706 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7707 %                                                                             %
7708 %                                                                             %
7709 %                                                                             %
7710 %     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                   %
7711 %                                                                             %
7712 %                                                                             %
7713 %                                                                             %
7714 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7715 %
7716 %  MagickOrderedPosterizeImage() performs an ordered dither based on a number
7717 %  of pre-defined dithering threshold maps, but over multiple intensity levels,
7718 %  which can be different for different channels, according to the input
7719 %  arguments.
7720 %
7721 %  The format of the MagickOrderedPosterizeImage method is:
7722 %
7723 %      MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7724 %        const char *threshold_map)
7725 %      MagickBooleanType MagickOrderedPosterizeImageChannel(MagickWand *wand,
7726 %        const ChannelType channel,const char *threshold_map)
7727 %
7728 %  A description of each parameter follows:
7729 %
7730 %    o image: the image.
7731 %
7732 %    o channel: the channel or channels to be thresholded.
7733 %
7734 %    o threshold_map: A string containing the name of the threshold dither
7735 %      map to use, followed by zero or more numbers representing the number of
7736 %      color levels tho dither between.
7737 %
7738 %      Any level number less than 2 is equivelent to 2, and means only binary
7739 %      dithering will be applied to each color channel.
7740 %
7741 %      No numbers also means a 2 level (bitmap) dither will be applied to all
7742 %      channels, while a single number is the number of levels applied to each
7743 %      channel in sequence.  More numbers will be applied in turn to each of
7744 %      the color channels.
7745 %
7746 %      For example: "o3x3,6" generates a 6 level posterization of the image
7747 %      with a ordered 3x3 diffused pixel dither being applied between each
7748 %      level. While checker,8,8,4 will produce a 332 colormaped image with
7749 %      only a single checkerboard hash pattern (50% grey) between each color
7750 %      level, to basically double the number of color levels with a bare
7751 %      minimim of dithering.
7752 %
7753 */
7754
7755 WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand,
7756   const char *threshold_map)
7757 {
7758   MagickBooleanType
7759     status;
7760
7761   status=MagickOrderedPosterizeImageChannel(wand,DefaultChannels,threshold_map);
7762   return(status);
7763 }
7764
7765 WandExport MagickBooleanType MagickOrderedPosterizeImageChannel(
7766   MagickWand *wand,const ChannelType channel,const char *threshold_map)
7767 {
7768   MagickBooleanType
7769     status;
7770
7771   assert(wand != (MagickWand *) NULL);
7772   assert(wand->signature == WandSignature);
7773   if (wand->debug != MagickFalse)
7774     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7775   if (wand->images == (Image *) NULL)
7776     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7777   status=OrderedPosterizeImageChannel(wand->images,channel,threshold_map,
7778     wand->exception);
7779   return(status);
7780 }
7781 \f
7782 /*
7783 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7784 %                                                                             %
7785 %                                                                             %
7786 %                                                                             %
7787 %   M a g i c k P i n g I m a g e                                             %
7788 %                                                                             %
7789 %                                                                             %
7790 %                                                                             %
7791 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7792 %
7793 %  MagickPingImage() is like MagickReadImage() except the only valid
7794 %  information returned is the image width, height, size, and format.  It
7795 %  is designed to efficiently obtain this information from a file without
7796 %  reading the entire image sequence into memory.
7797 %
7798 %  The format of the MagickPingImage method is:
7799 %
7800 %      MagickBooleanType MagickPingImage(MagickWand *wand,const char *filename)
7801 %
7802 %  A description of each parameter follows:
7803 %
7804 %    o wand: the magick wand.
7805 %
7806 %    o filename: the image filename.
7807 %
7808 */
7809 WandExport MagickBooleanType MagickPingImage(MagickWand *wand,
7810   const char *filename)
7811 {
7812   Image
7813     *images;
7814
7815   ImageInfo
7816     *ping_info;
7817
7818   assert(wand != (MagickWand *) NULL);
7819   assert(wand->signature == WandSignature);
7820   if (wand->debug != MagickFalse)
7821     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7822   ping_info=CloneImageInfo(wand->image_info);
7823   if (filename != (const char *) NULL)
7824     (void) CopyMagickString(ping_info->filename,filename,MaxTextExtent);
7825   images=PingImage(ping_info,wand->exception);
7826   ping_info=DestroyImageInfo(ping_info);
7827   if (images == (Image *) NULL)
7828     return(MagickFalse);
7829   return(InsertImageInWand(wand,images));
7830 }
7831 \f
7832 /*
7833 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7834 %                                                                             %
7835 %                                                                             %
7836 %                                                                             %
7837 %   M a g i c k P i n g I m a g e B l o b                                     %
7838 %                                                                             %
7839 %                                                                             %
7840 %                                                                             %
7841 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7842 %
7843 %  MagickPingImageBlob() pings an image or image sequence from a blob.
7844 %
7845 %  The format of the MagickPingImageBlob method is:
7846 %
7847 %      MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7848 %        const void *blob,const size_t length)
7849 %
7850 %  A description of each parameter follows:
7851 %
7852 %    o wand: the magick wand.
7853 %
7854 %    o blob: the blob.
7855 %
7856 %    o length: the blob length.
7857 %
7858 */
7859 WandExport MagickBooleanType MagickPingImageBlob(MagickWand *wand,
7860   const void *blob,const size_t length)
7861 {
7862   Image
7863     *images;
7864
7865   ImageInfo
7866     *read_info;
7867
7868   assert(wand != (MagickWand *) NULL);
7869   assert(wand->signature == WandSignature);
7870   if (wand->debug != MagickFalse)
7871     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7872   read_info=CloneImageInfo(wand->image_info);
7873   SetImageInfoBlob(read_info,blob,length);
7874   images=PingImage(read_info,wand->exception);
7875   read_info=DestroyImageInfo(read_info);
7876   if (images == (Image *) NULL)
7877     return(MagickFalse);
7878   return(InsertImageInWand(wand,images));
7879 }
7880 \f
7881 /*
7882 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7883 %                                                                             %
7884 %                                                                             %
7885 %                                                                             %
7886 %   M a g i c k P i n g I m a g e F i l e                                     %
7887 %                                                                             %
7888 %                                                                             %
7889 %                                                                             %
7890 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7891 %
7892 %  MagickPingImageFile() pings an image or image sequence from an open file
7893 %  descriptor.
7894 %
7895 %  The format of the MagickPingImageFile method is:
7896 %
7897 %      MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7898 %
7899 %  A description of each parameter follows:
7900 %
7901 %    o wand: the magick wand.
7902 %
7903 %    o file: the file descriptor.
7904 %
7905 */
7906 WandExport MagickBooleanType MagickPingImageFile(MagickWand *wand,FILE *file)
7907 {
7908   Image
7909     *images;
7910
7911   ImageInfo
7912     *read_info;
7913
7914   assert(wand != (MagickWand *) NULL);
7915   assert(wand->signature == WandSignature);
7916   assert(file != (FILE *) NULL);
7917   if (wand->debug != MagickFalse)
7918     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7919   read_info=CloneImageInfo(wand->image_info);
7920   SetImageInfoFile(read_info,file);
7921   images=PingImage(read_info,wand->exception);
7922   read_info=DestroyImageInfo(read_info);
7923   if (images == (Image *) NULL)
7924     return(MagickFalse);
7925   return(InsertImageInWand(wand,images));
7926 }
7927 \f
7928 /*
7929 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7930 %                                                                             %
7931 %                                                                             %
7932 %                                                                             %
7933 %   M a g i c k P o l a r o i d I m a g e                                     %
7934 %                                                                             %
7935 %                                                                             %
7936 %                                                                             %
7937 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7938 %
7939 %  MagickPolaroidImage() simulates a Polaroid picture.
7940 %
7941 %  The format of the MagickPolaroidImage method is:
7942 %
7943 %      MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7944 %        const DrawingWand *drawing_wand,const double angle)
7945 %
7946 %  A description of each parameter follows:
7947 %
7948 %    o wand: the magick wand.
7949 %
7950 %    o drawing_wand: the draw wand.
7951 %
7952 %    o angle: Apply the effect along this angle.
7953 %
7954 */
7955 WandExport MagickBooleanType MagickPolaroidImage(MagickWand *wand,
7956   const DrawingWand *drawing_wand,const double angle)
7957 {
7958   DrawInfo
7959     *draw_info;
7960
7961   Image
7962     *polaroid_image;
7963
7964   assert(wand != (MagickWand *) NULL);
7965   assert(wand->signature == WandSignature);
7966   if (wand->debug != MagickFalse)
7967     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
7968   if (wand->images == (Image *) NULL)
7969     ThrowWandException(WandError,"ContainsNoImages",wand->name);
7970   draw_info=PeekDrawingWand(drawing_wand);
7971   if (draw_info == (DrawInfo *) NULL)
7972     return(MagickFalse);
7973   polaroid_image=PolaroidImage(wand->images,draw_info,angle,wand->exception);
7974   if (polaroid_image == (Image *) NULL)
7975     return(MagickFalse);
7976   ReplaceImageInList(&wand->images,polaroid_image);
7977   return(MagickTrue);
7978 }
7979 \f
7980 /*
7981 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7982 %                                                                             %
7983 %                                                                             %
7984 %                                                                             %
7985 %   M a g i c k P o s t e r i z e I m a g e                                   %
7986 %                                                                             %
7987 %                                                                             %
7988 %                                                                             %
7989 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7990 %
7991 %  MagickPosterizeImage() reduces the image to a limited number of color level.
7992 %
7993 %  The format of the MagickPosterizeImage method is:
7994 %
7995 %      MagickBooleanType MagickPosterizeImage(MagickWand *wand,
7996 %        const unsigned levels,const MagickBooleanType dither)
7997 %
7998 %  A description of each parameter follows:
7999 %
8000 %    o wand: the magick wand.
8001 %
8002 %    o levels: Number of color levels allowed in each channel.  Very low values
8003 %      (2, 3, or 4) have the most visible effect.
8004 %
8005 %    o dither: Set this integer value to something other than zero to dither
8006 %      the mapped image.
8007 %
8008 */
8009 WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand,
8010   const size_t levels,const MagickBooleanType dither)
8011 {
8012   MagickBooleanType
8013     status;
8014
8015   assert(wand != (MagickWand *) NULL);
8016   assert(wand->signature == WandSignature);
8017   if (wand->debug != MagickFalse)
8018     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8019   if (wand->images == (Image *) NULL)
8020     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8021   status=PosterizeImage(wand->images,levels,dither);
8022   if (status == MagickFalse)
8023     InheritException(wand->exception,&wand->images->exception);
8024   return(status);
8025 }
8026 \f
8027 /*
8028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8029 %                                                                             %
8030 %                                                                             %
8031 %                                                                             %
8032 %   M a g i c k P r e v i e w I m a g e s                                     %
8033 %                                                                             %
8034 %                                                                             %
8035 %                                                                             %
8036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8037 %
8038 %  MagickPreviewImages() tiles 9 thumbnails of the specified image with an
8039 %  image processing operation applied at varying strengths.  This helpful
8040 %  to quickly pin-point an appropriate parameter for an image processing
8041 %  operation.
8042 %
8043 %  The format of the MagickPreviewImages method is:
8044 %
8045 %      MagickWand *MagickPreviewImages(MagickWand *wand,
8046 %        const PreviewType preview)
8047 %
8048 %  A description of each parameter follows:
8049 %
8050 %    o wand: the magick wand.
8051 %
8052 %    o preview: the preview type.
8053 %
8054 */
8055 WandExport MagickWand *MagickPreviewImages(MagickWand *wand,
8056   const PreviewType preview)
8057 {
8058   Image
8059     *preview_image;
8060
8061   assert(wand != (MagickWand *) NULL);
8062   assert(wand->signature == WandSignature);
8063   if (wand->debug != MagickFalse)
8064     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8065   if (wand->images == (Image *) NULL)
8066     return((MagickWand *) NULL);
8067   preview_image=PreviewImage(wand->images,preview,wand->exception);
8068   if (preview_image == (Image *) NULL)
8069     return((MagickWand *) NULL);
8070   return(CloneMagickWandFromImages(wand,preview_image));
8071 }
8072 \f
8073 /*
8074 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8075 %                                                                             %
8076 %                                                                             %
8077 %                                                                             %
8078 %   M a g i c k P r e v i o u s I m a g e                                     %
8079 %                                                                             %
8080 %                                                                             %
8081 %                                                                             %
8082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8083 %
8084 %  MagickPreviousImage() assocates the previous image in an image list with
8085 %  the magick wand.
8086 %
8087 %  The format of the MagickPreviousImage method is:
8088 %
8089 %      MagickBooleanType MagickPreviousImage(MagickWand *wand)
8090 %
8091 %  A description of each parameter follows:
8092 %
8093 %    o wand: the magick wand.
8094 %
8095 */
8096 WandExport MagickBooleanType MagickPreviousImage(MagickWand *wand)
8097 {
8098   assert(wand != (MagickWand *) NULL);
8099   assert(wand->signature == WandSignature);
8100   if (wand->debug != MagickFalse)
8101     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8102   if (wand->images == (Image *) NULL)
8103     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8104   if (wand->pend != MagickFalse)
8105     {
8106       wand->pend=MagickFalse;
8107       return(MagickTrue);
8108     }
8109   if (GetPreviousImageInList(wand->images) == (Image *) NULL)
8110     {
8111       wand->pend=MagickTrue;
8112       return(MagickFalse);
8113     }
8114   wand->images=GetPreviousImageInList(wand->images);
8115   return(MagickTrue);
8116 }
8117 \f
8118 /*
8119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8120 %                                                                             %
8121 %                                                                             %
8122 %                                                                             %
8123 %   M a g i c k Q u a n t i z e I m a g e                                     %
8124 %                                                                             %
8125 %                                                                             %
8126 %                                                                             %
8127 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8128 %
8129 %  MagickQuantizeImage() analyzes the colors within a reference image and
8130 %  chooses a fixed number of colors to represent the image.  The goal of the
8131 %  algorithm is to minimize the color difference between the input and output
8132 %  image while minimizing the processing time.
8133 %
8134 %  The format of the MagickQuantizeImage method is:
8135 %
8136 %      MagickBooleanType MagickQuantizeImage(MagickWand *wand,
8137 %        const size_t number_colors,const ColorspaceType colorspace,
8138 %        const size_t treedepth,const MagickBooleanType dither,
8139 %        const MagickBooleanType measure_error)
8140 %
8141 %  A description of each parameter follows:
8142 %
8143 %    o wand: the magick wand.
8144 %
8145 %    o number_colors: the number of colors.
8146 %
8147 %    o colorspace: Perform color reduction in this colorspace, typically
8148 %      RGBColorspace.
8149 %
8150 %    o treedepth: Normally, this integer value is zero or one.  A zero or
8151 %      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
8152 %      reference image with the least amount of memory and the fastest
8153 %      computational speed.  In some cases, such as an image with low color
8154 %      dispersion (a few number of colors), a value other than
8155 %      Log4(number_colors) is required.  To expand the color tree completely,
8156 %      use a value of 8.
8157 %
8158 %    o dither: A value other than zero distributes the difference between an
8159 %      original image and the corresponding color reduced image to
8160 %      neighboring pixels along a Hilbert curve.
8161 %
8162 %    o measure_error: A value other than zero measures the difference between
8163 %      the original and quantized images.  This difference is the total
8164 %      quantization error.  The error is computed by summing over all pixels
8165 %      in an image the distance squared in RGB space between each reference
8166 %      pixel value and its quantized value.
8167 %
8168 */
8169 WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand,
8170   const size_t number_colors,const ColorspaceType colorspace,
8171   const size_t treedepth,const MagickBooleanType dither,
8172   const MagickBooleanType measure_error)
8173 {
8174   MagickBooleanType
8175     status;
8176
8177   QuantizeInfo
8178     *quantize_info;
8179
8180   assert(wand != (MagickWand *) NULL);
8181   assert(wand->signature == WandSignature);
8182   if (wand->debug != MagickFalse)
8183     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8184   if (wand->images == (Image *) NULL)
8185     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8186   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8187   quantize_info->number_colors=number_colors;
8188   quantize_info->dither=dither;
8189   quantize_info->tree_depth=treedepth;
8190   quantize_info->colorspace=colorspace;
8191   quantize_info->measure_error=measure_error;
8192   status=QuantizeImage(quantize_info,wand->images);
8193   if (status == MagickFalse)
8194     InheritException(wand->exception,&wand->images->exception);
8195   quantize_info=DestroyQuantizeInfo(quantize_info);
8196   return(status);
8197 }
8198 \f
8199 /*
8200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8201 %                                                                             %
8202 %                                                                             %
8203 %                                                                             %
8204 %   M a g i c k Q u a n t i z e I m a g e s                                   %
8205 %                                                                             %
8206 %                                                                             %
8207 %                                                                             %
8208 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8209 %
8210 %  MagickQuantizeImages() analyzes the colors within a sequence of images and
8211 %  chooses a fixed number of colors to represent the image.  The goal of the
8212 %  algorithm is to minimize the color difference between the input and output
8213 %  image while minimizing the processing time.
8214 %
8215 %  The format of the MagickQuantizeImages method is:
8216 %
8217 %      MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8218 %        const size_t number_colors,const ColorspaceType colorspace,
8219 %        const size_t treedepth,const MagickBooleanType dither,
8220 %        const MagickBooleanType measure_error)
8221 %
8222 %  A description of each parameter follows:
8223 %
8224 %    o wand: the magick wand.
8225 %
8226 %    o number_colors: the number of colors.
8227 %
8228 %    o colorspace: Perform color reduction in this colorspace, typically
8229 %      RGBColorspace.
8230 %
8231 %    o treedepth: Normally, this integer value is zero or one.  A zero or
8232 %      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
8233 %      reference image with the least amount of memory and the fastest
8234 %      computational speed.  In some cases, such as an image with low color
8235 %      dispersion (a few number of colors), a value other than
8236 %      Log4(number_colors) is required.  To expand the color tree completely,
8237 %      use a value of 8.
8238 %
8239 %    o dither: A value other than zero distributes the difference between an
8240 %      original image and the corresponding color reduced algorithm to
8241 %      neighboring pixels along a Hilbert curve.
8242 %
8243 %    o measure_error: A value other than zero measures the difference between
8244 %      the original and quantized images.  This difference is the total
8245 %      quantization error.  The error is computed by summing over all pixels
8246 %      in an image the distance squared in RGB space between each reference
8247 %      pixel value and its quantized value.
8248 %
8249 */
8250 WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand,
8251   const size_t number_colors,const ColorspaceType colorspace,
8252   const size_t treedepth,const MagickBooleanType dither,
8253   const MagickBooleanType measure_error)
8254 {
8255   MagickBooleanType
8256     status;
8257
8258   QuantizeInfo
8259     *quantize_info;
8260
8261   assert(wand != (MagickWand *) NULL);
8262   assert(wand->signature == WandSignature);
8263   if (wand->debug != MagickFalse)
8264     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8265   if (wand->images == (Image *) NULL)
8266     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8267   quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
8268   quantize_info->number_colors=number_colors;
8269   quantize_info->dither=dither;
8270   quantize_info->tree_depth=treedepth;
8271   quantize_info->colorspace=colorspace;
8272   quantize_info->measure_error=measure_error;
8273   status=QuantizeImages(quantize_info,wand->images);
8274   if (status == MagickFalse)
8275     InheritException(wand->exception,&wand->images->exception);
8276   quantize_info=DestroyQuantizeInfo(quantize_info);
8277   return(status);
8278 }
8279 \f
8280 /*
8281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8282 %                                                                             %
8283 %                                                                             %
8284 %                                                                             %
8285 %   M a g i c k R a d i a l B l u r I m a g e                                 %
8286 %                                                                             %
8287 %                                                                             %
8288 %                                                                             %
8289 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8290 %
8291 %  MagickRadialBlurImage() radial blurs an image.
8292 %
8293 %  The format of the MagickRadialBlurImage method is:
8294 %
8295 %      MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
8296 %        const double angle)
8297 %      MagickBooleanType MagickRadialBlurImageChannel(MagickWand *wand,
8298 %        const ChannelType channel,const double angle)
8299 %
8300 %  A description of each parameter follows:
8301 %
8302 %    o wand: the magick wand.
8303 %
8304 %    o channel: the image channel(s).
8305 %
8306 %    o angle: the angle of the blur in degrees.
8307 %
8308 */
8309 WandExport MagickBooleanType MagickRadialBlurImage(MagickWand *wand,
8310   const double angle)
8311 {
8312   MagickBooleanType
8313     status;
8314
8315   status=MagickRadialBlurImageChannel(wand,DefaultChannels,angle);
8316   return(status);
8317 }
8318
8319 WandExport MagickBooleanType MagickRadialBlurImageChannel(MagickWand *wand,
8320   const ChannelType channel,const double angle)
8321 {
8322   Image
8323     *blur_image;
8324
8325   assert(wand != (MagickWand *) NULL);
8326   assert(wand->signature == WandSignature);
8327   if (wand->debug != MagickFalse)
8328     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8329   if (wand->images == (Image *) NULL)
8330     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8331   blur_image=RadialBlurImageChannel(wand->images,channel,angle,
8332     wand->exception);
8333   if (blur_image == (Image *) NULL)
8334     return(MagickFalse);
8335   ReplaceImageInList(&wand->images,blur_image);
8336   return(MagickTrue);
8337 }
8338 \f
8339 /*
8340 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8341 %                                                                             %
8342 %                                                                             %
8343 %                                                                             %
8344 %   M a g i c k R a i s e I m a g e                                           %
8345 %                                                                             %
8346 %                                                                             %
8347 %                                                                             %
8348 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8349 %
8350 %  MagickRaiseImage() creates a simulated three-dimensional button-like effect
8351 %  by lightening and darkening the edges of the image.  Members width and
8352 %  height of raise_info define the width of the vertical and horizontal
8353 %  edge of the effect.
8354 %
8355 %  The format of the MagickRaiseImage method is:
8356 %
8357 %      MagickBooleanType MagickRaiseImage(MagickWand *wand,
8358 %        const size_t width,const size_t height,const ssize_t x,
8359 %        const ssize_t y,const MagickBooleanType raise)
8360 %
8361 %  A description of each parameter follows:
8362 %
8363 %    o wand: the magick wand.
8364 %
8365 %    o width,height,x,y:  Define the dimensions of the area to raise.
8366 %
8367 %    o raise: A value other than zero creates a 3-D raise effect,
8368 %      otherwise it has a lowered effect.
8369 %
8370 */
8371 WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand,
8372   const size_t width,const size_t height,const ssize_t x,
8373   const ssize_t y,const MagickBooleanType raise)
8374 {
8375   MagickBooleanType
8376     status;
8377
8378   RectangleInfo
8379     raise_info;
8380
8381   assert(wand != (MagickWand *) NULL);
8382   assert(wand->signature == WandSignature);
8383   if (wand->debug != MagickFalse)
8384     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8385   if (wand->images == (Image *) NULL)
8386     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8387   raise_info.width=width;
8388   raise_info.height=height;
8389   raise_info.x=x;
8390   raise_info.y=y;
8391   status=RaiseImage(wand->images,&raise_info,raise);
8392   if (status == MagickFalse)
8393     InheritException(wand->exception,&wand->images->exception);
8394   return(status);
8395 }
8396 \f
8397 /*
8398 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8399 %                                                                             %
8400 %                                                                             %
8401 %                                                                             %
8402 %   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                       %
8403 %                                                                             %
8404 %                                                                             %
8405 %                                                                             %
8406 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8407 %
8408 %  MagickRandomThresholdImage() changes the value of individual pixels based on
8409 %  the intensity of each pixel compared to threshold.  The result is a
8410 %  high-contrast, two color image.
8411 %
8412 %  The format of the MagickRandomThresholdImage method is:
8413 %
8414 %      MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8415 %        const double low,const double high)
8416 %      MagickBooleanType MagickRandomThresholdImageChannel(MagickWand *wand,
8417 %        const ChannelType channel,const double low,const double high)
8418 %
8419 %  A description of each parameter follows:
8420 %
8421 %    o wand: the magick wand.
8422 %
8423 %    o channel: the image channel(s).
8424 %
8425 %    o low,high: Specify the high and low thresholds.  These values range from
8426 %      0 to QuantumRange.
8427 %
8428 */
8429
8430 WandExport MagickBooleanType MagickRandomThresholdImage(MagickWand *wand,
8431   const double low,const double high)
8432 {
8433   MagickBooleanType
8434     status;
8435
8436   status=MagickRandomThresholdImageChannel(wand,DefaultChannels,low,high);
8437   return(status);
8438 }
8439
8440 WandExport MagickBooleanType MagickRandomThresholdImageChannel(
8441   MagickWand *wand,const ChannelType channel,const double low,
8442   const double high)
8443 {
8444   char
8445     threshold[MaxTextExtent];
8446
8447   MagickBooleanType
8448     status;
8449
8450   assert(wand != (MagickWand *) NULL);
8451   assert(wand->signature == WandSignature);
8452   if (wand->debug != MagickFalse)
8453     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8454   if (wand->images == (Image *) NULL)
8455     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8456   (void) FormatMagickString(threshold,MaxTextExtent,"%gx%g",low,high);
8457   status=RandomThresholdImageChannel(wand->images,channel,threshold,
8458     wand->exception);
8459   if (status == MagickFalse)
8460     InheritException(wand->exception,&wand->images->exception);
8461   return(status);
8462 }
8463 \f
8464 /*
8465 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8466 %                                                                             %
8467 %                                                                             %
8468 %                                                                             %
8469 %   M a g i c k R e a d I m a g e                                             %
8470 %                                                                             %
8471 %                                                                             %
8472 %                                                                             %
8473 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8474 %
8475 %  MagickReadImage() reads an image or image sequence.  The images are inserted
8476 %  at the current image pointer position.   Use MagickSetFirstIterator(),
8477 %  MagickSetLastIterator, or MagickSetImageIndex() to specify the current
8478 %  image pointer position at the beginning of the image list, the end, or
8479 %  anywhere in-between respectively.
8480 %
8481 %  The format of the MagickReadImage method is:
8482 %
8483 %      MagickBooleanType MagickReadImage(MagickWand *wand,const char *filename)
8484 %
8485 %  A description of each parameter follows:
8486 %
8487 %    o wand: the magick wand.
8488 %
8489 %    o filename: the image filename.
8490 %
8491 */
8492 WandExport MagickBooleanType MagickReadImage(MagickWand *wand,
8493   const char *filename)
8494 {
8495   Image
8496     *images;
8497
8498   ImageInfo
8499     *read_info;
8500
8501   assert(wand != (MagickWand *) NULL);
8502   assert(wand->signature == WandSignature);
8503   if (wand->debug != MagickFalse)
8504     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8505   read_info=CloneImageInfo(wand->image_info);
8506   if (filename != (const char *) NULL)
8507     (void) CopyMagickString(read_info->filename,filename,MaxTextExtent);
8508   images=ReadImage(read_info,wand->exception);
8509   read_info=DestroyImageInfo(read_info);
8510   if (images == (Image *) NULL)
8511     return(MagickFalse);
8512   return(InsertImageInWand(wand,images));
8513 }
8514 \f
8515 /*
8516 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8517 %                                                                             %
8518 %                                                                             %
8519 %                                                                             %
8520 %   M a g i c k R e a d I m a g e B l o b                                     %
8521 %                                                                             %
8522 %                                                                             %
8523 %                                                                             %
8524 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8525 %
8526 %  MagickReadImageBlob() reads an image or image sequence from a blob.
8527 %
8528 %  The format of the MagickReadImageBlob method is:
8529 %
8530 %      MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8531 %        const void *blob,const size_t length)
8532 %
8533 %  A description of each parameter follows:
8534 %
8535 %    o wand: the magick wand.
8536 %
8537 %    o blob: the blob.
8538 %
8539 %    o length: the blob length.
8540 %
8541 */
8542 WandExport MagickBooleanType MagickReadImageBlob(MagickWand *wand,
8543   const void *blob,const size_t length)
8544 {
8545   Image
8546     *images;
8547
8548   assert(wand != (MagickWand *) NULL);
8549   assert(wand->signature == WandSignature);
8550   if (wand->debug != MagickFalse)
8551     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8552   images=BlobToImage(wand->image_info,blob,length,wand->exception);
8553   if (images == (Image *) NULL)
8554     return(MagickFalse);
8555   return(InsertImageInWand(wand,images));
8556 }
8557 \f
8558 /*
8559 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8560 %                                                                             %
8561 %                                                                             %
8562 %                                                                             %
8563 %   M a g i c k R e a d I m a g e F i l e                                     %
8564 %                                                                             %
8565 %                                                                             %
8566 %                                                                             %
8567 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8568 %
8569 %  MagickReadImageFile() reads an image or image sequence from an open file
8570 %  descriptor.
8571 %
8572 %  The format of the MagickReadImageFile method is:
8573 %
8574 %      MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8575 %
8576 %  A description of each parameter follows:
8577 %
8578 %    o wand: the magick wand.
8579 %
8580 %    o file: the file descriptor.
8581 %
8582 */
8583 WandExport MagickBooleanType MagickReadImageFile(MagickWand *wand,FILE *file)
8584 {
8585   Image
8586     *images;
8587
8588   ImageInfo
8589     *read_info;
8590
8591   assert(wand != (MagickWand *) NULL);
8592   assert(wand->signature == WandSignature);
8593   assert(file != (FILE *) NULL);
8594   if (wand->debug != MagickFalse)
8595     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8596   read_info=CloneImageInfo(wand->image_info);
8597   SetImageInfoFile(read_info,file);
8598   images=ReadImage(read_info,wand->exception);
8599   read_info=DestroyImageInfo(read_info);
8600   if (images == (Image *) NULL)
8601     return(MagickFalse);
8602   return(InsertImageInWand(wand,images));
8603 }
8604 \f
8605 /*
8606 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8607 %                                                                             %
8608 %                                                                             %
8609 %                                                                             %
8610 %     M a g i c k R e d u c e N o i s e I m a g e                             %
8611 %                                                                             %
8612 %                                                                             %
8613 %                                                                             %
8614 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8615 %
8616 %  MagickReduceNoiseImage() smooths the contours of an image while still
8617 %  preserving edge information.  The algorithm works by replacing each pixel
8618 %  with its neighbor closest in value.  A neighbor is defined by radius.  Use
8619 %  a radius of 0 and ReduceNoise() selects a suitable radius for you.
8620 %
8621 %  The format of the MagickReduceNoiseImage method is:
8622 %
8623 %      MagickBooleanType MagickReduceNoiseImage(MagickWand *wand,
8624 %        const double radius)
8625 %
8626 %  A description of each parameter follows:
8627 %
8628 %    o wand: the magick wand.
8629 %
8630 %    o radius: the radius of the pixel neighborhood.
8631 %
8632 */
8633 WandExport MagickBooleanType MagickReduceNoiseImage(MagickWand *wand,
8634   const double radius)
8635 {
8636   Image
8637     *noise_image;
8638
8639   assert(wand != (MagickWand *) NULL);
8640   assert(wand->signature == WandSignature);
8641   if (wand->debug != MagickFalse)
8642     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8643   if (wand->images == (Image *) NULL)
8644     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8645   noise_image=ReduceNoiseImage(wand->images,radius,wand->exception);
8646   if (noise_image == (Image *) NULL)
8647     return(MagickFalse);
8648   ReplaceImageInList(&wand->images,noise_image);
8649   return(MagickTrue);
8650 }
8651 \f
8652 /*
8653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8654 %                                                                             %
8655 %                                                                             %
8656 %                                                                             %
8657 %   M a g i c k R e m a p I m a g e                                           %
8658 %                                                                             %
8659 %                                                                             %
8660 %                                                                             %
8661 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8662 %
8663 %  MagickRemapImage() replaces the colors of an image with the closest color
8664 %  from a reference image.
8665 %
8666 %  The format of the MagickRemapImage method is:
8667 %
8668 %      MagickBooleanType MagickRemapImage(MagickWand *wand,
8669 %        const MagickWand *remap_wand,const DitherMethod method)
8670 %
8671 %  A description of each parameter follows:
8672 %
8673 %    o wand: the magick wand.
8674 %
8675 %    o affinity: the affinity wand.
8676 %
8677 %    o method: choose from these dither methods: NoDitherMethod,
8678 %      RiemersmaDitherMethod, or FloydSteinbergDitherMethod.
8679 %
8680 */
8681 WandExport MagickBooleanType MagickRemapImage(MagickWand *wand,
8682   const MagickWand *remap_wand,const DitherMethod method)
8683 {
8684   MagickBooleanType
8685     status;
8686
8687   QuantizeInfo
8688     *quantize_info;
8689
8690   assert(wand != (MagickWand *) NULL);
8691   assert(wand->signature == WandSignature);
8692   if (wand->debug != MagickFalse)
8693     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8694   if ((wand->images == (Image *) NULL) ||
8695       (remap_wand->images == (Image *) NULL))
8696     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8697   quantize_info=AcquireQuantizeInfo(wand->image_info);
8698   quantize_info->dither_method=method;
8699   if (method == NoDitherMethod)
8700     quantize_info->dither=MagickFalse;
8701   status=RemapImage(quantize_info,wand->images,remap_wand->images);
8702   quantize_info=DestroyQuantizeInfo(quantize_info);
8703   if (status == MagickFalse)
8704     InheritException(wand->exception,&wand->images->exception);
8705   return(status);
8706 }
8707 \f
8708 /*
8709 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8710 %                                                                             %
8711 %                                                                             %
8712 %                                                                             %
8713 %   M a g i c k R e m o v e I m a g e                                         %
8714 %                                                                             %
8715 %                                                                             %
8716 %                                                                             %
8717 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8718 %
8719 %  MagickRemoveImage() removes an image from the image list.
8720 %
8721 %  The format of the MagickRemoveImage method is:
8722 %
8723 %      MagickBooleanType MagickRemoveImage(MagickWand *wand)
8724 %
8725 %  A description of each parameter follows:
8726 %
8727 %    o wand: the magick wand.
8728 %
8729 %    o insert: the splice wand.
8730 %
8731 */
8732 WandExport MagickBooleanType MagickRemoveImage(MagickWand *wand)
8733 {
8734   assert(wand != (MagickWand *) NULL);
8735   assert(wand->signature == WandSignature);
8736   if (wand->debug != MagickFalse)
8737     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8738   if (wand->images == (Image *) NULL)
8739     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8740   DeleteImageFromList(&wand->images);
8741   return(MagickTrue);
8742 }
8743 \f
8744 /*
8745 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8746 %                                                                             %
8747 %                                                                             %
8748 %                                                                             %
8749 %   M a g i c k R e s a m p l e I m a g e                                     %
8750 %                                                                             %
8751 %                                                                             %
8752 %                                                                             %
8753 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8754 %
8755 %  MagickResampleImage() resample image to desired resolution.
8756 %
8757 %    Bessel   Blackman   Box
8758 %    Catrom   Cubic      Gaussian
8759 %    Hanning  Hermite    Lanczos
8760 %    Mitchell Point      Quandratic
8761 %    Sinc     Triangle
8762 %
8763 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8764 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8765 %  are windowed (brought down to zero) with the Blackman filter.
8766 %
8767 %  The format of the MagickResampleImage method is:
8768 %
8769 %      MagickBooleanType MagickResampleImage(MagickWand *wand,
8770 %        const double x_resolution,const double y_resolution,
8771 %        const FilterTypes filter,const double blur)
8772 %
8773 %  A description of each parameter follows:
8774 %
8775 %    o wand: the magick wand.
8776 %
8777 %    o x_resolution: the new image x resolution.
8778 %
8779 %    o y_resolution: the new image y resolution.
8780 %
8781 %    o filter: Image filter to use.
8782 %
8783 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8784 %
8785 */
8786 WandExport MagickBooleanType MagickResampleImage(MagickWand *wand,
8787   const double x_resolution,const double y_resolution,const FilterTypes filter,
8788   const double blur)
8789 {
8790   Image
8791     *resample_image;
8792
8793   assert(wand != (MagickWand *) NULL);
8794   assert(wand->signature == WandSignature);
8795   if (wand->debug != MagickFalse)
8796     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8797   if (wand->images == (Image *) NULL)
8798     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8799   resample_image=ResampleImage(wand->images,x_resolution,y_resolution,filter,
8800     blur,wand->exception);
8801   if (resample_image == (Image *) NULL)
8802     return(MagickFalse);
8803   ReplaceImageInList(&wand->images,resample_image);
8804   return(MagickTrue);
8805 }
8806 \f
8807 /*
8808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8809 %                                                                             %
8810 %                                                                             %
8811 %                                                                             %
8812 %   M a g i c k R e s e t I m a g e P a g e                                   %
8813 %                                                                             %
8814 %                                                                             %
8815 %                                                                             %
8816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8817 %
8818 %  MagickResetImagePage() resets the Wand page canvas and position.
8819 %
8820 %  The format of the MagickResetImagePage method is:
8821 %
8822 %      MagickBooleanType MagickResetImagePage(MagickWand *wand,
8823 %        const char *page)
8824 %
8825 %  A description of each parameter follows:
8826 %
8827 %    o wand: the magick wand.
8828 %
8829 %    o page: the relative page specification.
8830 %
8831 */
8832 WandExport MagickBooleanType MagickResetImagePage(MagickWand *wand,
8833   const char *page)
8834 {
8835   assert(wand != (MagickWand *) NULL);
8836   assert(wand->signature == WandSignature);
8837   if (wand->debug != MagickFalse)
8838     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8839   if (wand->images == (Image *) NULL)
8840     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8841   if ((page == (char *) NULL) || (*page == '\0'))
8842     {
8843       (void) ParseAbsoluteGeometry("0x0+0+0",&wand->images->page);
8844       return(MagickTrue);
8845     }
8846   return(ResetImagePage(wand->images,page));
8847 }
8848 \f
8849 /*
8850 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8851 %                                                                             %
8852 %                                                                             %
8853 %                                                                             %
8854 %   M a g i c k R e s i z e I m a g e                                         %
8855 %                                                                             %
8856 %                                                                             %
8857 %                                                                             %
8858 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8859 %
8860 %  MagickResizeImage() scales an image to the desired dimensions with one of
8861 %  these filters:
8862 %
8863 %    Bessel   Blackman   Box
8864 %    Catrom   Cubic      Gaussian
8865 %    Hanning  Hermite    Lanczos
8866 %    Mitchell Point      Quandratic
8867 %    Sinc     Triangle
8868 %
8869 %  Most of the filters are FIR (finite impulse response), however, Bessel,
8870 %  Gaussian, and Sinc are IIR (infinite impulse response).  Bessel and Sinc
8871 %  are windowed (brought down to zero) with the Blackman filter.
8872 %
8873 %  The format of the MagickResizeImage method is:
8874 %
8875 %      MagickBooleanType MagickResizeImage(MagickWand *wand,
8876 %        const size_t columns,const size_t rows,
8877 %        const FilterTypes filter,const double blur)
8878 %
8879 %  A description of each parameter follows:
8880 %
8881 %    o wand: the magick wand.
8882 %
8883 %    o columns: the number of columns in the scaled image.
8884 %
8885 %    o rows: the number of rows in the scaled image.
8886 %
8887 %    o filter: Image filter to use.
8888 %
8889 %    o blur: the blur factor where > 1 is blurry, < 1 is sharp.
8890 %
8891 */
8892 WandExport MagickBooleanType MagickResizeImage(MagickWand *wand,
8893   const size_t columns,const size_t rows,const FilterTypes filter,
8894   const double blur)
8895 {
8896   Image
8897     *resize_image;
8898
8899   assert(wand != (MagickWand *) NULL);
8900   assert(wand->signature == WandSignature);
8901   if (wand->debug != MagickFalse)
8902     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8903   if (wand->images == (Image *) NULL)
8904     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8905   resize_image=ResizeImage(wand->images,columns,rows,filter,blur,
8906     wand->exception);
8907   if (resize_image == (Image *) NULL)
8908     return(MagickFalse);
8909   ReplaceImageInList(&wand->images,resize_image);
8910   return(MagickTrue);
8911 }
8912 \f
8913 /*
8914 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8915 %                                                                             %
8916 %                                                                             %
8917 %                                                                             %
8918 %   M a g i c k R o l l I m a g e                                             %
8919 %                                                                             %
8920 %                                                                             %
8921 %                                                                             %
8922 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8923 %
8924 %  MagickRollImage() offsets an image as defined by x and y.
8925 %
8926 %  The format of the MagickRollImage method is:
8927 %
8928 %      MagickBooleanType MagickRollImage(MagickWand *wand,const ssize_t x,
8929 %        const size_t y)
8930 %
8931 %  A description of each parameter follows:
8932 %
8933 %    o wand: the magick wand.
8934 %
8935 %    o x: the x offset.
8936 %
8937 %    o y: the y offset.
8938 %
8939 %
8940 */
8941 WandExport MagickBooleanType MagickRollImage(MagickWand *wand,
8942   const ssize_t x,const ssize_t y)
8943 {
8944   Image
8945     *roll_image;
8946
8947   assert(wand != (MagickWand *) NULL);
8948   assert(wand->signature == WandSignature);
8949   if (wand->debug != MagickFalse)
8950     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
8951   if (wand->images == (Image *) NULL)
8952     ThrowWandException(WandError,"ContainsNoImages",wand->name);
8953   roll_image=RollImage(wand->images,x,y,wand->exception);
8954   if (roll_image == (Image *) NULL)
8955     return(MagickFalse);
8956   ReplaceImageInList(&wand->images,roll_image);
8957   return(MagickTrue);
8958 }
8959 \f
8960 /*
8961 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8962 %                                                                             %
8963 %                                                                             %
8964 %                                                                             %
8965 %   M a g i c k R o t a t e I m a g e                                         %
8966 %                                                                             %
8967 %                                                                             %
8968 %                                                                             %
8969 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8970 %
8971 %  MagickRotateImage() rotates an image the specified number of degrees. Empty
8972 %  triangles left over from rotating the image are filled with the
8973 %  background color.
8974 %
8975 %  The format of the MagickRotateImage method is:
8976 %
8977 %      MagickBooleanType MagickRotateImage(MagickWand *wand,
8978 %        const PixelWand *background,const double degrees)
8979 %
8980 %  A description of each parameter follows:
8981 %
8982 %    o wand: the magick wand.
8983 %
8984 %    o background: the background pixel wand.
8985 %
8986 %    o degrees: the number of degrees to rotate the image.
8987 %
8988 %
8989 */
8990 WandExport MagickBooleanType MagickRotateImage(MagickWand *wand,
8991   const PixelWand *background,const double degrees)
8992 {
8993   Image
8994     *rotate_image;
8995
8996   assert(wand != (MagickWand *) NULL);
8997   assert(wand->signature == WandSignature);
8998   if (wand->debug != MagickFalse)
8999     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9000   if (wand->images == (Image *) NULL)
9001     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9002   PixelGetQuantumColor(background,&wand->images->background_color);
9003   rotate_image=RotateImage(wand->images,degrees,wand->exception);
9004   if (rotate_image == (Image *) NULL)
9005     return(MagickFalse);
9006   ReplaceImageInList(&wand->images,rotate_image);
9007   return(MagickTrue);
9008 }
9009 \f
9010 /*
9011 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9012 %                                                                             %
9013 %                                                                             %
9014 %                                                                             %
9015 %   M a g i c k S a m p l e I m a g e                                         %
9016 %                                                                             %
9017 %                                                                             %
9018 %                                                                             %
9019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9020 %
9021 %  MagickSampleImage() scales an image to the desired dimensions with pixel
9022 %  sampling.  Unlike other scaling methods, this method does not introduce
9023 %  any additional color into the scaled image.
9024 %
9025 %  The format of the MagickSampleImage method is:
9026 %
9027 %      MagickBooleanType MagickSampleImage(MagickWand *wand,
9028 %        const size_t columns,const size_t rows)
9029 %
9030 %  A description of each parameter follows:
9031 %
9032 %    o wand: the magick wand.
9033 %
9034 %    o columns: the number of columns in the scaled image.
9035 %
9036 %    o rows: the number of rows in the scaled image.
9037 %
9038 %
9039 */
9040 WandExport MagickBooleanType MagickSampleImage(MagickWand *wand,
9041   const size_t columns,const size_t rows)
9042 {
9043   Image
9044     *sample_image;
9045
9046   assert(wand != (MagickWand *) NULL);
9047   assert(wand->signature == WandSignature);
9048   if (wand->debug != MagickFalse)
9049     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9050   if (wand->images == (Image *) NULL)
9051     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9052   sample_image=SampleImage(wand->images,columns,rows,wand->exception);
9053   if (sample_image == (Image *) NULL)
9054     return(MagickFalse);
9055   ReplaceImageInList(&wand->images,sample_image);
9056   return(MagickTrue);
9057 }
9058 \f
9059 /*
9060 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9061 %                                                                             %
9062 %                                                                             %
9063 %                                                                             %
9064 %   M a g i c k S c a l e I m a g e                                           %
9065 %                                                                             %
9066 %                                                                             %
9067 %                                                                             %
9068 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9069 %
9070 %  MagickScaleImage() scales the size of an image to the given dimensions.
9071 %
9072 %  The format of the MagickScaleImage method is:
9073 %
9074 %      MagickBooleanType MagickScaleImage(MagickWand *wand,
9075 %        const size_t columns,const size_t rows)
9076 %
9077 %  A description of each parameter follows:
9078 %
9079 %    o wand: the magick wand.
9080 %
9081 %    o columns: the number of columns in the scaled image.
9082 %
9083 %    o rows: the number of rows in the scaled image.
9084 %
9085 %
9086 */
9087 WandExport MagickBooleanType MagickScaleImage(MagickWand *wand,
9088   const size_t columns,const size_t rows)
9089 {
9090   Image
9091     *scale_image;
9092
9093   assert(wand != (MagickWand *) NULL);
9094   assert(wand->signature == WandSignature);
9095   if (wand->debug != MagickFalse)
9096     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9097   if (wand->images == (Image *) NULL)
9098     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9099   scale_image=ScaleImage(wand->images,columns,rows,wand->exception);
9100   if (scale_image == (Image *) NULL)
9101     return(MagickFalse);
9102   ReplaceImageInList(&wand->images,scale_image);
9103   return(MagickTrue);
9104 }
9105 \f
9106 /*
9107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9108 %                                                                             %
9109 %                                                                             %
9110 %                                                                             %
9111 %   M a g i c k S e g m e n t I m a g e                                       %
9112 %                                                                             %
9113 %                                                                             %
9114 %                                                                             %
9115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9116 %
9117 %  MagickSegmentImage() segments an image by analyzing the histograms of the
9118 %  color components and identifying units that are homogeneous with the fuzzy
9119 %  C-means technique.
9120 %
9121 %  The format of the SegmentImage method is:
9122 %
9123 %      MagickBooleanType MagickSegmentImage(MagickWand *wand,
9124 %        const ColorspaceType colorspace,const MagickBooleanType verbose,
9125 %        const double cluster_threshold,const double smooth_threshold)
9126 %
9127 %  A description of each parameter follows.
9128 %
9129 %    o wand: the wand.
9130 %
9131 %    o colorspace: the image colorspace.
9132 %
9133 %    o verbose:  Set to MagickTrue to print detailed information about the
9134 %      identified classes.
9135 %
9136 %    o cluster_threshold:  This represents the minimum number of pixels
9137 %      contained in a hexahedra before it can be considered valid (expressed as
9138 %      a percentage).
9139 %
9140 %    o smooth_threshold: the smoothing threshold eliminates noise in the second
9141 %      derivative of the histogram.  As the value is increased, you can expect a
9142 %      smoother second derivative.
9143 %
9144 */
9145 MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand,
9146   const ColorspaceType colorspace,const MagickBooleanType verbose,
9147   const double cluster_threshold,const double smooth_threshold)
9148 {
9149   MagickBooleanType
9150     status;
9151
9152   assert(wand != (MagickWand *) NULL);
9153   assert(wand->signature == WandSignature);
9154   if (wand->debug != MagickFalse)
9155     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9156   if (wand->images == (Image *) NULL)
9157     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9158   status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold,
9159     smooth_threshold);
9160   if (status == MagickFalse)
9161     InheritException(wand->exception,&wand->images->exception);
9162   return(status);
9163 }
9164 \f
9165 /*
9166 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9167 %                                                                             %
9168 %                                                                             %
9169 %                                                                             %
9170 %   M a g i c k S e l e c t i v e B l u r I m a g e                           %
9171 %                                                                             %
9172 %                                                                             %
9173 %                                                                             %
9174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9175 %
9176 %  MagickSelectiveBlurImage() selectively blur an image within a contrast
9177 %  threshold. It is similar to the unsharpen mask that sharpens everything with
9178 %  contrast above a certain threshold.
9179 %
9180 %  The format of the MagickSelectiveBlurImage method is:
9181 %
9182 %      MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9183 %        const double radius,const double sigma,const double threshold)
9184 %      MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
9185 %        const ChannelType channel,const double radius,const double sigma,
9186 %        const double threshold)
9187 %
9188 %  A description of each parameter follows:
9189 %
9190 %    o wand: the magick wand.
9191 %
9192 %    o channel: the image channel(s).
9193 %
9194 %    o radius: the radius of the gaussian, in pixels, not counting the center
9195 %      pixel.
9196 %
9197 %    o sigma: the standard deviation of the gaussian, in pixels.
9198 %
9199 %    o threshold: only pixels within this contrast threshold are included
9200 %      in the blur operation.
9201 %
9202 */
9203
9204 WandExport MagickBooleanType MagickSelectiveBlurImage(MagickWand *wand,
9205   const double radius,const double sigma,const double threshold)
9206 {
9207   MagickBooleanType
9208     status;
9209
9210   status=MagickSelectiveBlurImageChannel(wand,DefaultChannels,radius,sigma,
9211     threshold);
9212   return(status);
9213 }
9214
9215 WandExport MagickBooleanType MagickSelectiveBlurImageChannel(MagickWand *wand,
9216   const ChannelType channel,const double radius,const double sigma,
9217   const double threshold)
9218 {
9219   Image
9220     *blur_image;
9221
9222   assert(wand != (MagickWand *) NULL);
9223   assert(wand->signature == WandSignature);
9224   if (wand->debug != MagickFalse)
9225     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9226   if (wand->images == (Image *) NULL)
9227     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9228   blur_image=SelectiveBlurImageChannel(wand->images,channel,radius,sigma,
9229     threshold,wand->exception);
9230   if (blur_image == (Image *) NULL)
9231     return(MagickFalse);
9232   ReplaceImageInList(&wand->images,blur_image);
9233   return(MagickTrue);
9234 }
9235 \f
9236 /*
9237 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9238 %                                                                             %
9239 %                                                                             %
9240 %                                                                             %
9241 %   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                       %
9242 %                                                                             %
9243 %                                                                             %
9244 %                                                                             %
9245 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9246 %
9247 %  MagickSeparateImageChannel() separates a channel from the image and returns a
9248 %  grayscale image.  A channel is a particular color component of each pixel
9249 %  in the image.
9250 %
9251 %  The format of the MagickSeparateImageChannel method is:
9252 %
9253 %      MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
9254 %        const ChannelType channel)
9255 %
9256 %  A description of each parameter follows:
9257 %
9258 %    o wand: the magick wand.
9259 %
9260 %    o channel: the image channel(s).
9261 %
9262 */
9263 WandExport MagickBooleanType MagickSeparateImageChannel(MagickWand *wand,
9264   const ChannelType channel)
9265 {
9266   MagickBooleanType
9267     status;
9268
9269   assert(wand != (MagickWand *) NULL);
9270   assert(wand->signature == WandSignature);
9271   if (wand->debug != MagickFalse)
9272     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9273   if (wand->images == (Image *) NULL)
9274     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9275   status=SeparateImageChannel(wand->images,channel);
9276   if (status == MagickFalse)
9277     InheritException(wand->exception,&wand->images->exception);
9278   return(status);
9279 }
9280 \f
9281 /*
9282 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9283 %                                                                             %
9284 %                                                                             %
9285 %                                                                             %
9286 %     M a g i c k S e p i a T o n e I m a g e                                 %
9287 %                                                                             %
9288 %                                                                             %
9289 %                                                                             %
9290 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9291 %
9292 %  MagickSepiaToneImage() applies a special effect to the image, similar to the
9293 %  effect achieved in a photo darkroom by sepia toning.  Threshold ranges from
9294 %  0 to QuantumRange and is a measure of the extent of the sepia toning.  A
9295 %  threshold of 80% is a good starting point for a reasonable tone.
9296 %
9297 %  The format of the MagickSepiaToneImage method is:
9298 %
9299 %      MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9300 %        const double threshold)
9301 %
9302 %  A description of each parameter follows:
9303 %
9304 %    o wand: the magick wand.
9305 %
9306 %    o threshold:  Define the extent of the sepia toning.
9307 %
9308 */
9309 WandExport MagickBooleanType MagickSepiaToneImage(MagickWand *wand,
9310   const double threshold)
9311 {
9312   Image
9313     *sepia_image;
9314
9315   assert(wand != (MagickWand *) NULL);
9316   assert(wand->signature == WandSignature);
9317   if (wand->debug != MagickFalse)
9318     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9319   if (wand->images == (Image *) NULL)
9320     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9321   sepia_image=SepiaToneImage(wand->images,threshold,wand->exception);
9322   if (sepia_image == (Image *) NULL)
9323     return(MagickFalse);
9324   ReplaceImageInList(&wand->images,sepia_image);
9325   return(MagickTrue);
9326 }
9327 \f
9328 /*
9329 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9330 %                                                                             %
9331 %                                                                             %
9332 %                                                                             %
9333 %   M a g i c k S e t I m a g e                                               %
9334 %                                                                             %
9335 %                                                                             %
9336 %                                                                             %
9337 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9338 %
9339 %  MagickSetImage() replaces the last image returned by MagickSetImageIndex(),
9340 %  MagickNextImage(), MagickPreviousImage() with the images from the specified
9341 %  wand.
9342 %
9343 %  The format of the MagickSetImage method is:
9344 %
9345 %      MagickBooleanType MagickSetImage(MagickWand *wand,
9346 %        const MagickWand *set_wand)
9347 %
9348 %  A description of each parameter follows:
9349 %
9350 %    o wand: the magick wand.
9351 %
9352 %    o set_wand: the set_wand wand.
9353 %
9354 */
9355 WandExport MagickBooleanType MagickSetImage(MagickWand *wand,
9356   const MagickWand *set_wand)
9357 {
9358   Image
9359     *images;
9360
9361   assert(wand != (MagickWand *) NULL);
9362   assert(wand->signature == WandSignature);
9363   if (wand->debug != MagickFalse)
9364     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9365   assert(set_wand != (MagickWand *) NULL);
9366   assert(set_wand->signature == WandSignature);
9367   if (wand->debug != MagickFalse)
9368     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",set_wand->name);
9369   if (set_wand->images == (Image *) NULL)
9370     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9371   images=CloneImageList(set_wand->images,wand->exception);
9372   if (images == (Image *) NULL)
9373     return(MagickFalse);
9374   ReplaceImageInList(&wand->images,images);
9375   return(MagickTrue);
9376 }
9377 \f
9378 /*
9379 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9380 %                                                                             %
9381 %                                                                             %
9382 %                                                                             %
9383 %   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                       %
9384 %                                                                             %
9385 %                                                                             %
9386 %                                                                             %
9387 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9388 %
9389 %  MagickSetImageAlphaChannel() activates, deactivates, resets, or sets the
9390 %  alpha channel.
9391 %
9392 %  The format of the MagickSetImageAlphaChannel method is:
9393 %
9394 %      MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9395 %        const AlphaChannelType alpha_type)
9396 %
9397 %  A description of each parameter follows:
9398 %
9399 %    o wand: the magick wand.
9400 %
9401 %    o alpha_type: the alpha channel type: ActivateAlphaChannel,
9402 %      DeactivateAlphaChannel, OpaqueAlphaChannel, or SetAlphaChannel.
9403 %
9404 */
9405 WandExport MagickBooleanType MagickSetImageAlphaChannel(MagickWand *wand,
9406   const AlphaChannelType alpha_type)
9407 {
9408   assert(wand != (MagickWand *) NULL);
9409   assert(wand->signature == WandSignature);
9410   if (wand->debug != MagickFalse)
9411     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9412   if (wand->images == (Image *) NULL)
9413     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9414   return(SetImageAlphaChannel(wand->images,alpha_type));
9415 }
9416 \f
9417 /*
9418 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9419 %                                                                             %
9420 %                                                                             %
9421 %                                                                             %
9422 %   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                 %
9423 %                                                                             %
9424 %                                                                             %
9425 %                                                                             %
9426 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9427 %
9428 %  MagickSetImageBackgroundColor() sets the image background color.
9429 %
9430 %  The format of the MagickSetImageBackgroundColor method is:
9431 %
9432 %      MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9433 %        const PixelWand *background)
9434 %
9435 %  A description of each parameter follows:
9436 %
9437 %    o wand: the magick wand.
9438 %
9439 %    o background: the background pixel wand.
9440 %
9441 */
9442 WandExport MagickBooleanType MagickSetImageBackgroundColor(MagickWand *wand,
9443   const PixelWand *background)
9444 {
9445   assert(wand != (MagickWand *) NULL);
9446   assert(wand->signature == WandSignature);
9447   if (wand->debug != MagickFalse)
9448     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9449   if (wand->images == (Image *) NULL)
9450     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9451   PixelGetQuantumColor(background,&wand->images->background_color);
9452   return(MagickTrue);
9453 }
9454 \f
9455 /*
9456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9457 %                                                                             %
9458 %                                                                             %
9459 %                                                                             %
9460 %   M a g i c k S e t I m a g e B i a s                                       %
9461 %                                                                             %
9462 %                                                                             %
9463 %                                                                             %
9464 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9465 %
9466 %  MagickSetImageBias() sets the image bias for any method that convolves an
9467 %  image (e.g. MagickConvolveImage()).
9468 %
9469 %  The format of the MagickSetImageBias method is:
9470 %
9471 %      MagickBooleanType MagickSetImageBias(MagickWand *wand,
9472 %        const double bias)
9473 %
9474 %  A description of each parameter follows:
9475 %
9476 %    o wand: the magick wand.
9477 %
9478 %    o bias: the image bias.
9479 %
9480 */
9481 WandExport MagickBooleanType MagickSetImageBias(MagickWand *wand,
9482   const double bias)
9483 {
9484   assert(wand != (MagickWand *) NULL);
9485   assert(wand->signature == WandSignature);
9486   if (wand->debug != MagickFalse)
9487     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9488   if (wand->images == (Image *) NULL)
9489     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9490   wand->images->bias=bias;
9491   return(MagickTrue);
9492 }
9493 \f
9494 /*
9495 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9496 %                                                                             %
9497 %                                                                             %
9498 %                                                                             %
9499 %   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                         %
9500 %                                                                             %
9501 %                                                                             %
9502 %                                                                             %
9503 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9504 %
9505 %  MagickSetImageBluePrimary() sets the image chromaticity blue primary point.
9506 %
9507 %  The format of the MagickSetImageBluePrimary method is:
9508 %
9509 %      MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9510 %        const double x,const double y)
9511 %
9512 %  A description of each parameter follows:
9513 %
9514 %    o wand: the magick wand.
9515 %
9516 %    o x: the blue primary x-point.
9517 %
9518 %    o y: the blue primary y-point.
9519 %
9520 */
9521 WandExport MagickBooleanType MagickSetImageBluePrimary(MagickWand *wand,
9522   const double x,const double y)
9523 {
9524   assert(wand != (MagickWand *) NULL);
9525   assert(wand->signature == WandSignature);
9526   if (wand->debug != MagickFalse)
9527     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9528   if (wand->images == (Image *) NULL)
9529     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9530   wand->images->chromaticity.blue_primary.x=x;
9531   wand->images->chromaticity.blue_primary.y=y;
9532   return(MagickTrue);
9533 }
9534 \f
9535 /*
9536 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9537 %                                                                             %
9538 %                                                                             %
9539 %                                                                             %
9540 %   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                         %
9541 %                                                                             %
9542 %                                                                             %
9543 %                                                                             %
9544 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9545 %
9546 %  MagickSetImageBorderColor() sets the image border color.
9547 %
9548 %  The format of the MagickSetImageBorderColor method is:
9549 %
9550 %      MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9551 %        const PixelWand *border)
9552 %
9553 %  A description of each parameter follows:
9554 %
9555 %    o wand: the magick wand.
9556 %
9557 %    o border: the border pixel wand.
9558 %
9559 */
9560 WandExport MagickBooleanType MagickSetImageBorderColor(MagickWand *wand,
9561   const PixelWand *border)
9562 {
9563   assert(wand != (MagickWand *) NULL);
9564   assert(wand->signature == WandSignature);
9565   if (wand->debug != MagickFalse)
9566     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9567   if (wand->images == (Image *) NULL)
9568     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9569   PixelGetQuantumColor(border,&wand->images->border_color);
9570   return(MagickTrue);
9571 }
9572 \f
9573 /*
9574 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9575 %                                                                             %
9576 %                                                                             %
9577 %                                                                             %
9578 %   M a g i c k S e t I m a g e C h a n n e l D e p t h                       %
9579 %                                                                             %
9580 %                                                                             %
9581 %                                                                             %
9582 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9583 %
9584 %  MagickSetImageChannelDepth() sets the depth of a particular image channel.
9585 %
9586 %  The format of the MagickSetImageChannelDepth method is:
9587 %
9588 %      MagickBooleanType MagickSetImageChannelDepth(MagickWand *wand,
9589 %        const ChannelType channel,const size_t depth)
9590 %
9591 %  A description of each parameter follows:
9592 %
9593 %    o wand: the magick wand.
9594 %
9595 %    o channel: the image channel(s).
9596 %
9597 %    o depth: the image depth in bits.
9598 %
9599 */
9600 WandExport MagickBooleanType MagickSetImageChannelDepth(MagickWand *wand,
9601   const ChannelType channel,const size_t depth)
9602 {
9603   assert(wand != (MagickWand *) NULL);
9604   assert(wand->signature == WandSignature);
9605   if (wand->debug != MagickFalse)
9606     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9607   if (wand->images == (Image *) NULL)
9608     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9609   return(SetImageChannelDepth(wand->images,channel,depth));
9610 }
9611 \f
9612 /*
9613 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9614 %                                                                             %
9615 %                                                                             %
9616 %                                                                             %
9617 %   M a g i c k S e t I m a g e C l i p M a s k                               %
9618 %                                                                             %
9619 %                                                                             %
9620 %                                                                             %
9621 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9622 %
9623 %  MagickSetImageClipMask() sets image clip mask.
9624 %
9625 %  The format of the MagickSetImageClipMask method is:
9626 %
9627 %      MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
9628 %        const MagickWand *clip_mask)
9629 %
9630 %  A description of each parameter follows:
9631 %
9632 %    o wand: the magick wand.
9633 %
9634 %    o clip_mask: the clip_mask wand.
9635 %
9636 */
9637 WandExport MagickBooleanType MagickSetImageClipMask(MagickWand *wand,
9638   const MagickWand *clip_mask)
9639 {
9640   assert(wand != (MagickWand *) NULL);
9641   assert(wand->signature == WandSignature);
9642   if (wand->debug != MagickFalse)
9643     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9644   assert(clip_mask != (MagickWand *) NULL);
9645   assert(clip_mask->signature == WandSignature);
9646   if (wand->debug != MagickFalse)
9647     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clip_mask->name);
9648   if (clip_mask->images == (Image *) NULL)
9649     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9650   return(SetImageClipMask(wand->images,clip_mask->images));
9651 }
9652 \f
9653 /*
9654 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9655 %                                                                             %
9656 %                                                                             %
9657 %                                                                             %
9658 %   M a g i c k S e t I m a g e C o l o r                                     %
9659 %                                                                             %
9660 %                                                                             %
9661 %                                                                             %
9662 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9663 %
9664 %  MagickSetImageColor() set the entire wand canvas to the specified color.
9665 %
9666 %  The format of the MagickSetImageColor method is:
9667 %
9668 %      MagickBooleanType MagickSetImageColor(MagickWand *wand,
9669 %        const PixelWand *color)
9670 %
9671 %  A description of each parameter follows:
9672 %
9673 %    o wand: the magick wand.
9674 %
9675 %    o background: the image color.
9676 %
9677 */
9678 WandExport MagickBooleanType MagickSetImageColor(MagickWand *wand,
9679   const PixelWand *color)
9680 {
9681   MagickBooleanType
9682     status;
9683
9684   MagickPixelPacket
9685     pixel;
9686
9687   assert(wand != (MagickWand *) NULL);
9688   assert(wand->signature == WandSignature);
9689   if (wand->debug != MagickFalse)
9690     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9691   PixelGetMagickColor(color,&pixel);
9692   status=SetImageColor(wand->images,&pixel);
9693   if (status == MagickFalse)
9694     InheritException(wand->exception,&wand->images->exception);
9695   return(status);
9696 }
9697 \f
9698 /*
9699 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9700 %                                                                             %
9701 %                                                                             %
9702 %                                                                             %
9703 %   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                     %
9704 %                                                                             %
9705 %                                                                             %
9706 %                                                                             %
9707 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9708 %
9709 %  MagickSetImageColormapColor() sets the color of the specified colormap
9710 %  index.
9711 %
9712 %  The format of the MagickSetImageColormapColor method is:
9713 %
9714 %      MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9715 %        const size_t index,const PixelWand *color)
9716 %
9717 %  A description of each parameter follows:
9718 %
9719 %    o wand: the magick wand.
9720 %
9721 %    o index: the offset into the image colormap.
9722 %
9723 %    o color: Return the colormap color in this wand.
9724 %
9725 */
9726 WandExport MagickBooleanType MagickSetImageColormapColor(MagickWand *wand,
9727   const size_t index,const PixelWand *color)
9728 {
9729   assert(wand != (MagickWand *) NULL);
9730   assert(wand->signature == WandSignature);
9731   if (wand->debug != MagickFalse)
9732     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9733   if (wand->images == (Image *) NULL)
9734     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9735   if ((wand->images->colormap == (PixelPacket *) NULL) ||
9736       (index >= wand->images->colors))
9737     ThrowWandException(WandError,"InvalidColormapIndex",wand->name);
9738   PixelGetQuantumColor(color,wand->images->colormap+index);
9739   return(SyncImage(wand->images));
9740 }
9741 \f
9742 /*
9743 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9744 %                                                                             %
9745 %                                                                             %
9746 %                                                                             %
9747 %   M a g i c k S e t I m a g e C o l o r s p a c e                           %
9748 %                                                                             %
9749 %                                                                             %
9750 %                                                                             %
9751 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9752 %
9753 %  MagickSetImageColorspace() sets the image colorspace.
9754 %
9755 %  The format of the MagickSetImageColorspace method is:
9756 %
9757 %      MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9758 %        const ColorspaceType colorspace)
9759 %
9760 %  A description of each parameter follows:
9761 %
9762 %    o wand: the magick wand.
9763 %
9764 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
9765 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
9766 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
9767 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
9768 %      HSLColorspace, or HWBColorspace.
9769 %
9770 */
9771 WandExport MagickBooleanType MagickSetImageColorspace(MagickWand *wand,
9772   const ColorspaceType colorspace)
9773 {
9774   assert(wand != (MagickWand *) NULL);
9775   assert(wand->signature == WandSignature);
9776   if (wand->debug != MagickFalse)
9777     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9778   if (wand->images == (Image *) NULL)
9779     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9780   return(SetImageColorspace(wand->images,colorspace));
9781 }
9782 \f
9783 /*
9784 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9785 %                                                                             %
9786 %                                                                             %
9787 %                                                                             %
9788 %   M a g i c k S e t I m a g e C o m p o s e                                 %
9789 %                                                                             %
9790 %                                                                             %
9791 %                                                                             %
9792 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9793 %
9794 %  MagickSetImageCompose() sets the image composite operator, useful for
9795 %  specifying how to composite the image thumbnail when using the
9796 %  MagickMontageImage() method.
9797 %
9798 %  The format of the MagickSetImageCompose method is:
9799 %
9800 %      MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9801 %        const CompositeOperator compose)
9802 %
9803 %  A description of each parameter follows:
9804 %
9805 %    o wand: the magick wand.
9806 %
9807 %    o compose: the image composite operator.
9808 %
9809 */
9810 WandExport MagickBooleanType MagickSetImageCompose(MagickWand *wand,
9811   const CompositeOperator compose)
9812 {
9813   assert(wand != (MagickWand *) NULL);
9814   assert(wand->signature == WandSignature);
9815   if (wand->debug != MagickFalse)
9816     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9817   if (wand->images == (Image *) NULL)
9818     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9819   wand->images->compose=compose;
9820   return(MagickTrue);
9821 }
9822 \f
9823 /*
9824 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9825 %                                                                             %
9826 %                                                                             %
9827 %                                                                             %
9828 %   M a g i c k S e t I m a g e C o m p r e s s i o n                         %
9829 %                                                                             %
9830 %                                                                             %
9831 %                                                                             %
9832 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9833 %
9834 %  MagickSetImageCompression() sets the image compression.
9835 %
9836 %  The format of the MagickSetImageCompression method is:
9837 %
9838 %      MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9839 %        const CompressionType compression)
9840 %
9841 %  A description of each parameter follows:
9842 %
9843 %    o wand: the magick wand.
9844 %
9845 %    o compression: the image compression type.
9846 %
9847 */
9848 WandExport MagickBooleanType MagickSetImageCompression(MagickWand *wand,
9849   const CompressionType compression)
9850 {
9851   assert(wand != (MagickWand *) NULL);
9852   assert(wand->signature == WandSignature);
9853   if (wand->debug != MagickFalse)
9854     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9855   if (wand->images == (Image *) NULL)
9856     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9857   wand->images->compression=compression;
9858   return(MagickTrue);
9859 }
9860 \f
9861 /*
9862 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9863 %                                                                             %
9864 %                                                                             %
9865 %                                                                             %
9866 %   M a g i c k S e t I m a g e C o m p r e s s i o n Q u a l i t y           %
9867 %                                                                             %
9868 %                                                                             %
9869 %                                                                             %
9870 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9871 %
9872 %  MagickSetImageCompressionQuality() sets the image compression quality.
9873 %
9874 %  The format of the MagickSetImageCompressionQuality method is:
9875 %
9876 %      MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9877 %        const size_t quality)
9878 %
9879 %  A description of each parameter follows:
9880 %
9881 %    o wand: the magick wand.
9882 %
9883 %    o quality: the image compression tlityype.
9884 %
9885 */
9886 WandExport MagickBooleanType MagickSetImageCompressionQuality(MagickWand *wand,
9887   const size_t quality)
9888 {
9889   assert(wand != (MagickWand *) NULL);
9890   assert(wand->signature == WandSignature);
9891   if (wand->debug != MagickFalse)
9892     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9893   if (wand->images == (Image *) NULL)
9894     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9895   wand->images->quality=quality;
9896   return(MagickTrue);
9897 }
9898 \f
9899 /*
9900 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9901 %                                                                             %
9902 %                                                                             %
9903 %                                                                             %
9904 %   M a g i c k S e t I m a g e D e l a y                                     %
9905 %                                                                             %
9906 %                                                                             %
9907 %                                                                             %
9908 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9909 %
9910 %  MagickSetImageDelay() sets the image delay.
9911 %
9912 %  The format of the MagickSetImageDelay method is:
9913 %
9914 %      MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9915 %        const size_t delay)
9916 %
9917 %  A description of each parameter follows:
9918 %
9919 %    o wand: the magick wand.
9920 %
9921 %    o delay: the image delay in ticks-per-second units.
9922 %
9923 */
9924 WandExport MagickBooleanType MagickSetImageDelay(MagickWand *wand,
9925   const size_t delay)
9926 {
9927   assert(wand != (MagickWand *) NULL);
9928   assert(wand->signature == WandSignature);
9929   if (wand->debug != MagickFalse)
9930     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9931   if (wand->images == (Image *) NULL)
9932     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9933   wand->images->delay=delay;
9934   return(MagickTrue);
9935 }
9936 \f
9937 /*
9938 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9939 %                                                                             %
9940 %                                                                             %
9941 %                                                                             %
9942 %   M a g i c k S e t I m a g e D e p t h                                     %
9943 %                                                                             %
9944 %                                                                             %
9945 %                                                                             %
9946 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9947 %
9948 %  MagickSetImageDepth() sets the image depth.
9949 %
9950 %  The format of the MagickSetImageDepth method is:
9951 %
9952 %      MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9953 %        const size_t depth)
9954 %
9955 %  A description of each parameter follows:
9956 %
9957 %    o wand: the magick wand.
9958 %
9959 %    o depth: the image depth in bits: 8, 16, or 32.
9960 %
9961 */
9962 WandExport MagickBooleanType MagickSetImageDepth(MagickWand *wand,
9963   const size_t depth)
9964 {
9965   assert(wand != (MagickWand *) NULL);
9966   assert(wand->signature == WandSignature);
9967   if (wand->debug != MagickFalse)
9968     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
9969   if (wand->images == (Image *) NULL)
9970     ThrowWandException(WandError,"ContainsNoImages",wand->name);
9971   wand->images->depth=depth;
9972   return(MagickTrue);
9973 }
9974 \f
9975 /*
9976 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9977 %                                                                             %
9978 %                                                                             %
9979 %                                                                             %
9980 %   M a g i c k S e t I m a g e D i s p o s e                                 %
9981 %                                                                             %
9982 %                                                                             %
9983 %                                                                             %
9984 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9985 %
9986 %  MagickSetImageDispose() sets the image disposal method.
9987 %
9988 %  The format of the MagickSetImageDispose method is:
9989 %
9990 %      MagickBooleanType MagickSetImageDispose(MagickWand *wand,
9991 %        const DisposeType dispose)
9992 %
9993 %  A description of each parameter follows:
9994 %
9995 %    o wand: the magick wand.
9996 %
9997 %    o dispose: the image disposeal type.
9998 %
9999 */
10000 WandExport MagickBooleanType MagickSetImageDispose(MagickWand *wand,
10001   const DisposeType dispose)
10002 {
10003   assert(wand != (MagickWand *) NULL);
10004   assert(wand->signature == WandSignature);
10005   if (wand->debug != MagickFalse)
10006     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10007   if (wand->images == (Image *) NULL)
10008     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10009   wand->images->dispose=dispose;
10010   return(MagickTrue);
10011 }
10012 \f
10013 /*
10014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10015 %                                                                             %
10016 %                                                                             %
10017 %                                                                             %
10018 %   M a g i c k S e t I m a g e E x t e n t                                   %
10019 %                                                                             %
10020 %                                                                             %
10021 %                                                                             %
10022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10023 %
10024 %  MagickSetImageExtent() sets the image size (i.e. columns & rows).
10025 %
10026 %  The format of the MagickSetImageExtent method is:
10027 %
10028 %      MagickBooleanType MagickSetImageExtent(MagickWand *wand,
10029 %        const size_t columns,const unsigned rows)
10030 %
10031 %  A description of each parameter follows:
10032 %
10033 %    o wand: the magick wand.
10034 %
10035 %    o columns:  The image width in pixels.
10036 %
10037 %    o rows:  The image height in pixels.
10038 %
10039 */
10040 WandExport MagickBooleanType MagickSetImageExtent(MagickWand *wand,
10041   const size_t columns,const size_t rows)
10042 {
10043   assert(wand != (MagickWand *) NULL);
10044   assert(wand->signature == WandSignature);
10045   if (wand->debug != MagickFalse)
10046     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10047   if (wand->images == (Image *) NULL)
10048     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10049   return(SetImageExtent(wand->images,columns,rows));
10050 }
10051 \f
10052 /*
10053 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10054 %                                                                             %
10055 %                                                                             %
10056 %                                                                             %
10057 %   M a g i c k S e t I m a g e F i l e n a m e                               %
10058 %                                                                             %
10059 %                                                                             %
10060 %                                                                             %
10061 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10062 %
10063 %  MagickSetImageFilename() sets the filename of a particular image in a
10064 %  sequence.
10065 %
10066 %  The format of the MagickSetImageFilename method is:
10067 %
10068 %      MagickBooleanType MagickSetImageFilename(MagickWand *wand,
10069 %        const char *filename)
10070 %
10071 %  A description of each parameter follows:
10072 %
10073 %    o wand: the magick wand.
10074 %
10075 %    o filename: the image filename.
10076 %
10077 */
10078 WandExport MagickBooleanType MagickSetImageFilename(MagickWand *wand,
10079   const char *filename)
10080 {
10081   assert(wand != (MagickWand *) NULL);
10082   assert(wand->signature == WandSignature);
10083   if (wand->debug != MagickFalse)
10084     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10085   if (wand->images == (Image *) NULL)
10086     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10087   if (filename != (const char *) NULL)
10088     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
10089   return(MagickTrue);
10090 }
10091 \f
10092 /*
10093 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10094 %                                                                             %
10095 %                                                                             %
10096 %                                                                             %
10097 %   M a g i c k S e t I m a g e F o r m a t                                   %
10098 %                                                                             %
10099 %                                                                             %
10100 %                                                                             %
10101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10102 %
10103 %  MagickSetImageFormat() sets the format of a particular image in a
10104 %  sequence.
10105 %
10106 %  The format of the MagickSetImageFormat method is:
10107 %
10108 %      MagickBooleanType MagickSetImageFormat(MagickWand *wand,
10109 %        const char *format)
10110 %
10111 %  A description of each parameter follows:
10112 %
10113 %    o wand: the magick wand.
10114 %
10115 %    o format: the image format.
10116 %
10117 */
10118 WandExport MagickBooleanType MagickSetImageFormat(MagickWand *wand,
10119   const char *format)
10120 {
10121   const MagickInfo
10122     *magick_info;
10123
10124   assert(wand != (MagickWand *) NULL);
10125   assert(wand->signature == WandSignature);
10126   if (wand->debug != MagickFalse)
10127     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10128   if (wand->images == (Image *) NULL)
10129     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10130   if ((format == (char *) NULL) || (*format == '\0'))
10131     {
10132       *wand->images->magick='\0';
10133       return(MagickTrue);
10134     }
10135   magick_info=GetMagickInfo(format,wand->exception);
10136   if (magick_info == (const MagickInfo *) NULL)
10137     return(MagickFalse);
10138   ClearMagickException(wand->exception);
10139   (void) CopyMagickString(wand->images->magick,format,MaxTextExtent);
10140   return(MagickTrue);
10141 }
10142 \f
10143 /*
10144 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10145 %                                                                             %
10146 %                                                                             %
10147 %                                                                             %
10148 %   M a g i c k S e t I m a g e F u z z                                       %
10149 %                                                                             %
10150 %                                                                             %
10151 %                                                                             %
10152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10153 %
10154 %  MagickSetImageFuzz() sets the image fuzz.
10155 %
10156 %  The format of the MagickSetImageFuzz method is:
10157 %
10158 %      MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
10159 %        const double fuzz)
10160 %
10161 %  A description of each parameter follows:
10162 %
10163 %    o wand: the magick wand.
10164 %
10165 %    o fuzz: the image fuzz.
10166 %
10167 */
10168 WandExport MagickBooleanType MagickSetImageFuzz(MagickWand *wand,
10169   const double fuzz)
10170 {
10171   assert(wand != (MagickWand *) NULL);
10172   assert(wand->signature == WandSignature);
10173   if (wand->debug != MagickFalse)
10174     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10175   if (wand->images == (Image *) NULL)
10176     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10177   wand->images->fuzz=fuzz;
10178   return(MagickTrue);
10179 }
10180 \f
10181 /*
10182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10183 %                                                                             %
10184 %                                                                             %
10185 %                                                                             %
10186 %   M a g i c k S e t I m a g e G a m m a                                     %
10187 %                                                                             %
10188 %                                                                             %
10189 %                                                                             %
10190 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10191 %
10192 %  MagickSetImageGamma() sets the image gamma.
10193 %
10194 %  The format of the MagickSetImageGamma method is:
10195 %
10196 %      MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10197 %        const double gamma)
10198 %
10199 %  A description of each parameter follows:
10200 %
10201 %    o wand: the magick wand.
10202 %
10203 %    o gamma: the image gamma.
10204 %
10205 */
10206 WandExport MagickBooleanType MagickSetImageGamma(MagickWand *wand,
10207   const double gamma)
10208 {
10209   assert(wand != (MagickWand *) NULL);
10210   assert(wand->signature == WandSignature);
10211   if (wand->debug != MagickFalse)
10212     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10213   if (wand->images == (Image *) NULL)
10214     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10215   wand->images->gamma=gamma;
10216   return(MagickTrue);
10217 }
10218 \f
10219 /*
10220 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10221 %                                                                             %
10222 %                                                                             %
10223 %                                                                             %
10224 %   M a g i c k S e t I m a g e G r a v i t y                                 %
10225 %                                                                             %
10226 %                                                                             %
10227 %                                                                             %
10228 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10229 %
10230 %  MagickSetImageGravity() sets the image gravity type.
10231 %
10232 %  The format of the MagickSetImageGravity method is:
10233 %
10234 %      MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10235 %        const GravityType gravity)
10236 %
10237 %  A description of each parameter follows:
10238 %
10239 %    o wand: the magick wand.
10240 %
10241 %    o gravity: the image interlace scheme: NoInterlace, LineInterlace,
10242 %      PlaneInterlace, PartitionInterlace.
10243 %
10244 */
10245 WandExport MagickBooleanType MagickSetImageGravity(MagickWand *wand,
10246   const GravityType gravity)
10247 {
10248   assert(wand != (MagickWand *) NULL);
10249   assert(wand->signature == WandSignature);
10250   if (wand->debug != MagickFalse)
10251     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10252   if (wand->images == (Image *) NULL)
10253     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10254   wand->images->gravity=gravity;
10255   return(MagickTrue);
10256 }
10257 \f
10258 /*
10259 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10260 %                                                                             %
10261 %                                                                             %
10262 %                                                                             %
10263 %   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                       %
10264 %                                                                             %
10265 %                                                                             %
10266 %                                                                             %
10267 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10268 %
10269 %  MagickSetImageGreenPrimary() sets the image chromaticity green primary
10270 %  point.
10271 %
10272 %  The format of the MagickSetImageGreenPrimary method is:
10273 %
10274 %      MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10275 %        const double x,const double y)
10276 %
10277 %  A description of each parameter follows:
10278 %
10279 %    o wand: the magick wand.
10280 %
10281 %    o x: the green primary x-point.
10282 %
10283 %    o y: the green primary y-point.
10284 %
10285 %
10286 */
10287 WandExport MagickBooleanType MagickSetImageGreenPrimary(MagickWand *wand,
10288   const double x,const double y)
10289 {
10290   assert(wand != (MagickWand *) NULL);
10291   assert(wand->signature == WandSignature);
10292   if (wand->debug != MagickFalse)
10293     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10294   if (wand->images == (Image *) NULL)
10295     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10296   wand->images->chromaticity.green_primary.x=x;
10297   wand->images->chromaticity.green_primary.y=y;
10298   return(MagickTrue);
10299 }
10300 \f
10301 /*
10302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10303 %                                                                             %
10304 %                                                                             %
10305 %                                                                             %
10306 %   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                 %
10307 %                                                                             %
10308 %                                                                             %
10309 %                                                                             %
10310 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10311 %
10312 %  MagickSetImageInterlaceScheme() sets the image interlace scheme.
10313 %
10314 %  The format of the MagickSetImageInterlaceScheme method is:
10315 %
10316 %      MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10317 %        const InterlaceType interlace)
10318 %
10319 %  A description of each parameter follows:
10320 %
10321 %    o wand: the magick wand.
10322 %
10323 %    o interlace: the image interlace scheme: NoInterlace, LineInterlace,
10324 %      PlaneInterlace, PartitionInterlace.
10325 %
10326 */
10327 WandExport MagickBooleanType MagickSetImageInterlaceScheme(MagickWand *wand,
10328   const InterlaceType interlace)
10329 {
10330   assert(wand != (MagickWand *) NULL);
10331   assert(wand->signature == WandSignature);
10332   if (wand->debug != MagickFalse)
10333     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10334   if (wand->images == (Image *) NULL)
10335     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10336   wand->images->interlace=interlace;
10337   return(MagickTrue);
10338 }
10339 \f
10340 /*
10341 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10342 %                                                                             %
10343 %                                                                             %
10344 %                                                                             %
10345 %   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             %
10346 %                                                                             %
10347 %                                                                             %
10348 %                                                                             %
10349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10350 %
10351 %  MagickSetImageInterpolateMethod() sets the image interpolate pixel method.
10352 %
10353 %  The format of the MagickSetImageInterpolateMethod method is:
10354 %
10355 %      MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10356 %        const InterpolatePixelMethod method)
10357 %
10358 %  A description of each parameter follows:
10359 %
10360 %    o wand: the magick wand.
10361 %
10362 %    o method: the image interpole pixel methods: choose from Undefined,
10363 %      Average, Bicubic, Bilinear, Filter, Integer, Mesh, NearestNeighbor.
10364 %
10365 */
10366 WandExport MagickBooleanType MagickSetImageInterpolateMethod(MagickWand *wand,
10367   const InterpolatePixelMethod method)
10368 {
10369   assert(wand != (MagickWand *) NULL);
10370   assert(wand->signature == WandSignature);
10371   if (wand->debug != MagickFalse)
10372     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10373   if (wand->images == (Image *) NULL)
10374     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10375   wand->images->interpolate=method;
10376   return(MagickTrue);
10377 }
10378 \f
10379 /*
10380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10381 %                                                                             %
10382 %                                                                             %
10383 %                                                                             %
10384 %   M a g i c k S e t I m a g e I t e r a t i o n s                           %
10385 %                                                                             %
10386 %                                                                             %
10387 %                                                                             %
10388 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10389 %
10390 %  MagickSetImageIterations() sets the image iterations.
10391 %
10392 %  The format of the MagickSetImageIterations method is:
10393 %
10394 %      MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10395 %        const size_t iterations)
10396 %
10397 %  A description of each parameter follows:
10398 %
10399 %    o wand: the magick wand.
10400 %
10401 %    o delay: the image delay in 1/100th of a second.
10402 %
10403 */
10404 WandExport MagickBooleanType MagickSetImageIterations(MagickWand *wand,
10405   const size_t iterations)
10406 {
10407   assert(wand != (MagickWand *) NULL);
10408   assert(wand->signature == WandSignature);
10409   if (wand->debug != MagickFalse)
10410     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10411   if (wand->images == (Image *) NULL)
10412     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10413   wand->images->iterations=iterations;
10414   return(MagickTrue);
10415 }
10416 \f
10417 /*
10418 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10419 %                                                                             %
10420 %                                                                             %
10421 %                                                                             %
10422 %   M a g i c k S e t I m a g e M a t t e                                     %
10423 %                                                                             %
10424 %                                                                             %
10425 %                                                                             %
10426 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10427 %
10428 %  MagickSetImageMatte() sets the image matte channel.
10429 %
10430 %  The format of the MagickSetImageMatteColor method is:
10431 %
10432 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10433 %        const MagickBooleanType *matte)
10434 %
10435 %  A description of each parameter follows:
10436 %
10437 %    o wand: the magick wand.
10438 %
10439 %    o matte: Set to MagickTrue to enable the image matte channel otherwise
10440 %      MagickFalse.
10441 %
10442 */
10443 WandExport MagickBooleanType MagickSetImageMatte(MagickWand *wand,
10444   const MagickBooleanType matte)
10445 {
10446   assert(wand != (MagickWand *) NULL);
10447   assert(wand->signature == WandSignature);
10448   if (wand->debug != MagickFalse)
10449     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10450   if (wand->images == (Image *) NULL)
10451     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10452   if ((wand->images->matte == MagickFalse) && (matte != MagickFalse))
10453     (void) SetImageOpacity(wand->images,OpaqueOpacity);
10454   wand->images->matte=matte;
10455   return(MagickTrue);
10456 }
10457 \f
10458 /*
10459 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10460 %                                                                             %
10461 %                                                                             %
10462 %                                                                             %
10463 %   M a g i c k S e t I m a g e M a t t e C o l o r                           %
10464 %                                                                             %
10465 %                                                                             %
10466 %                                                                             %
10467 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10468 %
10469 %  MagickSetImageMatteColor() sets the image matte color.
10470 %
10471 %  The format of the MagickSetImageMatteColor method is:
10472 %
10473 %      MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10474 %        const PixelWand *matte)
10475 %
10476 %  A description of each parameter follows:
10477 %
10478 %    o wand: the magick wand.
10479 %
10480 %    o matte: the matte pixel wand.
10481 %
10482 */
10483 WandExport MagickBooleanType MagickSetImageMatteColor(MagickWand *wand,
10484   const PixelWand *matte)
10485 {
10486   assert(wand != (MagickWand *) NULL);
10487   assert(wand->signature == WandSignature);
10488   if (wand->debug != MagickFalse)
10489     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10490   if (wand->images == (Image *) NULL)
10491     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10492   PixelGetQuantumColor(matte,&wand->images->matte_color);
10493   return(MagickTrue);
10494 }
10495 \f
10496 /*
10497 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10498 %                                                                             %
10499 %                                                                             %
10500 %                                                                             %
10501 %   M a g i c k S e t I m a g e O p a c i t y                                 %
10502 %                                                                             %
10503 %                                                                             %
10504 %                                                                             %
10505 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10506 %
10507 %  MagickSetImageOpacity() sets the image to the specified opacity level.
10508 %
10509 %  The format of the MagickSetImageOpacity method is:
10510 %
10511 %      MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10512 %        const double alpha)
10513 %
10514 %  A description of each parameter follows:
10515 %
10516 %    o wand: the magick wand.
10517 %
10518 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
10519 %      transparent.
10520 %
10521 */
10522 WandExport MagickBooleanType MagickSetImageOpacity(MagickWand *wand,
10523   const double alpha)
10524 {
10525   MagickBooleanType
10526     status;
10527
10528   assert(wand != (MagickWand *) NULL);
10529   assert(wand->signature == WandSignature);
10530   if (wand->debug != MagickFalse)
10531     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10532   if (wand->images == (Image *) NULL)
10533     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10534   status=SetImageOpacity(wand->images,ClampToQuantum((MagickRealType)
10535     QuantumRange-QuantumRange*alpha));
10536   if (status == MagickFalse)
10537     InheritException(wand->exception,&wand->images->exception);
10538   return(status);
10539 }
10540 \f
10541 /*
10542 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10543 %                                                                             %
10544 %                                                                             %
10545 %                                                                             %
10546 %   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                         %
10547 %                                                                             %
10548 %                                                                             %
10549 %                                                                             %
10550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10551 %
10552 %  MagickSetImageOrientation() sets the image orientation.
10553 %
10554 %  The format of the MagickSetImageOrientation method is:
10555 %
10556 %      MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10557 %        const OrientationType orientation)
10558 %
10559 %  A description of each parameter follows:
10560 %
10561 %    o wand: the magick wand.
10562 %
10563 %    o orientation: the image orientation type.
10564 %
10565 */
10566 WandExport MagickBooleanType MagickSetImageOrientation(MagickWand *wand,
10567   const OrientationType orientation)
10568 {
10569   assert(wand != (MagickWand *) NULL);
10570   assert(wand->signature == WandSignature);
10571   if (wand->debug != MagickFalse)
10572     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10573   if (wand->images == (Image *) NULL)
10574     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10575   wand->images->orientation=orientation;
10576   return(MagickTrue);
10577 }
10578 \f
10579 /*
10580 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10581 %                                                                             %
10582 %                                                                             %
10583 %                                                                             %
10584 %   M a g i c k S e t I m a g e P a g e                                       %
10585 %                                                                             %
10586 %                                                                             %
10587 %                                                                             %
10588 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10589 %
10590 %  MagickSetImagePage() sets the page geometry of the image.
10591 %
10592 %  The format of the MagickSetImagePage method is:
10593 %
10594 %      MagickBooleanType MagickSetImagePage(MagickWand *wand,
10595 %        const size_t width,const size_t height,const ssize_t x,
10596 %        const ssize_t y)
10597 %
10598 %  A description of each parameter follows:
10599 %
10600 %    o wand: the magick wand.
10601 %
10602 %    o width: the page width.
10603 %
10604 %    o height: the page height.
10605 %
10606 %    o x: the page x-offset.
10607 %
10608 %    o y: the page y-offset.
10609 %
10610 */
10611 WandExport MagickBooleanType MagickSetImagePage(MagickWand *wand,
10612   const size_t width,const size_t height,const ssize_t x,
10613   const ssize_t y)
10614 {
10615   assert(wand != (MagickWand *) NULL);
10616   assert(wand->signature == WandSignature);
10617   if (wand->debug != MagickFalse)
10618     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10619   if (wand->images == (Image *) NULL)
10620     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10621   wand->images->page.width=width;
10622   wand->images->page.height=height;
10623   wand->images->page.x=x;
10624   wand->images->page.y=y;
10625   return(MagickTrue);
10626 }
10627 \f
10628 /*
10629 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10630 %                                                                             %
10631 %                                                                             %
10632 %                                                                             %
10633 %   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                 %
10634 %                                                                             %
10635 %                                                                             %
10636 %                                                                             %
10637 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10638 %
10639 %  MagickSetImageProgressMonitor() sets the wand image progress monitor to the
10640 %  specified method and returns the previous progress monitor if any.  The
10641 %  progress monitor method looks like this:
10642 %
10643 %    MagickBooleanType MagickProgressMonitor(const char *text,
10644 %      const MagickOffsetType offset,const MagickSizeType span,
10645 %      void *client_data)
10646 %
10647 %  If the progress monitor returns MagickFalse, the current operation is
10648 %  interrupted.
10649 %
10650 %  The format of the MagickSetImageProgressMonitor method is:
10651 %
10652 %      MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand
10653 %        const MagickProgressMonitor progress_monitor,void *client_data)
10654 %
10655 %  A description of each parameter follows:
10656 %
10657 %    o wand: the magick wand.
10658 %
10659 %    o progress_monitor: Specifies a pointer to a method to monitor progress
10660 %      of an image operation.
10661 %
10662 %    o client_data: Specifies a pointer to any client data.
10663 %
10664 */
10665 WandExport MagickProgressMonitor MagickSetImageProgressMonitor(MagickWand *wand,
10666   const MagickProgressMonitor progress_monitor,void *client_data)
10667 {
10668   MagickProgressMonitor
10669     previous_monitor;
10670
10671   assert(wand != (MagickWand *) NULL);
10672   assert(wand->signature == WandSignature);
10673   if (wand->debug != MagickFalse)
10674     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10675   if (wand->images == (Image *) NULL)
10676     {
10677       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
10678         "ContainsNoImages","`%s'",wand->name);
10679       return((MagickProgressMonitor) NULL);
10680     }
10681   previous_monitor=SetImageProgressMonitor(wand->images,
10682     progress_monitor,client_data);
10683   return(previous_monitor);
10684 }
10685 \f
10686 /*
10687 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10688 %                                                                             %
10689 %                                                                             %
10690 %                                                                             %
10691 %   M a g i c k S e t I m a g e R e d P r i m a r y                           %
10692 %                                                                             %
10693 %                                                                             %
10694 %                                                                             %
10695 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10696 %
10697 %  MagickSetImageRedPrimary() sets the image chromaticity red primary point.
10698 %
10699 %  The format of the MagickSetImageRedPrimary method is:
10700 %
10701 %      MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10702 %        const double x,const double y)
10703 %
10704 %  A description of each parameter follows:
10705 %
10706 %    o wand: the magick wand.
10707 %
10708 %    o x: the red primary x-point.
10709 %
10710 %    o y: the red primary y-point.
10711 %
10712 */
10713 WandExport MagickBooleanType MagickSetImageRedPrimary(MagickWand *wand,
10714   const double x,const double y)
10715 {
10716   assert(wand != (MagickWand *) NULL);
10717   assert(wand->signature == WandSignature);
10718   if (wand->debug != MagickFalse)
10719     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10720   if (wand->images == (Image *) NULL)
10721     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10722   wand->images->chromaticity.red_primary.x=x;
10723   wand->images->chromaticity.red_primary.y=y;
10724   return(MagickTrue);
10725 }
10726 \f
10727 /*
10728 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10729 %                                                                             %
10730 %                                                                             %
10731 %                                                                             %
10732 %   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                 %
10733 %                                                                             %
10734 %                                                                             %
10735 %                                                                             %
10736 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10737 %
10738 %  MagickSetImageRenderingIntent() sets the image rendering intent.
10739 %
10740 %  The format of the MagickSetImageRenderingIntent method is:
10741 %
10742 %      MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10743 %        const RenderingIntent rendering_intent)
10744 %
10745 %  A description of each parameter follows:
10746 %
10747 %    o wand: the magick wand.
10748 %
10749 %    o rendering_intent: the image rendering intent: UndefinedIntent,
10750 %      SaturationIntent, PerceptualIntent, AbsoluteIntent, or RelativeIntent.
10751 %
10752 */
10753 WandExport MagickBooleanType MagickSetImageRenderingIntent(MagickWand *wand,
10754   const RenderingIntent rendering_intent)
10755 {
10756   assert(wand != (MagickWand *) NULL);
10757   assert(wand->signature == WandSignature);
10758   if (wand->debug != MagickFalse)
10759     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10760   if (wand->images == (Image *) NULL)
10761     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10762   wand->images->rendering_intent=rendering_intent;
10763   return(MagickTrue);
10764 }
10765 \f
10766 /*
10767 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10768 %                                                                             %
10769 %                                                                             %
10770 %                                                                             %
10771 %   M a g i c k S e t I m a g e R e s o l u t i o n                           %
10772 %                                                                             %
10773 %                                                                             %
10774 %                                                                             %
10775 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10776 %
10777 %  MagickSetImageResolution() sets the image resolution.
10778 %
10779 %  The format of the MagickSetImageResolution method is:
10780 %
10781 %      MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10782 %        const double x_resolution,const doubtl y_resolution)
10783 %
10784 %  A description of each parameter follows:
10785 %
10786 %    o wand: the magick wand.
10787 %
10788 %    o x_resolution: the image x resolution.
10789 %
10790 %    o y_resolution: the image y resolution.
10791 %
10792 */
10793 WandExport MagickBooleanType MagickSetImageResolution(MagickWand *wand,
10794   const double x_resolution,const double y_resolution)
10795 {
10796   assert(wand != (MagickWand *) NULL);
10797   assert(wand->signature == WandSignature);
10798   if (wand->debug != MagickFalse)
10799     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10800   if (wand->images == (Image *) NULL)
10801     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10802   wand->images->x_resolution=x_resolution;
10803   wand->images->y_resolution=y_resolution;
10804   return(MagickTrue);
10805 }
10806 \f
10807 /*
10808 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10809 %                                                                             %
10810 %                                                                             %
10811 %                                                                             %
10812 %   M a g i c k S e t I m a g e S c e n e                                     %
10813 %                                                                             %
10814 %                                                                             %
10815 %                                                                             %
10816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10817 %
10818 %  MagickSetImageScene() sets the image scene.
10819 %
10820 %  The format of the MagickSetImageScene method is:
10821 %
10822 %      MagickBooleanType MagickSetImageScene(MagickWand *wand,
10823 %        const size_t scene)
10824 %
10825 %  A description of each parameter follows:
10826 %
10827 %    o wand: the magick wand.
10828 %
10829 %    o delay: the image scene number.
10830 %
10831 */
10832 WandExport MagickBooleanType MagickSetImageScene(MagickWand *wand,
10833   const size_t scene)
10834 {
10835   assert(wand != (MagickWand *) NULL);
10836   assert(wand->signature == WandSignature);
10837   if (wand->debug != MagickFalse)
10838     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10839   if (wand->images == (Image *) NULL)
10840     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10841   wand->images->scene=scene;
10842   return(MagickTrue);
10843 }
10844 \f
10845 /*
10846 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10847 %                                                                             %
10848 %                                                                             %
10849 %                                                                             %
10850 %   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                   %
10851 %                                                                             %
10852 %                                                                             %
10853 %                                                                             %
10854 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10855 %
10856 %  MagickSetImageTicksPerSecond() sets the image ticks-per-second.
10857 %
10858 %  The format of the MagickSetImageTicksPerSecond method is:
10859 %
10860 %      MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10861 %        const ssize_t ticks_per-second)
10862 %
10863 %  A description of each parameter follows:
10864 %
10865 %    o wand: the magick wand.
10866 %
10867 %    o ticks_per_second: the units to use for the image delay.
10868 %
10869 */
10870 WandExport MagickBooleanType MagickSetImageTicksPerSecond(MagickWand *wand,
10871   const ssize_t ticks_per_second)
10872 {
10873   assert(wand != (MagickWand *) NULL);
10874   assert(wand->signature == WandSignature);
10875   if (wand->debug != MagickFalse)
10876     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10877   if (wand->images == (Image *) NULL)
10878     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10879   wand->images->ticks_per_second=ticks_per_second;
10880   return(MagickTrue);
10881 }
10882 \f
10883 /*
10884 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10885 %                                                                             %
10886 %                                                                             %
10887 %                                                                             %
10888 %   M a g i c k S e t I m a g e T y p e                                       %
10889 %                                                                             %
10890 %                                                                             %
10891 %                                                                             %
10892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10893 %
10894 %  MagickSetImageType() sets the image type.
10895 %
10896 %  The format of the MagickSetImageType method is:
10897 %
10898 %      MagickBooleanType MagickSetImageType(MagickWand *wand,
10899 %        const ImageType image_type)
10900 %
10901 %  A description of each parameter follows:
10902 %
10903 %    o wand: the magick wand.
10904 %
10905 %    o image_type: the image type:   UndefinedType, BilevelType, GrayscaleType,
10906 %      GrayscaleMatteType, PaletteType, PaletteMatteType, TrueColorType,
10907 %      TrueColorMatteType, ColorSeparationType, ColorSeparationMatteType,
10908 %      or OptimizeType.
10909 %
10910 */
10911 WandExport MagickBooleanType MagickSetImageType(MagickWand *wand,
10912   const ImageType image_type)
10913 {
10914   assert(wand != (MagickWand *) NULL);
10915   assert(wand->signature == WandSignature);
10916   if (wand->debug != MagickFalse)
10917     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10918   if (wand->images == (Image *) NULL)
10919     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10920   return(SetImageType(wand->images,image_type));
10921 }
10922 \f
10923 /*
10924 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10925 %                                                                             %
10926 %                                                                             %
10927 %                                                                             %
10928 %   M a g i c k S e t I m a g e U n i t s                                     %
10929 %                                                                             %
10930 %                                                                             %
10931 %                                                                             %
10932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10933 %
10934 %  MagickSetImageUnits() sets the image units of resolution.
10935 %
10936 %  The format of the MagickSetImageUnits method is:
10937 %
10938 %      MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10939 %        const ResolutionType units)
10940 %
10941 %  A description of each parameter follows:
10942 %
10943 %    o wand: the magick wand.
10944 %
10945 %    o units: the image units of resolution : UndefinedResolution,
10946 %      PixelsPerInchResolution, or PixelsPerCentimeterResolution.
10947 %
10948 */
10949 WandExport MagickBooleanType MagickSetImageUnits(MagickWand *wand,
10950   const ResolutionType units)
10951 {
10952   assert(wand != (MagickWand *) NULL);
10953   assert(wand->signature == WandSignature);
10954   if (wand->debug != MagickFalse)
10955     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10956   if (wand->images == (Image *) NULL)
10957     ThrowWandException(WandError,"ContainsNoImages",wand->name);
10958   wand->images->units=units;
10959   return(MagickTrue);
10960 }
10961 \f
10962 /*
10963 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10964 %                                                                             %
10965 %                                                                             %
10966 %                                                                             %
10967 %   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           %
10968 %                                                                             %
10969 %                                                                             %
10970 %                                                                             %
10971 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10972 %
10973 %  MagickSetImageVirtualPixelMethod() sets the image virtual pixel method.
10974 %
10975 %  The format of the MagickSetImageVirtualPixelMethod method is:
10976 %
10977 %      VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10978 %        const VirtualPixelMethod method)
10979 %
10980 %  A description of each parameter follows:
10981 %
10982 %    o wand: the magick wand.
10983 %
10984 %    o method: the image virtual pixel method : UndefinedVirtualPixelMethod,
10985 %      ConstantVirtualPixelMethod,  EdgeVirtualPixelMethod,
10986 %      MirrorVirtualPixelMethod, or TileVirtualPixelMethod.
10987 %
10988 */
10989 WandExport VirtualPixelMethod MagickSetImageVirtualPixelMethod(MagickWand *wand,
10990   const VirtualPixelMethod method)
10991 {
10992   assert(wand != (MagickWand *) NULL);
10993   assert(wand->signature == WandSignature);
10994   if (wand->debug != MagickFalse)
10995     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
10996   if (wand->images == (Image *) NULL)
10997     return(UndefinedVirtualPixelMethod);
10998   return(SetImageVirtualPixelMethod(wand->images,method));
10999 }
11000 \f
11001 /*
11002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11003 %                                                                             %
11004 %                                                                             %
11005 %                                                                             %
11006 %   M a g i c k S e t I m a g e W h i t e P o i n t                           %
11007 %                                                                             %
11008 %                                                                             %
11009 %                                                                             %
11010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11011 %
11012 %  MagickSetImageWhitePoint() sets the image chromaticity white point.
11013 %
11014 %  The format of the MagickSetImageWhitePoint method is:
11015 %
11016 %      MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
11017 %        const double x,const double y)
11018 %
11019 %  A description of each parameter follows:
11020 %
11021 %    o wand: the magick wand.
11022 %
11023 %    o x: the white x-point.
11024 %
11025 %    o y: the white y-point.
11026 %
11027 */
11028 WandExport MagickBooleanType MagickSetImageWhitePoint(MagickWand *wand,
11029   const double x,const double y)
11030 {
11031   assert(wand != (MagickWand *) NULL);
11032   assert(wand->signature == WandSignature);
11033   if (wand->debug != MagickFalse)
11034     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11035   if (wand->images == (Image *) NULL)
11036     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11037   wand->images->chromaticity.white_point.x=x;
11038   wand->images->chromaticity.white_point.y=y;
11039   return(MagickTrue);
11040 }
11041 \f
11042 /*
11043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11044 %                                                                             %
11045 %                                                                             %
11046 %                                                                             %
11047 %   M a g i c k S h a d e I m a g e C h a n n e l                             %
11048 %                                                                             %
11049 %                                                                             %
11050 %                                                                             %
11051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11052 %
11053 %  MagickShadeImage() shines a distant light on an image to create a
11054 %  three-dimensional effect. You control the positioning of the light with
11055 %  azimuth and elevation; azimuth is measured in degrees off the x axis
11056 %  and elevation is measured in pixels above the Z axis.
11057 %
11058 %  The format of the MagickShadeImage method is:
11059 %
11060 %      MagickBooleanType MagickShadeImage(MagickWand *wand,
11061 %        const MagickBooleanType gray,const double azimuth,
11062 %        const double elevation)
11063 %
11064 %  A description of each parameter follows:
11065 %
11066 %    o wand: the magick wand.
11067 %
11068 %    o gray: A value other than zero shades the intensity of each pixel.
11069 %
11070 %    o azimuth, elevation:  Define the light source direction.
11071 %
11072 */
11073 WandExport MagickBooleanType MagickShadeImage(MagickWand *wand,
11074   const MagickBooleanType gray,const double asimuth,const double elevation)
11075 {
11076   Image
11077     *shade_image;
11078
11079   assert(wand != (MagickWand *) NULL);
11080   assert(wand->signature == WandSignature);
11081   if (wand->debug != MagickFalse)
11082     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11083   if (wand->images == (Image *) NULL)
11084     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11085   shade_image=ShadeImage(wand->images,gray,asimuth,elevation,wand->exception);
11086   if (shade_image == (Image *) NULL)
11087     return(MagickFalse);
11088   ReplaceImageInList(&wand->images,shade_image);
11089   return(MagickTrue);
11090 }
11091 \f
11092 /*
11093 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11094 %                                                                             %
11095 %                                                                             %
11096 %                                                                             %
11097 %   M a g i c k S h a d o w I m a g e                                         %
11098 %                                                                             %
11099 %                                                                             %
11100 %                                                                             %
11101 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11102 %
11103 %  MagickShadowImage() simulates an image shadow.
11104 %
11105 %  The format of the MagickShadowImage method is:
11106 %
11107 %      MagickBooleanType MagickShadowImage(MagickWand *wand,
11108 %        const double opacity,const double sigma,const ssize_t x,const ssize_t y)
11109 %
11110 %  A description of each parameter follows:
11111 %
11112 %    o wand: the magick wand.
11113 %
11114 %    o opacity: percentage transparency.
11115 %
11116 %    o sigma: the standard deviation of the Gaussian, in pixels.
11117 %
11118 %    o x: the shadow x-offset.
11119 %
11120 %    o y: the shadow y-offset.
11121 %
11122 */
11123 WandExport MagickBooleanType MagickShadowImage(MagickWand *wand,
11124   const double opacity,const double sigma,const ssize_t x,const ssize_t y)
11125 {
11126   Image
11127     *shadow_image;
11128
11129   assert(wand != (MagickWand *) NULL);
11130   assert(wand->signature == WandSignature);
11131   if (wand->debug != MagickFalse)
11132     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11133   if (wand->images == (Image *) NULL)
11134     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11135   shadow_image=ShadowImage(wand->images,opacity,sigma,x,y,wand->exception);
11136   if (shadow_image == (Image *) NULL)
11137     return(MagickFalse);
11138   ReplaceImageInList(&wand->images,shadow_image);
11139   return(MagickTrue);
11140 }
11141 \f
11142 /*
11143 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11144 %                                                                             %
11145 %                                                                             %
11146 %                                                                             %
11147 %   M a g i c k S h a r p e n I m a g e                                       %
11148 %                                                                             %
11149 %                                                                             %
11150 %                                                                             %
11151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11152 %
11153 %  MagickSharpenImage() sharpens an image.  We convolve the image with a
11154 %  Gaussian operator of the given radius and standard deviation (sigma).
11155 %  For reasonable results, the radius should be larger than sigma.  Use a
11156 %  radius of 0 and MagickSharpenImage() selects a suitable radius for you.
11157 %
11158 %  The format of the MagickSharpenImage method is:
11159 %
11160 %      MagickBooleanType MagickSharpenImage(MagickWand *wand,
11161 %        const double radius,const double sigma)
11162 %      MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
11163 %        const ChannelType channel,const double radius,const double sigma)
11164 %
11165 %  A description of each parameter follows:
11166 %
11167 %    o wand: the magick wand.
11168 %
11169 %    o channel: the image channel(s).
11170 %
11171 %    o radius: the radius of the Gaussian, in pixels, not counting the center
11172 %      pixel.
11173 %
11174 %    o sigma: the standard deviation of the Gaussian, in pixels.
11175 %
11176 */
11177
11178 WandExport MagickBooleanType MagickSharpenImage(MagickWand *wand,
11179   const double radius,const double sigma)
11180 {
11181   MagickBooleanType
11182     status;
11183
11184   status=MagickSharpenImageChannel(wand,DefaultChannels,radius,sigma);
11185   return(status);
11186 }
11187
11188 WandExport MagickBooleanType MagickSharpenImageChannel(MagickWand *wand,
11189   const ChannelType channel,const double radius,const double sigma)
11190 {
11191   Image
11192     *sharp_image;
11193
11194   assert(wand != (MagickWand *) NULL);
11195   assert(wand->signature == WandSignature);
11196   if (wand->debug != MagickFalse)
11197     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11198   if (wand->images == (Image *) NULL)
11199     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11200   sharp_image=SharpenImageChannel(wand->images,channel,radius,sigma,
11201     wand->exception);
11202   if (sharp_image == (Image *) NULL)
11203     return(MagickFalse);
11204   ReplaceImageInList(&wand->images,sharp_image);
11205   return(MagickTrue);
11206 }
11207 \f
11208 /*
11209 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11210 %                                                                             %
11211 %                                                                             %
11212 %                                                                             %
11213 %   M a g i c k S h a v e I m a g e                                           %
11214 %                                                                             %
11215 %                                                                             %
11216 %                                                                             %
11217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11218 %
11219 %  MagickShaveImage() shaves pixels from the image edges.  It allocates the
11220 %  memory necessary for the new Image structure and returns a pointer to the
11221 %  new image.
11222 %
11223 %  The format of the MagickShaveImage method is:
11224 %
11225 %      MagickBooleanType MagickShaveImage(MagickWand *wand,
11226 %        const size_t columns,const size_t rows)
11227 %
11228 %  A description of each parameter follows:
11229 %
11230 %    o wand: the magick wand.
11231 %
11232 %    o columns: the number of columns in the scaled image.
11233 %
11234 %    o rows: the number of rows in the scaled image.
11235 %
11236 %
11237 */
11238 WandExport MagickBooleanType MagickShaveImage(MagickWand *wand,
11239   const size_t columns,const size_t rows)
11240 {
11241   Image
11242     *shave_image;
11243
11244   RectangleInfo
11245     shave_info;
11246
11247   assert(wand != (MagickWand *) NULL);
11248   assert(wand->signature == WandSignature);
11249   if (wand->debug != MagickFalse)
11250     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11251   if (wand->images == (Image *) NULL)
11252     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11253   shave_info.width=columns;
11254   shave_info.height=rows;
11255   shave_info.x=0;
11256   shave_info.y=0;
11257   shave_image=ShaveImage(wand->images,&shave_info,wand->exception);
11258   if (shave_image == (Image *) NULL)
11259     return(MagickFalse);
11260   ReplaceImageInList(&wand->images,shave_image);
11261   return(MagickTrue);
11262 }
11263 \f
11264 /*
11265 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11266 %                                                                             %
11267 %                                                                             %
11268 %                                                                             %
11269 %   M a g i c k S h e a r I m a g e                                           %
11270 %                                                                             %
11271 %                                                                             %
11272 %                                                                             %
11273 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11274 %
11275 %  MagickShearImage() slides one edge of an image along the X or Y axis,
11276 %  creating a parallelogram.  An X direction shear slides an edge along the X
11277 %  axis, while a Y direction shear slides an edge along the Y axis.  The amount
11278 %  of the shear is controlled by a shear angle.  For X direction shears, x_shear
11279 %  is measured relative to the Y axis, and similarly, for Y direction shears
11280 %  y_shear is measured relative to the X axis.  Empty triangles left over from
11281 %  shearing the image are filled with the background color.
11282 %
11283 %  The format of the MagickShearImage method is:
11284 %
11285 %      MagickBooleanType MagickShearImage(MagickWand *wand,
11286 %        const PixelWand *background,const double x_shear,onst double y_shear)
11287 %
11288 %  A description of each parameter follows:
11289 %
11290 %    o wand: the magick wand.
11291 %
11292 %    o background: the background pixel wand.
11293 %
11294 %    o x_shear: the number of degrees to shear the image.
11295 %
11296 %    o y_shear: the number of degrees to shear the image.
11297 %
11298 */
11299 WandExport MagickBooleanType MagickShearImage(MagickWand *wand,
11300   const PixelWand *background,const double x_shear,const double y_shear)
11301 {
11302   Image
11303     *shear_image;
11304
11305   assert(wand != (MagickWand *) NULL);
11306   assert(wand->signature == WandSignature);
11307   if (wand->debug != MagickFalse)
11308     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11309   if (wand->images == (Image *) NULL)
11310     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11311   PixelGetQuantumColor(background,&wand->images->background_color);
11312   shear_image=ShearImage(wand->images,x_shear,y_shear,wand->exception);
11313   if (shear_image == (Image *) NULL)
11314     return(MagickFalse);
11315   ReplaceImageInList(&wand->images,shear_image);
11316   return(MagickTrue);
11317 }
11318 \f
11319 /*
11320 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11321 %                                                                             %
11322 %                                                                             %
11323 %                                                                             %
11324 %   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                   %
11325 %                                                                             %
11326 %                                                                             %
11327 %                                                                             %
11328 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11329 %
11330 %  MagickSigmoidalContrastImage() adjusts the contrast of an image with a
11331 %  non-linear sigmoidal contrast algorithm.  Increase the contrast of the
11332 %  image using a sigmoidal transfer function without saturating highlights or
11333 %  shadows.  Contrast indicates how much to increase the contrast (0 is none;
11334 %  3 is typical; 20 is pushing it); mid-point indicates where midtones fall in
11335 %  the resultant image (0 is white; 50% is middle-gray; 100% is black).  Set
11336 %  sharpen to MagickTrue to increase the image contrast otherwise the contrast
11337 %  is reduced.
11338 %
11339 %  The format of the MagickSigmoidalContrastImage method is:
11340 %
11341 %      MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11342 %        const MagickBooleanType sharpen,const double alpha,const double beta)
11343 %      MagickBooleanType MagickSigmoidalContrastImageChannel(MagickWand *wand,
11344 %        const ChannelType channel,const MagickBooleanType sharpen,
11345 %        const double alpha,const double beta)
11346 %
11347 %  A description of each parameter follows:
11348 %
11349 %    o wand: the magick wand.
11350 %
11351 %    o channel: Identify which channel to level: RedChannel, GreenChannel,
11352 %
11353 %    o sharpen: Increase or decrease image contrast.
11354 %
11355 %    o alpha: strength of the contrast, the larger the number the more
11356 %      'threshold-like' it becomes.
11357 %
11358 %    o beta: midpoint of the function as a color value 0 to QuantumRange.
11359 %
11360 */
11361
11362 WandExport MagickBooleanType MagickSigmoidalContrastImage(MagickWand *wand,
11363   const MagickBooleanType sharpen,const double alpha,const double beta)
11364 {
11365   MagickBooleanType
11366     status;
11367
11368   status=MagickSigmoidalContrastImageChannel(wand,DefaultChannels,sharpen,
11369     alpha,beta);
11370   return(status);
11371 }
11372
11373 WandExport MagickBooleanType MagickSigmoidalContrastImageChannel(
11374   MagickWand *wand,const ChannelType channel,const MagickBooleanType sharpen,
11375   const double alpha,const double beta)
11376 {
11377   MagickBooleanType
11378     status;
11379
11380   assert(wand != (MagickWand *) NULL);
11381   assert(wand->signature == WandSignature);
11382   if (wand->debug != MagickFalse)
11383     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11384   if (wand->images == (Image *) NULL)
11385     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11386   status=SigmoidalContrastImageChannel(wand->images,channel,sharpen,alpha,beta);
11387   if (status == MagickFalse)
11388     InheritException(wand->exception,&wand->images->exception);
11389   return(status);
11390 }
11391 \f
11392 /*
11393 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11394 %                                                                             %
11395 %                                                                             %
11396 %                                                                             %
11397 %   M a g i c k S i m i l a r i t y I m a g e                                 %
11398 %                                                                             %
11399 %                                                                             %
11400 %                                                                             %
11401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11402 %
11403 %  MagickSimilarityImage() compares the reference image of the image and
11404 %  returns the best match offset.  In addition, it returns a similarity image
11405 %  such that an exact match location is completely white and if none of the
11406 %  pixels match, black, otherwise some gray level in-between.
11407 %
11408 %  The format of the MagickSimilarityImage method is:
11409 %
11410 %      MagickWand *MagickSimilarityImage(MagickWand *wand,
11411 %        const MagickWand *reference,RectangeInfo *offset,double *similarity)
11412 %
11413 %  A description of each parameter follows:
11414 %
11415 %    o wand: the magick wand.
11416 %
11417 %    o reference: the reference wand.
11418 %
11419 %    o offset: the best match offset of the reference image within the image.
11420 %
11421 %    o similarity: the computed similarity between the images.
11422 %
11423 */
11424 WandExport MagickWand *MagickSimilarityImage(MagickWand *wand,
11425   const MagickWand *reference,RectangleInfo *offset,double *similarity)
11426 {
11427   Image
11428     *similarity_image;
11429
11430   assert(wand != (MagickWand *) NULL);
11431   assert(wand->signature == WandSignature);
11432   if (wand->debug != MagickFalse)
11433     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11434   if ((wand->images == (Image *) NULL) || (reference->images == (Image *) NULL))
11435     {
11436       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11437         "ContainsNoImages","`%s'",wand->name);
11438       return((MagickWand *) NULL);
11439     }
11440   similarity_image=SimilarityImage(wand->images,reference->images,offset,
11441     similarity,&wand->images->exception);
11442   if (similarity_image == (Image *) NULL)
11443     return((MagickWand *) NULL);
11444   return(CloneMagickWandFromImages(wand,similarity_image));
11445 }
11446 \f
11447 /*
11448 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11449 %                                                                             %
11450 %                                                                             %
11451 %                                                                             %
11452 %   M a g i c k S k e t c h I m a g e                                         %
11453 %                                                                             %
11454 %                                                                             %
11455 %                                                                             %
11456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11457 %
11458 %  MagickSketchImage() simulates a pencil sketch.  We convolve the image with
11459 %  a Gaussian operator of the given radius and standard deviation (sigma).
11460 %  For reasonable results, radius should be larger than sigma.  Use a
11461 %  radius of 0 and SketchImage() selects a suitable radius for you.
11462 %  Angle gives the angle of the blurring motion.
11463 %
11464 %  The format of the MagickSketchImage method is:
11465 %
11466 %      MagickBooleanType MagickSketchImage(MagickWand *wand,
11467 %        const double radius,const double sigma,const double angle)
11468 %
11469 %  A description of each parameter follows:
11470 %
11471 %    o wand: the magick wand.
11472 %
11473 %    o radius: the radius of the Gaussian, in pixels, not counting
11474 %      the center pixel.
11475 %
11476 %    o sigma: the standard deviation of the Gaussian, in pixels.
11477 %
11478 %    o angle: Apply the effect along this angle.
11479 %
11480 */
11481 WandExport MagickBooleanType MagickSketchImage(MagickWand *wand,
11482   const double radius,const double sigma,const double angle)
11483 {
11484   Image
11485     *sketch_image;
11486
11487   assert(wand != (MagickWand *) NULL);
11488   assert(wand->signature == WandSignature);
11489   if (wand->debug != MagickFalse)
11490     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11491   if (wand->images == (Image *) NULL)
11492     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11493   sketch_image=SketchImage(wand->images,radius,sigma,angle,wand->exception);
11494   if (sketch_image == (Image *) NULL)
11495     return(MagickFalse);
11496   ReplaceImageInList(&wand->images,sketch_image);
11497   return(MagickTrue);
11498 }
11499 \f
11500 /*
11501 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11502 %                                                                             %
11503 %                                                                             %
11504 %                                                                             %
11505 %     M a g i c k S o l a r i z e I m a g e                                   %
11506 %                                                                             %
11507 %                                                                             %
11508 %                                                                             %
11509 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11510 %
11511 %  MagickSolarizeImage() applies a special effect to the image, similar to the
11512 %  effect achieved in a photo darkroom by selectively exposing areas of photo
11513 %  sensitive paper to light.  Threshold ranges from 0 to QuantumRange and is a
11514 %  measure of the extent of the solarization.
11515 %
11516 %  The format of the MagickSolarizeImage method is:
11517 %
11518 %      MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11519 %        const double threshold)
11520 %
11521 %  A description of each parameter follows:
11522 %
11523 %    o wand: the magick wand.
11524 %
11525 %    o threshold:  Define the extent of the solarization.
11526 %
11527 */
11528 WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand,
11529   const double threshold)
11530 {
11531   MagickBooleanType
11532     status;
11533
11534   assert(wand != (MagickWand *) NULL);
11535   assert(wand->signature == WandSignature);
11536   if (wand->debug != MagickFalse)
11537     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11538   if (wand->images == (Image *) NULL)
11539     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11540   status=SolarizeImage(wand->images,threshold);
11541   if (status == MagickFalse)
11542     InheritException(wand->exception,&wand->images->exception);
11543   return(status);
11544 }
11545 \f
11546 /*
11547 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11548 %                                                                             %
11549 %                                                                             %
11550 %                                                                             %
11551 %   M a g i c k S p a r s e C o l o r I m a g e                               %
11552 %                                                                             %
11553 %                                                                             %
11554 %                                                                             %
11555 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11556 %
11557 %  MagickSparseColorImage(), given a set of coordinates, interpolates the
11558 %  colors found at those coordinates, across the whole image, using various
11559 %  methods.
11560 %
11561 %  The format of the MagickSparseColorImage method is:
11562 %
11563 %      MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11564 %        const ChannelType channel,const SparseColorMethod method,
11565 %        const size_t number_arguments,const double *arguments)
11566 %
11567 %  A description of each parameter follows:
11568 %
11569 %    o image: the image to be sparseed.
11570 %
11571 %    o method: the method of image sparseion.
11572 %
11573 %        ArcSparseColorion will always ignore source image offset, and always
11574 %        'bestfit' the destination image with the top left corner offset
11575 %        relative to the polar mapping center.
11576 %
11577 %        Bilinear has no simple inverse mapping so will not allow 'bestfit'
11578 %        style of image sparseion.
11579 %
11580 %        Affine, Perspective, and Bilinear, will do least squares fitting of
11581 %        the distrotion when more than the minimum number of control point
11582 %        pairs are provided.
11583 %
11584 %        Perspective, and Bilinear, will fall back to a Affine sparseion when
11585 %        less than 4 control point pairs are provided. While Affine sparseions
11586 %        will let you use any number of control point pairs, that is Zero pairs
11587 %        is a No-Op (viewport only) distrotion, one pair is a translation and
11588 %        two pairs of control points will do a scale-rotate-translate, without
11589 %        any shearing.
11590 %
11591 %    o number_arguments: the number of arguments given for this sparseion
11592 %      method.
11593 %
11594 %    o arguments: the arguments for this sparseion method.
11595 %
11596 */
11597 WandExport MagickBooleanType MagickSparseColorImage(MagickWand *wand,
11598   const ChannelType channel,const SparseColorMethod method,
11599   const size_t number_arguments,const double *arguments)
11600 {
11601   Image
11602     *sparse_image;
11603
11604   assert(wand != (MagickWand *) NULL);
11605   assert(wand->signature == WandSignature);
11606   if (wand->debug != MagickFalse)
11607     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11608   if (wand->images == (Image *) NULL)
11609     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11610   sparse_image=SparseColorImage(wand->images,channel,method,number_arguments,
11611     arguments,wand->exception);
11612   if (sparse_image == (Image *) NULL)
11613     return(MagickFalse);
11614   ReplaceImageInList(&wand->images,sparse_image);
11615   return(MagickTrue);
11616 }
11617 \f
11618 /*
11619 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11620 %                                                                             %
11621 %                                                                             %
11622 %                                                                             %
11623 %   M a g i c k S p l i c e I m a g e                                         %
11624 %                                                                             %
11625 %                                                                             %
11626 %                                                                             %
11627 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11628 %
11629 %  MagickSpliceImage() splices a solid color into the image.
11630 %
11631 %  The format of the MagickSpliceImage method is:
11632 %
11633 %      MagickBooleanType MagickSpliceImage(MagickWand *wand,
11634 %        const size_t width,const size_t height,const ssize_t x,
11635 %        const ssize_t y)
11636 %
11637 %  A description of each parameter follows:
11638 %
11639 %    o wand: the magick wand.
11640 %
11641 %    o width: the region width.
11642 %
11643 %    o height: the region height.
11644 %
11645 %    o x: the region x offset.
11646 %
11647 %    o y: the region y offset.
11648 %
11649 */
11650 WandExport MagickBooleanType MagickSpliceImage(MagickWand *wand,
11651   const size_t width,const size_t height,const ssize_t x,
11652   const ssize_t y)
11653 {
11654   Image
11655     *splice_image;
11656
11657   RectangleInfo
11658     splice;
11659
11660   assert(wand != (MagickWand *) NULL);
11661   assert(wand->signature == WandSignature);
11662   if (wand->debug != MagickFalse)
11663     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11664   if (wand->images == (Image *) NULL)
11665     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11666   splice.width=width;
11667   splice.height=height;
11668   splice.x=x;
11669   splice.y=y;
11670   splice_image=SpliceImage(wand->images,&splice,wand->exception);
11671   if (splice_image == (Image *) NULL)
11672     return(MagickFalse);
11673   ReplaceImageInList(&wand->images,splice_image);
11674   return(MagickTrue);
11675 }
11676 \f
11677 /*
11678 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11679 %                                                                             %
11680 %                                                                             %
11681 %                                                                             %
11682 %   M a g i c k S p r e a d I m a g e                                         %
11683 %                                                                             %
11684 %                                                                             %
11685 %                                                                             %
11686 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11687 %
11688 %  MagickSpreadImage() is a special effects method that randomly displaces each
11689 %  pixel in a block defined by the radius parameter.
11690 %
11691 %  The format of the MagickSpreadImage method is:
11692 %
11693 %      MagickBooleanType MagickSpreadImage(MagickWand *wand,const double radius)
11694 %
11695 %  A description of each parameter follows:
11696 %
11697 %    o wand: the magick wand.
11698 %
11699 %    o radius:  Choose a random pixel in a neighborhood of this extent.
11700 %
11701 */
11702 WandExport MagickBooleanType MagickSpreadImage(MagickWand *wand,
11703   const double radius)
11704 {
11705   Image
11706     *spread_image;
11707
11708   assert(wand != (MagickWand *) NULL);
11709   assert(wand->signature == WandSignature);
11710   if (wand->debug != MagickFalse)
11711     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11712   if (wand->images == (Image *) NULL)
11713     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11714   spread_image=SpreadImage(wand->images,radius,wand->exception);
11715   if (spread_image == (Image *) NULL)
11716     return(MagickFalse);
11717   ReplaceImageInList(&wand->images,spread_image);
11718   return(MagickTrue);
11719 }
11720 \f
11721 /*
11722 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11723 %                                                                             %
11724 %                                                                             %
11725 %                                                                             %
11726 %   M a g i c k S t e g a n o I m a g e                                       %
11727 %                                                                             %
11728 %                                                                             %
11729 %                                                                             %
11730 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11731 %
11732 %  MagickSteganoImage() hides a digital watermark within the image.
11733 %  Recover the hidden watermark later to prove that the authenticity of
11734 %  an image.  Offset defines the start position within the image to hide
11735 %  the watermark.
11736 %
11737 %  The format of the MagickSteganoImage method is:
11738 %
11739 %      MagickWand *MagickSteganoImage(MagickWand *wand,
11740 %        const MagickWand *watermark_wand,const ssize_t offset)
11741 %
11742 %  A description of each parameter follows:
11743 %
11744 %    o wand: the magick wand.
11745 %
11746 %    o watermark_wand: the watermark wand.
11747 %
11748 %    o offset: Start hiding at this offset into the image.
11749 %
11750 */
11751 WandExport MagickWand *MagickSteganoImage(MagickWand *wand,
11752   const MagickWand *watermark_wand,const ssize_t offset)
11753 {
11754   Image
11755     *stegano_image;
11756
11757   assert(wand != (MagickWand *) NULL);
11758   assert(wand->signature == WandSignature);
11759   if (wand->debug != MagickFalse)
11760     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11761   if ((wand->images == (Image *) NULL) ||
11762       (watermark_wand->images == (Image *) NULL))
11763     {
11764       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11765         "ContainsNoImages","`%s'",wand->name);
11766       return((MagickWand *) NULL);
11767     }
11768   wand->images->offset=offset;
11769   stegano_image=SteganoImage(wand->images,watermark_wand->images,
11770     wand->exception);
11771   if (stegano_image == (Image *) NULL)
11772     return((MagickWand *) NULL);
11773   return(CloneMagickWandFromImages(wand,stegano_image));
11774 }
11775 \f
11776 /*
11777 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11778 %                                                                             %
11779 %                                                                             %
11780 %                                                                             %
11781 %   M a g i c k S t e r e o I m a g e                                         %
11782 %                                                                             %
11783 %                                                                             %
11784 %                                                                             %
11785 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11786 %
11787 %  MagickStereoImage() composites two images and produces a single image that
11788 %  is the composite of a left and right image of a stereo pair
11789 %
11790 %  The format of the MagickStereoImage method is:
11791 %
11792 %      MagickWand *MagickStereoImage(MagickWand *wand,
11793 %        const MagickWand *offset_wand)
11794 %
11795 %  A description of each parameter follows:
11796 %
11797 %    o wand: the magick wand.
11798 %
11799 %    o offset_wand: Another image wand.
11800 %
11801 */
11802 WandExport MagickWand *MagickStereoImage(MagickWand *wand,
11803   const MagickWand *offset_wand)
11804 {
11805   Image
11806     *stereo_image;
11807
11808   assert(wand != (MagickWand *) NULL);
11809   assert(wand->signature == WandSignature);
11810   if (wand->debug != MagickFalse)
11811     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11812   if ((wand->images == (Image *) NULL) ||
11813       (offset_wand->images == (Image *) NULL))
11814     {
11815       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11816         "ContainsNoImages","`%s'",wand->name);
11817       return((MagickWand *) NULL);
11818     }
11819   stereo_image=StereoImage(wand->images,offset_wand->images,wand->exception);
11820   if (stereo_image == (Image *) NULL)
11821     return((MagickWand *) NULL);
11822   return(CloneMagickWandFromImages(wand,stereo_image));
11823 }
11824 \f
11825 /*
11826 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11827 %                                                                             %
11828 %                                                                             %
11829 %                                                                             %
11830 %   M a g i c k S t r i p I m a g e                                           %
11831 %                                                                             %
11832 %                                                                             %
11833 %                                                                             %
11834 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11835 %
11836 %  MagickStripImage() strips an image of all profiles and comments.
11837 %
11838 %  The format of the MagickStripImage method is:
11839 %
11840 %      MagickBooleanType MagickStripImage(MagickWand *wand)
11841 %
11842 %  A description of each parameter follows:
11843 %
11844 %    o wand: the magick wand.
11845 %
11846 */
11847 WandExport MagickBooleanType MagickStripImage(MagickWand *wand)
11848 {
11849   MagickBooleanType
11850     status;
11851
11852   assert(wand != (MagickWand *) NULL);
11853   assert(wand->signature == WandSignature);
11854   if (wand->debug != MagickFalse)
11855     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11856   if (wand->images == (Image *) NULL)
11857     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11858   status=StripImage(wand->images);
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 S w i r l I m a g e                                           %
11870 %                                                                             %
11871 %                                                                             %
11872 %                                                                             %
11873 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11874 %
11875 %  MagickSwirlImage() swirls the pixels about the center of the image, where
11876 %  degrees indicates the sweep of the arc through which each pixel is moved.
11877 %  You get a more dramatic effect as the degrees move from 1 to 360.
11878 %
11879 %  The format of the MagickSwirlImage method is:
11880 %
11881 %      MagickBooleanType MagickSwirlImage(MagickWand *wand,const double degrees)
11882 %
11883 %  A description of each parameter follows:
11884 %
11885 %    o wand: the magick wand.
11886 %
11887 %    o degrees: Define the tightness of the swirling effect.
11888 %
11889 */
11890 WandExport MagickBooleanType MagickSwirlImage(MagickWand *wand,
11891   const double degrees)
11892 {
11893   Image
11894     *swirl_image;
11895
11896   assert(wand != (MagickWand *) NULL);
11897   assert(wand->signature == WandSignature);
11898   if (wand->debug != MagickFalse)
11899     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11900   if (wand->images == (Image *) NULL)
11901     ThrowWandException(WandError,"ContainsNoImages",wand->name);
11902   swirl_image=SwirlImage(wand->images,degrees,wand->exception);
11903   if (swirl_image == (Image *) NULL)
11904     return(MagickFalse);
11905   ReplaceImageInList(&wand->images,swirl_image);
11906   return(MagickTrue);
11907 }
11908 \f
11909 /*
11910 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11911 %                                                                             %
11912 %                                                                             %
11913 %                                                                             %
11914 %   M a g i c k T e x t u r e I m a g e                                       %
11915 %                                                                             %
11916 %                                                                             %
11917 %                                                                             %
11918 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11919 %
11920 %  MagickTextureImage() repeatedly tiles the texture image across and down the
11921 %  image canvas.
11922 %
11923 %  The format of the MagickTextureImage method is:
11924 %
11925 %      MagickWand *MagickTextureImage(MagickWand *wand,
11926 %        const MagickWand *texture_wand)
11927 %
11928 %  A description of each parameter follows:
11929 %
11930 %    o wand: the magick wand.
11931 %
11932 %    o texture_wand: the texture wand
11933 %
11934 */
11935 WandExport MagickWand *MagickTextureImage(MagickWand *wand,
11936   const MagickWand *texture_wand)
11937 {
11938   Image
11939     *texture_image;
11940
11941   MagickBooleanType
11942     status;
11943
11944   assert(wand != (MagickWand *) NULL);
11945   assert(wand->signature == WandSignature);
11946   if (wand->debug != MagickFalse)
11947     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
11948   if ((wand->images == (Image *) NULL) ||
11949       (texture_wand->images == (Image *) NULL))
11950     {
11951       (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
11952         "ContainsNoImages","`%s'",wand->name);
11953       return((MagickWand *) NULL);
11954     }
11955   texture_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
11956   if (texture_image == (Image *) NULL)
11957     return((MagickWand *) NULL);
11958   status=TextureImage(texture_image,texture_wand->images);
11959   if (status == MagickFalse)
11960     {
11961       InheritException(wand->exception,&texture_image->exception);
11962       texture_image=DestroyImage(texture_image);
11963       return((MagickWand *) NULL);
11964     }
11965   return(CloneMagickWandFromImages(wand,texture_image));
11966 }
11967 \f
11968 /*
11969 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11970 %                                                                             %
11971 %                                                                             %
11972 %                                                                             %
11973 %   M a g i c k T h r e s h o l d I m a g e                                   %
11974 %                                                                             %
11975 %                                                                             %
11976 %                                                                             %
11977 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11978 %
11979 %  MagickThresholdImage() changes the value of individual pixels based on
11980 %  the intensity of each pixel compared to threshold.  The result is a
11981 %  high-contrast, two color image.
11982 %
11983 %  The format of the MagickThresholdImage method is:
11984 %
11985 %      MagickBooleanType MagickThresholdImage(MagickWand *wand,
11986 %        const double threshold)
11987 %      MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
11988 %        const ChannelType channel,const double threshold)
11989 %
11990 %  A description of each parameter follows:
11991 %
11992 %    o wand: the magick wand.
11993 %
11994 %    o channel: the image channel(s).
11995 %
11996 %    o threshold: Define the threshold value.
11997 %
11998 */
11999 WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand,
12000   const double threshold)
12001 {
12002   MagickBooleanType
12003     status;
12004
12005   status=MagickThresholdImageChannel(wand,DefaultChannels,threshold);
12006   return(status);
12007 }
12008
12009 WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand,
12010   const ChannelType channel,const double threshold)
12011 {
12012   MagickBooleanType
12013     status;
12014
12015   assert(wand != (MagickWand *) NULL);
12016   assert(wand->signature == WandSignature);
12017   if (wand->debug != MagickFalse)
12018     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12019   if (wand->images == (Image *) NULL)
12020     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12021   status=BilevelImageChannel(wand->images,channel,threshold);
12022   if (status == MagickFalse)
12023     InheritException(wand->exception,&wand->images->exception);
12024   return(status);
12025 }
12026 \f
12027 /*
12028 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12029 %                                                                             %
12030 %                                                                             %
12031 %                                                                             %
12032 %   M a g i c k T h u m b n a i l I m a g e                                   %
12033 %                                                                             %
12034 %                                                                             %
12035 %                                                                             %
12036 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12037 %
12038 %  MagickThumbnailImage()  changes the size of an image to the given dimensions
12039 %  and removes any associated profiles.  The goal is to produce small low cost
12040 %  thumbnail images suited for display on the Web.
12041 %
12042 %  The format of the MagickThumbnailImage method is:
12043 %
12044 %      MagickBooleanType MagickThumbnailImage(MagickWand *wand,
12045 %        const size_t columns,const size_t rows)
12046 %
12047 %  A description of each parameter follows:
12048 %
12049 %    o wand: the magick wand.
12050 %
12051 %    o columns: the number of columns in the scaled image.
12052 %
12053 %    o rows: the number of rows in the scaled image.
12054 %
12055 */
12056 WandExport MagickBooleanType MagickThumbnailImage(MagickWand *wand,
12057   const size_t columns,const size_t rows)
12058 {
12059   Image
12060     *thumbnail_image;
12061
12062   assert(wand != (MagickWand *) NULL);
12063   assert(wand->signature == WandSignature);
12064   if (wand->debug != MagickFalse)
12065     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12066   if (wand->images == (Image *) NULL)
12067     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12068   thumbnail_image=ThumbnailImage(wand->images,columns,rows,wand->exception);
12069   if (thumbnail_image == (Image *) NULL)
12070     return(MagickFalse);
12071   ReplaceImageInList(&wand->images,thumbnail_image);
12072   return(MagickTrue);
12073 }
12074 \f
12075 /*
12076 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12077 %                                                                             %
12078 %                                                                             %
12079 %                                                                             %
12080 %   M a g i c k T i n t I m a g e                                             %
12081 %                                                                             %
12082 %                                                                             %
12083 %                                                                             %
12084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12085 %
12086 %  MagickTintImage() applies a color vector to each pixel in the image.  The
12087 %  length of the vector is 0 for black and white and at its maximum for the
12088 %  midtones.  The vector weighting function is
12089 %  f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
12090 %
12091 %  The format of the MagickTintImage method is:
12092 %
12093 %      MagickBooleanType MagickTintImage(MagickWand *wand,
12094 %        const PixelWand *tint,const PixelWand *opacity)
12095 %
12096 %  A description of each parameter follows:
12097 %
12098 %    o wand: the magick wand.
12099 %
12100 %    o tint: the tint pixel wand.
12101 %
12102 %    o opacity: the opacity pixel wand.
12103 %
12104 */
12105 WandExport MagickBooleanType MagickTintImage(MagickWand *wand,
12106   const PixelWand *tint,const PixelWand *opacity)
12107 {
12108   char
12109     percent_opaque[MaxTextExtent];
12110
12111   Image
12112     *tint_image;
12113
12114   PixelPacket
12115     target;
12116
12117   assert(wand != (MagickWand *) NULL);
12118   assert(wand->signature == WandSignature);
12119   if (wand->debug != MagickFalse)
12120     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12121   if (wand->images == (Image *) NULL)
12122     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12123   (void) FormatMagickString(percent_opaque,MaxTextExtent,
12124     "%g,%g,%g,%g",(double) (100.0*QuantumScale*
12125     PixelGetRedQuantum(opacity)),(double) (100.0*QuantumScale*
12126     PixelGetGreenQuantum(opacity)),(double) (100.0*QuantumScale*
12127     PixelGetBlueQuantum(opacity)),(double) (100.0*QuantumScale*
12128     PixelGetOpacityQuantum(opacity)));
12129   PixelGetQuantumColor(tint,&target);
12130   tint_image=TintImage(wand->images,percent_opaque,target,wand->exception);
12131   if (tint_image == (Image *) NULL)
12132     return(MagickFalse);
12133   ReplaceImageInList(&wand->images,tint_image);
12134   return(MagickTrue);
12135 }
12136 \f
12137 /*
12138 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12139 %                                                                             %
12140 %                                                                             %
12141 %                                                                             %
12142 %   M a g i c k T r a n s f o r m I m a g e                                   %
12143 %                                                                             %
12144 %                                                                             %
12145 %                                                                             %
12146 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12147 %
12148 %  MagickTransformImage() is a convenience method that behaves like
12149 %  MagickResizeImage() or MagickCropImage() but accepts scaling and/or cropping
12150 %  information as a region geometry specification.  If the operation fails,
12151 %  a NULL image handle is returned.
12152 %
12153 %  The format of the MagickTransformImage method is:
12154 %
12155 %      MagickWand *MagickTransformImage(MagickWand *wand,const char *crop,
12156 %        const char *geometry)
12157 %
12158 %  A description of each parameter follows:
12159 %
12160 %    o wand: the magick wand.
12161 %
12162 %    o crop: A crop geometry string.  This geometry defines a subregion of the
12163 %      image to crop.
12164 %
12165 %    o geometry: An image geometry string.  This geometry defines the final
12166 %      size of the image.
12167 %
12168 */
12169 WandExport MagickWand *MagickTransformImage(MagickWand *wand,
12170   const char *crop,const char *geometry)
12171 {
12172   Image
12173     *transform_image;
12174
12175   MagickBooleanType
12176     status;
12177
12178   assert(wand != (MagickWand *) NULL);
12179   assert(wand->signature == WandSignature);
12180   if (wand->debug != MagickFalse)
12181     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12182   if (wand->images == (Image *) NULL)
12183     return((MagickWand *) NULL);
12184   transform_image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12185   if (transform_image == (Image *) NULL)
12186     return((MagickWand *) NULL);
12187   status=TransformImage(&transform_image,crop,geometry);
12188   if (status == MagickFalse)
12189     {
12190       InheritException(wand->exception,&transform_image->exception);
12191       transform_image=DestroyImage(transform_image);
12192       return((MagickWand *) NULL);
12193     }
12194   return(CloneMagickWandFromImages(wand,transform_image));
12195 }
12196 \f
12197 /*
12198 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12199 %                                                                             %
12200 %                                                                             %
12201 %                                                                             %
12202 %   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               %
12203 %                                                                             %
12204 %                                                                             %
12205 %                                                                             %
12206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12207 %
12208 %  MagickTransformImageColorspace() transform the image colorspace.
12209 %
12210 %  The format of the MagickTransformImageColorspace method is:
12211 %
12212 %      MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12213 %        const ColorspaceType colorspace)
12214 %
12215 %  A description of each parameter follows:
12216 %
12217 %    o wand: the magick wand.
12218 %
12219 %    o colorspace: the image colorspace:   UndefinedColorspace, RGBColorspace,
12220 %      GRAYColorspace, TransparentColorspace, OHTAColorspace, XYZColorspace,
12221 %      YCbCrColorspace, YCCColorspace, YIQColorspace, YPbPrColorspace,
12222 %      YPbPrColorspace, YUVColorspace, CMYKColorspace, sRGBColorspace,
12223 %      HSLColorspace, or HWBColorspace.
12224 %
12225 */
12226 WandExport MagickBooleanType MagickTransformImageColorspace(MagickWand *wand,
12227   const ColorspaceType colorspace)
12228 {
12229   assert(wand != (MagickWand *) NULL);
12230   assert(wand->signature == WandSignature);
12231   if (wand->debug != MagickFalse)
12232     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12233   if (wand->images == (Image *) NULL)
12234     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12235   return(TransformImageColorspace(wand->images,colorspace));
12236 }
12237 \f
12238 /*
12239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12240 %                                                                             %
12241 %                                                                             %
12242 %                                                                             %
12243 %   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                     %
12244 %                                                                             %
12245 %                                                                             %
12246 %                                                                             %
12247 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12248 %
12249 %  MagickTransparentPaintImage() changes any pixel that matches color with the
12250 %  color defined by fill.
12251 %
12252 %  The format of the MagickTransparentPaintImage method is:
12253 %
12254 %      MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12255 %        const PixelWand *target,const double alpha,const double fuzz,
12256 %        const MagickBooleanType invert)
12257 %
12258 %  A description of each parameter follows:
12259 %
12260 %    o wand: the magick wand.
12261 %
12262 %    o target: Change this target color to specified opacity value within
12263 %      the image.
12264 %
12265 %    o alpha: the level of transparency: 1.0 is fully opaque and 0.0 is fully
12266 %      transparent.
12267 %
12268 %    o fuzz: By default target must match a particular pixel color
12269 %      exactly.  However, in many cases two colors may differ by a small amount.
12270 %      The fuzz member of image defines how much tolerance is acceptable to
12271 %      consider two colors as the same.  For example, set fuzz to 10 and the
12272 %      color red at intensities of 100 and 102 respectively are now interpreted
12273 %      as the same color for the purposes of the floodfill.
12274 %
12275 %    o invert: paint any pixel that does not match the target color.
12276 %
12277 */
12278 WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand,
12279   const PixelWand *target,const double alpha,const double fuzz,
12280   const MagickBooleanType invert)
12281 {
12282   MagickBooleanType
12283     status;
12284
12285   MagickPixelPacket
12286     target_pixel;
12287
12288   assert(wand != (MagickWand *) NULL);
12289   assert(wand->signature == WandSignature);
12290   if (wand->debug != MagickFalse)
12291     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12292   if (wand->images == (Image *) NULL)
12293     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12294   PixelGetMagickColor(target,&target_pixel);
12295   wand->images->fuzz=fuzz;
12296   status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum(
12297     (MagickRealType) QuantumRange-QuantumRange*alpha),invert);
12298   if (status == MagickFalse)
12299     InheritException(wand->exception,&wand->images->exception);
12300   return(status);
12301 }
12302 \f
12303 /*
12304 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12305 %                                                                             %
12306 %                                                                             %
12307 %                                                                             %
12308 %   M a g i c k T r a n s p o s e I m a g e                                   %
12309 %                                                                             %
12310 %                                                                             %
12311 %                                                                             %
12312 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12313 %
12314 %  MagickTransposeImage() creates a vertical mirror image by reflecting the
12315 %  pixels around the central x-axis while rotating them 90-degrees.
12316 %
12317 %  The format of the MagickTransposeImage method is:
12318 %
12319 %      MagickBooleanType MagickTransposeImage(MagickWand *wand)
12320 %
12321 %  A description of each parameter follows:
12322 %
12323 %    o wand: the magick wand.
12324 %
12325 */
12326 WandExport MagickBooleanType MagickTransposeImage(MagickWand *wand)
12327 {
12328   Image
12329     *transpose_image;
12330
12331   assert(wand != (MagickWand *) NULL);
12332   assert(wand->signature == WandSignature);
12333   if (wand->debug != MagickFalse)
12334     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12335   if (wand->images == (Image *) NULL)
12336     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12337   transpose_image=TransposeImage(wand->images,wand->exception);
12338   if (transpose_image == (Image *) NULL)
12339     return(MagickFalse);
12340   ReplaceImageInList(&wand->images,transpose_image);
12341   return(MagickTrue);
12342 }
12343 \f
12344 /*
12345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12346 %                                                                             %
12347 %                                                                             %
12348 %                                                                             %
12349 %   M a g i c k T r a n s v e r s e I m a g e                                 %
12350 %                                                                             %
12351 %                                                                             %
12352 %                                                                             %
12353 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12354 %
12355 %  MagickTransverseImage() creates a horizontal mirror image by reflecting the
12356 %  pixels around the central y-axis while rotating them 270-degrees.
12357 %
12358 %  The format of the MagickTransverseImage method is:
12359 %
12360 %      MagickBooleanType MagickTransverseImage(MagickWand *wand)
12361 %
12362 %  A description of each parameter follows:
12363 %
12364 %    o wand: the magick wand.
12365 %
12366 */
12367 WandExport MagickBooleanType MagickTransverseImage(MagickWand *wand)
12368 {
12369   Image
12370     *transverse_image;
12371
12372   assert(wand != (MagickWand *) NULL);
12373   assert(wand->signature == WandSignature);
12374   if (wand->debug != MagickFalse)
12375     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12376   if (wand->images == (Image *) NULL)
12377     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12378   transverse_image=TransverseImage(wand->images,wand->exception);
12379   if (transverse_image == (Image *) NULL)
12380     return(MagickFalse);
12381   ReplaceImageInList(&wand->images,transverse_image);
12382   return(MagickTrue);
12383 }
12384 \f
12385 /*
12386 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12387 %                                                                             %
12388 %                                                                             %
12389 %                                                                             %
12390 %   M a g i c k T r i m I m a g e                                             %
12391 %                                                                             %
12392 %                                                                             %
12393 %                                                                             %
12394 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12395 %
12396 %  MagickTrimImage() remove edges that are the background color from the image.
12397 %
12398 %  The format of the MagickTrimImage method is:
12399 %
12400 %      MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12401 %
12402 %  A description of each parameter follows:
12403 %
12404 %    o wand: the magick wand.
12405 %
12406 %    o fuzz: By default target must match a particular pixel color
12407 %      exactly.  However, in many cases two colors may differ by a small amount.
12408 %      The fuzz member of image defines how much tolerance is acceptable to
12409 %      consider two colors as the same.  For example, set fuzz to 10 and the
12410 %      color red at intensities of 100 and 102 respectively are now interpreted
12411 %      as the same color for the purposes of the floodfill.
12412 %
12413 */
12414 WandExport MagickBooleanType MagickTrimImage(MagickWand *wand,const double fuzz)
12415 {
12416   Image
12417     *trim_image;
12418
12419   assert(wand != (MagickWand *) NULL);
12420   assert(wand->signature == WandSignature);
12421   if (wand->debug != MagickFalse)
12422     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12423   if (wand->images == (Image *) NULL)
12424     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12425   wand->images->fuzz=fuzz;
12426   trim_image=TrimImage(wand->images,wand->exception);
12427   if (trim_image == (Image *) NULL)
12428     return(MagickFalse);
12429   ReplaceImageInList(&wand->images,trim_image);
12430   return(MagickTrue);
12431 }
12432 \f
12433 /*
12434 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12435 %                                                                             %
12436 %                                                                             %
12437 %                                                                             %
12438 %   M a g i c k U n i q u e I m a g e C o l o r s                             %
12439 %                                                                             %
12440 %                                                                             %
12441 %                                                                             %
12442 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12443 %
12444 %  MagickUniqueImageColors() discards all but one of any pixel color.
12445 %
12446 %  The format of the MagickUniqueImageColors method is:
12447 %
12448 %      MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12449 %
12450 %  A description of each parameter follows:
12451 %
12452 %    o wand: the magick wand.
12453 %
12454 */
12455 WandExport MagickBooleanType MagickUniqueImageColors(MagickWand *wand)
12456 {
12457   Image
12458     *unique_image;
12459
12460   assert(wand != (MagickWand *) NULL);
12461   assert(wand->signature == WandSignature);
12462   if (wand->debug != MagickFalse)
12463     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12464   if (wand->images == (Image *) NULL)
12465     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12466   unique_image=UniqueImageColors(wand->images,wand->exception);
12467   if (unique_image == (Image *) NULL)
12468     return(MagickFalse);
12469   ReplaceImageInList(&wand->images,unique_image);
12470   return(MagickTrue);
12471 }
12472 \f
12473 /*
12474 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12475 %                                                                             %
12476 %                                                                             %
12477 %                                                                             %
12478 %   M a g i c k U n s h a r p M a s k I m a g e                               %
12479 %                                                                             %
12480 %                                                                             %
12481 %                                                                             %
12482 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12483 %
12484 %  MagickUnsharpMaskImage() sharpens an image.  We convolve the image with a
12485 %  Gaussian operator of the given radius and standard deviation (sigma).
12486 %  For reasonable results, radius should be larger than sigma.  Use a radius
12487 %  of 0 and UnsharpMaskImage() selects a suitable radius for you.
12488 %
12489 %  The format of the MagickUnsharpMaskImage method is:
12490 %
12491 %      MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12492 %        const double radius,const double sigma,const double amount,
12493 %        const double threshold)
12494 %      MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
12495 %        const ChannelType channel,const double radius,const double sigma,
12496 %        const double amount,const double threshold)
12497 %
12498 %  A description of each parameter follows:
12499 %
12500 %    o wand: the magick wand.
12501 %
12502 %    o channel: the image channel(s).
12503 %
12504 %    o radius: the radius of the Gaussian, in pixels, not counting the center
12505 %      pixel.
12506 %
12507 %    o sigma: the standard deviation of the Gaussian, in pixels.
12508 %
12509 %    o amount: the percentage of the difference between the original and the
12510 %      blur image that is added back into the original.
12511 %
12512 %    o threshold: the threshold in pixels needed to apply the diffence amount.
12513 %
12514 */
12515
12516 WandExport MagickBooleanType MagickUnsharpMaskImage(MagickWand *wand,
12517   const double radius,const double sigma,const double amount,
12518   const double threshold)
12519 {
12520   MagickBooleanType
12521     status;
12522
12523   status=MagickUnsharpMaskImageChannel(wand,DefaultChannels,radius,sigma,
12524     amount,threshold);
12525   return(status);
12526 }
12527
12528 WandExport MagickBooleanType MagickUnsharpMaskImageChannel(MagickWand *wand,
12529   const ChannelType channel,const double radius,const double sigma,
12530   const double amount,const double threshold)
12531 {
12532   Image
12533     *unsharp_image;
12534
12535   assert(wand != (MagickWand *) NULL);
12536   assert(wand->signature == WandSignature);
12537   if (wand->debug != MagickFalse)
12538     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12539   if (wand->images == (Image *) NULL)
12540     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12541   unsharp_image=UnsharpMaskImageChannel(wand->images,channel,radius,sigma,
12542     amount,threshold,wand->exception);
12543   if (unsharp_image == (Image *) NULL)
12544     return(MagickFalse);
12545   ReplaceImageInList(&wand->images,unsharp_image);
12546   return(MagickTrue);
12547 }
12548 \f
12549 /*
12550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12551 %                                                                             %
12552 %                                                                             %
12553 %                                                                             %
12554 %   M a g i c k V i g n e t t e I m a g e                                     %
12555 %                                                                             %
12556 %                                                                             %
12557 %                                                                             %
12558 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12559 %
12560 %  MagickVignetteImage() softens the edges of the image in vignette style.
12561 %
12562 %  The format of the MagickVignetteImage method is:
12563 %
12564 %      MagickBooleanType MagickVignetteImage(MagickWand *wand,
12565 %        const double black_point,const double white_point,const ssize_t x,
12566 %        const ssize_t y)
12567 %
12568 %  A description of each parameter follows:
12569 %
12570 %    o wand: the magick wand.
12571 %
12572 %    o black_point: the black point.
12573 %
12574 %    o white_point: the white point.
12575 %
12576 %    o x, y:  Define the x and y ellipse offset.
12577 %
12578 */
12579 WandExport MagickBooleanType MagickVignetteImage(MagickWand *wand,
12580   const double black_point,const double white_point,const ssize_t x,const ssize_t y)
12581 {
12582   Image
12583     *vignette_image;
12584
12585   assert(wand != (MagickWand *) NULL);
12586   assert(wand->signature == WandSignature);
12587   if (wand->debug != MagickFalse)
12588     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12589   if (wand->images == (Image *) NULL)
12590     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12591   vignette_image=VignetteImage(wand->images,black_point,white_point,x,y,
12592     wand->exception);
12593   if (vignette_image == (Image *) NULL)
12594     return(MagickFalse);
12595   ReplaceImageInList(&wand->images,vignette_image);
12596   return(MagickTrue);
12597 }
12598 \f
12599 /*
12600 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12601 %                                                                             %
12602 %                                                                             %
12603 %                                                                             %
12604 %   M a g i c k W a v e I m a g e                                             %
12605 %                                                                             %
12606 %                                                                             %
12607 %                                                                             %
12608 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12609 %
12610 %  MagickWaveImage()  creates a "ripple" effect in the image by shifting
12611 %  the pixels vertically along a sine wave whose amplitude and wavelength
12612 %  is specified by the given parameters.
12613 %
12614 %  The format of the MagickWaveImage method is:
12615 %
12616 %      MagickBooleanType MagickWaveImage(MagickWand *wand,const double amplitude,
12617 %        const double wave_length)
12618 %
12619 %  A description of each parameter follows:
12620 %
12621 %    o wand: the magick wand.
12622 %
12623 %    o amplitude, wave_length:  Define the amplitude and wave length of the
12624 %      sine wave.
12625 %
12626 */
12627 WandExport MagickBooleanType MagickWaveImage(MagickWand *wand,
12628   const double amplitude,const double wave_length)
12629 {
12630   Image
12631     *wave_image;
12632
12633   assert(wand != (MagickWand *) NULL);
12634   assert(wand->signature == WandSignature);
12635   if (wand->debug != MagickFalse)
12636     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12637   if (wand->images == (Image *) NULL)
12638     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12639   wave_image=WaveImage(wand->images,amplitude,wave_length,wand->exception);
12640   if (wave_image == (Image *) NULL)
12641     return(MagickFalse);
12642   ReplaceImageInList(&wand->images,wave_image);
12643   return(MagickTrue);
12644 }
12645 \f
12646 /*
12647 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12648 %                                                                             %
12649 %                                                                             %
12650 %                                                                             %
12651 %   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                         %
12652 %                                                                             %
12653 %                                                                             %
12654 %                                                                             %
12655 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12656 %
12657 %  MagickWhiteThresholdImage() is like ThresholdImage() but  force all pixels
12658 %  above the threshold into white while leaving all pixels below the threshold
12659 %  unchanged.
12660 %
12661 %  The format of the MagickWhiteThresholdImage method is:
12662 %
12663 %      MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12664 %        const PixelWand *threshold)
12665 %
12666 %  A description of each parameter follows:
12667 %
12668 %    o wand: the magick wand.
12669 %
12670 %    o threshold: the pixel wand.
12671 %
12672 */
12673 WandExport MagickBooleanType MagickWhiteThresholdImage(MagickWand *wand,
12674   const PixelWand *threshold)
12675 {
12676   char
12677     thresholds[MaxTextExtent];
12678
12679   MagickBooleanType
12680     status;
12681
12682   assert(wand != (MagickWand *) NULL);
12683   assert(wand->signature == WandSignature);
12684   if (wand->debug != MagickFalse)
12685     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12686   if (wand->images == (Image *) NULL)
12687     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12688   (void) FormatMagickString(thresholds,MaxTextExtent,
12689     QuantumFormat "," QuantumFormat "," QuantumFormat "," QuantumFormat,
12690     PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold),
12691     PixelGetBlueQuantum(threshold),PixelGetOpacityQuantum(threshold));
12692   status=WhiteThresholdImage(wand->images,thresholds);
12693   if (status == MagickFalse)
12694     InheritException(wand->exception,&wand->images->exception);
12695   return(status);
12696 }
12697 \f
12698 /*
12699 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12700 %                                                                             %
12701 %                                                                             %
12702 %                                                                             %
12703 %   M a g i c k W r i t e I m a g e                                           %
12704 %                                                                             %
12705 %                                                                             %
12706 %                                                                             %
12707 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12708 %
12709 %  MagickWriteImage() writes an image to the specified filename.  If the
12710 %  filename parameter is NULL, the image is written to the filename set
12711 %  by MagickReadImage() or MagickSetImageFilename().
12712 %
12713 %  The format of the MagickWriteImage method is:
12714 %
12715 %      MagickBooleanType MagickWriteImage(MagickWand *wand,
12716 %        const char *filename)
12717 %
12718 %  A description of each parameter follows:
12719 %
12720 %    o wand: the magick wand.
12721 %
12722 %    o filename: the image filename.
12723 %
12724 %
12725 */
12726 WandExport MagickBooleanType MagickWriteImage(MagickWand *wand,
12727   const char *filename)
12728 {
12729   Image
12730     *image;
12731
12732   ImageInfo
12733     *write_info;
12734
12735   MagickBooleanType
12736     status;
12737
12738   assert(wand != (MagickWand *) NULL);
12739   assert(wand->signature == WandSignature);
12740   if (wand->debug != MagickFalse)
12741     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12742   if (wand->images == (Image *) NULL)
12743     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12744   if (filename != (const char *) NULL)
12745     (void) CopyMagickString(wand->images->filename,filename,MaxTextExtent);
12746   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12747   if (image == (Image *) NULL)
12748     return(MagickFalse);
12749   write_info=CloneImageInfo(wand->image_info);
12750   write_info->adjoin=MagickTrue;
12751   status=WriteImage(write_info,image);
12752   if (status == MagickFalse)
12753     InheritException(wand->exception,&image->exception);
12754   image=DestroyImage(image);
12755   write_info=DestroyImageInfo(write_info);
12756   return(status);
12757 }
12758 \f
12759 /*
12760 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12761 %                                                                             %
12762 %                                                                             %
12763 %                                                                             %
12764 %   M a g i c k W r i t e I m a g e F i l e                                   %
12765 %                                                                             %
12766 %                                                                             %
12767 %                                                                             %
12768 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12769 %
12770 %  MagickWriteImageFile() writes an image to an open file descriptor.
12771 %
12772 %  The format of the MagickWriteImageFile method is:
12773 %
12774 %      MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12775 %
12776 %  A description of each parameter follows:
12777 %
12778 %    o wand: the magick wand.
12779 %
12780 %    o file: the file descriptor.
12781 %
12782 */
12783 WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file)
12784 {
12785   Image
12786     *image;
12787
12788   ImageInfo
12789     *write_info;
12790
12791   MagickBooleanType
12792     status;
12793
12794   assert(wand != (MagickWand *) NULL);
12795   assert(wand->signature == WandSignature);
12796   assert(file != (FILE *) NULL);
12797   if (wand->debug != MagickFalse)
12798     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12799   if (wand->images == (Image *) NULL)
12800     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12801   image=CloneImage(wand->images,0,0,MagickTrue,wand->exception);
12802   if (image == (Image *) NULL)
12803     return(MagickFalse);
12804   write_info=CloneImageInfo(wand->image_info);
12805   SetImageInfoFile(write_info,file);
12806   write_info->adjoin=MagickTrue;
12807   status=WriteImage(write_info,image);
12808   write_info=DestroyImageInfo(write_info);
12809   if (status == MagickFalse)
12810     InheritException(wand->exception,&image->exception);
12811   image=DestroyImage(image);
12812   return(status);
12813 }
12814 \f
12815 /*
12816 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12817 %                                                                             %
12818 %                                                                             %
12819 %                                                                             %
12820 %   M a g i c k W r i t e I m a g e s                                         %
12821 %                                                                             %
12822 %                                                                             %
12823 %                                                                             %
12824 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12825 %
12826 %  MagickWriteImages() writes an image or image sequence.
12827 %
12828 %  The format of the MagickWriteImages method is:
12829 %
12830 %      MagickBooleanType MagickWriteImages(MagickWand *wand,
12831 %        const char *filename,const MagickBooleanType adjoin)
12832 %
12833 %  A description of each parameter follows:
12834 %
12835 %    o wand: the magick wand.
12836 %
12837 %    o filename: the image filename.
12838 %
12839 %    o adjoin: join images into a single multi-image file.
12840 %
12841 */
12842 WandExport MagickBooleanType MagickWriteImages(MagickWand *wand,
12843   const char *filename,const MagickBooleanType adjoin)
12844 {
12845   ImageInfo
12846     *write_info;
12847
12848   MagickBooleanType
12849     status;
12850
12851   assert(wand != (MagickWand *) NULL);
12852   assert(wand->signature == WandSignature);
12853   if (wand->debug != MagickFalse)
12854     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12855   if (wand->images == (Image *) NULL)
12856     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12857   write_info=CloneImageInfo(wand->image_info);
12858   write_info->adjoin=adjoin;
12859   status=WriteImages(write_info,wand->images,filename,wand->exception);
12860   if (status == MagickFalse)
12861     InheritException(wand->exception,&wand->images->exception);
12862   write_info=DestroyImageInfo(write_info);
12863   return(status);
12864 }
12865 \f
12866 /*
12867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12868 %                                                                             %
12869 %                                                                             %
12870 %                                                                             %
12871 %   M a g i c k W r i t e I m a g e s F i l e                                 %
12872 %                                                                             %
12873 %                                                                             %
12874 %                                                                             %
12875 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12876 %
12877 %  MagickWriteImagesFile() writes an image sequence to an open file descriptor.
12878 %
12879 %  The format of the MagickWriteImagesFile method is:
12880 %
12881 %      MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12882 %
12883 %  A description of each parameter follows:
12884 %
12885 %    o wand: the magick wand.
12886 %
12887 %    o file: the file descriptor.
12888 %
12889 */
12890 WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file)
12891 {
12892   ImageInfo
12893     *write_info;
12894
12895   MagickBooleanType
12896     status;
12897
12898   assert(wand != (MagickWand *) NULL);
12899   assert(wand->signature == WandSignature);
12900   if (wand->debug != MagickFalse)
12901     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
12902   if (wand->images == (Image *) NULL)
12903     ThrowWandException(WandError,"ContainsNoImages",wand->name);
12904   write_info=CloneImageInfo(wand->image_info);
12905   SetImageInfoFile(write_info,file);
12906   write_info->adjoin=MagickTrue;
12907   status=WriteImages(write_info,wand->images,(const char *) NULL,
12908     wand->exception);
12909   write_info=DestroyImageInfo(write_info);
12910   if (status == MagickFalse)
12911     InheritException(wand->exception,&wand->images->exception);
12912   return(status);
12913 }